Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xd204E1B61AA385b1F26105bb36Fd64b1973AFe4C
Balance 0 ETH
Nonce 1
Code Size 11113 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11113 bytes
0x608060405234801561001057600080fd5b506004361061032b5760003560e01c806370a08231116101b2578063a32f6976116100f9578063ba4e5c49116100a2578063dd62ed3e1161007c578063dd62ed3e146106be578063f19c4e3b146106f7578063f2fde38b1461070a578063f820f5671461071d57600080fd5b8063ba4e5c491461068f578063d48e4127146106a2578063d8f67851146106ab57600080fd5b8063a9059cbb116100d3578063a9059cbb1461065c578063a9d866851461066f578063b7bda68f1461067757600080fd5b8063a32f69761461060f578063a457c2d714610636578063a476df611461064957600080fd5b80638da5cb5b1161015b57806395d89b411161013557806395d89b41146105d35780639b19251a146105db578063a09a1601146105fe57600080fd5b80638da5cb5b1461056a5780638dac7191146105945780638e8c10a2146105bb57600080fd5b80638456cb591161018c5780638456cb5914610540578063878dd33214610548578063883356d91461055a57600080fd5b806370a08231146104fc578063715018a61461052557806379cc67901461052d57600080fd5b80633f4ba83a11610276578063537df3b61161021f5780635c975abb116101f95780635c975abb146104c65780636c5adaae146104d15780636d028027146104e757600080fd5b8063537df3b614610495578063542e9667146104a85780635a3990ce146104b157600080fd5b806346b45af71161025057806346b45af7146104605780634838d1651461046b5780634ac0bc321461047e57600080fd5b80633f4ba83a1461043257806340c10f191461043a57806342966c681461044d57600080fd5b806323b872dd116102d857806335377214116102b257806335377214146103e5578063378dc3dc146103f8578063395093511461041f57600080fd5b806323b872dd146103b45780632fa782eb146103c7578063313ce567146103d057600080fd5b8063095ea7b311610309578063095ea7b31461036b57806318160ddd1461038e578063184d69ab146103a057600080fd5b806302252c4d14610330578063044ab74e1461034557806306fdde0314610363575b600080fd5b61034361033e36600461293f565b610730565b005b61034d6107fd565b60405161035a91906129f1565b60405180910390f35b61034d61088b565b61037e6103793660046127ef565b61091d565b604051901515815260200161035a565b6002545b60405190815260200161035a565b600c5465010000000000900460ff1661037e565b61037e6103c23660046127b3565b610937565b610392600e5481565b600d5460405160ff909116815260200161035a565b6103436103f3366004612819565b610cab565b6103927f0000000000000000000000000000000000000000000000000000000005f5e10081565b61037e61042d3660046127ef565b610d5c565b610343610d9b565b6103436104483660046127ef565b610dd6565b61034361045b36600461293f565b610f4b565b600c5460ff1661037e565b610343610479366004612765565b610f8f565b600c5468010000000000000000900460ff1661037e565b6103436104a3366004612765565b6110f1565b610392600f5481565b600c546601000000000000900460ff1661037e565b60055460ff1661037e565b600c54670100000000000000900460ff1661037e565b6104ef6111da565b60405161035a91906129a4565b61039261050a366004612765565b6001600160a01b031660009081526020819052604090205490565b61034361123b565b61034361053b3660046127ef565b611253565b610343611295565b600c546301000000900460ff1661037e565b600c54610100900460ff1661037e565b60055461010090046001600160a01b03165b6040516001600160a01b03909116815260200161035a565b61057c7f000000000000000000000000c553fbe21704e6b28239a703c17d3acdafe81dcc81565b600c546901000000000000000000900460ff1661037e565b61034d6112ce565b61037e6105e9366004612765565b60076020526000908152604090205460ff1681565b600c5462010000900460ff1661037e565b6103927f000000000000000000000000000000000000000000000000000000000000000081565b61037e6106443660046127ef565b6112dd565b61034361065736600461288e565b611392565b61037e61066a3660046127ef565b611429565b61034d61174b565b600d5461057c9061010090046001600160a01b031681565b61057c61069d36600461293f565b611758565b610392600b5481565b6103436106b936600461293f565b611782565b6103926106cc366004612780565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6103436107053660046127ef565b61184d565b610343610718366004612765565b61195f565b600c54640100000000900460ff1661037e565b610738611ace565b610740611b2e565b600c546601000000000000900460ff16610786576040517f6273340f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b5481116107c1576040517fa43d2d7600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b8190556040518181527f2905481c6fd1a037492016c4760435a52203d82a6f34dc3de40f464c1bf42d59906020015b60405180910390a150565b600a805461080a90612ab6565b80601f016020809104026020016040519081016040528092919081815260200182805461083690612ab6565b80156108835780601f1061085857610100808354040283529160200191610883565b820191906000526020600020905b81548152906001019060200180831161086657829003601f168201915b505050505081565b60606003805461089a90612ab6565b80601f01602080910402602001604051908101604052809291908181526020018280546108c690612ab6565b80156109135780601f106108e857610100808354040283529160200191610913565b820191906000526020600020905b8154815290600101906020018083116108f657829003601f168201915b5050505050905090565b60003361092b818585611b81565b60019150505b92915050565b6000610941611b2e565b8383610959600c5460ff650100000000009091041690565b15610a62576001600160a01b03821660009081526007602052604090205460ff166109a75760405163bf3f938960e01b81526001600160a01b03831660048201526024015b60405180910390fd5b6001600160a01b03811660009081526007602052604090205460ff166109eb57604051632ac2e20360e21b81526001600160a01b038216600482015260240161099e565b6001600160a01b0382163314801590610a26575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b8015610a4257503360009081526007602052604090205460ff16155b15610a625760405163bf3f938960e01b815233600482015260240161099e565b600c546301000000900460ff1615610b74576001600160a01b03821660009081526006602052604090205460ff1615610ab95760405163578f3e1360e01b81526001600160a01b038316600482015260240161099e565b6001600160a01b03811660009081526006602052604090205460ff1615610afe576040516332e38af360e21b81526001600160a01b038216600482015260240161099e565b6001600160a01b0382163314801590610b39575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b8015610b5457503360009081526006602052604090205460ff165b15610b745760405163578f3e1360e01b815233600482015260240161099e565b6000610b808786611cd9565b90506000610b8d86611d28565b9050600081610b9c8489612a9f565b610ba69190612a9f565b600c549091506601000000000000900460ff1615610c1557600b5481610be18a6001600160a01b031660009081526020819052604090205490565b610beb9190612a46565b1115610c155760405163f6202a8f60e01b81526001600160a01b038916600482015260240161099e565b8215610c3857600d54610c38908a9061010090046001600160a01b031685611d57565b8115610c4857610c488983611f7b565b600c54670100000000000000900460ff168015610c7557506005546001600160a01b036101009091041633145b15610c9157610c85898983611d57565b60019550505050610ca2565b610c9c89898361210c565b95505050505b50509392505050565b610cb3611ace565b610cbb611b2e565b600c5465010000000000900460ff16610d00576040517f0b1b4e5500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d08612125565b610d1282826121d9565b610d1e6008838361264a565b507f6141feff42f24e29d1af3d91bffa3d40521e53485e9c92e358c4d946c0adbd388282604051610d50929190612958565b60405180910390a15050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061092b9082908690610d96908790612a46565b611b81565b610da3611ace565b600c5462010000900460ff16610dcc5760405163f00085b960e01b815260040160405180910390fd5b610dd4612337565b565b610dde611ace565b610de6611b2e565b600c5460ff16610e22576040517f3990ac6800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c546601000000000000900460ff1615610e8e57600b5481610e5a846001600160a01b031660009081526020819052604090205490565b610e649190612a46565b1115610e8e5760405163f6202a8f60e01b81526001600160a01b038316600482015260240161099e565b600c546301000000900460ff1615610ee5576001600160a01b03821660009081526006602052604090205460ff1615610ee5576040516332e38af360e21b81526001600160a01b038316600482015260240161099e565b600c5465010000000000900460ff1615610f3d576001600160a01b03821660009081526007602052604090205460ff16610f3d57604051632ac2e20360e21b81526001600160a01b038316600482015260240161099e565b610f478282612389565b5050565b610f53611ace565b610f5b611b2e565b600c54610100900460ff16610f8357604051636cb5913960e01b815260040160405180910390fd5b610f8c81612474565b50565b610f97611ace565b610f9f611b2e565b610fa881611978565b600c546301000000900460ff16610fd257604051633abeadc360e21b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615611030576040517f70b8fc840000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161099e565b600c5465010000000000900460ff16801561106357506001600160a01b03811660009081526007602052604090205460ff165b156110a5576040517febdacb5f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161099e565b6001600160a01b038116600081815260066020526040808220805460ff19166001179055517f7f8b7dc89dae85811a7a85800b892b5816ad5d381c856f1b56490f8fc470c9cb9190a250565b6110f9611ace565b611101611b2e565b61110a81611978565b600c546301000000900460ff1661113457604051633abeadc360e21b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff16611191576040517f3d7c1f4a0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161099e565b6001600160a01b038116600081815260066020526040808220805460ff19169055517f4ca5b343d678ca6f1f96e8c8a2115c41c2d40641fd872b928ba6f95d3648b9d19190a250565b6060600880548060200260200160405190810160405280929190818152602001828054801561091357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611214575050505050905090565b611243611ace565b61124b611b2e565b610dd461247e565b61125b611ace565b611263611b2e565b600c54610100900460ff1661128b57604051636cb5913960e01b815260040160405180910390fd5b610f478282612490565b61129d611ace565b600c5462010000900460ff166112c65760405163f00085b960e01b815260040160405180910390fd5b610dd46124a5565b60606004805461089a90612ab6565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091908381101561137a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161099e565b6113878286868403611b81565b506001949350505050565b61139a611ace565b6113a2611b2e565b600c54640100000000900460ff166113e6576040517f70a43fce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516113f990600a9060208401906126c5565b507f4456a0b562609d67398ddb488f136db285cd3c92343e0a7ba684925669237ade816040516107f291906129f1565b6000611433611b2e565b338361144b600c5460ff650100000000009091041690565b1561154f576001600160a01b03821660009081526007602052604090205460ff166114945760405163bf3f938960e01b81526001600160a01b038316600482015260240161099e565b6001600160a01b03811660009081526007602052604090205460ff166114d857604051632ac2e20360e21b81526001600160a01b038216600482015260240161099e565b6001600160a01b0382163314801590611513575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b801561152f57503360009081526007602052604090205460ff16155b1561154f5760405163bf3f938960e01b815233600482015260240161099e565b600c546301000000900460ff1615611661576001600160a01b03821660009081526006602052604090205460ff16156115a65760405163578f3e1360e01b81526001600160a01b038316600482015260240161099e565b6001600160a01b03811660009081526006602052604090205460ff16156115eb576040516332e38af360e21b81526001600160a01b038216600482015260240161099e565b6001600160a01b0382163314801590611626575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b801561164157503360009081526006602052604090205460ff165b156116615760405163578f3e1360e01b815233600482015260240161099e565b600061166d3386611cd9565b9050600061167a86611d28565b90506000816116898489612a9f565b6116939190612a9f565b600c549091506601000000000000900460ff161561170257600b54816116ce8a6001600160a01b031660009081526020819052604090205490565b6116d89190612a46565b11156117025760405163f6202a8f60e01b81526001600160a01b038916600482015260240161099e565b821561172557600d5461172590339061010090046001600160a01b031685611d57565b8115611735576117353383611f7b565b61173f88826124e2565b98975050505050505050565b6009805461080a90612ab6565b6008818154811061176857600080fd5b6000918252602090912001546001600160a01b0316905081565b61178a611ace565b611792611b2e565b600c546901000000000000000000900460ff166117db576040517fcd9e529800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61271081111561181a576040517fbb7465200000000000000000000000000000000000000000000000000000000081526004810182905260240161099e565b600f81905560405181907fc1ff65ee907dc079b64ed9913d53f4bd593bd6ebd9b2a2708db2916d49e17ec390600090a250565b611855611ace565b61185d611b2e565b600c5468010000000000000000900460ff166118a5576040517fc8a478a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127108111156118e4576040517fcb400e960000000000000000000000000000000000000000000000000000000081526004810182905260240161099e565b6118ed82611978565b600d80547fffffffffffffffffffffff0000000000000000000000000000000000000000ff166101006001600160a01b03851690810291909117909155600e8290556040518291907facc44e32fd5ca4240f6dbe6e8cf4eb49349c17c5ce5f80f1919a9c97b50d398a90600090a35050565b611967611ace565b61196f611b2e565b610f8c816119c3565b6001600160a01b038116610f8c576040517f4ef79e5a0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161099e565b6119cb611ace565b6001600160a01b038116611a475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161099e565b610f8c816124f0565b60055460ff1615611ac95760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e7366657220776860448201527f696c652070617573656400000000000000000000000000000000000000000000606482015260840161099e565b505050565b6005546001600160a01b03610100909104163314610dd45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161099e565b60055460ff1615610dd45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161099e565b6001600160a01b038316611bfc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161099e565b6001600160a01b038216611c785760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161099e565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000600e54600014158015611d015750600d546001600160a01b038481166101009092041614155b1561093157612710600e5483611d179190612a80565b611d219190612a5e565b9392505050565b6000600f54600014611d5257612710600f5483611d459190612a80565b611d4f9190612a5e565b90505b919050565b6001600160a01b038316611dd35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161099e565b6001600160a01b038216611e4f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161099e565b611e5a838383612561565b6001600160a01b03831660009081526020819052604090205481811015611ee95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161099e565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611f20908490612a46565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f6c91815260200190565b60405180910390a35b50505050565b6001600160a01b038216611ff75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161099e565b61200382600083612561565b6001600160a01b038216600090815260208190526040902054818110156120925760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161099e565b6001600160a01b03831660009081526020819052604081208383039055600280548492906120c1908490612a9f565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b60003361211a85828561256c565b611387858585611d57565b6000600880548060200260200160405190810160405280929190818152602001828054801561217d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161215f575b5050505050905060005b8151811015610f4757600760008383815181106121a6576121a6612b07565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169055600101612187565b60005b81811015611ac9576122138383838181106121f9576121f9612b07565b905060200201602081019061220e9190612765565b611978565b600c546301000000900460ff16801561227057506006600084848481811061223d5761223d612b07565b90506020020160208101906122529190612765565b6001600160a01b0316815260208101919091526040016000205460ff165b156122da5782828281811061228757612287612b07565b905060200201602081019061229c9190612765565b6040517f2cf5f7dd0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161099e565b6001600760008585858181106122f2576122f2612b07565b90506020020160208101906123079190612765565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556001016121dc565b61233f6125f8565b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166123df5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161099e565b6123eb60008383612561565b80600260008282546123fd9190612a46565b90915550506001600160a01b0382166000908152602081905260408120805483929061242a908490612a46565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b610f8c3382611f7b565b612486611ace565b610dd460006124f0565b61249b82338361256c565b610f478282611f7b565b6124ad611b2e565b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861236c3390565b60003361092b818585611d57565b600580546001600160a01b038381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611ac9838383611a50565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114611f7557818110156125eb5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161099e565b611f758484848403611b81565b60055460ff16610dd45760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161099e565b8280548282559060005260206000209081019282156126b5579160200282015b828111156126b55781547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384351617825560209092019160019091019061266a565b506126c1929150612739565b5090565b8280546126d190612ab6565b90600052602060002090601f0160209004810192826126f357600085556126b5565b82601f1061270c57805160ff19168380011785556126b5565b828001600101855582156126b5579182015b828111156126b557825182559160200191906001019061271e565b5b808211156126c1576000815560010161273a565b80356001600160a01b0381168114611d5257600080fd5b60006020828403121561277757600080fd5b611d218261274e565b6000806040838503121561279357600080fd5b61279c8361274e565b91506127aa6020840161274e565b90509250929050565b6000806000606084860312156127c857600080fd5b6127d18461274e565b92506127df6020850161274e565b9150604084013590509250925092565b6000806040838503121561280257600080fd5b61280b8361274e565b946020939093013593505050565b6000806020838503121561282c57600080fd5b823567ffffffffffffffff8082111561284457600080fd5b818501915085601f83011261285857600080fd5b81358181111561286757600080fd5b8660208260051b850101111561287c57600080fd5b60209290920196919550909350505050565b6000602082840312156128a057600080fd5b813567ffffffffffffffff808211156128b857600080fd5b818401915084601f8301126128cc57600080fd5b8135818111156128de576128de612b1d565b604051601f8201601f19908116603f0116810190838211818310171561290657612906612b1d565b8160405282815287602084870101111561291f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60006020828403121561295157600080fd5b5035919050565b60208082528181018390526000908460408401835b86811015612999576001600160a01b036129868461274e565b168252918301919083019060010161296d565b509695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156129e55783516001600160a01b0316835292840192918401916001016129c0565b50909695505050505050565b600060208083528351808285015260005b81811015612a1e57858101830151858201604001528201612a02565b81811115612a30576000604083870101525b50601f01601f1916929092016040019392505050565b60008219821115612a5957612a59612af1565b500190565b600082612a7b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612a9a57612a9a612af1565b500290565b600082821015612ab157612ab1612af1565b500390565b600181811c90821680612aca57607f821691505b60208210811415612aeb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220cca73cd197265d3ea8eef5a19ff84b15731406804994578f1128d7120dbe8bdc64736f6c63430008070033

Verified Source Code Full Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (1337 runs)
Helpers.sol 38 lines
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.7;

library Helpers {
  /// @notice raised when an address is zero
  error NonZeroAddress(address addr);
  /// @notice raised when payment fails
  error PaymentFailed(address to, uint256 amount);

  /**
   * @notice Helper function to check if an address is a zero address
   * @param addr - address to check
   */
  function validateAddress(address addr) internal pure {
    if (addr == address(0x0)) {
      revert NonZeroAddress(addr);
    }
  }

  /**
   * @notice method to pay a specific address with a specific amount
   * @dev inspired from https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol
   * @param to - the address to pay
   * @param amount - the amount to pay
   */
  function safeTransferETH(address to, uint256 amount) internal {
    bool success;
    // solhint-disable-next-line no-inline-assembly
    assembly {
      // Transfer the ETH and store if it succeeded or not.
      success := call(gas(), to, amount, 0, 0, 0, 0)
    }
    if (!success) {
      revert PaymentFailed(to, amount);
    }
  }
}
FullFeatureToken.sol 694 lines
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.7;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import { Helpers } from "./lib/Helpers.sol";

contract FullFeatureToken is ERC20, ERC20Burnable, ERC20Pausable, Ownable {
  uint256 private constant MAX_BPS_AMOUNT = 10_000;
  /// @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 _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_BPS_AMOUNT) {
        revert InvalidTaxBPS(_taxBPS);
      }
      Helpers.validateAddress(_taxAddress);
      taxAddress = _taxAddress;
      taxBPS = _taxBPS;
    }
    if (customConfigProps._isDeflationary) {
      if (_deflationBPS > MAX_BPS_AMOUNT) {
        revert InvalidDeflationBPS(_deflationBPS);
      }
      deflationBPS = _deflationBPS;
    }
    Helpers.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 {
    Helpers.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 {
    Helpers.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_BPS_AMOUNT) {
      revert InvalidTaxBPS(_taxBPS);
    }
    Helpers.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_BPS_AMOUNT) {
      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; ) {
      Helpers.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;
    }
  }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
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());
    }
}
ERC20.sol 383 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `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;
        }
        _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;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev 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 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}
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 33 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.
 */
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");
    }
}
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);
}

Read Contract

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