Address Contract Verified
Address
0x59f474b77F6036cE9B2e6C12b5e85D99D71F389B
Balance
0.001124 ETH
Nonce
1
Code Size
9135 bytes
Creator
0x995f3b12...f801 at tx 0xa100db0c...d0e9d2
Indexed Transactions
0
Contract Bytecode
9135 bytes
0x6080604052600436106102765760003560e01c806374baa1311161014f578063a6f2ae3a116100c1578063ec37d2591161007a578063ec37d25914610725578063f0dda65c14610745578063f0f4426014610765578063f2fde38b14610785578063f8b2cb4f146107a5578063f952fcad146107c557600080fd5b8063a6f2ae3a14610691578063a9059cbb14610699578063b47dbf22146106b9578063c2507ac1146106cf578063d5abeb01146106ef578063dd62ed3e1461070557600080fd5b80638da5cb5b116101135780638da5cb5b146105d45780638fc7a25d146105f75780639358928b1461061757806395d89b411461062c5780639b19251a14610641578063a457c2d71461067157600080fd5b806374baa1311461055357806379cc6790146105735780637dbcccfb146105935780637ff9b596146105a95780638456cb59146105bf57600080fd5b80635b46900c116101e857806367320dbb116101ac57806367320dbb146104955780636a61e5fc146104b55780636f8b44b0146104d55780636f9fb98a146104f557806370a0823114610508578063715018a61461053e57600080fd5b80635b46900c146103ef5780635b9792741461040f5780635c975abb1461042557806361d027b31461043d5780636402cdc31461047557600080fd5b80631b9a91a41161023a5780631b9a91a41461033e57806323b872dd1461035e578063313ce5671461037e578063395093511461039a5780633f4ba83a146103ba57806342966c68146103cf57600080fd5b806306fdde031461028a578063095ea7b3146102b55780630c424284146102e557806314b5e9811461030557806318160ddd1461032957600080fd5b36610285576102836107db565b005b600080fd5b34801561029657600080fd5b5061029f610b73565b6040516102ac9190611fdc565b60405180910390f35b3480156102c157600080fd5b506102d56102d036600461203f565b610c05565b60405190151581526020016102ac565b3480156102f157600080fd5b5061028361030036600461206b565b610c1f565b34801561031157600080fd5b5061031b60105481565b6040519081526020016102ac565b34801561033557600080fd5b5060025461031b565b34801561034a57600080fd5b5061028361035936600461203f565b610c87565b34801561036a57600080fd5b506102d56103793660046120a9565b610e1f565b34801561038a57600080fd5b50604051601281526020016102ac565b3480156103a657600080fd5b506102d56103b536600461203f565b610e90565b3480156103c657600080fd5b50610283610eb2565b3480156103db57600080fd5b506102836103ea3660046120ea565b610ec2565b3480156103fb57600080fd5b5061031b61040a366004612103565b610f13565b34801561041b57600080fd5b5061031b600a5481565b34801561043157600080fd5b5060065460ff166102d5565b34801561044957600080fd5b50600f5461045d906001600160a01b031681565b6040516001600160a01b0390911681526020016102ac565b34801561048157600080fd5b506102836104903660046120ea565b610f83565b3480156104a157600080fd5b506102836104b0366004612120565b61101b565b3480156104c157600080fd5b506102836104d03660046120ea565b6111a5565b3480156104e157600080fd5b506102836104f03660046120ea565b61123b565b34801561050157600080fd5b504761031b565b34801561051457600080fd5b5061031b610523366004612103565b6001600160a01b031660009081526020819052604090205490565b34801561054a57600080fd5b506102836112f9565b34801561055f57600080fd5b5061028361056e3660046120ea565b61130b565b34801561057f57600080fd5b5061028361058e36600461203f565b611351565b34801561059f57600080fd5b5061031b600e5481565b3480156105b557600080fd5b5061031b60075481565b3480156105cb57600080fd5b506102836113a6565b3480156105e057600080fd5b5060065461010090046001600160a01b031661045d565b34801561060357600080fd5b5061031b6106123660046120ea565b6113b6565b34801561062357600080fd5b5060125461031b565b34801561063857600080fd5b5061029f6113d5565b34801561064d57600080fd5b506102d561065c366004612103565b600c6020526000908152604090205460ff1681565b34801561067d57600080fd5b506102d561068c36600461203f565b6113e4565b6102836107db565b3480156106a557600080fd5b506102d56106b436600461203f565b61146a565b3480156106c557600080fd5b5061031b60095481565b3480156106db57600080fd5b5061031b6106ea3660046120ea565b6114d9565b3480156106fb57600080fd5b5061031b60115481565b34801561071157600080fd5b5061031b61072036600461214c565b6114fe565b34801561073157600080fd5b5061031b610740366004612103565b611529565b34801561075157600080fd5b5061028361076036600461203f565b6115aa565b34801561077157600080fd5b50610283610780366004612103565b6116bb565b34801561079157600080fd5b506102836107a0366004612103565b61176b565b3480156107b157600080fd5b5061031b6107c0366004612103565b6117e4565b3480156107d157600080fd5b5061031b60085481565b6107e3611802565b6107eb61185b565b600034116108405760405162461bcd60e51b815260206004820152601b60248201527f4d7573742073656e642045544820746f2062757920746f6b656e73000000000060448201526064015b60405180910390fd5b600e54336000908152600d602052604090205461085c916118a1565b4211806108785750336000908152600c602052604090205460ff165b6108c45760405162461bcd60e51b815260206004820181905260248201527f507572636861736520746f6f20736f6f6e206166746572206c617374206f6e656044820152606401610837565b60006108ef6007546108e96108d7601290565b6108e290600a612274565b34906118ad565b906118b9565b90506009548110156109435760405162461bcd60e51b815260206004820152601d60248201527f50757263686173652062656c6f77206d696e696d756d20616d6f756e740000006044820152606401610837565b6008548111156109955760405162461bcd60e51b815260206004820152601f60248201527f50757263686173652065786365656473206d6178696d756d20616d6f756e74006044820152606401610837565b60006109a46201518042612283565b336000908152600b60209081526040808320848452909152812054919250906109cd90846118a1565b9050600a54811115806109ef5750336000908152600c602052604090205460ff165b610a3b5760405162461bcd60e51b815260206004820152601d60248201527f4461696c79207075726368617365206c696d69742065786365656465640000006044820152606401610837565b601154601254610a4b90856118a1565b1115610a995760405162461bcd60e51b815260206004820152601b60248201527f576f756c6420657863656564206d6178696d756d20737570706c7900000000006044820152606401610837565b336000818152600b602090815260408083208684528252808320859055928252600d9052908120429055601054610ad990612710906108e99087906118ad565b90506000610ae785836118c5565b9050610af333826118d1565b8115610b0f57600f54610b0f906001600160a01b0316836118d1565b601254610b1c90866118a1565b601255604080513481526020810183905290810183905233907f0d1a0d5e3d583a0e92588799dd06e50fd78c07daf05f0cc06d7b848b1ca445f19060600160405180910390a25050505050610b716001600555565b565b606060038054610b82906122a5565b80601f0160208091040260200160405190810160405280929190818152602001828054610bae906122a5565b8015610bfb5780601f10610bd057610100808354040283529160200191610bfb565b820191906000526020600020905b815481529060010190602001808311610bde57829003601f168201915b5050505050905090565b600033610c13818585611990565b60019150505b92915050565b610c27611ab4565b6001600160a01b0382166000818152600c6020908152604091829020805460ff191685151590811790915591519182527faf367c7d20ce5b2ab6da56afd0c9c39b00ba995263c60292a3e1ee3781fd488591015b60405180910390a25050565b610c8f611ab4565b610c97611802565b6001600160a01b038216610ced5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f7420776974686472617720746f207a65726f2061646472657373006044820152606401610837565b47811115610d345760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610837565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610d81576040519150601f19603f3d011682016040523d82523d6000602084013e610d86565b606091505b5050905080610dcd5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610837565b826001600160a01b03167f8455ae6be5d92f1df1c3c1484388e247a36c7e60d72055ae216dbc258f257d4b83604051610e0891815260200190565b60405180910390a250610e1b6001600555565b5050565b60065460009061010090046001600160a01b03166001600160a01b0316336001600160a01b03161480610e615750336000908152600c602052604090205460ff165b610e7d5760405162461bcd60e51b8152600401610837906122df565b610e88848484611b14565b949350505050565b600033610c13818585610ea383836114fe565b610ead919061233c565b611990565b610eba611ab4565b610b71611b2d565b610ecb81611b7f565b601254610ed890826118c5565b60125560405181815233907ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb69060200160405180910390a250565b6001600160a01b0381166000908152600c602052604081205460ff1615610f3c57506000919050565b6001600160a01b0382166000908152600d6020526040812054600e54909190610f669083906118a1565b9050804210610f79575060009392505050565b610e8881426118c5565b610f8b611ab4565b6103e8811115610fd55760405162461bcd60e51b81526020600482015260156024820152744665652063616e6e6f74206578636565642031302560581b6044820152606401610837565b601080549082905560408051828152602081018490527f4b70c46ba38f1c90e434676782e78bddfbece3f6f8f0e9df8dfd3e149703edbf91015b60405180910390a15050565b611023611ab4565b600083116110845760405162461bcd60e51b815260206004820152602860248201527f4d696e696d756d20616d6f756e74206d7573742062652067726561746572207460448201526768616e207a65726f60c01b6064820152608401610837565b828210156110e85760405162461bcd60e51b815260206004820152602b60248201527f4d6178696d756d20616d6f756e74206d7573742062652067726561746572207460448201526a68616e206d696e696d756d60a81b6064820152608401610837565b818110156111505760405162461bcd60e51b815260206004820152602f60248201527f4461696c79206c696d6974206d7573742062652067726561746572207468616e60448201526e081b585e1a5b5d5b48185b5bdd5b9d608a1b6064820152608401610837565b60098390556008829055600a81905560408051848152602081018490529081018290527fd26920d0ed93395686157a07e1eb02c6e1aa34ec3a9a8d879db1750a7938dc189060600160405180910390a1505050565b6111ad611ab4565b600081116111fd5760405162461bcd60e51b815260206004820152601f60248201527f5072696365206d7573742062652067726561746572207468616e207a65726f006044820152606401610837565b600780549082905560408051828152602081018490527fd9cc159fa79112d02593601db522a6696e6c5c82d9e9ca9332f89ec824935bb0910161100f565b611243611ab4565b6012548110156112bb5760405162461bcd60e51b815260206004820152603d60248201527f4e6577206d617820737570706c792063616e6e6f74206265206c65737320746860448201527f616e2063757272656e742063697263756c6174696e6720737570706c790000006064820152608401610837565b601180549082905560408051828152602081018490527f44ecfc706d63e347851cfd40acfa6cf2e3a41faa3e8b460210c03938e84a91ad910161100f565b611301611ab4565b610b716000611b89565b611313611ab4565b600e80549082905560408051828152602081018490527f5230e177737051558c2fe276d241ca77d1d51404a14fe1a336ea71d0b306dbb0910161100f565b61135b8282611be3565b60125461136890826118c5565b6012556040518181526001600160a01b038316907ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb690602001610c7b565b6113ae611ab4565b610b71611bf8565b6000610c196113c76012600a612274565b6007546108e99085906118ad565b606060048054610b82906122a5565b600033816113f282866114fe565b9050838110156114525760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610837565b61145f8286868403611990565b506001949350505050565b60065460009061010090046001600160a01b03166001600160a01b0316336001600160a01b031614806114ac5750336000908152600c602052604090205460ff165b6114c85760405162461bcd60e51b8152600401610837906122df565b6114d28383611c35565b9392505050565b6000610c196007546108e96114ec601290565b6114f790600a612274565b85906118ad565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0381166000908152600c602052604081205460ff16156115535750600019919050565b60006115626201518042612283565b6001600160a01b0384166000908152600b60209081526040808320848452909152902054600a5491925090811061159d575060009392505050565b600a54610e8890826118c5565b6115b2611ab4565b6001600160a01b0382166116085760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f74206d696e7420746f207a65726f206164647265737300000000006044820152606401610837565b60115460125461161890836118a1565b11156116665760405162461bcd60e51b815260206004820152601b60248201527f576f756c6420657863656564206d6178696d756d20737570706c7900000000006044820152606401610837565b61167082826118d1565b60125461167d90826118a1565b6012556040518181526001600160a01b038316907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390602001610c7b565b6116c3611ab4565b6001600160a01b0381166117195760405162461bcd60e51b815260206004820152601f60248201527f54726561737572792063616e6e6f74206265207a65726f2061646472657373006044820152606401610837565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a90600090a35050565b611773611ab4565b6001600160a01b0381166117d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610837565b6117e181611b89565b50565b6001600160a01b038116600090815260208190526040812054610c19565b6002600554036118545760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610837565b6002600555565b60065460ff1615610b715760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610837565b60006114d2828461233c565b60006114d2828461234f565b60006114d28284612283565b60006114d28284612366565b6001600160a01b0382166119275760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610837565b8060026000828254611939919061233c565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0383166119f25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610837565b6001600160a01b038216611a535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610837565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6006546001600160a01b03610100909104163314610b715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610837565b600033611b22858285611c43565b61145f858585611cbd565b611b35611e61565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6117e13382611eaa565b600680546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611bee823383611c43565b610e1b8282611eaa565b611c0061185b565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611b623390565b600033610c13818585611cbd565b6000611c4f84846114fe565b90506000198114611cb75781811015611caa5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610837565b611cb78484848403611990565b50505050565b6001600160a01b038316611d215760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610837565b6001600160a01b038216611d835760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610837565b6001600160a01b03831660009081526020819052604090205481811015611dfb5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610837565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611cb7565b60065460ff16610b715760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610837565b6001600160a01b038216611f0a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610837565b6001600160a01b03821660009081526020819052604090205481811015611f7e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610837565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600060208083528351808285015260005b8181101561200957858101830151858201604001528201611fed565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b03811681146117e157600080fd5b6000806040838503121561205257600080fd5b823561205d8161202a565b946020939093013593505050565b6000806040838503121561207e57600080fd5b82356120898161202a565b91506020830135801515811461209e57600080fd5b809150509250929050565b6000806000606084860312156120be57600080fd5b83356120c98161202a565b925060208401356120d98161202a565b929592945050506040919091013590565b6000602082840312156120fc57600080fd5b5035919050565b60006020828403121561211557600080fd5b81356114d28161202a565b60008060006060848603121561213557600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561215f57600080fd5b823561216a8161202a565b9150602083013561209e8161202a565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156121cb5781600019048211156121b1576121b161217a565b808516156121be57918102915b93841c9390800290612195565b509250929050565b6000826121e257506001610c19565b816121ef57506000610c19565b8160018114612205576002811461220f5761222b565b6001915050610c19565b60ff8411156122205761222061217a565b50506001821b610c19565b5060208310610133831016604e8410600b841016171561224e575081810a610c19565b6122588383612190565b806000190482111561226c5761226c61217a565b029392505050565b60006114d260ff8416836121d3565b6000826122a057634e487b7160e01b600052601260045260246000fd5b500490565b600181811c908216806122b957607f821691505b6020821081036122d957634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526037908201527f4f6e6c79206f776e6572206f722077686974656c69737465642061646472657360408201527f7365732063616e207472616e7366657220746f6b656e73000000000000000000606082015260800190565b80820180821115610c1957610c1961217a565b8082028115828204841417610c1957610c1961217a565b81810381811115610c1957610c1961217a56fea26469706673582212200f66eac6afaeca725fae191ce3e13478fa9668a26e153bf20a27a8b293da189164736f6c63430008130033
Verified Source Code Full Match
Compiler: v0.8.19+commit.7dd6d404
EVM: paris
Optimization: Yes (200 runs)
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());
}
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
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);
}
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
SafeMath.sol 215 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
AuralToken.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title AuraL Token
* @dev An ERC20 token with advanced features including:
* - Buy-only mechanism (tokens can only be purchased, not transferred between users)
* - Anti-bot measures
* - Rate limiting
* - Whitelist functionality
* - Emergency pause
* - Owner controls
*/
contract AuralToken is ERC20, ERC20Burnable, ReentrancyGuard, Pausable, Ownable {
using SafeMath for uint256;
// Token price in wei per token (1 token = 0.0001 ETH by default)
uint256 public tokenPrice;
// Maximum tokens that can be purchased in a single transaction
uint256 public maxPurchaseAmount;
// Minimum tokens that can be purchased in a single transaction
uint256 public minPurchaseAmount;
// Rate limiting: maximum purchases per address per day
uint256 public maxDailyPurchases;
// Mapping to track purchases per address per day
mapping(address => mapping(uint256 => uint256)) private dailyPurchases;
// Whitelist for addresses allowed to purchase during restricted periods
mapping(address => bool) public whitelist;
// Mapping to track last purchase time per address (anti-bot)
mapping(address => uint256) private lastPurchaseTime;
// Minimum time between purchases (anti-bot)
uint256 public purchaseCooldown;
// Treasury address for collecting fees
address public treasury;
// Purchase fee percentage (in basis points, e.g., 100 = 1%)
uint256 public purchaseFee;
// Maximum supply cap
uint256 public maxSupply;
// Current circulating supply
uint256 private _circulatingSupply;
// Events
event TokensPurchased(address indexed buyer, uint256 ethAmount, uint256 tokenAmount, uint256 feeAmount);
event TokenPriceUpdated(uint256 oldPrice, uint256 newPrice);
event PurchaseLimitsUpdated(uint256 minAmount, uint256 maxAmount, uint256 dailyLimit);
event AddressWhitelisted(address indexed account, bool status);
event TreasuryUpdated(address indexed oldTreasury, address indexed newTreasury);
event PurchaseFeeUpdated(uint256 oldFee, uint256 newFee);
event PurchaseCooldownUpdated(uint256 oldCooldown, uint256 newCooldown);
event MaxSupplyUpdated(uint256 oldMaxSupply, uint256 newMaxSupply);
event TokensBurned(address indexed burner, uint256 amount);
event TokensMinted(address indexed to, uint256 amount);
event EthWithdrawn(address indexed to, uint256 amount);
/**
* @dev Constructor that initializes the token with name, symbol, and initial supply
* @param initialSupply The initial token supply to mint to the contract creator
* @param treasuryAddress The address to collect fees
*/
constructor(
uint256 initialSupply,
address treasuryAddress
) ERC20("AuraL", "AURA") {
require(treasuryAddress != address(0), "Treasury cannot be zero address");
// Mint initial supply to the contract creator
_mint(msg.sender, initialSupply);
_circulatingSupply = initialSupply;
// Set default token price (0.0001 ETH per token)
tokenPrice = 100000000000000; // 0.0001 ETH in wei
// Set default purchase limits
minPurchaseAmount = 10 * 10**decimals(); // 10 tokens minimum
maxPurchaseAmount = 200000 * 10**decimals(); // 200,000 tokens maximum
maxDailyPurchases = 500000 * 10**decimals(); // 500,000 tokens per day
// Set default anti-bot measures
purchaseCooldown = 1 minutes; // 1 minute between purchases
// Set default fee
purchaseFee = 200; // 2% fee (200 basis points)
// Set treasury
treasury = treasuryAddress;
// Set max supply (100 million tokens)
maxSupply = 100000000 * 10**decimals();
// Add contract creator to whitelist
whitelist[msg.sender] = true;
}
/**
* @dev Allows users to buy tokens by sending ETH to the contract
* Implements security measures including reentrancy protection and rate limiting
*/
function buy() public payable nonReentrant whenNotPaused {
require(msg.value > 0, "Must send ETH to buy tokens");
require(block.timestamp > lastPurchaseTime[msg.sender].add(purchaseCooldown) || whitelist[msg.sender], "Purchase too soon after last one");
// Calculate token amount based on ETH sent
uint256 tokenAmount = (msg.value.mul(10**decimals())).div(tokenPrice);
// Enforce purchase limits
require(tokenAmount >= minPurchaseAmount, "Purchase below minimum amount");
require(tokenAmount <= maxPurchaseAmount, "Purchase exceeds maximum amount");
// Enforce daily purchase limits
uint256 today = block.timestamp / 1 days;
uint256 userDailyTotal = dailyPurchases[msg.sender][today].add(tokenAmount);
require(userDailyTotal <= maxDailyPurchases || whitelist[msg.sender], "Daily purchase limit exceeded");
// Enforce max supply
require(_circulatingSupply.add(tokenAmount) <= maxSupply, "Would exceed maximum supply");
// Update tracking
dailyPurchases[msg.sender][today] = userDailyTotal;
lastPurchaseTime[msg.sender] = block.timestamp;
// Calculate fee
uint256 feeAmount = tokenAmount.mul(purchaseFee).div(10000);
uint256 userAmount = tokenAmount.sub(feeAmount);
// Mint tokens
_mint(msg.sender, userAmount);
if (feeAmount > 0) {
_mint(treasury, feeAmount);
}
// Update circulating supply
_circulatingSupply = _circulatingSupply.add(tokenAmount);
// Emit event
emit TokensPurchased(msg.sender, msg.value, userAmount, feeAmount);
}
/**
* @dev Fallback function to allow buying tokens by sending ETH directly to the contract
*/
receive() external payable {
buy();
}
/**
* @dev Overrides the transfer function to prevent transfers between users
* Only the contract owner can transfer tokens (for administrative purposes)
*/
function transfer(address to, uint256 amount) public override returns (bool) {
require(msg.sender == owner() || whitelist[msg.sender], "Only owner or whitelisted addresses can transfer tokens");
return super.transfer(to, amount);
}
/**
* @dev Overrides the transferFrom function to prevent transfers between users
* Only the contract owner can transfer tokens (for administrative purposes)
*/
function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
require(msg.sender == owner() || whitelist[msg.sender], "Only owner or whitelisted addresses can transfer tokens");
return super.transferFrom(from, to, amount);
}
/**
* @dev Override the burn function to update circulating supply
*/
function burn(uint256 amount) public override {
super.burn(amount);
_circulatingSupply = _circulatingSupply.sub(amount);
emit TokensBurned(msg.sender, amount);
}
/**
* @dev Override the burnFrom function to update circulating supply
*/
function burnFrom(address account, uint256 amount) public override {
super.burnFrom(account, amount);
_circulatingSupply = _circulatingSupply.sub(amount);
emit TokensBurned(account, amount);
}
/**
* @dev Allows the owner to mint additional tokens
* @param to The address to receive the tokens
* @param amount The amount of tokens to mint
*/
function mintTokens(address to, uint256 amount) external onlyOwner {
require(to != address(0), "Cannot mint to zero address");
require(_circulatingSupply.add(amount) <= maxSupply, "Would exceed maximum supply");
_mint(to, amount);
_circulatingSupply = _circulatingSupply.add(amount);
emit TokensMinted(to, amount);
}
/**
* @dev Allows the owner to update the token price
* @param newPrice The new price in wei per token
*/
function setTokenPrice(uint256 newPrice) external onlyOwner {
require(newPrice > 0, "Price must be greater than zero");
uint256 oldPrice = tokenPrice;
tokenPrice = newPrice;
emit TokenPriceUpdated(oldPrice, newPrice);
}
/**
* @dev Allows the owner to update purchase limits
* @param newMinAmount The new minimum purchase amount
* @param newMaxAmount The new maximum purchase amount
* @param newDailyLimit The new daily purchase limit
*/
function setPurchaseLimits(
uint256 newMinAmount,
uint256 newMaxAmount,
uint256 newDailyLimit
) external onlyOwner {
require(newMinAmount > 0, "Minimum amount must be greater than zero");
require(newMaxAmount >= newMinAmount, "Maximum amount must be greater than minimum");
require(newDailyLimit >= newMaxAmount, "Daily limit must be greater than maximum amount");
minPurchaseAmount = newMinAmount;
maxPurchaseAmount = newMaxAmount;
maxDailyPurchases = newDailyLimit;
emit PurchaseLimitsUpdated(newMinAmount, newMaxAmount, newDailyLimit);
}
/**
* @dev Allows the owner to update the purchase cooldown (anti-bot)
* @param newCooldown The new cooldown period in seconds
*/
function setPurchaseCooldown(uint256 newCooldown) external onlyOwner {
uint256 oldCooldown = purchaseCooldown;
purchaseCooldown = newCooldown;
emit PurchaseCooldownUpdated(oldCooldown, newCooldown);
}
/**
* @dev Allows the owner to update the purchase fee
* @param newFee The new fee in basis points (e.g., 100 = 1%)
*/
function setPurchaseFee(uint256 newFee) external onlyOwner {
require(newFee <= 1000, "Fee cannot exceed 10%");
uint256 oldFee = purchaseFee;
purchaseFee = newFee;
emit PurchaseFeeUpdated(oldFee, newFee);
}
/**
* @dev Allows the owner to update the treasury address
* @param newTreasury The new treasury address
*/
function setTreasury(address newTreasury) external onlyOwner {
require(newTreasury != address(0), "Treasury cannot be zero address");
address oldTreasury = treasury;
treasury = newTreasury;
emit TreasuryUpdated(oldTreasury, newTreasury);
}
/**
* @dev Allows the owner to update the maximum supply
* @param newMaxSupply The new maximum supply
*/
function setMaxSupply(uint256 newMaxSupply) external onlyOwner {
require(newMaxSupply >= _circulatingSupply, "New max supply cannot be less than current circulating supply");
uint256 oldMaxSupply = maxSupply;
maxSupply = newMaxSupply;
emit MaxSupplyUpdated(oldMaxSupply, newMaxSupply);
}
/**
* @dev Allows the owner to add or remove addresses from the whitelist
* @param account The address to update
* @param status Whether the address should be whitelisted
*/
function setWhitelistStatus(address account, bool status) external onlyOwner {
whitelist[account] = status;
emit AddressWhitelisted(account, status);
}
/**
* @dev Allows the owner to pause token purchases
*/
function pause() external onlyOwner {
_pause();
}
/**
* @dev Allows the owner to unpause token purchases
*/
function unpause() external onlyOwner {
_unpause();
}
/**
* @dev Allows the owner to withdraw ETH from the contract
* @param to The address to send ETH to
* @param amount The amount of ETH to withdraw
*/
function withdrawEth(address payable to, uint256 amount) external onlyOwner nonReentrant {
require(to != address(0), "Cannot withdraw to zero address");
require(amount <= address(this).balance, "Insufficient balance");
(bool success, ) = to.call{value: amount}("");
require(success, "ETH transfer failed");
emit EthWithdrawn(to, amount);
}
/**
* @dev Returns the token balance of an address
* @param account The address to check
* @return The token balance
*/
function getBalance(address account) external view returns (uint256) {
return balanceOf(account);
}
/**
* @dev Returns the current ETH balance of the contract
* @return The ETH balance
*/
function getContractBalance() external view returns (uint256) {
return address(this).balance;
}
/**
* @dev Returns the current circulating supply
* @return The circulating supply
*/
function circulatingSupply() external view returns (uint256) {
return _circulatingSupply;
}
/**
* @dev Returns the number of tokens that can be purchased with a given amount of ETH
* @param ethAmount The amount of ETH in wei
* @return The number of tokens (before fees)
*/
function getTokenAmount(uint256 ethAmount) external view returns (uint256) {
return (ethAmount.mul(10**decimals())).div(tokenPrice);
}
/**
* @dev Returns the amount of ETH needed to purchase a given number of tokens
* @param tokenAmount The number of tokens
* @return The amount of ETH in wei
*/
function getEthAmount(uint256 tokenAmount) external view returns (uint256) {
return (tokenAmount.mul(tokenPrice)).div(10**decimals());
}
/**
* @dev Returns the remaining daily purchase limit for an address
* @param account The address to check
* @return The remaining daily purchase limit
*/
function getRemainingDailyLimit(address account) external view returns (uint256) {
if (whitelist[account]) {
return type(uint256).max; // Whitelisted addresses have no limit
}
uint256 today = block.timestamp / 1 days;
uint256 used = dailyPurchases[account][today];
if (used >= maxDailyPurchases) {
return 0;
}
return maxDailyPurchases.sub(used);
}
/**
* @dev Returns the time remaining until the account can purchase again
* @param account The address to check
* @return The time remaining in seconds (0 if can purchase now)
*/
function getCooldownRemaining(address account) external view returns (uint256) {
if (whitelist[account]) {
return 0; // Whitelisted addresses have no cooldown
}
uint256 lastPurchase = lastPurchaseTime[account];
uint256 nextPurchaseTime = lastPurchase.add(purchaseCooldown);
if (block.timestamp >= nextPurchaseTime) {
return 0;
}
return nextPurchaseTime.sub(block.timestamp);
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
circulatingSupply 0x9358928b → uint256
decimals 0x313ce567 → uint8
getBalance 0xf8b2cb4f → uint256
getContractBalance 0x6f9fb98a → uint256
getCooldownRemaining 0x5b46900c → uint256
getEthAmount 0x8fc7a25d → uint256
getRemainingDailyLimit 0xec37d259 → uint256
getTokenAmount 0xc2507ac1 → uint256
maxDailyPurchases 0x5b979274 → uint256
maxPurchaseAmount 0xf952fcad → uint256
maxSupply 0xd5abeb01 → uint256
minPurchaseAmount 0xb47dbf22 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
purchaseCooldown 0x7dbcccfb → uint256
purchaseFee 0x14b5e981 → uint256
symbol 0x95d89b41 → string
tokenPrice 0x7ff9b596 → uint256
totalSupply 0x18160ddd → uint256
treasury 0x61d027b3 → address
whitelist 0x9b19251a → bool
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
buy 0xa6f2ae3a
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mintTokens 0xf0dda65c
address to
uint256 amount
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
No parameters
setMaxSupply 0x6f8b44b0
uint256 newMaxSupply
setPurchaseCooldown 0x74baa131
uint256 newCooldown
setPurchaseFee 0x6402cdc3
uint256 newFee
setPurchaseLimits 0x67320dbb
uint256 newMinAmount
uint256 newMaxAmount
uint256 newDailyLimit
setTokenPrice 0x6a61e5fc
uint256 newPrice
setTreasury 0xf0f44260
address newTreasury
setWhitelistStatus 0x0c424284
address account
bool status
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
withdrawEth 0x1b9a91a4
address to
uint256 amount
Recent Transactions
No transactions found for this address