Address Contract Partially Verified
Address
0x49857Aea8494E2ae32EdE73f2503a78e463a4aa7
Balance
0 ETH
Nonce
1
Code Size
19315 bytes
Creator
0x4904Ba31...a4bd at tx 0xf9d0e5e8...99d023
Indexed Transactions
0
Contract Bytecode
19315 bytes
0x608060405234801561001057600080fd5b506004361061030c5760003560e01c8063715018a61161019d578063a476df61116100e9578063d48e4127116100a2578063f19c4e3b1161007c578063f19c4e3b14610905578063f2fde38b14610921578063f820f5671461093d578063ffa1ad741461095b5761030c565b8063d48e41271461089b578063d8f67851146108b9578063dd62ed3e146108d55761030c565b8063a476df61146107c5578063a9059cbb146107e1578063a9d8668514610811578063b7bda68f1461082f578063ba4e5c491461084d578063bfcf73551461087d5761030c565b80638dac7191116101565780639b19251a116101305780639b19251a14610729578063a09a160114610759578063a32f697614610777578063a457c2d7146107955761030c565b80638dac7191146106cf5780638e8c10a2146106ed57806395d89b411461070b5761030c565b8063715018a61461064557806379cc67901461064f5780638456cb591461066b578063878dd33214610675578063883356d9146106935780638da5cb5b146106b15761030c565b806340c10f191161025c578063542e966711610215578063614d08f8116101ef578063614d08f8146105bb5780636c5adaae146105d95780636d028027146105f757806370a08231146106155761030c565b8063542e9667146105615780635a3990ce1461057f5780635c975abb1461059d5761030c565b806340c10f19146104b557806342966c68146104d157806346b45af7146104ed5780634838d1651461050b5780634ac0bc3214610527578063537df3b6146105455761030c565b806323b872dd116102c957806335377214116102a35780633537721414610441578063378dc3dc1461045d578063395093511461047b5780633f4ba83a146104ab5761030c565b806323b872dd146103d55780632fa782eb14610405578063313ce567146104235761030c565b806302252c4d14610311578063044ab74e1461032d57806306fdde031461034b578063095ea7b31461036957806318160ddd14610399578063184d69ab146103b7575b600080fd5b61032b6004803603810190610326919061383b565b610979565b005b610335610a43565b60405161034291906138f8565b60405180910390f35b610353610ad1565b60405161036091906138f8565b60405180910390f35b610383600480360381019061037e9190613978565b610b63565b60405161039091906139d3565b60405180910390f35b6103a1610b86565b6040516103ae91906139fd565b60405180910390f35b6103bf610b90565b6040516103cc91906139d3565b60405180910390f35b6103ef60048036038101906103ea9190613a18565b610baa565b6040516103fc91906139d3565b60405180910390f35b61040d61117c565b60405161041a91906139fd565b60405180910390f35b61042b611182565b6040516104389190613a87565b60405180910390f35b61045b60048036038101906104569190613b07565b6111aa565b005b610465611259565b60405161047291906139fd565b60405180910390f35b61049560048036038101906104909190613978565b61127d565b6040516104a291906139d3565b60405180910390f35b6104b36112b4565b005b6104cf60048036038101906104ca9190613978565b611304565b005b6104eb60048036038101906104e6919061383b565b611501565b005b6104f561155b565b60405161050291906139d3565b60405180910390f35b61052560048036038101906105209190613b54565b611575565b005b61052f611798565b60405161053c91906139d3565b60405180910390f35b61055f600480360381019061055a9190613b54565b6117b2565b005b61056961192c565b60405161057691906139fd565b60405180910390f35b610587611932565b60405161059491906139d3565b60405180910390f35b6105a561194c565b6040516105b291906139d3565b60405180910390f35b6105c3611963565b6040516105d091906138f8565b60405180910390f35b6105e161199c565b6040516105ee91906139d3565b60405180910390f35b6105ff6119b6565b60405161060c9190613c3f565b60405180910390f35b61062f600480360381019061062a9190613b54565b611a44565b60405161063c91906139fd565b60405180910390f35b61064d611a8c565b005b61066960048036038101906106649190613978565b611aa6565b005b610673611b02565b005b61067d611b52565b60405161068a91906139d3565b60405180910390f35b61069b611b6c565b6040516106a891906139d3565b60405180910390f35b6106b9611b86565b6040516106c69190613c70565b60405180910390f35b6106d7611bb0565b6040516106e49190613c70565b60405180910390f35b6106f5611bd4565b60405161070291906139d3565b60405180910390f35b610713611bee565b60405161072091906138f8565b60405180910390f35b610743600480360381019061073e9190613b54565b611c80565b60405161075091906139d3565b60405180910390f35b610761611ca0565b60405161076e91906139d3565b60405180910390f35b61077f611cba565b60405161078c91906139fd565b60405180910390f35b6107af60048036038101906107aa9190613978565b611cde565b6040516107bc91906139d3565b60405180910390f35b6107df60048036038101906107da9190613dbb565b611d55565b005b6107fb60048036038101906107f69190613978565b611ded565b60405161080891906139d3565b60405180910390f35b61081961235a565b60405161082691906138f8565b60405180910390f35b6108376123e8565b6040516108449190613c70565b60405180910390f35b6108676004803603810190610862919061383b565b61240e565b6040516108749190613c70565b60405180910390f35b61088561244d565b6040516108929190613e1d565b60405180910390f35b6108a3612474565b6040516108b091906139fd565b60405180910390f35b6108d360048036038101906108ce919061383b565b61247a565b005b6108ef60048036038101906108ea9190613e38565b612546565b6040516108fc91906139fd565b60405180910390f35b61091f600480360381019061091a9190613978565b6125cd565b005b61093b60048036038101906109369190613b54565b6126fb565b005b610945612717565b60405161095291906139d3565b60405180910390f35b610963612731565b60405161097091906138f8565b60405180910390f35b610981612863565b6109896128e1565b610991611932565b6109c7576040517f6273340f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b548111610a02576040517fa43d2d7600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600b819055507f2905481c6fd1a037492016c4760435a52203d82a6f34dc3de40f464c1bf42d5981604051610a3891906139fd565b60405180910390a150565b600a8054610a5090613ea7565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7c90613ea7565b8015610ac95780601f10610a9e57610100808354040283529160200191610ac9565b820191906000526020600020905b815481529060010190602001808311610aac57829003601f168201915b505050505081565b606060038054610ae090613ea7565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0c90613ea7565b8015610b595780601f10610b2e57610100808354040283529160200191610b59565b820191906000526020600020905b815481529060010190602001808311610b3c57829003601f168201915b5050505050905090565b600080610b6e61292b565b9050610b7b818585612933565b600191505092915050565b6000600254905090565b6000600c60000160059054906101000a900460ff16905090565b6000610bb46128e1565b8383610bbe610b90565b15610de757600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610c5157816040517fbf3f9389000000000000000000000000000000000000000000000000000000008152600401610c489190613c70565b60405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610cdf57806040517fab0b880c000000000000000000000000000000000000000000000000000000008152600401610cd69190613c70565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015610d4e5750610d1e611b86565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b8015610da45750600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15610de657336040517fbf3f9389000000000000000000000000000000000000000000000000000000008152600401610ddd9190613c70565b60405180910390fd5b5b610def611b52565b1561101957600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e8357816040517f578f3e13000000000000000000000000000000000000000000000000000000008152600401610e7a9190613c70565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f1257806040517fcb8e2bcc000000000000000000000000000000000000000000000000000000008152600401610f099190613c70565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015610f815750610f51611b86565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b8015610fd65750600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561101857336040517f578f3e1300000000000000000000000000000000000000000000000000000000815260040161100f9190613c70565b60405180910390fd5b5b60006110258786612afc565b9050600061103286612b87565b905060008183886110439190613f07565b61104d9190613f07565b9050611057611932565b156110b757600b54816110698a611a44565b6110739190613f3b565b11156110b657876040517ff6202a8f0000000000000000000000000000000000000000000000000000000081526004016110ad9190613c70565b60405180910390fd5b5b600083146110ed576110ec89600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685612bb5565b5b60008214611100576110ff8983612e2b565b5b61110861199c565b801561114657503373ffffffffffffffffffffffffffffffffffffffff1661112e611b86565b73ffffffffffffffffffffffffffffffffffffffff16145b1561116257611156898983612bb5565b60019550505050611173565b61116d898983612ff8565b95505050505b50509392505050565b600e5481565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b6111b2612863565b6111ba6128e1565b6111c2610b90565b6111f8576040517f0b1b4e5500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611200613027565b61120a8282613138565b81816008919061121b929190613734565b507f6141feff42f24e29d1af3d91bffa3d40521e53485e9c92e358c4d946c0adbd38828260405161124d929190613ffa565b60405180910390a15050565b7f000000000000000000000000000000000000000000000000000000000ee6b28081565b60008061128861292b565b90506112a981858561129a8589612546565b6112a49190613f3b565b612933565b600191505092915050565b6112bc612863565b6112c4611ca0565b6112fa576040517ff00085b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113026132fd565b565b61130c612863565b6113146128e1565b61131c61155b565b611352576040517f3990ac6800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61135a611932565b156113ba57600b548161136c84611a44565b6113769190613f3b565b11156113b957816040517ff6202a8f0000000000000000000000000000000000000000000000000000000081526004016113b09190613c70565b60405180910390fd5b5b6113c2611b52565b1561145757600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561145657816040517fcb8e2bcc00000000000000000000000000000000000000000000000000000000815260040161144d9190613c70565b60405180910390fd5b5b61145f610b90565b156114f357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166114f257816040517fab0b880c0000000000000000000000000000000000000000000000000000000081526004016114e99190613c70565b60405180910390fd5b5b6114fd8282613360565b5050565b611509612863565b6115116128e1565b611519611b6c565b61154f576040517f6cb5913900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611558816134b6565b50565b6000600c60000160009054906101000a900460ff16905090565b61157d612863565b6115856128e1565b61158e8161276a565b611596611b52565b6115cc576040517feafab70c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561165b57806040517f70b8fc840000000000000000000000000000000000000000000000000000000081526004016116529190613c70565b60405180910390fd5b611663610b90565b80156116b85750600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156116fa57806040517febdacb5f0000000000000000000000000000000000000000000000000000000081526004016116f19190613c70565b60405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7f8b7dc89dae85811a7a85800b892b5816ad5d381c856f1b56490f8fc470c9cb60405160405180910390a250565b6000600c60000160089054906101000a900460ff16905090565b6117ba612863565b6117c26128e1565b6117cb8161276a565b6117d3611b52565b611809576040517feafab70c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661189757806040517f3d7c1f4a00000000000000000000000000000000000000000000000000000000815260040161188e9190613c70565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690558073ffffffffffffffffffffffffffffffffffffffff167f4ca5b343d678ca6f1f96e8c8a2115c41c2d40641fd872b928ba6f95d3648b9d160405160405180910390a250565b600f5481565b6000600c60000160069054906101000a900460ff16905090565b6000600560009054906101000a900460ff16905090565b6040518060400160405280600781526020017f546563685061790000000000000000000000000000000000000000000000000081525081565b6000600c60000160079054906101000a900460ff16905090565b60606008805480602002602001604051908101604052809291908181526020018280548015611a3a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116119f0575b5050505050905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611a94612863565b611a9c6128e1565b611aa46134ca565b565b611aae612863565b611ab66128e1565b611abe611b6c565b611af4576040517f6cb5913900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611afe82826134de565b5050565b611b0a612863565b611b12611ca0565b611b48576040517ff00085b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b506134fe565b565b6000600c60000160039054906101000a900460ff16905090565b6000600c60000160019054906101000a900460ff16905090565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f0000000000000000000000002ce6470403eac26359056cd7815a786f3ee356c281565b6000600c60000160099054906101000a900460ff16905090565b606060048054611bfd90613ea7565b80601f0160208091040260200160405190810160405280929190818152602001828054611c2990613ea7565b8015611c765780601f10611c4b57610100808354040283529160200191611c76565b820191906000526020600020905b815481529060010190602001808311611c5957829003601f168201915b5050505050905090565b60076020528060005260406000206000915054906101000a900460ff1681565b6000600c60000160029054906101000a900460ff16905090565b7f00000000000000000000000000000000000000000000d3c21bcecceda100000081565b600080611ce961292b565b90506000611cf78286612546565b905083811015611d3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3390614090565b60405180910390fd5b611d498286868403612933565b60019250505092915050565b611d5d612863565b611d656128e1565b611d6d612717565b611da3576040517f70a43fce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600a9081611db2919061425c565b507f4456a0b562609d67398ddb488f136db285cd3c92343e0a7ba684925669237ade81604051611de291906138f8565b60405180910390a150565b6000611df76128e1565b3383611e01610b90565b1561202a57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611e9457816040517fbf3f9389000000000000000000000000000000000000000000000000000000008152600401611e8b9190613c70565b60405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611f2257806040517fab0b880c000000000000000000000000000000000000000000000000000000008152600401611f199190613c70565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f915750611f61611b86565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b8015611fe75750600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561202957336040517fbf3f93890000000000000000000000000000000000000000000000000000000081526004016120209190613c70565b60405180910390fd5b5b612032611b52565b1561225c57600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156120c657816040517f578f3e130000000000000000000000000000000000000000000000000000000081526004016120bd9190613c70565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561215557806040517fcb8e2bcc00000000000000000000000000000000000000000000000000000000815260040161214c9190613c70565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156121c45750612194611b86565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b80156122195750600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561225b57336040517f578f3e130000000000000000000000000000000000000000000000000000000081526004016122529190613c70565b60405180910390fd5b5b60006122683386612afc565b9050600061227586612b87565b905060008183886122869190613f07565b6122909190613f07565b905061229a611932565b156122fa57600b54816122ac8a611a44565b6122b69190613f3b565b11156122f957876040517ff6202a8f0000000000000000000000000000000000000000000000000000000081526004016122f09190613c70565b60405180910390fd5b5b600083146123305761232f33600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685612bb5565b5b60008214612343576123423383612e2b565b5b61234d8882613561565b9550505050505092915050565b6009805461236790613ea7565b80601f016020809104026020016040519081016040528092919081815260200182805461239390613ea7565b80156123e05780601f106123b5576101008083540402835291602001916123e0565b820191906000526020600020905b8154815290600101906020018083116123c357829003601f168201915b505050505081565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6008818154811061241e57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f649dd22ffb9b5ece36ce844ba1916af2dc15df7cded3d3957049fcc6c2bbb4f060001b81565b600b5481565b612482612863565b61248a6128e1565b612492611bd4565b6124c8576040517fcd9e529800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61138881111561250f57806040517fbb74652000000000000000000000000000000000000000000000000000000000815260040161250691906139fd565b60405180910390fd5b80600f81905550807fc1ff65ee907dc079b64ed9913d53f4bd593bd6ebd9b2a2708db2916d49e17ec360405160405180910390a250565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6125d5612863565b6125dd6128e1565b6125e5611798565b61261b576040517fc8a478a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61138881111561266257806040517fcb400e9600000000000000000000000000000000000000000000000000000000815260040161265991906139fd565b60405180910390fd5b61266b8261276a565b81600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600e81905550808273ffffffffffffffffffffffffffffffffffffffff167facc44e32fd5ca4240f6dbe6e8cf4eb49349c17c5ce5f80f1919a9c97b50d398a60405160405180910390a35050565b612703612863565b61270b6128e1565b61271481612783565b50565b6000600c60000160049054906101000a900460ff16905090565b6040518060400160405280600c81526020017f73656375726974795f765f31000000000000000000000000000000000000000081525081565b8060601b6127805763d92e233d6000526004601cfd5b50565b61278b612863565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036127fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f1906143a0565b60405180910390fd5b61280381613584565b50565b61281183838361285e565b61281961194c565b15612859576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161285090614432565b60405180910390fd5b505050565b505050565b61286b61292b565b73ffffffffffffffffffffffffffffffffffffffff16612889611b86565b73ffffffffffffffffffffffffffffffffffffffff16146128df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128d69061449e565b60405180910390fd5b565b6128e961194c565b15612929576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129209061450a565b60405180910390fd5b565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036129a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129999061459c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612a11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a089061462e565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051612aef91906139fd565b60405180910390a3505050565b600080600e5414158015612b5e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15612b8157612710600e5483612b74919061464e565b612b7e91906146bf565b90505b92915050565b600080600f5414612bb057612710600f5483612ba3919061464e565b612bad91906146bf565b90505b919050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1b90614762565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612c93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c8a906147f4565b60405180910390fd5b612c9e83838361364a565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1b90614886565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612e1291906139fd565b60405180910390a3612e2584848461365a565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612e9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e9190614918565b60405180910390fd5b612ea68260008361364a565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612f2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f23906149aa565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612fdf91906139fd565b60405180910390a3612ff38360008461365a565b505050565b60008061300361292b565b905061301085828561365f565b61301b858585612bb5565b60019150509392505050565b600060088054806020026020016040519081016040528092919081815260200182805480156130ab57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311613061575b5050505050905060005b815181101561313457600760008383815181106130d5576130d46149ca565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905580806001019150506130b5565b5050565b60005b828290508110156132f85761317683838381811061315c5761315b6149ca565b5b90506020020160208101906131719190613b54565b61276a565b600c60000160039054906101000a900460ff1680156132055750600660008484848181106131a7576131a66149ca565b5b90506020020160208101906131bc9190613b54565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561326e5782828281811061321d5761321c6149ca565b5b90506020020160208101906132329190613b54565b6040517f2cf5f7dd0000000000000000000000000000000000000000000000000000000081526004016132659190613c70565b60405180910390fd5b600160076000858585818110613287576132866149ca565b5b905060200201602081019061329c9190613b54565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600101905061313b565b505050565b6133056136eb565b6000600560006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61334961292b565b6040516133569190613c70565b60405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036133cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133c690614a45565b60405180910390fd5b6133db6000838361364a565b80600260008282546133ed9190613f3b565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161349e91906139fd565b60405180910390a36134b26000838361365a565b5050565b6134c76134c161292b565b82612e2b565b50565b6134d2612863565b6134dc6000613584565b565b6134f0826134ea61292b565b8361365f565b6134fa8282612e2b565b5050565b6135066128e1565b6001600560006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861354a61292b565b6040516135579190613c70565b60405180910390a1565b60008061356c61292b565b9050613579818585612bb5565b600191505092915050565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b613655838383612806565b505050565b505050565b600061366b8484612546565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146136e557818110156136d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136ce90614ab1565b60405180910390fd5b6136e48484848403612933565b5b50505050565b6136f361194c565b613732576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161372990614b1d565b60405180910390fd5b565b8280548282559060005260206000209081019282156137c3579160200282015b828111156137c257823573ffffffffffffffffffffffffffffffffffffffff168260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190613754565b5b5090506137d091906137d4565b5090565b5b808211156137ed5760008160009055506001016137d5565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61381881613805565b811461382357600080fd5b50565b6000813590506138358161380f565b92915050565b600060208284031215613851576138506137fb565b5b600061385f84828501613826565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156138a2578082015181840152602081019050613887565b60008484015250505050565b6000601f19601f8301169050919050565b60006138ca82613868565b6138d48185613873565b93506138e4818560208601613884565b6138ed816138ae565b840191505092915050565b6000602082019050818103600083015261391281846138bf565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006139458261391a565b9050919050565b6139558161393a565b811461396057600080fd5b50565b6000813590506139728161394c565b92915050565b6000806040838503121561398f5761398e6137fb565b5b600061399d85828601613963565b92505060206139ae85828601613826565b9150509250929050565b60008115159050919050565b6139cd816139b8565b82525050565b60006020820190506139e860008301846139c4565b92915050565b6139f781613805565b82525050565b6000602082019050613a1260008301846139ee565b92915050565b600080600060608486031215613a3157613a306137fb565b5b6000613a3f86828701613963565b9350506020613a5086828701613963565b9250506040613a6186828701613826565b9150509250925092565b600060ff82169050919050565b613a8181613a6b565b82525050565b6000602082019050613a9c6000830184613a78565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112613ac757613ac6613aa2565b5b8235905067ffffffffffffffff811115613ae457613ae3613aa7565b5b602083019150836020820283011115613b0057613aff613aac565b5b9250929050565b60008060208385031215613b1e57613b1d6137fb565b5b600083013567ffffffffffffffff811115613b3c57613b3b613800565b5b613b4885828601613ab1565b92509250509250929050565b600060208284031215613b6a57613b696137fb565b5b6000613b7884828501613963565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613bb68161393a565b82525050565b6000613bc88383613bad565b60208301905092915050565b6000602082019050919050565b6000613bec82613b81565b613bf68185613b8c565b9350613c0183613b9d565b8060005b83811015613c32578151613c198882613bbc565b9750613c2483613bd4565b925050600181019050613c05565b5085935050505092915050565b60006020820190508181036000830152613c598184613be1565b905092915050565b613c6a8161393a565b82525050565b6000602082019050613c856000830184613c61565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613cc8826138ae565b810181811067ffffffffffffffff82111715613ce757613ce6613c90565b5b80604052505050565b6000613cfa6137f1565b9050613d068282613cbf565b919050565b600067ffffffffffffffff821115613d2657613d25613c90565b5b613d2f826138ae565b9050602081019050919050565b82818337600083830152505050565b6000613d5e613d5984613d0b565b613cf0565b905082815260208101848484011115613d7a57613d79613c8b565b5b613d85848285613d3c565b509392505050565b600082601f830112613da257613da1613aa2565b5b8135613db2848260208601613d4b565b91505092915050565b600060208284031215613dd157613dd06137fb565b5b600082013567ffffffffffffffff811115613def57613dee613800565b5b613dfb84828501613d8d565b91505092915050565b6000819050919050565b613e1781613e04565b82525050565b6000602082019050613e326000830184613e0e565b92915050565b60008060408385031215613e4f57613e4e6137fb565b5b6000613e5d85828601613963565b9250506020613e6e85828601613963565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613ebf57607f821691505b602082108103613ed257613ed1613e78565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613f1282613805565b9150613f1d83613805565b9250828203905081811115613f3557613f34613ed8565b5b92915050565b6000613f4682613805565b9150613f5183613805565b9250828201905080821115613f6957613f68613ed8565b5b92915050565b6000819050919050565b6000613f886020840184613963565b905092915050565b6000602082019050919050565b6000613fa98385613b8c565b9350613fb482613f6f565b8060005b85811015613fed57613fca8284613f79565b613fd48882613bbc565b9750613fdf83613f90565b925050600181019050613fb8565b5085925050509392505050565b60006020820190508181036000830152614015818486613f9d565b90509392505050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061407a602583613873565b91506140858261401e565b604082019050919050565b600060208201905081810360008301526140a98161406d565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026141127fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826140d5565b61411c86836140d5565b95508019841693508086168417925050509392505050565b6000819050919050565b600061415961415461414f84613805565b614134565b613805565b9050919050565b6000819050919050565b6141738361413e565b61418761417f82614160565b8484546140e2565b825550505050565b600090565b61419c61418f565b6141a781848461416a565b505050565b5b818110156141cb576141c0600082614194565b6001810190506141ad565b5050565b601f821115614210576141e1816140b0565b6141ea846140c5565b810160208510156141f9578190505b61420d614205856140c5565b8301826141ac565b50505b505050565b600082821c905092915050565b600061423360001984600802614215565b1980831691505092915050565b600061424c8383614222565b9150826002028217905092915050565b61426582613868565b67ffffffffffffffff81111561427e5761427d613c90565b5b6142888254613ea7565b6142938282856141cf565b600060209050601f8311600181146142c657600084156142b4578287015190505b6142be8582614240565b865550614326565b601f1984166142d4866140b0565b60005b828110156142fc578489015182556001820191506020850194506020810190506142d7565b868310156143195784890151614315601f891682614222565b8355505b6001600288020188555050505b505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061438a602683613873565b91506143958261432e565b604082019050919050565b600060208201905081810360008301526143b98161437d565b9050919050565b7f45524332305061757361626c653a20746f6b656e207472616e7366657220776860008201527f696c652070617573656400000000000000000000000000000000000000000000602082015250565b600061441c602a83613873565b9150614427826143c0565b604082019050919050565b6000602082019050818103600083015261444b8161440f565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614488602083613873565b915061449382614452565b602082019050919050565b600060208201905081810360008301526144b78161447b565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b60006144f4601083613873565b91506144ff826144be565b602082019050919050565b60006020820190508181036000830152614523816144e7565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614586602483613873565b91506145918261452a565b604082019050919050565b600060208201905081810360008301526145b581614579565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000614618602283613873565b9150614623826145bc565b604082019050919050565b600060208201905081810360008301526146478161460b565b9050919050565b600061465982613805565b915061466483613805565b925082820261467281613805565b9150828204841483151761468957614688613ed8565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006146ca82613805565b91506146d583613805565b9250826146e5576146e4614690565b5b828204905092915050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061474c602583613873565b9150614757826146f0565b604082019050919050565b6000602082019050818103600083015261477b8161473f565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006147de602383613873565b91506147e982614782565b604082019050919050565b6000602082019050818103600083015261480d816147d1565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000614870602683613873565b915061487b82614814565b604082019050919050565b6000602082019050818103600083015261489f81614863565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b6000614902602183613873565b915061490d826148a6565b604082019050919050565b60006020820190508181036000830152614931816148f5565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b6000614994602283613873565b915061499f82614938565b604082019050919050565b600060208201905081810360008301526149c381614987565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000614a2f601f83613873565b9150614a3a826149f9565b602082019050919050565b60006020820190508181036000830152614a5e81614a22565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b6000614a9b601d83613873565b9150614aa682614a65565b602082019050919050565b60006020820190508181036000830152614aca81614a8e565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000614b07601483613873565b9150614b1282614ad1565b602082019050919050565b60006020820190508181036000830152614b3681614afa565b905091905056fea2646970667358221220151f7aecd72fb10551cc4b65a070493e3a5ec75a8a6899fadb675af9e75cd6ec64736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
TechPay.sol 684 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ERC20Burnable } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import { ERC20Pausable } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import { LibCommon } from "./lib/LibCommon.sol";
contract TechPay is ERC20, ERC20Burnable, ERC20Pausable, Ownable {
uint256 private constant MAX_BPS_AMOUNT = 10_000;
uint256 private constant MAX_ALLOWED_BPS = 5_000;
string public constant VERSION = "security_v_1";
string public constant CONTRACT_NAME = "TechPay";
bytes32 public constant CONTRACT_HASH = 0x649dd22ffb9b5ece36ce844ba1916af2dc15df7cded3d3957049fcc6c2bbb4f0;
/// @notice mapping of blacklisted addresses to a boolean
mapping(address => bool) private _isBlacklisted;
/// @notice mapping of whitelisted addresses to a boolean
mapping(address => bool) public whitelist;
/// @notice array holding all whitelisted addresses
address[] public whitelistedAddresses;
/// @notice support for attaching of documentation for security tokens
string public initialDocumentUri;
/// @notice the security token documentation
string public documentUri;
/// @notice initial number of tokens which will be minted during initialization
uint256 public immutable initialSupply;
/// @notice initial max amount of tokens allowed per wallet
uint256 public immutable initialMaxTokenAmountPerAddress;
/// @notice max amount of tokens allowed per wallet
uint256 public maxTokenAmountPerAddress;
/// @notice set of features supported by the token
struct ERC20ConfigProps {
bool _isMintable;
bool _isBurnable;
bool _isPausable;
bool _isBlacklistEnabled;
bool _isDocumentAllowed;
bool _isWhitelistEnabled;
bool _isMaxAmountOfTokensSet;
bool _isForceTransferAllowed;
bool _isTaxable;
bool _isDeflationary;
}
/// @notice features of the token
ERC20ConfigProps private configProps;
/// @notice owner of the contract
address public immutable initialTokenOwner;
/// @notice number of decimals of the token
uint8 private immutable _decimals;
address public taxAddress;
uint256 public taxBPS;
uint256 public deflationBPS;
/// @notice emitted when an address is blacklisted
event UserBlacklisted(address indexed addr);
/// @notice emitted when an address is unblacklisted
event UserUnBlacklisted(address indexed addr);
/// @notice emitted when a new document is set for the security token
event DocumentUriSet(string newDocUri);
/// @notice emitted when a new max amount of tokens per wallet is set
event MaxTokenAmountPerSet(uint256 newMaxTokenAmount);
/// @notice emitted when a new whitelist is set
event UsersWhitelisted(address[] updatedAddresses);
/// @notice emitted when a new tax address or taxBPS is set
event TaxConfigSet(address indexed _taxAddress, uint256 indexed _taxBPS);
/// @notice emitted when a new deflationBPS is set
event DeflationConfigSet(uint256 indexed _deflationBPS);
/// @notice raised when the amount sent is zero
error InvalidMaxTokenAmount(uint256 maxTokenAmount);
/// @notice raised when the decimals are not in the range 0 - 18
error InvalidDecimals(uint8 decimals);
/// @notice raised when setting maxTokenAmount less than current
error MaxTokenAmountPerAddrLtPrevious();
/// @notice raised when blacklisting is not enabled
error BlacklistNotEnabled();
/// @notice raised when the address is already blacklisted
error AddrAlreadyBlacklisted(address addr);
/// @notice raised when the address is already unblacklisted
error AddrAlreadyUnblacklisted(address addr);
/// @notice raised when attempting to blacklist a whitelisted address
error CannotBlacklistWhitelistedAddr(address addr);
/// @notice raised when a recipient address is blacklisted
error RecipientBlacklisted(address addr);
/// @notice raised when a sender address is blacklisted
error SenderBlacklisted(address addr);
/// @notice raised when a recipient address is not whitelisted
error RecipientNotWhitelisted(address addr);
/// @notice raised when a sender address is not whitelisted
error SenderNotWhitelisted(address addr);
/// @notice raised when recipient balance exceeds maxTokenAmountPerAddress
error DestBalanceExceedsMaxAllowed(address addr);
/// @notice raised minting is not enabled
error MintingNotEnabled();
/// @notice raised when burning is not enabled
error BurningNotEnabled();
/// @notice raised when pause is not enabled
error PausingNotEnabled();
/// @notice raised when whitelist is not enabled
error WhitelistNotEnabled();
/// @notice raised when attempting to whitelist a blacklisted address
error CannotWhitelistBlacklistedAddr(address addr);
/// @notice raised when trying to set a document URI when not allowed
error DocumentUriNotAllowed();
/// @notice raised when trying to set a max amount of tokens when not allowed
error MaxTokenAmountNotAllowed();
/// @notice raised when trying to set a tax address or taxBPS when not allowed
error TokenIsNotTaxable();
/// @notice raised when trying to set a deflationBPS when not allowed
error TokenIsNotDeflationary();
/// @notice raised when trying to set an invalid taxBPS
error InvalidTaxBPS(uint256 bps);
/// @notice raised when trying to set and invalid deflationBPS
error InvalidDeflationBPS(uint256 bps);
/**
* @notice modifier for validating if transfer is possible and valid
* @param sender the sender of the transaction
* @param recipient the recipient of the transaction
*/
modifier validateTransfer(address sender, address recipient) {
if (isWhitelistEnabled()) {
if (!whitelist[sender]) {
revert SenderNotWhitelisted(sender);
}
if (!whitelist[recipient]) {
revert RecipientNotWhitelisted(recipient);
}
if (
sender != msg.sender && msg.sender != owner() && !whitelist[msg.sender]
) {
revert SenderNotWhitelisted(msg.sender);
}
}
if (isBlacklistEnabled()) {
if (_isBlacklisted[sender]) {
revert SenderBlacklisted(sender);
}
if (_isBlacklisted[recipient]) {
revert RecipientBlacklisted(recipient);
}
if (
sender != msg.sender &&
msg.sender != owner() &&
_isBlacklisted[msg.sender]
) {
revert SenderBlacklisted(msg.sender);
}
}
_;
}
constructor(
string memory name_,
string memory symbol_,
uint256 initialSupplyToSet,
uint8 decimalsToSet,
address tokenOwner,
ERC20ConfigProps memory customConfigProps,
uint256 maxTokenAmount,
string memory newDocumentUri,
address _taxAddress,
uint256 _taxBPS,
uint256 _deflationBPS
) ERC20(name_, symbol_) {
if (customConfigProps._isMaxAmountOfTokensSet) {
if (maxTokenAmount == 0) {
revert InvalidMaxTokenAmount(maxTokenAmount);
}
}
if (decimalsToSet > 18) {
revert InvalidDecimals(decimalsToSet);
}
if (customConfigProps._isTaxable) {
if (_taxBPS > MAX_ALLOWED_BPS) {
revert InvalidTaxBPS(_taxBPS);
}
LibCommon.validateAddress(_taxAddress);
taxAddress = _taxAddress;
taxBPS = _taxBPS;
}
if (customConfigProps._isDeflationary) {
if (_deflationBPS > MAX_ALLOWED_BPS) {
revert InvalidDeflationBPS(_deflationBPS);
}
deflationBPS = _deflationBPS;
}
LibCommon.validateAddress(tokenOwner);
initialSupply = initialSupplyToSet;
initialMaxTokenAmountPerAddress = maxTokenAmount;
initialDocumentUri = newDocumentUri;
initialTokenOwner = tokenOwner;
_decimals = decimalsToSet;
configProps = customConfigProps;
documentUri = newDocumentUri;
maxTokenAmountPerAddress = maxTokenAmount;
if (initialSupplyToSet != 0) {
_mint(tokenOwner, initialSupplyToSet * 10 ** decimalsToSet);
}
if (tokenOwner != msg.sender) {
transferOwnership(tokenOwner);
}
}
/**
* @notice hook called before any transfer of tokens. This includes minting and burning
* imposed by the ERC20 standard
* @param from - address of the sender
* @param to - address of the recipient
* @param amount - amount of tokens to transfer
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Pausable) {
super._beforeTokenTransfer(from, to, amount);
}
/// @notice method which checks if the token is pausable
function isPausable() public view returns (bool) {
return configProps._isPausable;
}
/// @notice method which checks if the token is mintable
function isMintable() public view returns (bool) {
return configProps._isMintable;
}
/// @notice method which checks if the token is burnable
function isBurnable() public view returns (bool) {
return configProps._isBurnable;
}
/// @notice method which checks if the token supports blacklisting
function isBlacklistEnabled() public view returns (bool) {
return configProps._isBlacklistEnabled;
}
/// @notice method which checks if the token supports whitelisting
function isWhitelistEnabled() public view returns (bool) {
return configProps._isWhitelistEnabled;
}
/// @notice method which checks if the token supports max amount of tokens per wallet
function isMaxAmountOfTokensSet() public view returns (bool) {
return configProps._isMaxAmountOfTokensSet;
}
/// @notice method which checks if the token supports documentUris
function isDocumentUriAllowed() public view returns (bool) {
return configProps._isDocumentAllowed;
}
/// @notice method which checks if the token supports force transfers
function isForceTransferAllowed() public view returns (bool) {
return configProps._isForceTransferAllowed;
}
/// @notice method which returns the number of decimals for the token
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
/// @notice method which checks if the token is taxable
function isTaxable() public view returns (bool) {
return configProps._isTaxable;
}
/// @notice method which checks if the token is deflationary
function isDeflationary() public view returns (bool) {
return configProps._isDeflationary;
}
/**
* @notice which returns an array of all the whitelisted addresses
* @return whitelistedAddresses array of all the whitelisted addresses
*/
function getWhitelistedAddresses() external view returns (address[] memory) {
return whitelistedAddresses;
}
/**
* @notice method which allows the owner to set a documentUri
* @param newDocumentUri - the new documentUri
* @dev only callable by the owner
*/
function setDocumentUri(
string memory newDocumentUri
) external onlyOwner whenNotPaused {
if (!isDocumentUriAllowed()) {
revert DocumentUriNotAllowed();
}
documentUri = newDocumentUri;
emit DocumentUriSet(newDocumentUri);
}
/**
* @notice method which allows the owner to set a max amount of tokens per wallet
* @param newMaxTokenAmount - the new max amount of tokens per wallet
* @dev only callable by the owner
*/
function setMaxTokenAmountPerAddress(
uint256 newMaxTokenAmount
) external onlyOwner whenNotPaused {
if (!isMaxAmountOfTokensSet()) {
revert MaxTokenAmountNotAllowed();
}
if (newMaxTokenAmount <= maxTokenAmountPerAddress) {
revert MaxTokenAmountPerAddrLtPrevious();
}
maxTokenAmountPerAddress = newMaxTokenAmount;
emit MaxTokenAmountPerSet(newMaxTokenAmount);
}
/**
* @notice method which allows the owner to blacklist an address
* @param addr - the address to blacklist
* @dev only callable by the owner
* @dev only callable if the token is not paused
* @dev only callable if the token supports blacklisting
* @dev only callable if the address is not already blacklisted
* @dev only callable if the address is not whitelisted
*/
function blackList(address addr) external onlyOwner whenNotPaused {
LibCommon.validateAddress(addr);
if (!isBlacklistEnabled()) {
revert BlacklistNotEnabled();
}
if (_isBlacklisted[addr]) {
revert AddrAlreadyBlacklisted(addr);
}
if (isWhitelistEnabled() && whitelist[addr]) {
revert CannotBlacklistWhitelistedAddr(addr);
}
_isBlacklisted[addr] = true;
emit UserBlacklisted(addr);
}
/**
* @notice method which allows the owner to unblacklist an address
* @param addr - the address to unblacklist
* @dev only callable by the owner
* @dev only callable if the token is not paused
* @dev only callable if the token supports blacklisting
* @dev only callable if the address is blacklisted
*/
function removeFromBlacklist(address addr) external onlyOwner whenNotPaused {
LibCommon.validateAddress(addr);
if (!isBlacklistEnabled()) {
revert BlacklistNotEnabled();
}
if (!_isBlacklisted[addr]) {
revert AddrAlreadyUnblacklisted(addr);
}
delete _isBlacklisted[addr];
emit UserUnBlacklisted(addr);
}
/**
* @notice method which allows the owner to set the tax config
* @param _taxAddress - the new taxAddress
* @param _taxBPS - the new taxBPS
*/
function setTaxConfig(
address _taxAddress,
uint256 _taxBPS
) external onlyOwner whenNotPaused {
if (!isTaxable()) {
revert TokenIsNotTaxable();
}
if (_taxBPS > MAX_ALLOWED_BPS) {
revert InvalidTaxBPS(_taxBPS);
}
LibCommon.validateAddress(_taxAddress);
taxAddress = _taxAddress;
taxBPS = _taxBPS;
emit TaxConfigSet(_taxAddress, _taxBPS);
}
/**
* @notice method which allows the owner to set the deflation config
* @param _deflationBPS - the new deflationBPS
*/
function setDeflationConfig(
uint256 _deflationBPS
) external onlyOwner whenNotPaused {
if (!isDeflationary()) {
revert TokenIsNotDeflationary();
}
if (_deflationBPS > MAX_ALLOWED_BPS) {
revert InvalidDeflationBPS(_deflationBPS);
}
deflationBPS = _deflationBPS;
emit DeflationConfigSet(_deflationBPS);
}
/**
* @notice method which allows to transfer a predefined amount of tokens to a predefined address
* @param to - the address to transfer the tokens to
* @param amount - the amount of tokens to transfer
* @return true if the transfer was successful
* @dev only callable if the token is not paused
* @dev only callable if the balance of the receiver is lower than the max amount of tokens per wallet
* @dev checks if blacklisting is enabled and if the sender and receiver are not blacklisted
* @dev checks if whitelisting is enabled and if the sender and receiver are whitelisted
* @dev captures the tax during the transfer if tax is enabvled
* @dev burns the deflationary amount during the transfer if deflation is enabled
*/
function transfer(
address to,
uint256 amount
)
public
virtual
override
whenNotPaused
validateTransfer(msg.sender, to)
returns (bool)
{
uint256 taxAmount = _taxAmount(msg.sender, amount);
uint256 deflationAmount = _deflationAmount(amount);
uint256 amountToTransfer = amount - taxAmount - deflationAmount;
if (isMaxAmountOfTokensSet()) {
if (balanceOf(to) + amountToTransfer > maxTokenAmountPerAddress) {
revert DestBalanceExceedsMaxAllowed(to);
}
}
if (taxAmount != 0) {
_transfer(msg.sender, taxAddress, taxAmount);
}
if (deflationAmount != 0) {
_burn(msg.sender, deflationAmount);
}
return super.transfer(to, amountToTransfer);
}
/**
* @notice method which allows to transfer a predefined amount of tokens from a predefined address to a predefined address
* @param from - the address to transfer the tokens from
* @param to - the address to transfer the tokens to
* @param amount - the amount of tokens to transfer
* @return true if the transfer was successful
* @dev only callable if the token is not paused
* @dev only callable if the balance of the receiver is lower than the max amount of tokens per wallet
* @dev checks if blacklisting is enabled and if the sender and receiver are not blacklisted
* @dev checks if whitelisting is enabled and if the sender and receiver are whitelisted
* @dev captures the tax during the transfer if tax is enabvled
* @dev burns the deflationary amount during the transfer if deflation is enabled
*/
function transferFrom(
address from,
address to,
uint256 amount
)
public
virtual
override
whenNotPaused
validateTransfer(from, to)
returns (bool)
{
uint256 taxAmount = _taxAmount(from, amount);
uint256 deflationAmount = _deflationAmount(amount);
uint256 amountToTransfer = amount - taxAmount - deflationAmount;
if (isMaxAmountOfTokensSet()) {
if (balanceOf(to) + amountToTransfer > maxTokenAmountPerAddress) {
revert DestBalanceExceedsMaxAllowed(to);
}
}
if (taxAmount != 0) {
_transfer(from, taxAddress, taxAmount);
}
if (deflationAmount != 0) {
_burn(from, deflationAmount);
}
if (isForceTransferAllowed() && owner() == msg.sender) {
_transfer(from, to, amountToTransfer);
return true;
} else {
return super.transferFrom(from, to, amountToTransfer);
}
}
/**
* @notice method which allows to mint a predefined amount of tokens to a predefined address
* @param to - the address to mint the tokens to
* @param amount - the amount of tokens to mint
* @dev only callable by the owner
* @dev only callable if the token is not paused
* @dev only callable if the token supports additional minting
* @dev only callable if the balance of the receiver is lower than the max amount of tokens per wallet
* @dev checks if blacklisting is enabled and if the receiver is not blacklisted
* @dev checks if whitelisting is enabled and if the receiver is whitelisted
*/
function mint(address to, uint256 amount) external onlyOwner whenNotPaused {
if (!isMintable()) {
revert MintingNotEnabled();
}
if (isMaxAmountOfTokensSet()) {
if (balanceOf(to) + amount > maxTokenAmountPerAddress) {
revert DestBalanceExceedsMaxAllowed(to);
}
}
if (isBlacklistEnabled()) {
if (_isBlacklisted[to]) {
revert RecipientBlacklisted(to);
}
}
if (isWhitelistEnabled()) {
if (!whitelist[to]) {
revert RecipientNotWhitelisted(to);
}
}
super._mint(to, amount);
}
/**
* @notice method which allows to burn a predefined amount of tokens
* @param amount - the amount of tokens to burn
* @dev only callable by the owner
* @dev only callable if the token is not paused
* @dev only callable if the token supports burning
*/
function burn(uint256 amount) public override onlyOwner whenNotPaused {
if (!isBurnable()) {
revert BurningNotEnabled();
}
super.burn(amount);
}
/**
* @notice method which allows to burn a predefined amount of tokens from a predefined address
* @param from - the address to burn the tokens from
* @param amount - the amount of tokens to burn
* @dev only callable by the owner
* @dev only callable if the token is not paused
* @dev only callable if the token supports burning
*/
function burnFrom(
address from,
uint256 amount
) public override onlyOwner whenNotPaused {
if (!isBurnable()) {
revert BurningNotEnabled();
}
super.burnFrom(from, amount);
}
/**
* @notice method which allows to pause the token
* @dev only callable by the owner
*/
function pause() external onlyOwner {
if (!isPausable()) {
revert PausingNotEnabled();
}
_pause();
}
/**
* @notice method which allows to unpause the token
* @dev only callable by the owner
*/
function unpause() external onlyOwner {
if (!isPausable()) {
revert PausingNotEnabled();
}
_unpause();
}
/**
* @notice method which allows to removing the owner of the token
* @dev methods which are only callable by the owner will not be callable anymore
* @dev only callable by the owner
* @dev only callable if the token is not paused
*/
function renounceOwnership() public override onlyOwner whenNotPaused {
super.renounceOwnership();
}
/**
* @notice method which allows to transfer the ownership of the token
* @param newOwner - the address of the new owner
* @dev only callable by the owner
* @dev only callable if the token is not paused
*/
function transferOwnership(
address newOwner
) public override onlyOwner whenNotPaused {
super.transferOwnership(newOwner);
}
/**
* @notice method which allows to update the whitelist of the token
* @param updatedAddresses - the new set of addresses
* @dev only callable by the owner
* @dev only callable if the token supports whitelisting
*/
function updateWhitelist(
address[] calldata updatedAddresses
) external onlyOwner whenNotPaused {
if (!isWhitelistEnabled()) {
revert WhitelistNotEnabled();
}
_clearWhitelist();
_addManyToWhitelist(updatedAddresses);
whitelistedAddresses = updatedAddresses;
emit UsersWhitelisted(updatedAddresses);
}
/**
* @notice method which allows for adding a new set of addresses to the whitelist
* @param addresses - the addresses to add to the whitelist
* @dev called internally by the contract
* @dev only callable if any of the addresses are not already whitelisted
*/
function _addManyToWhitelist(address[] calldata addresses) private {
for (uint256 i; i < addresses.length; ) {
LibCommon.validateAddress(addresses[i]);
if (configProps._isBlacklistEnabled && _isBlacklisted[addresses[i]]) {
revert CannotWhitelistBlacklistedAddr(addresses[i]);
}
whitelist[addresses[i]] = true;
unchecked {
++i;
}
}
}
/**
* @notice method which allows for removing a set of addresses from the whitelist
*/
function _clearWhitelist() private {
unchecked {
address[] memory addresses = whitelistedAddresses;
for (uint256 i; i < addresses.length; i++) {
delete whitelist[addresses[i]];
}
}
}
/**
* @notice method which returns the amount of tokens to be taxed during a transfer
* @param sender - the address of the originating account
* @param amount - the total amount of tokens sent in the transfer
* @dev if the tax address is the same as the originating account performing the transfer, no tax is applied
*/
function _taxAmount(
address sender,
uint256 amount
) internal view returns (uint256 taxAmount) {
taxAmount = 0;
if (taxBPS != 0 && sender != taxAddress) {
taxAmount = (amount * taxBPS) / MAX_BPS_AMOUNT;
}
}
/**
* @notice method which returns the amount of tokens to be burned during a transfer
* @param amount - the total amount of tokens sent in the transfer
*/
function _deflationAmount(
uint256 amount
) internal view returns (uint256 deflationAmount) {
deflationAmount = 0;
if (deflationBPS != 0) {
deflationAmount = (amount * deflationBPS) / MAX_BPS_AMOUNT;
}
}
}
ERC20.sol 365 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* 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 default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, 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) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, 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) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC20Burnable.sol 39 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
}
ERC20Pausable.sol 35 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../security/Pausable.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*
* IMPORTANT: This contract does not include public pause and unpause functions. In
* addition to inheriting this contract, you must define both functions, invoking the
* {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate
* access control, e.g. using {AccessControl} or {Ownable}. Not doing so will
* make the contract unpausable.
*/
abstract contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}
Pausable.sol 105 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
LibCommon.sol 118 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
library LibCommon {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev The address is the zero address.
error ZeroAddress();
/// @notice raised when an ERC20 transfer fails
error TransferFailed();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ETH OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @notice Taken from Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Sends `amount` (in wei) ETH to `to`.
/// Reverts upon failure.
function safeTransferETH(address to, uint256 amount) internal {
// solhint-disable-next-line no-inline-assembly
assembly {
// Transfer the ETH and check if it succeeded or not.
if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {
// Store the function selector of `ETHTransferFailed()`.
// bytes4(keccak256(bytes("ETHTransferFailed()"))) = 0xb12d13eb
mstore(0x00, 0xb12d13eb)
// Revert with (offset, size).
revert(0x1c, 0x04)
}
}
}
/// @notice Validates that the address is not the zero address using assembly.
/// @dev Reverts if the address is the zero address.
function validateAddress(address addr) internal pure {
// solhint-disable-next-line no-inline-assembly
assembly {
if iszero(shl(96, addr)) {
// Store the function selector of `ZeroAddress()`.
// bytes4(keccak256(bytes("ZeroAddress()"))) = 0xd92e233d
mstore(0x00, 0xd92e233d)
// Revert with (offset, size).
revert(0x1c, 0x04)
}
}
}
/// @notice Helper function to transfer ERC20 tokens without the need for SafeERC20.
/// @dev Reverts if the ERC20 transfer fails.
/// @param tokenAddress The address of the ERC20 token.
/// @param from The address to transfer the tokens from.
/// @param to The address to transfer the tokens to.
/// @param amount The amount of tokens to transfer.
function safeTransferFrom(
address tokenAddress,
address from,
address to,
uint256 amount
) internal returns (bool) {
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory data) = tokenAddress.call(
abi.encodeWithSignature(
"transferFrom(address,address,uint256)",
from,
to,
amount
)
);
if (!success) {
if (data.length != 0) {
// bubble up error
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(data)
revert(add(32, data), returndata_size)
}
} else {
revert TransferFailed();
}
}
return true;
}
/// @notice Helper function to transfer ERC20 tokens without the need for SafeERC20.
/// @dev Reverts if the ERC20 transfer fails.
/// @param tokenAddress The address of the ERC20 token.
/// @param to The address to transfer the tokens to.
/// @param amount The amount of tokens to transfer.
function safeTransfer(
address tokenAddress,
address to,
uint256 amount
) internal returns (bool) {
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory data) = tokenAddress.call(
abi.encodeWithSignature("transfer(address,uint256)", to, amount)
);
if (!success) {
if (data.length != 0) {
// bubble up error
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(data)
revert(add(32, data), returndata_size)
}
} else {
revert TransferFailed();
}
}
return true;
}
}
Read Contract
CONTRACT_HASH 0xbfcf7355 → bytes32
CONTRACT_NAME 0x614d08f8 → string
VERSION 0xffa1ad74 → string
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
deflationBPS 0x542e9667 → uint256
documentUri 0x044ab74e → string
getWhitelistedAddresses 0x6d028027 → address[]
initialDocumentUri 0xa9d86685 → string
initialMaxTokenAmountPerAddress 0xa32f6976 → uint256
initialSupply 0x378dc3dc → uint256
initialTokenOwner 0x8dac7191 → address
isBlacklistEnabled 0x878dd332 → bool
isBurnable 0x883356d9 → bool
isDeflationary 0x8e8c10a2 → bool
isDocumentUriAllowed 0xf820f567 → bool
isForceTransferAllowed 0x6c5adaae → bool
isMaxAmountOfTokensSet 0x5a3990ce → bool
isMintable 0x46b45af7 → bool
isPausable 0xa09a1601 → bool
isTaxable 0x4ac0bc32 → bool
isWhitelistEnabled 0x184d69ab → bool
maxTokenAmountPerAddress 0xd48e4127 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
symbol 0x95d89b41 → string
taxAddress 0xb7bda68f → address
taxBPS 0x2fa782eb → uint256
totalSupply 0x18160ddd → uint256
whitelist 0x9b19251a → bool
whitelistedAddresses 0xba4e5c49 → address
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
blackList 0x4838d165
address addr
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address from
uint256 amount
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address to
uint256 amount
pause 0x8456cb59
No parameters
removeFromBlacklist 0x537df3b6
address addr
renounceOwnership 0x715018a6
No parameters
setDeflationConfig 0xd8f67851
uint256 _deflationBPS
setDocumentUri 0xa476df61
string newDocumentUri
setMaxTokenAmountPerAddress 0x02252c4d
uint256 newMaxTokenAmount
setTaxConfig 0xf19c4e3b
address _taxAddress
uint256 _taxBPS
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateWhitelist 0x35377214
address[] updatedAddresses
Recent Transactions
No transactions found for this address