Address Contract Verified
Address
0x9F49034409ae6813d2c70aE5117fd23cDff2d190
Balance
0 ETH
Nonce
1
Code Size
10493 bytes
Creator
0x399E3086...dEf0 at tx 0xab20dab9...09e9cf
Last Active
Indexed Transactions
1 (24,460,527 → 24,460,527)
Gas Used (indexed)
46,371
Contract Bytecode
10493 bytes
0x60806040526004361061030c5760003560e01c8063751039fc1161019a578063c0246668116100e1578063ee40166e1161008a578063f5648a4f11610064578063f5648a4f14610912578063f8b45b0514610927578063fabb0b4f1461093d57600080fd5b8063ee40166e146108bc578063f0f44260146108d2578063f2fde38b146108f257600080fd5b8063d36e8239116100bb578063d36e823914610840578063dc3f0d0f14610856578063dd62ed3e1461087657600080fd5b8063c0246668146107ea578063cc274b291461080a578063cc2ffe7c1461082a57600080fd5b80639a7a23d611610143578063b62496f51161011d578063b62496f514610785578063b8eb3546146107b5578063bbc0c742146107cb57600080fd5b80639a7a23d614610725578063a457c2d714610745578063a9059cbb1461076557600080fd5b80638366e79a116101745780638366e79a146106d25780638da5cb5b146106f257806395d89b411461071057600080fd5b8063751039fc1461063c5780637571336a146106515780637f4e48491461067157600080fd5b8063467abe0a1161025e578063588813041161020757806370a08231116101e157806370a08231146105db57806370db69d614610611578063715018a61461062757600080fd5b8063588813041461057b5780635e83ae761461059b5780636ddd1713146105bb57600080fd5b80634a62bb65116102385780634a62bb651461052c57806351bc3c8514610546578063563df32f1461055b57600080fd5b8063467abe0a146104c257806347062402146104e257806349bd5a5e146104f857600080fd5b80631c499ab0116102c05780632b14ca561161029a5780632b14ca5614610470578063313ce5671461048657806339509351146104a257600080fd5b80631c499ab01461040e5780631d933a4a1461043057806323b872dd1461045057600080fd5b806310d5de53116102f157806310d5de53146103735780631694505e146103a357806318160ddd146103ef57600080fd5b806306fdde0314610318578063095ea7b31461034357600080fd5b3661031357005b600080fd5b34801561032457600080fd5b5061032d610953565b60405161033a919061259d565b60405180910390f35b34801561034f57600080fd5b5061036361035e366004612600565b6109e5565b604051901515815260200161033a565b34801561037f57600080fd5b5061036361038e36600461262c565b60136020526000908152604090205460ff1681565b3480156103af57600080fd5b506103d77f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b03909116815260200161033a565b3480156103fb57600080fd5b506002545b60405190815260200161033a565b34801561041a57600080fd5b5061042e610429366004612650565b6109ff565b005b34801561043c57600080fd5b5061042e61044b366004612650565b610b03565b34801561045c57600080fd5b5061036361046b366004612669565b610b64565b34801561047c57600080fd5b5061040060105481565b34801561049257600080fd5b506040516012815260200161033a565b3480156104ae57600080fd5b506103636104bd366004612600565b610b88565b3480156104ce57600080fd5b5061042e6104dd366004612650565b610bc7565b3480156104ee57600080fd5b50610400600f5481565b34801561050457600080fd5b506103d77f00000000000000000000000053105437195172ec1a65416cab9487ec109d23c681565b34801561053857600080fd5b50600e546103639060ff1681565b34801561055257600080fd5b5061042e610c25565b34801561056757600080fd5b50600b546103d7906001600160a01b031681565b34801561058757600080fd5b5061042e610596366004612650565b610c7d565b3480156105a757600080fd5b5061042e6105b63660046126b8565b610d75565b3480156105c757600080fd5b50600e546103639062010000900460ff1681565b3480156105e757600080fd5b506104006105f636600461262c565b6001600160a01b031660009081526020819052604090205490565b34801561061d57600080fd5b5061040060065481565b34801561063357600080fd5b5061042e610e73565b34801561064857600080fd5b5061042e610e87565b34801561065d57600080fd5b5061042e61066c3660046126d6565b610ec4565b34801561067d57600080fd5b50610686610fa3565b6040805198895260208901979097526001600160a01b039586169688019690965292151560608701529015156080860152151560a08501521660c083015260e08201526101000161033a565b3480156106de57600080fd5b506103636106ed36600461270f565b61100d565b3480156106fe57600080fd5b506005546001600160a01b03166103d7565b34801561071c57600080fd5b5061032d6111ed565b34801561073157600080fd5b5061042e6107403660046126d6565b6111fc565b34801561075157600080fd5b50610363610760366004612600565b6112a1565b34801561077157600080fd5b50610363610780366004612600565b611333565b34801561079157600080fd5b506103636107a036600461262c565b60146020526000908152604090205460ff1681565b3480156107c157600080fd5b5061040060075481565b3480156107d757600080fd5b50600e5461036390610100900460ff1681565b3480156107f657600080fd5b5061042e6108053660046126d6565b611341565b34801561081657600080fd5b5061042e610825366004612650565b6113a8565b34801561083657600080fd5b5061040060115481565b34801561084c57600080fd5b50610400600a5481565b34801561086257600080fd5b5061042e610871366004612650565b611429565b34801561088257600080fd5b5061040061089136600461270f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156108c857600080fd5b50610400600c5481565b3480156108de57600080fd5b5061042e6108ed36600461262c565b611521565b3480156108fe57600080fd5b5061042e61090d36600461262c565b6115d6565b34801561091e57600080fd5b5061042e61164c565b34801561093357600080fd5b5061040060085481565b34801561094957600080fd5b50610400600d5481565b6060600380546109629061273d565b80601f016020809104026020016040519081016040528092919081815260200182805461098e9061273d565b80156109db5780601f106109b0576101008083540402835291602001916109db565b820191906000526020600020905b8154815290600101906020018083116109be57829003601f168201915b5050505050905090565b6000336109f3818585611702565b60019150505b92915050565b610a07611826565b670de0b6b3a76400006103e8610a1c60025490565b610a2790600361278d565b610a3191906127a4565b610a3b91906127a4565b811015610ab55760405162461bcd60e51b815260206004820152602c60248201527f43616e6e6f7420736574206d61782077616c6c657420616d6f756e74206c6f7760448201527f6572207468616e20302e3325000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610ac781670de0b6b3a764000061278d565b60088190556040519081527f3046ad62de8b70d396246aaed19ff2559ff20df8706520cbde58320766c42762906020015b60405180910390a150565b610b0b611826565b60108190556028811115610b615760405162461bcd60e51b815260206004820152601960248201527f46656573206d7573742062652034302520206f72206c657373000000000000006044820152606401610aac565b50565b600033610b72858285611880565b610b7d85858561190c565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091906109f39082908690610bc29087906127c6565b611702565b610bcf611826565b600f8190556028811115610b615760405162461bcd60e51b815260206004820152601960248201527f46656573206d7573742062652034302520206f72206c657373000000000000006044820152606401610aac565b600b546001600160a01b0316336001600160a01b031614610c4557600080fd5b306000908152602081905260409020548015610b61576009805460ff19166001179055610c7061204e565b6009805460ff1916905550565b610c85611826565b670de0b6b3a76400006103e8610c9a60025490565b610ca590600161278d565b610caf91906127a4565b610cb991906127a4565b811015610d2e5760405162461bcd60e51b815260206004820152602d60248201527f43616e6e6f7420736574206d6178696d756d2062757920616d6f756e74206c6f60448201527f776572207468616e20302e3125000000000000000000000000000000000000006064820152608401610aac565b610d4081670de0b6b3a764000061278d565b60068190556040519081527fc33b8db52e9d66d369a22d8f3a3add75239d75a591361da3ee15972003b2e43890602001610af8565b610d7d611826565b600e54610100900460ff1615610dd55760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f742072652d656e61626c652074726164696e6700000000000000006044820152606401610aac565b600e805462ff0000198415156101009081029190911662ffff0019909216919091176201000017918290556040517fe185248899f361d51a48833938ab33493ebd7272d195abf7f51a833ea813881292610e4192900460ff169084909115158252602082015260400190565b60405180910390a1600e54610100900460ff168015610e605750600c54155b15610e6f5743600c55600d8190555b5050565b610e7b611826565b610e85600061210d565b565b610e8f611826565b600e805460ff191690556040517fa4ffae85e880608d5d4365c2b682786545d136145537788e7e0940dff9f0b98c90600090a1565b610ecc611826565b80610f78577f00000000000000000000000053105437195172ec1a65416cab9487ec109d23c66001600160a01b0316826001600160a01b031603610f785760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f742072656d6f766520756e697377617020706169722066726f6d2060448201527f6d6178207472616e73616374696f6e00000000000000000000000000000000006064820152608401610aac565b6001600160a01b03919091166000908152601360205260409020805460ff1916911515919091179055565b600f54601054600b54600e5460009384938493849384938493849384936001600160a01b039091169060ff620100008204811691610100810482169116610ff26005546001600160a01b031690565b600254969f959e50939c50919a509850965094509092509050565b60006001600160a01b0383166110655760405162461bcd60e51b815260206004820152601a60248201527f5f746f6b656e20616464726573732063616e6e6f7420626520300000000000006044820152606401610aac565b600b546001600160a01b031633146110bf5760405162461bcd60e51b815260206004820152601a60248201527f6f6e6c792054726561737572792063616e2077697468647261770000000000006044820152606401610aac565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112a91906127d9565b60405163a9059cbb60e01b81526001600160a01b038581166004830152602482018390529192509085169063a9059cbb906044016020604051808303816000875af115801561117d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a191906127f2565b604080516001600160a01b0387168152602081018490529193507fdeda980967fcead7b61e78ac46a4da14274af29e894d4d61e8b81ec38ab3e438910160405180910390a15092915050565b6060600480546109629061273d565b611204611826565b7f00000000000000000000000053105437195172ec1a65416cab9487ec109d23c66001600160a01b0316826001600160a01b0316036112975760405162461bcd60e51b815260206004820152602960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d20604482015268414d4d20706169727360b81b6064820152608401610aac565b610e6f828261216c565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156113265760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610aac565b610b7d8286868403611702565b6000336109f381858561190c565b611349611826565b6001600160a01b038216600081815260126020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b600b546001600160a01b031633146114115760405162461bcd60e51b815260206004820152602660248201527f6f6e6c792054726561737572792063616e206368616e67652073776170546872604482015265195cda1bdb1960d21b6064820152608401610aac565b61142381670de0b6b3a764000061278d565b600a5550565b611431611826565b670de0b6b3a76400006103e861144660025490565b61145190600161278d565b61145b91906127a4565b61146591906127a4565b8110156114da5760405162461bcd60e51b815260206004820152602e60248201527f43616e6e6f7420736574206d6178696d756d2073656c6c20616d6f756e74206c60448201527f6f776572207468616e20302e31250000000000000000000000000000000000006064820152608401610aac565b6114ec81670de0b6b3a764000061278d565b60078190556040519081527f53c4eb831d8cfeb750f1c62590d8cd30f4c6f0380d29a05caa09f0d92588560e90602001610af8565b611529611826565b6001600160a01b03811661157f5760405162461bcd60e51b815260206004820152601d60248201527f5f547265617375727920616464726573732063616e6e6f7420626520300000006044820152606401610aac565b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fa6df481f77da1f4c92eb330341e03585d46106fcf522f8e6b6b2afbea56eefdc90600090a250565b6115de611826565b6001600160a01b0381166116435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aac565b610b618161210d565b600b546000906001600160a01b031633146116b75760405162461bcd60e51b815260206004820152602560248201527f6f6e6c792054726561737572792063616e20706572666f726d2074686973206160448201526431ba34b7b760d91b6064820152608401610aac565b60405133904790600081818185875af1925050503d80600081146116f7576040519150601f19603f3d011682016040523d82523d6000602084013e6116fc565b606091505b50505050565b6001600160a01b0383166117645760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610aac565b6001600160a01b0382166117c55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610aac565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b03163314610e855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610aac565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146116fc57818110156118ff5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610aac565b6116fc8484848403611702565b6001600160a01b0383166119705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610aac565b6001600160a01b0382166119d25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610aac565b60008111611a225760405162461bcd60e51b815260206004820152601d60248201527f616d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610aac565b600e5460ff1615611e08576005546001600160a01b03848116911614801590611a5957506005546001600160a01b03838116911614155b8015611a6d57506001600160a01b03821615155b8015611a8457506001600160a01b03821661dead14155b15611e0857600e54610100900460ff16611b80576001600160a01b03831660009081526013602052604090205460ff1680611ad757506001600160a01b03821660009081526013602052604090205460ff165b611b235760405162461bcd60e51b815260206004820152601660248201527f54726164696e67206973206e6f74206163746976652e000000000000000000006044820152606401610aac565b6005546001600160a01b03848116911614611b805760405162461bcd60e51b815260206004820152601660248201527f54726164696e67206973206e6f7420656e61626c6564000000000000000000006044820152606401610aac565b6001600160a01b03831660009081526014602052604090205460ff168015611bc157506001600160a01b03821660009081526013602052604090205460ff16155b15611ca257600654811115611c295760405162461bcd60e51b815260206004820152602860248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201526736b0bc10313abc9760c11b6064820152608401610aac565b6008546001600160a01b038316600090815260208190526040902054611c4f90836127c6565b1115611c9d5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420457863656564206d61782077616c6c657400000000000000006044820152606401610aac565b611e08565b6001600160a01b03821660009081526014602052604090205460ff168015611ce357506001600160a01b03831660009081526013602052604090205460ff16155b15611d4d57600754811115611c9d5760405162461bcd60e51b815260206004820152602a60248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152691036b0bc1039b2b6361760b11b6064820152608401610aac565b6001600160a01b03821660009081526013602052604090205460ff16158015611d8f57506001600160a01b03831660009081526013602052604090205460ff16155b15611e08576008546001600160a01b038316600090815260208190526040902054611dba90836127c6565b1115611e085760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420457863656564206d61782077616c6c657400000000000000006044820152606401610aac565b30600090815260208190526040902054600a5481108015908190611e345750600e5462010000900460ff165b8015611e43575060095460ff16155b8015611e6857506001600160a01b03851660009081526014602052604090205460ff16155b8015611e8d57506001600160a01b03851660009081526012602052604090205460ff16155b8015611eb257506001600160a01b03841660009081526012602052604090205460ff16155b15611ed7576009805460ff19166001179055611ecc61204e565b6009805460ff191690555b6001600160a01b03851660009081526012602052604090205460019060ff1680611f1957506001600160a01b03851660009081526012602052604090205460ff165b15611f22575060005b600080828015611f3457506000600c54115b8015611f415750600c5443115b15612039576001600160a01b03871660009081526014602052604090205460ff168015611f7057506000601054115b15611fae57606460105487611f85919061278d565b611f8f91906127a4565b91508160116000828254611fa391906127c6565b909155506120119050565b6001600160a01b03881660009081526014602052604090205460ff168015611fd857506000600f54115b15612011576064600f5487611fed919061278d565b611ff791906127a4565b9150816011600082825461200b91906127c6565b90915550505b8115612022576120228830846121d6565b61202c81836127c6565b612036908761280f565b95505b6120448888886121d6565b5050505050505050565b3060009081526020819052604090205460115481158061206c575080155b15612075575050565b600a5461208390600561278d565b82111561209b57600a5461209890600561278d565b91505b60006120a68361237a565b60006011554780156116fc57600b546040516001600160a01b03909116904790600081818185875af1925050503d80600081146120ff576040519150601f19603f3d011682016040523d82523d6000602084013e612104565b606091505b50505050505050565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166000908152601460205260409020805460ff191682151517905561219a828261253a565b604051811515906001600160a01b038416907fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab90600090a35050565b6001600160a01b03831661223a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610aac565b6001600160a01b03821661229c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610aac565b6001600160a01b038316600090815260208190526040902054818110156123145760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610aac565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36116fc565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106123af576123af612822565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561242d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124519190612838565b8160018151811061246457612464612822565b60200260200101906001600160a01b031690816001600160a01b0316815250506124af307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611702565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612504908590600090869030904290600401612855565b600060405180830381600087803b15801561251e57600080fd5b505af1158015612532573d6000803e3d6000fd5b505050505050565b6001600160a01b038216600081815260136020908152604091829020805460ff19168515159081179091558251938452908301527f6b4f1be9103e6cbcd38ca4a922334f2c3109b260130a6676a987f94088fd6746910160405180910390a15050565b602081526000825180602084015260005b818110156125cb57602081860181015160408684010152016125ae565b506000604082850101526040601f19601f83011684010191505092915050565b6001600160a01b0381168114610b6157600080fd5b6000806040838503121561261357600080fd5b823561261e816125eb565b946020939093013593505050565b60006020828403121561263e57600080fd5b8135612649816125eb565b9392505050565b60006020828403121561266257600080fd5b5035919050565b60008060006060848603121561267e57600080fd5b8335612689816125eb565b92506020840135612699816125eb565b929592945050506040919091013590565b8015158114610b6157600080fd5b600080604083850312156126cb57600080fd5b823561261e816126aa565b600080604083850312156126e957600080fd5b82356126f4816125eb565b91506020830135612704816126aa565b809150509250929050565b6000806040838503121561272257600080fd5b823561272d816125eb565b91506020830135612704816125eb565b600181811c9082168061275157607f821691505b60208210810361277157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109f9576109f9612777565b6000826127c157634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156109f9576109f9612777565b6000602082840312156127eb57600080fd5b5051919050565b60006020828403121561280457600080fd5b8151612649816126aa565b818103818111156109f9576109f9612777565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561284a57600080fd5b8151612649816125eb565b600060a0820187835286602084015260a0604084015280865180835260c08501915060208801925060005b818110156128a75783516001600160a01b0316835260209384019390920191600101612880565b50506001600160a01b03959095166060840152505060800152939250505056fea26469706673582212201f870882dca3ab2a3ccadc6dbfb242d6b6ac1aa29e5f9e1b1f2a9f35345c16d164736f6c634300081c0033
Verified Source Code Full Match
Compiler: v0.8.28+commit.7893614a
EVM: paris
Optimization: Yes (600 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);
}
}
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 {}
}
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);
}
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);
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
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;
}
}
IUniswapV2Factory.sol 17 lines
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
IUniswapV2Router02.sol 44 lines
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
PRXS.sol 387 lines
// SPDX-License-Identifier: MIT
/*
██████ ███████ ██████ ██ ██ ███ ████ ██████
██ ██ ██ █ ██ ██ ██ ██ ██ ██ █
██ ██ ██ ██ ██ ██ ███ ██ █████
██ ███ ████ █████ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ █ █ ██ ██ ██ ██ ███ ███ ████
website: https://prxs.ai
x: https://x.com/Praxis_Protocol
*/
pragma solidity 0.8.28;
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract Praxis is ERC20, Ownable {
uint256 private immutable deploymentTimestamp = block.timestamp;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
uint256 public maxBuy;
uint256 public maxSell;
uint256 public maxWallet;
bool private swapping;
uint256 public swapTokensAt;
address public Treasury;
uint256 public tradingActiveBlock = 0;
uint256 public deadBlocks = 1;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
uint256 public buyFee;
uint256 public sellFee;
uint256 public tokensForTreasury;
// exlcude from fees and max transaction amount
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
mapping (address => bool) public automatedMarketMakerPairs;
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event EnabledTrading(bool tradingActive, uint256 deadBlocks);
event RemovedLimits();
event ExcludeFromFees(address indexed account, bool isExcluded);
event UpdatedMaxBuy(uint256 newAmount);
event UpdatedMaxSellAmount(uint256 newAmount);
event UpdatedMaxWallet(uint256 newAmount);
event UpdatedTreasury(address indexed newWallet);
event MaxTransactionExclusion(address _address, bool excluded);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
event TransferForeignToken(address token, uint256 amount);
constructor(
address _treasury
) ERC20("Praxis", "PRXS") {
address newOwner = msg.sender;
require(_treasury != address(0), "Treasury address cannot be zero");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
uint256 totalSupply = 100000000 * 1e18;
maxBuy = totalSupply * 20 / 1000;
maxSell = totalSupply * 5 / 1000;
maxWallet = totalSupply * 20 / 1000;
swapTokensAt = totalSupply * 100 / 100000;
buyFee = 40;
sellFee = 40;
_excludeFromMaxTransaction(newOwner, true);
_excludeFromMaxTransaction(address(this), true);
_excludeFromMaxTransaction(address(0xdead), true);
Treasury = address(_treasury);
excludeFromFees(newOwner, true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromFees(Treasury, true);
_mint(newOwner, totalSupply);
_transferOwnership(newOwner);
}
receive() external payable {}
function getContractState() external view returns (
uint256 _buyFee,
uint256 _sellFee,
address _treasuryAddress,
bool _swapEnabled,
bool _tradingActive,
bool _limitsInEffect,
address _owner,
uint256 _supply
) {
return (
buyFee,
sellFee,
Treasury,
swapEnabled,
tradingActive,
limitsInEffect,
owner(),
totalSupply()
);
}
function updateMaxBuy(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 1 / 1000)/1e18, "Cannot set maximum buy amount lower than 0.1%");
maxBuy = newNum * (10**18);
emit UpdatedMaxBuy(maxBuy);
}
function updateMaxSellAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 1 / 1000)/1e18, "Cannot set maximum sell amount lower than 0.1%");
maxSell = newNum * (10**18);
emit UpdatedMaxSellAmount(maxSell);
}
// remove limits after token is stable
function removeLimits() external onlyOwner {
limitsInEffect = false;
emit RemovedLimits();
}
function _excludeFromMaxTransaction(address updAds, bool isExcluded) private {
_isExcludedMaxTransactionAmount[updAds] = isExcluded;
emit MaxTransactionExclusion(updAds, isExcluded);
}
function excludeFromMaxTransaction(address updAds, bool isEx) external onlyOwner {
if(!isEx){
require(updAds != uniswapV2Pair, "Cannot remove uniswap pair from max transaction");
}
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
function updateMaxWallet(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 3 / 1000)/1e18, "Cannot set max wallet amount lower than 0.3%");
maxWallet = newNum * (10**18);
emit UpdatedMaxWallet(maxWallet);
}
function updateSwapThreshold(uint256 newAmount) public {
require(msg.sender==Treasury,"only Treasury can change swapThreshold");
swapTokensAt = newAmount* (10**18);
}
function transferForeignToken(address _token, address _to) public returns (bool _sent) {
require(_token != address(0), "_token address cannot be 0");
require(msg.sender==Treasury,"only Treasury can withdraw");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
_sent = IERC20(_token).transfer(_to, _contractBalance);
emit TransferForeignToken(_token, _contractBalance);
}
// withdraw ETH if someone accidentally sends to SC
function withdrawStuckETH() public {
bool success;
require(msg.sender==Treasury,"only Treasury can perform this action");
(success,) = address(msg.sender).call{value: address(this).balance}("");
}
function updateBuyFee(uint256 _fee) external onlyOwner {
buyFee = _fee;
require(buyFee <= 40, "Fees must be 40% or less");
}
function updateSellFee(uint256 _fee) external onlyOwner {
sellFee = _fee;
require(sellFee <= 40, "Fees must be 40% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function _transfer(address from, address to, uint256 amount) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "amount must be greater than 0");
if(limitsInEffect){
if (from != owner() && to != owner() && to != address(0) && to != address(0xdead)){
if(!tradingActive){
require(_isExcludedMaxTransactionAmount[from] || _isExcludedMaxTransactionAmount[to], "Trading is not active.");
require(from == owner(), "Trading is not enabled");
}
//when buy
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) {
require(amount <= maxBuy, "Buy transfer amount exceeds the max buy.");
require(amount + balanceOf(to) <= maxWallet, "Cannot Exceed max wallet");
}
//when sell
else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {
require(amount <= maxSell, "Sell transfer amount exceeds the max sell.");
}
else if (!_isExcludedMaxTransactionAmount[to] && !_isExcludedMaxTransactionAmount[from]){
require(amount + balanceOf(to) <= maxWallet, "Cannot Exceed max wallet");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAt;
if(canSwap && swapEnabled && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to]) {
swapping = true;
swapBack();
swapping = false;
}
bool takeFee = true;
// if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
uint256 penaltyAmount = 0;
// only take fees on trades, NOT on wallet transfers
if(takeFee && tradingActiveBlock>0 && (block.number>tradingActiveBlock)) {
// on sell
if (automatedMarketMakerPairs[to] && sellFee > 0) {
fees = amount * sellFee / 100;
tokensForTreasury += fees;
}
// on buy
else if(automatedMarketMakerPairs[from] && buyFee > 0) {
fees = amount * buyFee / 100;
tokensForTreasury += fees;
}
if(fees > 0){
super._transfer(from, address(this), fees);
}
amount -= fees + penaltyAmount;
}
super._transfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function setAutomatedMarketMakerPair(address pair, bool value) external onlyOwner {
require(pair != uniswapV2Pair, "The pair cannot be removed from AMM pairs");
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
_excludeFromMaxTransaction(pair, value);
emit SetAutomatedMarketMakerPair(pair, value);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to uniswapV2Router
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // cannot avoid slippage
0, // cannot avoid slippage
address(owner()),
block.timestamp
);
}
function setTreasury(address _Treasury) external onlyOwner {
require(_Treasury != address(0), "_Treasury address cannot be 0");
Treasury = payable(_Treasury);
emit UpdatedTreasury(_Treasury);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForTreasury;
if(contractBalance == 0 || totalTokensToSwap == 0) {return;}
if(contractBalance > swapTokensAt * 5){
contractBalance = swapTokensAt * 5;
}
bool success;
swapTokensForEth(contractBalance);
tokensForTreasury = 0;
uint256 ethBalance=address(this).balance;
if(ethBalance>0){
(success,) = address(Treasury).call{value: address(this).balance}("");
}
}
function manualSwap() external {
require(_msgSender()==Treasury);
uint256 tokenBalance=balanceOf(address(this));
if(tokenBalance>0){
swapping = true;
swapBack();
swapping = false;
}
}
// cannot be turned off, once enabled
function enableTrading(bool _status, uint256 _deadBlocks) external onlyOwner {
require(!tradingActive, "Cannot re-enable trading");
tradingActive = _status;
swapEnabled = true;
emit EnabledTrading(tradingActive, _deadBlocks);
if (tradingActive && tradingActiveBlock == 0) {
tradingActiveBlock = block.number;
deadBlocks = _deadBlocks;
}
}
}
Read Contract
Treasury 0x563df32f → address
_isExcludedMaxTransactionAmount 0x10d5de53 → bool
allowance 0xdd62ed3e → uint256
automatedMarketMakerPairs 0xb62496f5 → bool
balanceOf 0x70a08231 → uint256
buyFee 0x47062402 → uint256
deadBlocks 0xfabb0b4f → uint256
decimals 0x313ce567 → uint8
getContractState 0x7f4e4849 → uint256, uint256, address, bool, bool, bool, address, uint256
limitsInEffect 0x4a62bb65 → bool
maxBuy 0x70db69d6 → uint256
maxSell 0xb8eb3546 → uint256
maxWallet 0xf8b45b05 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
sellFee 0x2b14ca56 → uint256
swapEnabled 0x6ddd1713 → bool
swapTokensAt 0xd36e8239 → uint256
symbol 0x95d89b41 → string
tokensForTreasury 0xcc2ffe7c → uint256
totalSupply 0x18160ddd → uint256
tradingActive 0xbbc0c742 → bool
tradingActiveBlock 0xee40166e → uint256
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
enableTrading 0x5e83ae76
bool _status
uint256 _deadBlocks
excludeFromFees 0xc0246668
address account
bool excluded
excludeFromMaxTransaction 0x7571336a
address updAds
bool isEx
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
manualSwap 0x51bc3c85
No parameters
removeLimits 0x751039fc
No parameters
renounceOwnership 0x715018a6
No parameters
setAutomatedMarketMakerPair 0x9a7a23d6
address pair
bool value
setTreasury 0xf0f44260
address _Treasury
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferForeignToken 0x8366e79a
address _token
address _to
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateBuyFee 0x467abe0a
uint256 _fee
updateMaxBuy 0x58881304
uint256 newNum
updateMaxSellAmount 0xdc3f0d0f
uint256 newNum
updateMaxWallet 0x1c499ab0
uint256 newNum
updateSellFee 0x1d933a4a
uint256 _fee
updateSwapThreshold 0xcc274b29
uint256 newAmount
withdrawStuckETH 0xf5648a4f
No parameters
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0xCe2E752c...a2dD | 1 | 1 |
Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0xaa324231...ba65a3 | 24,460,527 | IN | 0xCe2E752c...a2dD | 0 ETH |