Address Contract Verified
Address
0x18084fbA666a33d37592fA2633fD49a74DD93a88
Balance
0 ETH
Nonce
1
Code Size
12877 bytes
Creator
0x12369488...4cAf at tx 0x52538ac6...971ba2
Last Active
Indexed Transactions
3 (24,589,055 → 24,589,072)
Gas Used (indexed)
125,537
Contract Bytecode
12877 bytes
0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063771da5c5116100c3578063b4f94b2e1161007c578063b4f94b2e146103b7578063cae9ca51146103d5578063d505accf14610405578063dd62ed3e14610421578063f2fde38b14610451578063fc4e51f61461046d57610158565b8063771da5c5146102e157806379cc6790146102ff5780637ecebe001461031b5780638da5cb5b1461034b57806395d89b4114610369578063a9059cbb1461038757610158565b8063313ce56711610115578063313ce567146102335780633644e5151461025157806340c10f191461026f57806342966c681461028b57806370a08231146102a7578063715018a6146102d757610158565b806306fdde031461015d578063095ea7b31461017b5780631171bda9146101ab57806318160ddd146101c757806323b872dd146101e557806330adf81f14610215575b600080fd5b610165610489565b6040516101729190612796565b60405180910390f35b61019560048036038101906101909190611ef3565b610517565b6040516101a29190612667565b60405180910390f35b6101c560048036038101906101c09190611fbf565b61052e565b005b6101cf6105da565b6040516101dc9190612a18565b60405180910390f35b6101ff60048036038101906101fa9190611e06565b6105e0565b60405161020c9190612667565b60405180910390f35b61021d6106fa565b60405161022a9190612682565b60405180910390f35b61023b61071e565b6040516102489190612a33565b60405180910390f35b610259610723565b6040516102669190612682565b60405180910390f35b61028960048036038101906102849190611ef3565b610783565b005b6102a560048036038101906102a0919061208e565b610954565b005b6102c160048036038101906102bc9190611da1565b610961565b6040516102ce9190612a18565b60405180910390f35b6102df610979565b005b6102e9610a01565b6040516102f69190612a18565b60405180910390f35b61031960048036038101906103149190611ef3565b610a25565b005b61033560048036038101906103309190611da1565b610b36565b6040516103429190612a18565b60405180910390f35b610353610b4e565b6040516103609190612589565b60405180910390f35b610371610b77565b60405161037e9190612796565b60405180910390f35b6103a1600480360381019061039c9190611ef3565b610c05565b6040516103ae9190612667565b60405180910390f35b6103bf610c1c565b6040516103cc9190612682565b60405180910390f35b6103ef60048036038101906103ea9190611f2f565b610c40565b6040516103fc9190612667565b60405180910390f35b61041f600480360381019061041a9190611e55565b610cd7565b005b61043b60048036038101906104369190611dca565b610fbb565b6040516104489190612a18565b60405180910390f35b61046b60048036038101906104669190611da1565b610fe0565b005b6104876004803603810190610482919061200e565b6110d8565b005b6005805461049690612c56565b80601f01602080910402602001604051908101604052809291908181526020018280546104c290612c56565b801561050f5780601f106104e45761010080835404028352916020019161050f565b820191906000526020600020905b8154815290600101906020018083116104f257829003601f168201915b505050505081565b60006105243384846111ce565b6001905092915050565b610536611399565b73ffffffffffffffffffffffffffffffffffffffff16610554610b4e565b73ffffffffffffffffffffffffffffffffffffffff16146105aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a190612918565b60405180910390fd5b6105d582828573ffffffffffffffffffffffffffffffffffffffff166113a19092919063ffffffff16565b505050565b60045481565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146106e357828110156106cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c3906127f8565b60405180910390fd5b6106e2853385846106dd9190612b5d565b6111ce565b5b6106ee858585611427565b60019150509392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60007f0000000000000000000000000000000000000000000000000000000000000001461415610775577f85df006d8efff5040f4fdd173197325caa418545ff9f6fbab526b624756ff3629050610780565b61077d611718565b90505b90565b61078b611399565b73ffffffffffffffffffffffffffffffffffffffff166107a9610b4e565b73ffffffffffffffffffffffffffffffffffffffff16146107ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f690612918565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086690612998565b60405180910390fd5b61087b600083836117c0565b806004600082825461088d9190612b07565b9250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546108e39190612b07565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516109489190612a18565b60405180910390a35050565b61095e33826117c5565b50565b60016020528060005260406000206000915090505481565b610981611399565b73ffffffffffffffffffffffffffffffffffffffff1661099f610b4e565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612918565b60405180910390fd5b6109ff600061192b565b565b7f000000000000000000000000000000000000000000000000000000000000000181565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610b275781811015610b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b07906128b8565b60405180910390fd5b610b2683338484610b219190612b5d565b6111ce565b5b610b3183836117c5565b505050565b60036020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60068054610b8490612c56565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb090612c56565b8015610bfd5780601f10610bd257610100808354040283529160200191610bfd565b820191906000526020600020905b815481529060010190602001808311610be057829003601f168201915b505050505081565b6000610c12338484611427565b6001905092915050565b7f85df006d8efff5040f4fdd173197325caa418545ff9f6fbab526b624756ff36281565b6000610c4c8484610517565b15610ccb578373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401610c90949392919061261b565b600060405180830381600087803b158015610caa57600080fd5b505af1158015610cbe573d6000803e3d6000fd5b5050505060019050610cd0565b600090505b9392505050565b42841015610d1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1190612938565b60405180910390fd5b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08160001c1115610d80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7790612978565b60405180910390fd5b601b8360ff161480610d955750601c8360ff16145b610dd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dcb90612818565b60405180910390fd5b6000610dde610723565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9898989600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610e5290612cb9565b919050558a604051602001610e6c9695949392919061269d565b60405160208183030381529060405280519060200120604051602001610e93929190612552565b604051602081830303815290604052805190602001209050600060018286868660405160008152602001604052604051610ed09493929190612751565b6020604051602081039080840390855afa158015610ef2573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015610f6657508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610fa5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9c90612858565b60405180910390fd5b610fb08989896111ce565b505050505050505050565b6002602052816000526040600020602052806000526040600020600091509150505481565b610fe8611399565b73ffffffffffffffffffffffffffffffffffffffff16611006610b4e565b73ffffffffffffffffffffffffffffffffffffffff161461105c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105390612918565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c3906127d8565b60405180910390fd5b6110d58161192b565b50565b6110e0611399565b73ffffffffffffffffffffffffffffffffffffffff166110fe610b4e565b73ffffffffffffffffffffffffffffffffffffffff1614611154576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114b90612918565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff1663b88d4fde30868686866040518663ffffffff1660e01b81526004016111959594939291906125a4565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561123e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123590612898565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906127b8565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161138c9190612a18565b60405180910390a3505050565b600033905090565b6114228363a9059cbb60e01b84846040516024016113c09291906125f2565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506119ef565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148e906129f8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114fe906129d8565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611576576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156d90612838565b60405180910390fd5b6115818383836117c0565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611608576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ff906128d8565b60405180910390fd5b81816116149190612b5d565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116a69190612b07565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161170a9190612a18565b60405180910390a350505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600560405161174a919061253b565b60405180910390206040518060400160405280600181526020017f31000000000000000000000000000000000000000000000000000000000000008152508051906020012046306040516020016117a59594939291906126fe565b60405160208183030381529060405280519060200120905090565b505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611843906128f8565b60405180910390fd5b611858836000846117c0565b81816118649190612b5d565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008282546118b99190612b5d565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161191e9190612a18565b60405180910390a3505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000611a51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ab69092919063ffffffff16565b9050600081511115611ab15780806020019051810190611a719190611f96565b611ab0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa7906129b8565b60405180910390fd5b5b505050565b6060611ac58484600085611ace565b90509392505050565b606082471015611b13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0a90612878565b60405180910390fd5b611b1c85611be2565b611b5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5290612958565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611b849190612524565b60006040518083038185875af1925050503d8060008114611bc1576040519150601f19603f3d011682016040523d82523d6000602084013e611bc6565b606091505b5091509150611bd6828286611bf5565b92505050949350505050565b600080823b905060008111915050919050565b60608315611c0557829050611c55565b600083511115611c185782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612796565b60405180910390fd5b9392505050565b6000611c6f611c6a84612a73565b612a4e565b905082815260208101848484011115611c8757600080fd5b611c92848285612c14565b509392505050565b600081359050611ca981613176565b92915050565b600081519050611cbe8161318d565b92915050565b600081359050611cd3816131a4565b92915050565b60008083601f840112611ceb57600080fd5b8235905067ffffffffffffffff811115611d0457600080fd5b602083019150836001820283011115611d1c57600080fd5b9250929050565b600082601f830112611d3457600080fd5b8135611d44848260208601611c5c565b91505092915050565b600081359050611d5c816131bb565b92915050565b600081359050611d71816131d2565b92915050565b600081359050611d86816131e9565b92915050565b600081359050611d9b81613200565b92915050565b600060208284031215611db357600080fd5b6000611dc184828501611c9a565b91505092915050565b60008060408385031215611ddd57600080fd5b6000611deb85828601611c9a565b9250506020611dfc85828601611c9a565b9150509250929050565b600080600060608486031215611e1b57600080fd5b6000611e2986828701611c9a565b9350506020611e3a86828701611c9a565b9250506040611e4b86828701611d77565b9150509250925092565b600080600080600080600060e0888a031215611e7057600080fd5b6000611e7e8a828b01611c9a565b9750506020611e8f8a828b01611c9a565b9650506040611ea08a828b01611d77565b9550506060611eb18a828b01611d77565b9450506080611ec28a828b01611d8c565b93505060a0611ed38a828b01611cc4565b92505060c0611ee48a828b01611cc4565b91505092959891949750929550565b60008060408385031215611f0657600080fd5b6000611f1485828601611c9a565b9250506020611f2585828601611d77565b9150509250929050565b600080600060608486031215611f4457600080fd5b6000611f5286828701611c9a565b9350506020611f6386828701611d77565b925050604084013567ffffffffffffffff811115611f8057600080fd5b611f8c86828701611d23565b9150509250925092565b600060208284031215611fa857600080fd5b6000611fb684828501611caf565b91505092915050565b600080600060608486031215611fd457600080fd5b6000611fe286828701611d4d565b9350506020611ff386828701611c9a565b925050604061200486828701611d77565b9150509250925092565b60008060008060006080868803121561202657600080fd5b600061203488828901611d62565b955050602061204588828901611c9a565b945050604061205688828901611d77565b935050606086013567ffffffffffffffff81111561207357600080fd5b61207f88828901611cd9565b92509250509295509295909350565b6000602082840312156120a057600080fd5b60006120ae84828501611d77565b91505092915050565b6120c081612b91565b82525050565b6120cf81612ba3565b82525050565b6120de81612baf565b82525050565b6120f56120f082612baf565b612d02565b82525050565b60006121078385612acf565b9350612114838584612c14565b61211d83612d99565b840190509392505050565b600061213382612ab9565b61213d8185612acf565b935061214d818560208601612c23565b61215681612d99565b840191505092915050565b600061216c82612ab9565b6121768185612ae0565b9350612186818560208601612c23565b80840191505092915050565b6000815461219f81612c56565b6121a98186612ae0565b945060018216600081146121c457600181146121d557612208565b60ff19831686528186019350612208565b6121de85612aa4565b60005b83811015612200578154818901526001820191506020810190506121e1565b838801955050505b50505092915050565b600061221c82612ac4565b6122268185612aeb565b9350612236818560208601612c23565b61223f81612d99565b840191505092915050565b6000612257601b83612aeb565b915061226282612daa565b602082019050919050565b600061227a602683612aeb565b915061228582612dd3565b604082019050919050565b600061229d602183612aeb565b91506122a882612e22565b604082019050919050565b60006122c0600283612afc565b91506122cb82612e71565b600282019050919050565b60006122e3601b83612aeb565b91506122ee82612e9a565b602082019050919050565b6000612306601d83612aeb565b915061231182612ec3565b602082019050919050565b6000612329601183612aeb565b915061233482612eec565b602082019050919050565b600061234c602683612aeb565b915061235782612f15565b604082019050919050565b600061236f601d83612aeb565b915061237a82612f64565b602082019050919050565b6000612392601d83612aeb565b915061239d82612f8d565b602082019050919050565b60006123b5601f83612aeb565b91506123c082612fb6565b602082019050919050565b60006123d8601b83612aeb565b91506123e382612fdf565b602082019050919050565b60006123fb602083612aeb565b915061240682613008565b602082019050919050565b600061241e601283612aeb565b915061242982613031565b602082019050919050565b6000612441601d83612aeb565b915061244c8261305a565b602082019050919050565b6000612464601b83612aeb565b915061246f82613083565b602082019050919050565b6000612487601883612aeb565b9150612492826130ac565b602082019050919050565b60006124aa602a83612aeb565b91506124b5826130d5565b604082019050919050565b60006124cd601c83612aeb565b91506124d882613124565b602082019050919050565b60006124f0601e83612aeb565b91506124fb8261314d565b602082019050919050565b61250f81612bfd565b82525050565b61251e81612c07565b82525050565b60006125308284612161565b915081905092915050565b60006125478284612192565b915081905092915050565b600061255d826122b3565b915061256982856120e4565b60208201915061257982846120e4565b6020820191508190509392505050565b600060208201905061259e60008301846120b7565b92915050565b60006080820190506125b960008301886120b7565b6125c660208301876120b7565b6125d36040830186612506565b81810360608301526125e68184866120fb565b90509695505050505050565b600060408201905061260760008301856120b7565b6126146020830184612506565b9392505050565b600060808201905061263060008301876120b7565b61263d6020830186612506565b61264a60408301856120b7565b818103606083015261265c8184612128565b905095945050505050565b600060208201905061267c60008301846120c6565b92915050565b600060208201905061269760008301846120d5565b92915050565b600060c0820190506126b260008301896120d5565b6126bf60208301886120b7565b6126cc60408301876120b7565b6126d96060830186612506565b6126e66080830185612506565b6126f360a0830184612506565b979650505050505050565b600060a08201905061271360008301886120d5565b61272060208301876120d5565b61272d60408301866120d5565b61273a6060830185612506565b61274760808301846120b7565b9695505050505050565b600060808201905061276660008301876120d5565b6127736020830186612515565b61278060408301856120d5565b61278d60608301846120d5565b95945050505050565b600060208201905081810360008301526127b08184612211565b905092915050565b600060208201905081810360008301526127d18161224a565b9050919050565b600060208201905081810360008301526127f18161226d565b9050919050565b6000602082019050818103600083015261281181612290565b9050919050565b60006020820190508181036000830152612831816122d6565b9050919050565b60006020820190508181036000830152612851816122f9565b9050919050565b600060208201905081810360008301526128718161231c565b9050919050565b600060208201905081810360008301526128918161233f565b9050919050565b600060208201905081810360008301526128b181612362565b9050919050565b600060208201905081810360008301526128d181612385565b9050919050565b600060208201905081810360008301526128f1816123a8565b9050919050565b60006020820190508181036000830152612911816123cb565b9050919050565b60006020820190508181036000830152612931816123ee565b9050919050565b6000602082019050818103600083015261295181612411565b9050919050565b6000602082019050818103600083015261297181612434565b9050919050565b6000602082019050818103600083015261299181612457565b9050919050565b600060208201905081810360008301526129b18161247a565b9050919050565b600060208201905081810360008301526129d18161249d565b9050919050565b600060208201905081810360008301526129f1816124c0565b9050919050565b60006020820190508181036000830152612a11816124e3565b9050919050565b6000602082019050612a2d6000830184612506565b92915050565b6000602082019050612a486000830184612515565b92915050565b6000612a58612a69565b9050612a648282612c88565b919050565b6000604051905090565b600067ffffffffffffffff821115612a8e57612a8d612d6a565b5b612a9782612d99565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000612b1282612bfd565b9150612b1d83612bfd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b5257612b51612d0c565b5b828201905092915050565b6000612b6882612bfd565b9150612b7383612bfd565b925082821015612b8657612b85612d0c565b5b828203905092915050565b6000612b9c82612bdd565b9050919050565b60008115159050919050565b6000819050919050565b6000612bc482612b91565b9050919050565b6000612bd682612b91565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b83811015612c41578082015181840152602081019050612c26565b83811115612c50576000848401525b50505050565b60006002820490506001821680612c6e57607f821691505b60208210811415612c8257612c81612d3b565b5b50919050565b612c9182612d99565b810181811067ffffffffffffffff82111715612cb057612caf612d6a565b5b80604052505050565b6000612cc482612bfd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612cf757612cf6612d0c565b5b600182019050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f417070726f766520746f20746865207a65726f20616464726573730000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f5472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6360008201527f6500000000000000000000000000000000000000000000000000000000000000602082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f496e76616c6964207369676e6174757265202776272076616c75650000000000600082015250565b7f5472616e7366657220746f2074686520746f6b656e2061646472657373000000600082015250565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f417070726f76652066726f6d20746865207a65726f2061646472657373000000600082015250565b7f4275726e20616d6f756e74206578636565647320616c6c6f77616e6365000000600082015250565b7f5472616e7366657220616d6f756e7420657863656564732062616c616e636500600082015250565b7f4275726e20616d6f756e7420657863656564732062616c616e63650000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5065726d697373696f6e20657870697265640000000000000000000000000000600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f496e76616c6964207369676e6174757265202773272076616c75650000000000600082015250565b7f4d696e7420746f20746865207a65726f20616464726573730000000000000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5472616e7366657220746f20746865207a65726f206164647265737300000000600082015250565b7f5472616e736665722066726f6d20746865207a65726f20616464726573730000600082015250565b61317f81612b91565b811461318a57600080fd5b50565b61319681612ba3565b81146131a157600080fd5b50565b6131ad81612baf565b81146131b857600080fd5b50565b6131c481612bb9565b81146131cf57600080fd5b50565b6131db81612bcb565b81146131e657600080fd5b50565b6131f281612bfd565b81146131fd57600080fd5b50565b61320981612c07565b811461321457600080fd5b5056fea2646970667358221220b66e3ef21ffde9263f6eb3247e39c2adf91afb2daa59dd552c43bf8eace893db64736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: No
TBTC.sol 10 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol";
import "@thesis/solidity-contracts/contracts/token/MisfundRecovery.sol";
contract TBTC is ERC20WithPermit, MisfundRecovery {
constructor() ERC20WithPermit("tBTC v2", "tBTC") {}
}
Address.sol 210 lines
// 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);
}
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);
}
}
}
}
Context.sol 23 lines
// 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;
}
}
Ownable.sol 71 lines
// 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);
}
}
IERC20.sol 81 lines
// 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);
}
IERC721.sol 142 lines
// 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;
}
SafeERC20.sol 98 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC20.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 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");
}
}
}
IERC165.sol 24 lines
// 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);
}
ERC20WithPermit.sol 334 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IERC20WithPermit.sol";
import "./IReceiveApproval.sol";
/// @title ERC20WithPermit
/// @notice Burnable ERC20 token with EIP2612 permit functionality. User can
/// authorize a transfer of their token with a signature conforming
/// EIP712 standard instead of an on-chain transaction from their
/// address. Anyone can submit this signature on the user's behalf by
/// calling the permit function, as specified in EIP2612 standard,
/// paying gas fees, and possibly performing other actions in the same
/// transaction.
contract ERC20WithPermit is IERC20WithPermit, Ownable {
/// @notice The amount of tokens owned by the given account.
mapping(address => uint256) public override balanceOf;
/// @notice The remaining number of tokens that spender will be
/// allowed to spend on behalf of owner through `transferFrom` and
/// `burnFrom`. This is zero by default.
mapping(address => mapping(address => uint256)) public override allowance;
/// @notice Returns the current nonce for EIP2612 permission for the
/// provided token owner for a replay protection. Used to construct
/// EIP2612 signature provided to `permit` function.
mapping(address => uint256) public override nonces;
uint256 public immutable cachedChainId;
bytes32 public immutable cachedDomainSeparator;
/// @notice Returns EIP2612 Permit message hash. Used to construct EIP2612
/// signature provided to `permit` function.
bytes32 public constant override PERMIT_TYPEHASH =
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
);
/// @notice The amount of tokens in existence.
uint256 public override totalSupply;
/// @notice The name of the token.
string public override name;
/// @notice The symbol of the token.
string public override symbol;
/// @notice The decimals places of the token.
uint8 public constant override decimals = 18;
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
cachedChainId = block.chainid;
cachedDomainSeparator = buildDomainSeparator();
}
/// @notice Moves `amount` tokens from the caller's account to `recipient`.
/// @return True if the operation succeeded, reverts otherwise.
/// @dev Requirements:
/// - `recipient` cannot be the zero address,
/// - the caller must have a balance of at least `amount`.
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
_transfer(msg.sender, recipient, amount);
return true;
}
/// @notice Moves `amount` tokens from `sender` to `recipient` using the
/// allowance mechanism. `amount` is then deducted from the caller's
/// allowance unless the allowance was made for `type(uint256).max`.
/// @return True if the operation succeeded, reverts otherwise.
/// @dev 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 override returns (bool) {
uint256 currentAllowance = allowance[sender][msg.sender];
if (currentAllowance != type(uint256).max) {
require(
currentAllowance >= amount,
"Transfer amount exceeds allowance"
);
_approve(sender, msg.sender, currentAllowance - amount);
}
_transfer(sender, recipient, amount);
return true;
}
/// @notice EIP2612 approval made with secp256k1 signature.
/// Users can authorize a transfer of their tokens with a signature
/// conforming EIP712 standard, rather than an on-chain transaction
/// from their address. Anyone can submit this signature on the
/// user's behalf by calling the permit function, paying gas fees,
/// and possibly performing other actions in the same transaction.
/// @dev The deadline argument can be set to `type(uint256).max to create
/// permits that effectively never expire. If the `amount` is set
/// to `type(uint256).max` then `transferFrom` and `burnFrom` will
/// not reduce an allowance.
function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external override {
/* solhint-disable-next-line not-rely-on-time */
require(deadline >= block.timestamp, "Permission expired");
// Validate `s` and `v` values for a malleability concern described in EIP2.
// Only signatures with `s` value in the lower half of the secp256k1
// curve's order and `v` value of 27 or 28 are considered valid.
require(
uint256(s) <=
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"Invalid signature 's' value"
);
require(v == 27 || v == 28, "Invalid signature 'v' value");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
amount,
nonces[owner]++,
deadline
)
)
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(
recoveredAddress != address(0) && recoveredAddress == owner,
"Invalid signature"
);
_approve(owner, spender, amount);
}
/// @notice Creates `amount` tokens and assigns them to `account`,
/// increasing the total supply.
/// @dev Requirements:
/// - `recipient` cannot be the zero address.
function mint(address recipient, uint256 amount) external onlyOwner {
require(recipient != address(0), "Mint to the zero address");
beforeTokenTransfer(address(0), recipient, amount);
totalSupply += amount;
balanceOf[recipient] += amount;
emit Transfer(address(0), recipient, amount);
}
/// @notice Destroys `amount` tokens from the caller.
/// @dev Requirements:
/// - the caller must have a balance of at least `amount`.
function burn(uint256 amount) external override {
_burn(msg.sender, amount);
}
/// @notice Destroys `amount` of tokens from `account` using the allowance
/// mechanism. `amount` is then deducted from the caller's allowance
/// unless the allowance was made for `type(uint256).max`.
/// @dev Requirements:
/// - `account` must have a balance of at least `amount`,
/// - the caller must have allowance for `account`'s tokens of at least
/// `amount`.
function burnFrom(address account, uint256 amount) external override {
uint256 currentAllowance = allowance[account][msg.sender];
if (currentAllowance != type(uint256).max) {
require(
currentAllowance >= amount,
"Burn amount exceeds allowance"
);
_approve(account, msg.sender, currentAllowance - amount);
}
_burn(account, amount);
}
/// @notice Calls `receiveApproval` function on spender previously approving
/// the spender to withdraw from the caller multiple times, up to
/// the `amount` amount. If this function is called again, it
/// overwrites the current allowance with `amount`. Reverts if the
/// approval reverted or if `receiveApproval` call on the spender
/// reverted.
/// @return True if both approval and `receiveApproval` calls succeeded.
/// @dev If the `amount` is set to `type(uint256).max` then
/// `transferFrom` and `burnFrom` will not reduce an allowance.
function approveAndCall(
address spender,
uint256 amount,
bytes memory extraData
) external override returns (bool) {
if (approve(spender, amount)) {
IReceiveApproval(spender).receiveApproval(
msg.sender,
amount,
address(this),
extraData
);
return true;
}
return false;
}
/// @notice Sets `amount` as the allowance of `spender` over the caller's
/// tokens.
/// @return True if the operation succeeded.
/// @dev If the `amount` is set to `type(uint256).max` then
/// `transferFrom` and `burnFrom` will not reduce an allowance.
/// 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
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(msg.sender, spender, amount);
return true;
}
/// @notice Returns hash of EIP712 Domain struct with the token name as
/// a signing domain and token contract as a verifying contract.
/// Used to construct EIP2612 signature provided to `permit`
/// function.
/* solhint-disable-next-line func-name-mixedcase */
function DOMAIN_SEPARATOR() public view override returns (bytes32) {
// As explained in EIP-2612, if the DOMAIN_SEPARATOR contains the
// chainId and is defined at contract deployment instead of
// reconstructed for every signature, there is a risk of possible replay
// attacks between chains in the event of a future chain split.
// To address this issue, we check the cached chain ID against the
// current one and in case they are different, we build domain separator
// from scratch.
if (block.chainid == cachedChainId) {
return cachedDomainSeparator;
} else {
return buildDomainSeparator();
}
}
/// @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.
// slither-disable-next-line dead-code
function beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _burn(address account, uint256 amount) internal {
uint256 currentBalance = balanceOf[account];
require(currentBalance >= amount, "Burn amount exceeds balance");
beforeTokenTransfer(account, address(0), amount);
balanceOf[account] = currentBalance - amount;
totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _transfer(
address sender,
address recipient,
uint256 amount
) private {
require(sender != address(0), "Transfer from the zero address");
require(recipient != address(0), "Transfer to the zero address");
require(recipient != address(this), "Transfer to the token address");
beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = balanceOf[sender];
require(senderBalance >= amount, "Transfer amount exceeds balance");
balanceOf[sender] = senderBalance - amount;
balanceOf[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "Approve from the zero address");
require(spender != address(0), "Approve to the zero address");
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function buildDomainSeparator() private view returns (bytes32) {
return
keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(name)),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
}
}
IApproveAndCall.sol 19 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice An interface that should be implemented by tokens supporting
/// `approveAndCall`/`receiveApproval` pattern.
interface IApproveAndCall {
/// @notice Executes `receiveApproval` function on spender as specified in
/// `IReceiveApproval` interface. Approves spender to withdraw from
/// the caller multiple times, up to the `amount`. If this
/// function is called again, it overwrites the current allowance
/// with `amount`. Reverts if the approval reverted or if
/// `receiveApproval` call on the spender reverted.
function approveAndCall(
address spender,
uint256 amount,
bytes memory extraData
) external returns (bool);
}
MisfundRecovery.sol 33 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
/// @title MisfundRecovery
/// @notice Allows the owner of the token contract extending MisfundRecovery
/// to recover any ERC20 and ERC721 sent mistakenly to the token
/// contract address.
contract MisfundRecovery is Ownable {
using SafeERC20 for IERC20;
function recoverERC20(
IERC20 token,
address recipient,
uint256 amount
) external onlyOwner {
token.safeTransfer(recipient, amount);
}
function recoverERC721(
IERC721 token,
address recipient,
uint256 tokenId,
bytes calldata data
) external onlyOwner {
token.safeTransferFrom(address(this), recipient, tokenId, data);
}
}
IERC20WithPermit.sol 60 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./IApproveAndCall.sol";
/// @title IERC20WithPermit
/// @notice Burnable ERC20 token with EIP2612 permit functionality. User can
/// authorize a transfer of their token with a signature conforming
/// EIP712 standard instead of an on-chain transaction from their
/// address. Anyone can submit this signature on the user's behalf by
/// calling the permit function, as specified in EIP2612 standard,
/// paying gas fees, and possibly performing other actions in the same
/// transaction.
interface IERC20WithPermit is IERC20, IERC20Metadata, IApproveAndCall {
/// @notice EIP2612 approval made with secp256k1 signature.
/// Users can authorize a transfer of their tokens with a signature
/// conforming EIP712 standard, rather than an on-chain transaction
/// from their address. Anyone can submit this signature on the
/// user's behalf by calling the permit function, paying gas fees,
/// and possibly performing other actions in the same transaction.
/// @dev The deadline argument can be set to `type(uint256).max to create
/// permits that effectively never expire.
function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/// @notice Destroys `amount` tokens from the caller.
function burn(uint256 amount) external;
/// @notice Destroys `amount` of tokens from `account`, deducting the amount
/// from caller's allowance.
function burnFrom(address account, uint256 amount) external;
/// @notice Returns hash of EIP712 Domain struct with the token name as
/// a signing domain and token contract as a verifying contract.
/// Used to construct EIP2612 signature provided to `permit`
/// function.
/* solhint-disable-next-line func-name-mixedcase */
function DOMAIN_SEPARATOR() external view returns (bytes32);
/// @notice Returns the current nonce for EIP2612 permission for the
/// provided token owner for a replay protection. Used to construct
/// EIP2612 signature provided to `permit` function.
function nonces(address owner) external view returns (uint256);
/// @notice Returns EIP2612 Permit message hash. Used to construct EIP2612
/// signature provided to `permit` function.
/* solhint-disable-next-line func-name-mixedcase */
function PERMIT_TYPEHASH() external pure returns (bytes32);
}
IReceiveApproval.sol 16 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice An interface that should be implemented by contracts supporting
/// `approveAndCall`/`receiveApproval` pattern.
interface IReceiveApproval {
/// @notice Receives approval to spend tokens. Called as a result of
/// `approveAndCall` call on the token.
function receiveApproval(
address from,
uint256 amount,
address token,
bytes calldata extraData
) external;
}
IERC20Metadata.sol 27 lines
// 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);
}
Read Contract
DOMAIN_SEPARATOR 0x3644e515 → bytes32
PERMIT_TYPEHASH 0x30adf81f → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
cachedChainId 0x771da5c5 → uint256
cachedDomainSeparator 0xb4f94b2e → bytes32
decimals 0x313ce567 → uint8
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
approveAndCall 0xcae9ca51
address spender
uint256 amount
bytes extraData
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
mint 0x40c10f19
address recipient
uint256 amount
permit 0xd505accf
address owner
address spender
uint256 amount
uint256 deadline
uint8 v
bytes32 r
bytes32 s
recoverERC20 0x1171bda9
address token
address recipient
uint256 amount
recoverERC721 0xfc4e51f6
address token
address recipient
uint256 tokenId
bytes data
renounceOwnership 0x715018a6
No parameters
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0xc7f45De1...499f | 1 | 1 | |
| 0x36d5e19d...0B29 | 1 | 1 | |
| 0xEC62F275...285E | 1 | 1 |
Token Balances (1)
View Transfers →Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0x10ccae23...27a6fc | 24,589,072 | IN | 0xc7f45De1...499f | 0 ETH | |
| 0xa03c5e56...4366db | 24,589,071 | IN | 0xEC62F275...285E | 0 ETH | |
| 0xbec5994f...3a8cd8 | 24,589,055 | IN | 0x36d5e19d...0B29 | 0 ETH |