Address Contract Verified
Address
0x220e4201aA472262Df2C24Dd8069243cf4B76c12
Balance
0 ETH
Nonce
1
Code Size
11059 bytes
Creator
0x4904Ba31...a4bd at tx 0xacc64bef...6b5ba1
Indexed Transactions
0
Contract Bytecode
11059 bytes
0x608060405234801561001057600080fd5b506004361061032b5760003560e01c806370a08231116101b2578063a32f6976116100f9578063ba4e5c49116100a2578063dd62ed3e1161007c578063dd62ed3e146106d5578063f19c4e3b1461070e578063f2fde38b14610721578063f820f5671461073457600080fd5b8063ba4e5c49146106a6578063d48e4127146106b9578063d8f67851146106c257600080fd5b8063a9059cbb116100d3578063a9059cbb14610678578063a9d866851461068b578063b7bda68f1461069357600080fd5b8063a32f69761461062b578063a457c2d714610652578063a476df611461066557600080fd5b80638da5cb5b1161015b57806395d89b411161013557806395d89b41146105ef5780639b19251a146105f7578063a09a16011461061a57600080fd5b80638da5cb5b146105865780638dac7191146105b05780638e8c10a2146105d757600080fd5b80638456cb591161018c5780638456cb591461055c578063878dd33214610564578063883356d91461057657600080fd5b806370a0823114610518578063715018a61461054157806379cc67901461054957600080fd5b80633f4ba83a11610276578063537df3b61161021f5780635c975abb116101f95780635c975abb146104e25780636c5adaae146104ed5780636d0280271461050357600080fd5b8063537df3b6146104b1578063542e9667146104c45780635a3990ce146104cd57600080fd5b806346b45af71161025057806346b45af71461047c5780634838d165146104875780634ac0bc321461049a57600080fd5b80633f4ba83a1461044e57806340c10f191461045657806342966c681461046957600080fd5b806323b872dd116102d857806335377214116102b25780633537721414610401578063378dc3dc14610414578063395093511461043b57600080fd5b806323b872dd146103b45780632fa782eb146103c7578063313ce567146103d057600080fd5b8063095ea7b311610309578063095ea7b31461036b57806318160ddd1461038e578063184d69ab146103a057600080fd5b806302252c4d14610330578063044ab74e1461034557806306fdde0314610363575b600080fd5b61034361033e366004612623565b610747565b005b61034d610814565b60405161035a919061263c565b60405180910390f35b61034d6108a2565b61037e6103793660046126a1565b610934565b604051901515815260200161035a565b6002545b60405190815260200161035a565b600c5465010000000000900460ff1661037e565b61037e6103c23660046126cb565b61094e565b610392600e5481565b60405160ff7f000000000000000000000000000000000000000000000000000000000000000816815260200161035a565b61034361040f366004612707565b610cbd565b6103927f00000000000000000000000000000000000000000000000000000000069f6bc781565b61037e6104493660046126a1565b610d6e565b610343610dad565b6103436104643660046126a1565b610de8565b610343610477366004612623565b610f5d565b600c5460ff1661037e565b61034361049536600461277c565b610fa1565b600c5468010000000000000000900460ff1661037e565b6103436104bf36600461277c565b611103565b610392600f5481565b600c546601000000000000900460ff1661037e565b60055460ff1661037e565b600c54670100000000000000900460ff1661037e565b61050b6111ec565b60405161035a9190612797565b61039261052636600461277c565b6001600160a01b031660009081526020819052604090205490565b61034361124d565b6103436105573660046126a1565b611265565b6103436112a7565b600c546301000000900460ff1661037e565b600c54610100900460ff1661037e565b60055461010090046001600160a01b03165b6040516001600160a01b03909116815260200161035a565b6105987f000000000000000000000000d337dc138ac2b8a90e3e194df3139bb61093daf581565b600c546901000000000000000000900460ff1661037e565b61034d6112e0565b61037e61060536600461277c565b60076020526000908152604090205460ff1681565b600c5462010000900460ff1661037e565b6103927f000000000000000000000000000000000000000000000000000000000000000081565b61037e6106603660046126a1565b6112ef565b6103436106733660046127fa565b6113a4565b61037e6106863660046126a1565b611434565b61034d611751565b600d54610598906001600160a01b031681565b6105986106b4366004612623565b61175e565b610392600b5481565b6103436106d0366004612623565b611788565b6103926106e33660046128ab565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61034361071c3660046126a1565b611853565b61034361072f36600461277c565b611953565b600c54640100000000900460ff1661037e565b61074f611a8d565b610757611aed565b600c546601000000000000900460ff1661079d576040517f6273340f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b5481116107d8576040517fa43d2d7600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b8190556040518181527f2905481c6fd1a037492016c4760435a52203d82a6f34dc3de40f464c1bf42d59906020015b60405180910390a150565b600a8054610821906128de565b80601f016020809104026020016040519081016040528092919081815260200182805461084d906128de565b801561089a5780601f1061086f5761010080835404028352916020019161089a565b820191906000526020600020905b81548152906001019060200180831161087d57829003601f168201915b505050505081565b6060600380546108b1906128de565b80601f01602080910402602001604051908101604052809291908181526020018280546108dd906128de565b801561092a5780601f106108ff5761010080835404028352916020019161092a565b820191906000526020600020905b81548152906001019060200180831161090d57829003601f168201915b5050505050905090565b600033610942818585611b40565b60019150505b92915050565b6000610958611aed565b8383610970600c5460ff650100000000009091041690565b15610a79576001600160a01b03821660009081526007602052604090205460ff166109be5760405163bf3f938960e01b81526001600160a01b03831660048201526024015b60405180910390fd5b6001600160a01b03811660009081526007602052604090205460ff16610a0257604051632ac2e20360e21b81526001600160a01b03821660048201526024016109b5565b6001600160a01b0382163314801590610a3d575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b8015610a5957503360009081526007602052604090205460ff16155b15610a795760405163bf3f938960e01b81523360048201526024016109b5565b600c546301000000900460ff1615610b8b576001600160a01b03821660009081526006602052604090205460ff1615610ad05760405163578f3e1360e01b81526001600160a01b03831660048201526024016109b5565b6001600160a01b03811660009081526006602052604090205460ff1615610b15576040516332e38af360e21b81526001600160a01b03821660048201526024016109b5565b6001600160a01b0382163314801590610b50575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b8015610b6b57503360009081526006602052604090205460ff165b15610b8b5760405163578f3e1360e01b81523360048201526024016109b5565b6000610b978786611c98565b90506000610ba486611ce2565b9050600081610bb3848961292e565b610bbd919061292e565b600c549091506601000000000000900460ff1615610c2c57600b5481610bf88a6001600160a01b031660009081526020819052604090205490565b610c029190612941565b1115610c2c5760405163f6202a8f60e01b81526001600160a01b03891660048201526024016109b5565b8215610c4a57600d54610c4a908a906001600160a01b031685611d11565b8115610c5a57610c5a8983611f0b565b600c54670100000000000000900460ff168015610c8757506005546001600160a01b036101009091041633145b15610ca357610c97898983611d11565b60019550505050610cb4565b610cae898983612080565b95505050505b50509392505050565b610cc5611a8d565b610ccd611aed565b600c5465010000000000900460ff16610d12576040517f0b1b4e5500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d1a612099565b610d24828261214d565b610d306008838361259e565b507f6141feff42f24e29d1af3d91bffa3d40521e53485e9c92e358c4d946c0adbd388282604051610d62929190612954565b60405180910390a15050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091906109429082908690610da8908790612941565b611b40565b610db5611a8d565b600c5462010000900460ff16610dde5760405163f00085b960e01b815260040160405180910390fd5b610de66122ab565b565b610df0611a8d565b610df8611aed565b600c5460ff16610e34576040517f3990ac6800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c546601000000000000900460ff1615610ea057600b5481610e6c846001600160a01b031660009081526020819052604090205490565b610e769190612941565b1115610ea05760405163f6202a8f60e01b81526001600160a01b03831660048201526024016109b5565b600c546301000000900460ff1615610ef7576001600160a01b03821660009081526006602052604090205460ff1615610ef7576040516332e38af360e21b81526001600160a01b03831660048201526024016109b5565b600c5465010000000000900460ff1615610f4f576001600160a01b03821660009081526007602052604090205460ff16610f4f57604051632ac2e20360e21b81526001600160a01b03831660048201526024016109b5565b610f5982826122fd565b5050565b610f65611a8d565b610f6d611aed565b600c54610100900460ff16610f9557604051636cb5913960e01b815260040160405180910390fd5b610f9e816123c8565b50565b610fa9611a8d565b610fb1611aed565b610fba8161196c565b600c546301000000900460ff16610fe457604051633abeadc360e21b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615611042576040517f70b8fc840000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016109b5565b600c5465010000000000900460ff16801561107557506001600160a01b03811660009081526007602052604090205460ff165b156110b7576040517febdacb5f0000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016109b5565b6001600160a01b038116600081815260066020526040808220805460ff19166001179055517f7f8b7dc89dae85811a7a85800b892b5816ad5d381c856f1b56490f8fc470c9cb9190a250565b61110b611a8d565b611113611aed565b61111c8161196c565b600c546301000000900460ff1661114657604051633abeadc360e21b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff166111a3576040517f3d7c1f4a0000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016109b5565b6001600160a01b038116600081815260066020526040808220805460ff19169055517f4ca5b343d678ca6f1f96e8c8a2115c41c2d40641fd872b928ba6f95d3648b9d19190a250565b6060600880548060200260200160405190810160405280929190818152602001828054801561092a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611226575050505050905090565b611255611a8d565b61125d611aed565b610de66123d2565b61126d611a8d565b611275611aed565b600c54610100900460ff1661129d57604051636cb5913960e01b815260040160405180910390fd5b610f5982826123e4565b6112af611a8d565b600c5462010000900460ff166112d85760405163f00085b960e01b815260040160405180910390fd5b610de66123f9565b6060600480546108b1906128de565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091908381101561138c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016109b5565b6113998286868403611b40565b506001949350505050565b6113ac611a8d565b6113b4611aed565b600c54640100000000900460ff166113f8576040517f70a43fce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a61140482826129ee565b507f4456a0b562609d67398ddb488f136db285cd3c92343e0a7ba684925669237ade81604051610809919061263c565b600061143e611aed565b3383611456600c5460ff650100000000009091041690565b1561155a576001600160a01b03821660009081526007602052604090205460ff1661149f5760405163bf3f938960e01b81526001600160a01b03831660048201526024016109b5565b6001600160a01b03811660009081526007602052604090205460ff166114e357604051632ac2e20360e21b81526001600160a01b03821660048201526024016109b5565b6001600160a01b038216331480159061151e575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b801561153a57503360009081526007602052604090205460ff16155b1561155a5760405163bf3f938960e01b81523360048201526024016109b5565b600c546301000000900460ff161561166c576001600160a01b03821660009081526006602052604090205460ff16156115b15760405163578f3e1360e01b81526001600160a01b03831660048201526024016109b5565b6001600160a01b03811660009081526006602052604090205460ff16156115f6576040516332e38af360e21b81526001600160a01b03821660048201526024016109b5565b6001600160a01b0382163314801590611631575060055461010090046001600160a01b03166001600160a01b0316336001600160a01b031614155b801561164c57503360009081526006602052604090205460ff165b1561166c5760405163578f3e1360e01b81523360048201526024016109b5565b60006116783386611c98565b9050600061168586611ce2565b9050600081611694848961292e565b61169e919061292e565b600c549091506601000000000000900460ff161561170d57600b54816116d98a6001600160a01b031660009081526020819052604090205490565b6116e39190612941565b111561170d5760405163f6202a8f60e01b81526001600160a01b03891660048201526024016109b5565b821561172b57600d5461172b9033906001600160a01b031685611d11565b811561173b5761173b3383611f0b565b6117458882612436565b98975050505050505050565b60098054610821906128de565b6008818154811061176e57600080fd5b6000918252602090912001546001600160a01b0316905081565b611790611a8d565b611798611aed565b600c546901000000000000000000900460ff166117e1576040517fcd9e529800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611388811115611820576040517fbb746520000000000000000000000000000000000000000000000000000000008152600481018290526024016109b5565b600f81905560405181907fc1ff65ee907dc079b64ed9913d53f4bd593bd6ebd9b2a2708db2916d49e17ec390600090a250565b61185b611a8d565b611863611aed565b600c5468010000000000000000900460ff166118ab576040517fc8a478a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113888111156118ea576040517fcb400e96000000000000000000000000000000000000000000000000000000008152600481018290526024016109b5565b6118f38261196c565b600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416908117909155600e8290556040518291907facc44e32fd5ca4240f6dbe6e8cf4eb49349c17c5ce5f80f1919a9c97b50d398a90600090a35050565b61195b611a8d565b611963611aed565b610f9e81611982565b8060601b610f9e5763d92e233d6000526004601cfd5b61198a611a8d565b6001600160a01b038116611a065760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109b5565b610f9e81612444565b60055460ff1615611a885760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e7366657220776860448201527f696c65207061757365640000000000000000000000000000000000000000000060648201526084016109b5565b505050565b6005546001600160a01b03610100909104163314610de65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b5565b60055460ff1615610de65760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016109b5565b6001600160a01b038316611bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016109b5565b6001600160a01b038216611c375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016109b5565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000600e54600014158015611cbb5750600d546001600160a01b03848116911614155b1561094857612710600e5483611cd19190612aae565b611cdb9190612ac5565b9392505050565b6000600f54600014611d0c57612710600f5483611cff9190612aae565b611d099190612ac5565b90505b919050565b6001600160a01b038316611d8d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016109b5565b6001600160a01b038216611e095760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016109b5565b611e148383836124b5565b6001600160a01b03831660009081526020819052604090205481811015611ea35760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016109b5565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35b50505050565b6001600160a01b038216611f875760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016109b5565b611f93826000836124b5565b6001600160a01b038216600090815260208190526040902054818110156120225760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016109b5565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60003361208e8582856124c0565b611399858585611d11565b600060088054806020026020016040519081016040528092919081815260200182805480156120f157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120d3575b5050505050905060005b8151811015610f59576007600083838151811061211a5761211a612ae7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191690556001016120fb565b60005b81811015611a885761218783838381811061216d5761216d612ae7565b9050602002016020810190612182919061277c565b61196c565b600c546301000000900460ff1680156121e45750600660008484848181106121b1576121b1612ae7565b90506020020160208101906121c6919061277c565b6001600160a01b0316815260208101919091526040016000205460ff165b1561224e578282828181106121fb576121fb612ae7565b9050602002016020810190612210919061277c565b6040517f2cf5f7dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911660048201526024016109b5565b60016007600085858581811061226657612266612ae7565b905060200201602081019061227b919061277c565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055600101612150565b6122b361254c565b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166123535760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109b5565b61235f600083836124b5565b80600260008282546123719190612941565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b610f9e3382611f0b565b6123da611a8d565b610de66000612444565b6123ef8233836124c0565b610f598282611f0b565b612401611aed565b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122e03390565b600033610942818585611d11565b600580546001600160a01b038381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611a88838383611a0f565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114611f05578181101561253f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016109b5565b611f058484848403611b40565b60055460ff16610de65760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016109b5565b8280548282559060005260206000209081019282156125fe579160200282015b828111156125fe57815473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038435161782556020909201916001909101906125be565b5061260a92915061260e565b5090565b5b8082111561260a576000815560010161260f565b60006020828403121561263557600080fd5b5035919050565b600060208083528351808285015260005b818110156126695785810183015185820160400152820161264d565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114611d0c57600080fd5b600080604083850312156126b457600080fd5b6126bd8361268a565b946020939093013593505050565b6000806000606084860312156126e057600080fd5b6126e98461268a565b92506126f76020850161268a565b9150604084013590509250925092565b6000806020838503121561271a57600080fd5b823567ffffffffffffffff8082111561273257600080fd5b818501915085601f83011261274657600080fd5b81358181111561275557600080fd5b8660208260051b850101111561276a57600080fd5b60209290920196919550909350505050565b60006020828403121561278e57600080fd5b611cdb8261268a565b6020808252825182820181905260009190848201906040850190845b818110156127d85783516001600160a01b0316835292840192918401916001016127b3565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561280c57600080fd5b813567ffffffffffffffff8082111561282457600080fd5b818401915084601f83011261283857600080fd5b81358181111561284a5761284a6127e4565b604051601f8201601f19908116603f01168101908382118183101715612872576128726127e4565b8160405282815287602084870101111561288b57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600080604083850312156128be57600080fd5b6128c78361268a565b91506128d56020840161268a565b90509250929050565b600181811c908216806128f257607f821691505b60208210810361291257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094857610948612918565b8082018082111561094857610948612918565b60208082528181018390526000908460408401835b86811015612995576001600160a01b036129828461268a565b1682529183019190830190600101612969565b509695505050505050565b601f821115611a8857600081815260208120601f850160051c810160208610156129c75750805b601f850160051c820191505b818110156129e6578281556001016129d3565b505050505050565b815167ffffffffffffffff811115612a0857612a086127e4565b612a1c81612a1684546128de565b846129a0565b602080601f831160018114612a515760008415612a395750858301515b600019600386901b1c1916600185901b1785556129e6565b600085815260208120601f198616915b82811015612a8057888601518255948401946001909101908401612a61565b5085821015612a9e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761094857610948612918565b600082612ae257634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fdfea264697066735822122030d0fa8f27a883250c7a7bacf402c50c65a40c6ec96ccb650d9fc1a5f93ae6a064736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (1337 runs)
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;
}
}
FullFeatureToken.sol 686 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
/**
* Security notice: Refer to our product documentation for security advice
* around the configuration of our smart contracts https://docs.bitbond.com/
*/
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 FullFeatureToken is ERC20, ERC20Burnable, ERC20Pausable, Ownable {
uint256 private constant MAX_BPS_AMOUNT = 10_000;
uint256 private constant MAX_ALLOWED_BPS = 5_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 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;
}
}
}
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.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);
}
}
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 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);
}
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");
}
}
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