Address Contract Partially Verified
Address
0x16F78145AD0B9Af58747e9A97EBd99175378bd3D
Balance
0 ETH
Nonce
1
Code Size
11129 bytes
Creator
0x62798E0b...41A2 at tx 0x8ea6cf12...6324de
Last Active
Indexed Transactions
1 (24,319,942 → 24,319,942)
Gas Used (indexed)
24,955
Contract Bytecode
11129 bytes
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c8063720248de11610104578063a457c2d7116100a2578063c688387f11610071578063c688387f1461053e578063da394aec1461055c578063dd62ed3e1461057a578063ddaa26ad146105aa576101cf565b8063a457c2d7146104a4578063a9059cbb146104d4578063abf2ebd814610504578063b43bbd1114610520576101cf565b806386fdbdc1116100de57806386fdbdc11461042c57806387d45de71461044a57806395d89b41146104685780639aafa7a414610486576101cf565b8063720248de146103d257806375df1d7c146103f057806380ef01601461040e576101cf565b8063395093511161017157806346de26731161014b57806346de2673146103485780635760cc5d1461036657806357b3a5011461038457806370a08231146103a2576101cf565b806339509351146102dc5780633f1eaf0f1461030c578063413d9c3a1461032a576101cf565b80631e7269c5116101ad5780631e7269c51461024057806323b872dd14610270578063313ce567146102a057806332cb6b0c146102be576101cf565b806306fdde03146101d4578063095ea7b3146101f257806318160ddd14610222575b600080fd5b6101dc6105c8565b6040516101e991906122b6565b60405180910390f35b61020c60048036038101906102079190611e29565b61065a565b60405161021991906121b1565b60405180910390f35b61022a610678565b6040516102379190612458565b60405180910390f35b61025a60048036038101906102559190611d75565b610682565b6040516102679190612458565b60405180910390f35b61028a60048036038101906102859190611dda565b6106dd565b60405161029791906121b1565b60405180910390f35b6102a86107d5565b6040516102b59190612473565b60405180910390f35b6102c66107de565b6040516102d39190612458565b60405180910390f35b6102f660048036038101906102f19190611e29565b610811565b60405161030391906121b1565b60405180910390f35b6103146108bd565b6040516103219190612458565b60405180910390f35b610332610908565b60405161033f9190612458565b60405180910390f35b61035061090f565b60405161035d9190612196565b60405180910390f35b61036e610927565b60405161037b9190612196565b60405180910390f35b61038c61094b565b6040516103999190612458565b60405180910390f35b6103bc60048036038101906103b79190611d75565b610953565b6040516103c99190612458565b60405180910390f35b6103da6109ea565b6040516103e79190612458565b60405180910390f35b6103f8610a35565b6040516104059190612196565b60405180910390f35b610416610a4d565b6040516104239190612458565b60405180910390f35b610434610bc8565b6040516104419190612458565b60405180910390f35b610452610c13565b60405161045f9190612196565b60405180910390f35b610470610c2b565b60405161047d91906122b6565b60405180910390f35b61048e610cbd565b60405161049b9190612458565b60405180910390f35b6104be60048036038101906104b99190611e29565b610d14565b6040516104cb91906121b1565b60405180910390f35b6104ee60048036038101906104e99190611e29565b610dff565b6040516104fb91906121b1565b60405180910390f35b61051e60048036038101906105199190611e65565b610e1d565b005b6105286110dc565b6040516105359190612458565b60405180910390f35b610546611127565b60405161055391906121cc565b60405180910390f35b61056461114b565b6040516105719190612196565b60405180910390f35b610594600480360381019061058f9190611d9e565b611163565b6040516105a19190612458565b60405180910390f35b6105b26111ea565b6040516105bf9190612458565b60405180910390f35b6060600380546105d7906126dc565b80601f0160208091040260200160405190810160405280929190818152602001828054610603906126dc565b80156106505780601f1061062557610100808354040283529160200191610650565b820191906000526020600020905b81548152906001019060200180831161063357829003601f168201915b5050505050905090565b600061066e6106676111f0565b84846111f8565b6001905092915050565b6000600254905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff169050919050565b60006106ea8484846113c3565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107356111f0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156107b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ac906123b8565b60405180910390fd5b6107c9856107c16111f0565b8584036111f8565b60019150509392505050565b60006012905090565b6d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b60006108b361081e6111f0565b84846001600061082c6111f0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108ae919061250a565b6111f8565b6001905092915050565b600160646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166108fb9190612560565b6109059190612591565b81565b62278d0081565b73fe287b54288189bd492ee5c39a4114001ace1baa81565b7f000000000000000000000000ce044735bb3527d9d9e0b8add1118186900bb86c81565b6361f8078081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff169050919050565b601460646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610a289190612560565b610a329190612591565b81565b73ef0e03599a3a4a72a1be22a1dfadce2005681eaf81565b600160646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610a8b9190612560565b610a959190612591565b600960646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610ad39190612560565b610add9190612591565b601460646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610b1b9190612560565b610b259190612591565b601460646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610b639190612560565b610b6d9190612591565b610b77919061250a565b610b81919061250a565b610b8b919061250a565b6d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610bc591906125eb565b81565b600960646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610c069190612560565b610c109190612591565b81565b7351c0037aeedae7b046d539eeff3ffa1b9232a0b681565b606060048054610c3a906126dc565b80601f0160208091040260200160405190810160405280929190818152602001828054610c66906126dc565b8015610cb35780601f10610c8857610100808354040283529160200191610cb3565b820191906000526020600020905b815481529060010190602001808311610c9657829003601f168201915b5050505050905090565b603c601460646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610cfd9190612560565b610d079190612591565b610d119190612560565b81565b60008060016000610d236111f0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610de0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd790612418565b60405180910390fd5b610df4610deb6111f0565b858584036111f8565b600191505092915050565b6000610e13610e0c6111f0565b84846113c3565b6001905092915050565b6361f807804210610e63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5a90612398565b60405180910390fd5b6000837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff169050600060f885901c9050600082600254610ea2919061250a565b90506d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610f16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0d90612378565b60405180910390fd5b6000610f2133610682565b14610f61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5890612358565b60405180910390fd5b6000610fbe610f6e611769565b7f6ac0707cac0c442e03ae738b183f3fb620ee941711ca779bae1b0422a39331ea3387604051602001610fa3939291906121e7565b60405160208183030381529060405280519060200120611883565b604051602001610fce9190612139565b6040516020818303038152906040528051906020012090507f000000000000000000000000ce044735bb3527d9d9e0b8add1118186900bb86c73ffffffffffffffffffffffffffffffffffffffff16600182858989604051600081526020016040526040516110409493929190612271565b6020604051602081039080840390855afa158015611062573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b990612438565b60405180910390fd5b816002819055506110d333856118b6565b50505050505050565b601460646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1661111a9190612560565b6111249190612591565b81565b7f6ac0707cac0c442e03ae738b183f3fb620ee941711ca779bae1b0422a39331ea81565b7358e5a5df8ef5ebebe9ff2943ce45f79e7511e2d781565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60055481565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125f906123f8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cf90612318565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113b69190612458565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611433576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142a906123d8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149a906122d8565b60405180910390fd5b6114ac81611aaf565b6114b7838383611cdc565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1690508181101561158c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158390612338565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160018282829054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1661169f91906124b5565b92506101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516117509190612458565b60405180910390a3611763848484611ce1565b50505050565b60007f00000000000000000000000016f78145ad0b9af58747e9a97ebd99175378bd3d73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161480156117e557507f000000000000000000000000000000000000000000000000000000000000000146145b15611812577ffebc849ca077c2b1795e2e930853971056b690ff9885263c17eeb27f617c665d9050611880565b61187d7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7fa782b7d3ce2855850d919a81e4cdbfd9910c8169737494c6e7ae647a4f3cd3bf7fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6611ce6565b90505b90565b6000828260405160200161189892919061215f565b60405160208183030381529060405280519060200120905092915050565b6000816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611951919061250a565b9050806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16021790555060016000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff1602179055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611aa29190612458565b60405180910390a3505050565b73ef0e03599a3a4a72a1be22a1dfadce2005681eaf73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611c00576000611b1360055442611b0a91906125eb565b62278d00611d20565b9050603c8111611bfe57600081603c611b2c91906125eb565b603c601460646d04ee2d6d415b85acef81000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611b6c9190612560565b611b769190612591565b611b809190612560565b611b8a9190612591565b905060008382611b9a919061250a565b905080611bba73ef0e03599a3a4a72a1be22a1dfadce2005681eaf610953565b1015611bfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf2906122f8565b60405180910390fd5b50505b505b7358e5a5df8ef5ebebe9ff2943ce45f79e7511e2d773ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611c8d575073fe287b54288189bd492ee5c39a4114001ace1baa73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15611cd9576361f807804211611cd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ccf906122f8565b60405180910390fd5b5b50565b505050565b505050565b60008383834630604051602001611d0195949392919061221e565b6040516020818303038152906040528051906020012090509392505050565b60008183611d2e9190612560565b905092915050565b600081359050611d4581612afe565b92915050565b600081359050611d5a81612b15565b92915050565b600081359050611d6f81612b2c565b92915050565b600060208284031215611d8757600080fd5b6000611d9584828501611d36565b91505092915050565b60008060408385031215611db157600080fd5b6000611dbf85828601611d36565b9250506020611dd085828601611d36565b9150509250929050565b600080600060608486031215611def57600080fd5b6000611dfd86828701611d36565b9350506020611e0e86828701611d36565b9250506040611e1f86828701611d60565b9150509250925092565b60008060408385031215611e3c57600080fd5b6000611e4a85828601611d36565b9250506020611e5b85828601611d60565b9150509250929050565b600080600060608486031215611e7a57600080fd5b6000611e8886828701611d60565b9350506020611e9986828701611d4b565b9250506040611eaa86828701611d4b565b9150509250925092565b611ebd8161261f565b82525050565b611ecc81612631565b82525050565b611edb8161263d565b82525050565b611ef2611eed8261263d565b61270e565b82525050565b6000611f038261248e565b611f0d8185612499565b9350611f1d8185602086016126a9565b611f26816127a5565b840191505092915050565b6000611f3e602383612499565b9150611f49826127b6565b604082019050919050565b6000611f61601c836124aa565b9150611f6c82612805565b601c82019050919050565b6000611f84601983612499565b9150611f8f8261282e565b602082019050919050565b6000611fa7602283612499565b9150611fb282612857565b604082019050919050565b6000611fca6002836124aa565b9150611fd5826128a6565b600282019050919050565b6000611fed602683612499565b9150611ff8826128cf565b604082019050919050565b6000612010601183612499565b915061201b8261291e565b602082019050919050565b6000612033601b83612499565b915061203e82612947565b602082019050919050565b6000612056601a83612499565b915061206182612970565b602082019050919050565b6000612079602883612499565b915061208482612999565b604082019050919050565b600061209c602583612499565b91506120a7826129e8565b604082019050919050565b60006120bf602483612499565b91506120ca82612a37565b604082019050919050565b60006120e2602583612499565b91506120ed82612a86565b604082019050919050565b6000612105601883612499565b915061211082612ad5565b602082019050919050565b61212481612692565b82525050565b6121338161269c565b82525050565b600061214482611f54565b91506121508284611ee1565b60208201915081905092915050565b600061216a82611fbd565b91506121768285611ee1565b6020820191506121868284611ee1565b6020820191508190509392505050565b60006020820190506121ab6000830184611eb4565b92915050565b60006020820190506121c66000830184611ec3565b92915050565b60006020820190506121e16000830184611ed2565b92915050565b60006060820190506121fc6000830186611ed2565b6122096020830185611eb4565b612216604083018461211b565b949350505050565b600060a0820190506122336000830188611ed2565b6122406020830187611ed2565b61224d6040830186611ed2565b61225a606083018561211b565b6122676080830184611eb4565b9695505050505050565b60006080820190506122866000830187611ed2565b612293602083018661212a565b6122a06040830185611ed2565b6122ad6060830184611ed2565b95945050505050565b600060208201905081810360008301526122d08184611ef8565b905092915050565b600060208201905081810360008301526122f181611f31565b9050919050565b6000602082019050818103600083015261231181611f77565b9050919050565b6000602082019050818103600083015261233181611f9a565b9050919050565b6000602082019050818103600083015261235181611fe0565b9050919050565b6000602082019050818103600083015261237181612003565b9050919050565b6000602082019050818103600083015261239181612026565b9050919050565b600060208201905081810360008301526123b181612049565b9050919050565b600060208201905081810360008301526123d18161206c565b9050919050565b600060208201905081810360008301526123f18161208f565b9050919050565b60006020820190508181036000830152612411816120b2565b9050919050565b60006020820190508181036000830152612431816120d5565b9050919050565b60006020820190508181036000830152612451816120f8565b9050919050565b600060208201905061246d600083018461211b565b92915050565b6000602082019050612488600083018461212a565b92915050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b60006124c082612667565b91506124cb83612667565b9250827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124ff576124fe612718565b5b828201905092915050565b600061251582612692565b915061252083612692565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561255557612554612718565b5b828201905092915050565b600061256b82612692565b915061257683612692565b92508261258657612585612747565b5b828204905092915050565b600061259c82612692565b91506125a783612692565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125e0576125df612718565b5b828202905092915050565b60006125f682612692565b915061260183612692565b92508282101561261457612613612718565b5b828203905092915050565b600061262a82612647565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156126c75780820151818401526020810190506126ac565b838111156126d6576000848401525b50505050565b600060028204905060018216806126f457607f821691505b6020821081141561270857612707612776565b5b50919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b7f47726f757044414f3a205472616e73666572204c6f636b656400000000000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f47726f757044414f3a20436c61696d6564000000000000000000000000000000600082015250565b7f47726f757044414f3a20457863656564206d617820737570706c790000000000600082015250565b7f47726f757044414f3a2041697244726f702046696e6973686564000000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f47726f757044414f3a20496e76616c6964207369676e65720000000000000000600082015250565b612b078161261f565b8114612b1257600080fd5b50565b612b1e8161263d565b8114612b2957600080fd5b50565b612b3581612692565b8114612b4057600080fd5b5056fea264697066735822122079bb35e7eb74b40b69ed6b11aa1accf97a6f73b96a263448408660f07cdb932b64736f6c63430008040033
Verified Source Code Partial Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: No
Math.sol 64 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)
pragma solidity ^0.8.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.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This is same with standard division with `/`.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a / b;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a / b + (a % b == 0 ? 0 : 1);
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
ECDSA.sol 235 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
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 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));
}
}
ERC20.sol 372 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
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 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 {
struct MintBalance {
uint8 minted;
uint248 balance;
}
mapping(address => MintBalance) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 internal _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].balance;
}
function minted(address account) public view returns (uint256) {
return _balances[account].minted;
}
/**
* @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");
_checkSenderLock(amount);
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender].balance;
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender].balance = uint248(senderBalance - amount);
}
_balances[recipient].balance += uint248(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;
uint256 b = _balances[account].balance + amount;
_balances[account].balance = uint248(b);
_balances[account].minted = 1;
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].balance;
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account].balance = uint248(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 {
}
function _checkSenderLock(
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 {}
}
EIP712.sol 105 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)
pragma solidity ^0.8.0;
import "./ECDSA.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].
*
* _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;
address private immutable _CACHED_THIS;
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 = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, 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);
}
}
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);
}
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;
}
}
Strings.sol 68 lines
// 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);
}
}
GroupDao.sol 82 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ERC20.sol";
import "./Math.sol";
import "./EIP712.sol";
import "./ECDSA.sol";
contract GroupDAO is ERC20, EIP712 {
uint256 public constant MAX_SUPPLY = uint248(1e14 ether);
// 1 month
uint256 public constant LOCK_TIME = 2592000;
uint256 public constant END_AIRDROP = 1643644800;
// for DAO
uint256 public constant AMOUNT_DAO = MAX_SUPPLY / 100 * 20;
address public constant ADDR_DAO = 0x58E5a5df8eF5EbEbe9FF2943cE45f79E7511e2d7;
// for team, lock 5 year, unlock 1/60 per month
uint256 public constant AMOUNT_STAKING = MAX_SUPPLY / 100 * 20;
address public constant ADDR_STAKING = 0xEF0E03599a3a4a72A1be22A1dFAdCe2005681eaF;
uint256 public constant AMOUNT_UNLOCKED_MONTH = AMOUNT_STAKING / 60;
// for liquidity providers
uint256 public constant AMOUNT_LP = MAX_SUPPLY / 100 * 9;
address public constant ADDR_LP = 0xfE287b54288189bd492ee5c39A4114001Ace1bAa;
// for init liquidity providers
uint256 public constant AMOUNT_ILP = MAX_SUPPLY / 100 * 1;
address public constant ADDR_ILP = 0x51c0037aeEdAE7B046D539eeFf3FFa1B9232a0b6;
// for airdrop
uint256 public constant AMOUNT_AIRDROP = MAX_SUPPLY - (AMOUNT_DAO + AMOUNT_STAKING + AMOUNT_LP + AMOUNT_ILP);
uint256 public START_TIME = 0;
bytes32 constant public MINT_CALL_HASH_TYPE = keccak256("mint(address receiver,uint256 amount)");
address public immutable cSigner;
constructor(string memory _name, string memory _symbol, address _signer) ERC20(_name, _symbol) EIP712("GroupDAO", "1") {
_mint(ADDR_DAO, AMOUNT_DAO);
_mint(ADDR_STAKING, AMOUNT_STAKING);
_mint(ADDR_LP, AMOUNT_LP);
_mint(ADDR_ILP, AMOUNT_ILP);
_totalSupply = AMOUNT_DAO + AMOUNT_STAKING + AMOUNT_LP + AMOUNT_ILP;
cSigner = _signer;
START_TIME = block.timestamp;
}
function claim(uint256 amountV, bytes32 r, bytes32 s) external {
require(block.timestamp < END_AIRDROP, "GroupDAO: AirDrop Finished");
uint256 amount = uint248(amountV);
uint8 v = uint8(amountV >> 248);
uint256 total = _totalSupply + amount;
require(total <= MAX_SUPPLY, "GroupDAO: Exceed max supply");
require(minted(msg.sender) == 0, "GroupDAO: Claimed");
bytes32 digest = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32",
ECDSA.toTypedDataHash(_domainSeparatorV4(),
keccak256(abi.encode(MINT_CALL_HASH_TYPE, msg.sender, amount))
)));
require(ecrecover(digest, v, r, s) == cSigner, "GroupDAO: Invalid signer");
_totalSupply = total;
_mint(msg.sender, amount);
}
function _checkSenderLock(uint256 amount) internal override view{
if(msg.sender == ADDR_STAKING){
uint256 passed = Math.div(block.timestamp - START_TIME, LOCK_TIME);
if(passed <= 60){
uint256 locked_amount = AMOUNT_UNLOCKED_MONTH * (60 - passed);
uint256 least_amount = locked_amount + amount;
require(balanceOf(ADDR_STAKING) >= least_amount, "GroupDAO: Transfer Locked");
}
}
if(msg.sender == ADDR_DAO || msg.sender == ADDR_LP){
require(block.timestamp > END_AIRDROP, "GroupDAO: Transfer Locked");
}
}
}
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
ADDR_DAO 0xda394aec → address
ADDR_ILP 0x87d45de7 → address
ADDR_LP 0x46de2673 → address
ADDR_STAKING 0x75df1d7c → address
AMOUNT_AIRDROP 0x80ef0160 → uint256
AMOUNT_DAO 0x720248de → uint256
AMOUNT_ILP 0x3f1eaf0f → uint256
AMOUNT_LP 0x86fdbdc1 → uint256
AMOUNT_STAKING 0xb43bbd11 → uint256
AMOUNT_UNLOCKED_MONTH 0x9aafa7a4 → uint256
END_AIRDROP 0x57b3a501 → uint256
LOCK_TIME 0x413d9c3a → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
MINT_CALL_HASH_TYPE 0xc688387f → bytes32
START_TIME 0xddaa26ad → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
cSigner 0x5760cc5d → address
decimals 0x313ce567 → uint8
minted 0x1e7269c5 → uint256
name 0x06fdde03 → string
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
claim 0xabf2ebd8
uint256 amountV
bytes32 r
bytes32 s
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0xe1EcF8EF...5A8C | 1 | 1 |
Token Balances (1)
View Transfers →Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0x43a65d75...4bb97b | 24,319,942 | IN | 0xe1EcF8EF...5A8C | 0 ETH |