Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x7f841f18Fc2864fb2A3c0312a32fc1FD7D3B31Df
Balance 0 ETH
Nonce 1
Code Size 13215 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

13215 bytes
0x6080604052600436106101fd5760003560e01c8063757765f81161010d578063b81df742116100a0578063f2aa82181161006f578063f2aa821814610699578063f2fde38b146106d6578063f3fef3a3146106ff578063f8951a0014610728578063fa09e6301461076557610204565b8063b81df74214610601578063ca628c781461062c578063d293187c14610643578063e985e3671461066e57610204565b806398d6d8ed116100dc57806398d6d8ed1461056b57806399b7703214610596578063ace1741c146105bf578063b5b0763c146105ea57610204565b8063757765f8146104b157806389e6ce1e146104da5780638ce0b9d2146105035780638da5cb5b1461054057610204565b80633c00a36c1161019057806363b201171161015f57806363b20117146103fd57806368f8fc10146104285780636aa5b37f146104445780636bcedf9c1461046f578063715018a61461049a57610204565b80633c00a36c146103445780633f6f7ed61461036d578063444ad5ee1461039657806354a9f102146103bf57610204565b8063226ac321116101cc578063226ac321146102ae5780632a95c24c146102d75780632c4e722e146102ee5780633848a7711461031957610204565b806304c98b2b14610206578063115ece4c1461021d5780631ad2ad1a1461025a578063204120bc1461027157610204565b3661020457005b005b34801561021257600080fd5b5061021b61078e565b005b34801561022957600080fd5b50610244600480360381019061023f9190612473565b610877565b6040516102519190612f41565b60405180910390f35b34801561026657600080fd5b5061026f610a20565b005b34801561027d57600080fd5b506102986004803603810190610293919061244a565b610b08565b6040516102a59190612f41565b60405180910390f35b3480156102ba57600080fd5b506102d560048036038101906102d09190612473565b610b20565b005b3480156102e357600080fd5b506102ec610cb4565b005b3480156102fa57600080fd5b50610303610d9d565b6040516103109190612f41565b60405180910390f35b34801561032557600080fd5b5061032e610da3565b60405161033b9190612cc4565b60405180910390f35b34801561035057600080fd5b5061036b600480360381019061036691906124d8565b610db6565b005b34801561037957600080fd5b50610394600480360381019061038f91906124d8565b610e7c565b005b3480156103a257600080fd5b506103bd60048036038101906103b89190612473565b610f02565b005b3480156103cb57600080fd5b506103e660048036038101906103e1919061244a565b611062565b6040516103f4929190612f5c565b60405180910390f35b34801561040957600080fd5b50610412611093565b60405161041f9190612f41565b60405180910390f35b610442600480360381019061043d9190612473565b611099565b005b34801561045057600080fd5b50610459611558565b6040516104669190612f41565b60405180910390f35b34801561047b57600080fd5b5061048461155e565b6040516104919190612f41565b60405180910390f35b3480156104a657600080fd5b506104af611564565b005b3480156104bd57600080fd5b506104d860048036038101906104d391906124d8565b6115ec565b005b3480156104e657600080fd5b5061050160048036038101906104fc9190612473565b611672565b005b34801561050f57600080fd5b5061052a6004803603810190610525919061244a565b611884565b6040516105379190612cc4565b60405180910390f35b34801561054c57600080fd5b506105556118a4565b6040516105629190612c49565b60405180910390f35b34801561057757600080fd5b506105806118cd565b60405161058d9190612cc4565b60405180910390f35b3480156105a257600080fd5b506105bd60048036038101906105b891906124d8565b6118e0565b005b3480156105cb57600080fd5b506105d4611966565b6040516105e19190612f41565b60405180910390f35b3480156105f657600080fd5b506105ff61196c565b005b34801561060d57600080fd5b50610616611a54565b6040516106239190612f41565b60405180910390f35b34801561063857600080fd5b50610641611a5a565b005b34801561064f57600080fd5b50610658611c30565b6040516106659190612f41565b60405180910390f35b34801561067a57600080fd5b50610683611c36565b6040516106909190612c49565b60405180910390f35b3480156106a557600080fd5b506106c060048036038101906106bb91906124d8565b611c5c565b6040516106cd9190612c49565b60405180910390f35b3480156106e257600080fd5b506106fd60048036038101906106f8919061244a565b611c9b565b005b34801561070b57600080fd5b5061072660048036038101906107219190612473565b611d93565b005b34801561073457600080fd5b5061074f600480360381019061074a919061244a565b611e3e565b60405161075c9190612f41565b60405180910390f35b34801561077157600080fd5b5061078c6004803603810190610787919061244a565b611e56565b005b610796611f6d565b73ffffffffffffffffffffffffffffffffffffffff166107b46118a4565b73ffffffffffffffffffffffffffffffffffffffff161461080a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080190612e21565b60405180910390fd5b600a60019054906101000a900460ff161561085a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085190612e41565b60405180910390fd5b6001600a60016101000a81548160ff021916908315150217905550565b6000600a60019054906101000a900460ff166108965760009050610a1a565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146109dd5760011515600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461095e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095590612e61565b60405180910390fd5b6000600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506109d5816109c7600354600a6109b89190613091565b87611f7590919063ffffffff16565b611f8b90919063ffffffff16565b915050610a15565b610a12600154610a04600354600a6109f59190613091565b86611f7590919063ffffffff16565b611f8b90919063ffffffff16565b90505b809150505b92915050565b610a28611f6d565b73ffffffffffffffffffffffffffffffffffffffff16610a466118a4565b73ffffffffffffffffffffffffffffffffffffffff1614610a9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9390612e21565b60405180910390fd5b600a60019054906101000a900460ff16610aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae290612d61565b60405180910390fd5b6000600a60016101000a81548160ff021916908315150217905550565b60086020528060005260406000206000915090505481565b610b28611f6d565b73ffffffffffffffffffffffffffffffffffffffff16610b466118a4565b73ffffffffffffffffffffffffffffffffffffffff1614610b9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9390612e21565b60405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610c28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1f90612e61565b60405180910390fd5b6000811415610c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6390612dc1565b60405180910390fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b610cbc611f6d565b73ffffffffffffffffffffffffffffffffffffffff16610cda6118a4565b73ffffffffffffffffffffffffffffffffffffffff1614610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790612e21565b60405180910390fd5b600a60009054906101000a900460ff1615610d80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7790612e81565b60405180910390fd5b6001600a60006101000a81548160ff021916908315150217905550565b60015481565b600a60009054906101000a900460ff1681565b610dbe611f6d565b73ffffffffffffffffffffffffffffffffffffffff16610ddc6118a4565b73ffffffffffffffffffffffffffffffffffffffff1614610e32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2990612e21565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610e78573d6000803e3d6000fd5b5050565b610e84611f6d565b73ffffffffffffffffffffffffffffffffffffffff16610ea26118a4565b73ffffffffffffffffffffffffffffffffffffffff1614610ef8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eef90612e21565b60405180910390fd5b8060018190555050565b610f0a611f6d565b73ffffffffffffffffffffffffffffffffffffffff16610f286118a4565b73ffffffffffffffffffffffffffffffffffffffff1614610f7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7590612e21565b60405180910390fd5b6000811415610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb990612dc1565b60405180910390fd5b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600c6020528060005260406000206000915090508060000154908060010160009054906101000a900460ff16905082565b600e5481565b600a60019054906101000a900460ff166110e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110df90612d81565b60405180910390fd5b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146113575760008211611160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115790612ea1565b60405180910390fd5b60011515600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146111f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ea90612e61565b60405180910390fd5b6111fd8383610877565b9050600654811015611244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123b90612f01565b60405180910390fd5b60055481600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112929190612fb7565b11156112d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ca90612e01565b60405180910390fd5b60045481600e546112e49190612fb7565b1115611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612d21565b60405180910390fd5b6113523330848673ffffffffffffffffffffffffffffffffffffffff16611fa1909392919063ffffffff16565b61148b565b611362600034610877565b90506006548110156113a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a090612f01565b60405180910390fd5b60055481600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f79190612fb7565b1115611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f90612e01565b60405180910390fd5b60045481600e546114499190612fb7565b111561148a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148190612d21565b60405180910390fd5b5b80600e600082825461149d9190612fb7565b9250508190555080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282546114f69190612fb7565b9250508190555080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461154c9190612fb7565b92505081905550505050565b60055481565b60045481565b61156c611f6d565b73ffffffffffffffffffffffffffffffffffffffff1661158a6118a4565b73ffffffffffffffffffffffffffffffffffffffff16146115e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d790612e21565b60405180910390fd5b6115ea600061202a565b565b6115f4611f6d565b73ffffffffffffffffffffffffffffffffffffffff166116126118a4565b73ffffffffffffffffffffffffffffffffffffffff1614611668576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165f90612e21565b60405180910390fd5b8060058190555050565b61167a611f6d565b73ffffffffffffffffffffffffffffffffffffffff166116986118a4565b73ffffffffffffffffffffffffffffffffffffffff16146116ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e590612e21565b60405180910390fd5b600a60019054906101000a900460ff161561173e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173590612e41565b60405180910390fd5b81600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156117e757600080fd5b505afa1580156117fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181f919061252a565b60ff16600381905550806004819055506118803330600454600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fa1909392919063ffffffff16565b5050565b60076020528060005260406000206000915054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600a60019054906101000a900460ff1681565b6118e8611f6d565b73ffffffffffffffffffffffffffffffffffffffff166119066118a4565b73ffffffffffffffffffffffffffffffffffffffff161461195c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195390612e21565b60405180910390fd5b8060068190555050565b60035481565b611974611f6d565b73ffffffffffffffffffffffffffffffffffffffff166119926118a4565b73ffffffffffffffffffffffffffffffffffffffff16146119e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119df90612e21565b60405180910390fd5b600a60009054906101000a900460ff16611a37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2e90612de1565b60405180910390fd5b6000600a60006101000a81548160ff021916908315150217905550565b60065481565b6000801515600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff16151514611af1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae890612f21565b60405180910390fd5b600a60009054906101000a900460ff16611b40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3790612d01565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015490506001600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160006101000a81548160ff021916908315150217905550611c2d3382600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166120ee9092919063ffffffff16565b50565b600b5481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60098181548110611c6c57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611ca3611f6d565b73ffffffffffffffffffffffffffffffffffffffff16611cc16118a4565b73ffffffffffffffffffffffffffffffffffffffff1614611d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0e90612e21565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7e90612d41565b60405180910390fd5b611d908161202a565b50565b611d9b611f6d565b73ffffffffffffffffffffffffffffffffffffffff16611db96118a4565b73ffffffffffffffffffffffffffffffffffffffff1614611e0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0690612e21565b60405180910390fd5b611e3a33828473ffffffffffffffffffffffffffffffffffffffff166120ee9092919063ffffffff16565b5050565b600d6020528060005260406000206000915090505481565b611e5e611f6d565b73ffffffffffffffffffffffffffffffffffffffff16611e7c6118a4565b73ffffffffffffffffffffffffffffffffffffffff1614611ed2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec990612e21565b60405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611f0d9190612c49565b60206040518083038186803b158015611f2557600080fd5b505afa158015611f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5d9190612501565b9050611f698282611d93565b5050565b600033905090565b60008183611f8391906131af565b905092915050565b60008183611f99919061300d565b905092915050565b612024846323b872dd60e01b858585604051602401611fc293929190612c64565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612174565b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b61216f8363a9059cbb60e01b848460405160240161210d929190612c9b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612174565b505050565b60006121d6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661223b9092919063ffffffff16565b905060008151111561223657808060200190518101906121f691906124af565b612235576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222c90612ee1565b60405180910390fd5b5b505050565b606061224a8484600085612253565b90509392505050565b606082471015612298576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161228f90612da1565b60405180910390fd5b6122a185612367565b6122e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122d790612ec1565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123099190612c32565b60006040518083038185875af1925050503d8060008114612346576040519150601f19603f3d011682016040523d82523d6000602084013e61234b565b606091505b509150915061235b82828661237a565b92505050949350505050565b600080823b905060008111915050919050565b6060831561238a578290506123da565b60008351111561239d5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d19190612cdf565b60405180910390fd5b9392505050565b6000813590506123f08161330d565b92915050565b60008151905061240581613324565b92915050565b60008135905061241a8161333b565b92915050565b60008151905061242f8161333b565b92915050565b60008151905061244481613352565b92915050565b60006020828403121561245c57600080fd5b600061246a848285016123e1565b91505092915050565b6000806040838503121561248657600080fd5b6000612494858286016123e1565b92505060206124a58582860161240b565b9150509250929050565b6000602082840312156124c157600080fd5b60006124cf848285016123f6565b91505092915050565b6000602082840312156124ea57600080fd5b60006124f88482850161240b565b91505092915050565b60006020828403121561251357600080fd5b600061252184828501612420565b91505092915050565b60006020828403121561253c57600080fd5b600061254a84828501612435565b91505092915050565b61255c81613209565b82525050565b61256b8161321b565b82525050565b600061257c82612f85565b6125868185612f9b565b935061259681856020860161325e565b80840191505092915050565b60006125ad82612f90565b6125b78185612fa6565b93506125c781856020860161325e565b6125d0816132ef565b840191505092915050565b60006125e8602483612fa6565b91507f50726573616c653a204c6f636b696e6720706572696f64206e6f74206f76657260008301527f20796574000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061264e602283612fa6565b91507f50726553616c653a20546f74616c20546f6b656e2053616c652052656163686560008301527f64210000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006126b4602683612fa6565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061271a602183612fa6565b91507f50726553616c653a2053616c65206861736e277420737461727465642079657460008301527f21000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612780601683612fa6565b91507f50726553616c653a2053616c652073746f7070656421000000000000000000006000830152602082019050919050565b60006127c0602683612fa6565b91507f416464726573733a20696e73756666696369656e742062616c616e636520666f60008301527f722063616c6c00000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612826601e83612fa6565b91507f50726573616c653a2043616e6e6f742073657420707269636520746f203000006000830152602082019050919050565b6000612866602683612fa6565b91507f50726553616c653a20556e6c6f636b696e67206861736e27742073746172746560008301527f64207965742100000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006128cc602d83612fa6565b91507f50726573616c653a204d617820627579206c696d69742072656163686564206660008301527f6f722074686973207068617365000000000000000000000000000000000000006020830152604082019050919050565b6000612932602083612fa6565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000612972602183612fa6565b91507f50726553616c653a2053616c652068617320616c72656164792073746172746560008301527f64000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006129d8601e83612fa6565b91507f50726573616c653a20546f6b656e206e6f742077686974656c697374656400006000830152602082019050919050565b6000612a18602683612fa6565b91507f50726553616c653a20556e6c6f636b696e672068617320616c7265616479207360008301527f74617274656400000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612a7e602483612fa6565b91507f50726573616c653a2043616e6e6f74206275792077697468207a65726f20616d60008301527f6f756e74000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612ae4601d83612fa6565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b6000612b24602a83612fa6565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000612b8a602283612fa6565b91507f50726573616c653a204d696e20627579206c696d6974206e6f7420726561636860008301527f65640000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612bf0601883612fa6565b91507f50726573616c653a20416c726561647920636c61696d656400000000000000006000830152602082019050919050565b612c2c81613247565b82525050565b6000612c3e8284612571565b915081905092915050565b6000602082019050612c5e6000830184612553565b92915050565b6000606082019050612c796000830186612553565b612c866020830185612553565b612c936040830184612c23565b949350505050565b6000604082019050612cb06000830185612553565b612cbd6020830184612c23565b9392505050565b6000602082019050612cd96000830184612562565b92915050565b60006020820190508181036000830152612cf981846125a2565b905092915050565b60006020820190508181036000830152612d1a816125db565b9050919050565b60006020820190508181036000830152612d3a81612641565b9050919050565b60006020820190508181036000830152612d5a816126a7565b9050919050565b60006020820190508181036000830152612d7a8161270d565b9050919050565b60006020820190508181036000830152612d9a81612773565b9050919050565b60006020820190508181036000830152612dba816127b3565b9050919050565b60006020820190508181036000830152612dda81612819565b9050919050565b60006020820190508181036000830152612dfa81612859565b9050919050565b60006020820190508181036000830152612e1a816128bf565b9050919050565b60006020820190508181036000830152612e3a81612925565b9050919050565b60006020820190508181036000830152612e5a81612965565b9050919050565b60006020820190508181036000830152612e7a816129cb565b9050919050565b60006020820190508181036000830152612e9a81612a0b565b9050919050565b60006020820190508181036000830152612eba81612a71565b9050919050565b60006020820190508181036000830152612eda81612ad7565b9050919050565b60006020820190508181036000830152612efa81612b17565b9050919050565b60006020820190508181036000830152612f1a81612b7d565b9050919050565b60006020820190508181036000830152612f3a81612be3565b9050919050565b6000602082019050612f566000830184612c23565b92915050565b6000604082019050612f716000830185612c23565b612f7e6020830184612562565b9392505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000612fc282613247565b9150612fcd83613247565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561300257613001613291565b5b828201905092915050565b600061301882613247565b915061302383613247565b925082613033576130326132c0565b5b828204905092915050565b6000808291508390505b60018511156130885780860481111561306457613063613291565b5b60018516156130735780820291505b808102905061308185613300565b9450613048565b94509492505050565b600061309c82613247565b91506130a783613247565b92506130d47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846130dc565b905092915050565b6000826130ec57600190506131a8565b816130fa57600090506131a8565b8160018114613110576002811461311a57613149565b60019150506131a8565b60ff84111561312c5761312b613291565b5b8360020a91508482111561314357613142613291565b5b506131a8565b5060208310610133831016604e8410600b841016171561317e5782820a90508381111561317957613178613291565b5b6131a8565b61318b848484600161303e565b925090508184048111156131a2576131a1613291565b5b81810290505b9392505050565b60006131ba82613247565b91506131c583613247565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fe576131fd613291565b5b828202905092915050565b600061321482613227565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561327c578082015181840152602081019050613261565b8381111561328b576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b61331681613209565b811461332157600080fd5b50565b61332d8161321b565b811461333857600080fd5b50565b61334481613247565b811461334f57600080fd5b50565b61335b81613251565b811461336657600080fd5b5056fea2646970667358221220486dbb24fc4116088851cfc6d076ddb0741b1c3252f76669806ac0cddb16a9c964736f6c63430008000033

Verified Source Code Full Match

Compiler: v0.8.0+commit.c7dfd78e EVM: istanbul Optimization: No
BRDAPresale.sol 968 lines
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 substraction 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;
        }
    }
}


// File @openzeppelin/contracts/token/ERC20/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}


// File @openzeppelin/contracts/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}


// File @openzeppelin/contracts/access/[email protected]

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

/**
 * @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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}


// File contracts/OwnerWithdrawable.sol

pragma solidity ^0.8.0;



contract OwnerWithdrawable is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    receive() external payable {}

    fallback() external payable {}

    function withdraw(address token, uint256 amt) public onlyOwner {
        IERC20(token).safeTransfer(msg.sender, amt);
    }

    function withdrawAll(address token) public onlyOwner {
        uint256 amt = IERC20(token).balanceOf(address(this));
        withdraw(token, amt);
    }

    function withdrawCurrency(uint256 amt) public onlyOwner {
        payable(msg.sender).transfer(amt);
    }

    // function deposit(address token, uint256 amt) public onlyOwner {
    //     uint256 allowance = IERC20(token).allowance(msg.sender, address(this));
    //     require(allowance >= amt, "Check the token allowance");
    //     IERC20(token).transferFrom(owner(), address(this), amt);
    // }
}

// File @openzeppelin/contracts/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}


// File @openzeppelin/contracts/token/ERC20/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;


/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}


// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

/**
 * @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);
}

// File contracts/PreSale.sol
// SPDX-License-Identifier: MIT
// import "hardhat/console.sol";
pragma solidity ^0.8.0;

contract BRDAPresale is OwnerWithdrawable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using SafeERC20 for IERC20Metadata;

    uint256 public rate;
    address public saleToken;
    uint public saleTokenDec;
    uint256 public totalTokensforSale;
    uint256 public maxBuyLimit;
    uint256 public minBuyLimit;

    // Whitelist of tokens to buy from
    mapping(address => bool) public tokenWL;

    // 1 Token price in terms of WL tokens
    mapping(address => uint256) public tokenPrices;

    address[] public buyers;

    bool public isUnlockingStarted;
    bool public isPresaleStarted;
    uint public presalePhase;
    
    mapping(address => BuyerTokenDetails) public buyersAmount;
    mapping(address => uint256) public presaleData;

    uint256 public totalTokensSold;

    struct BuyerTokenDetails {
        uint amount;
        bool isClaimed;
    }

    constructor() { }

    modifier saleStarted(){
        require (!isPresaleStarted, "PreSale: Sale has already started");
        _;
    }

    //function to set information of Token sold in Pre-Sale and its rate in Native currency
    function setSaleTokenParams(
        address _saleToken,
        uint256 _totalTokensforSale
    ) external onlyOwner saleStarted{
        saleToken = _saleToken;
        saleTokenDec = IERC20Metadata(saleToken).decimals();
        totalTokensforSale = _totalTokensforSale;
        IERC20(saleToken).safeTransferFrom(msg.sender, address(this), totalTokensforSale);
    }

    // Add a token to buy presale token from, with price
    function addWhiteListedToken(
        address _token,
        uint256 _price
    ) external onlyOwner {
        require(_price != 0, "Presale: Cannot set price to 0");
        tokenWL[_token] = true;
        tokenPrices[_token] = _price;
    }

    function updateEthRate(uint256 _rate) external  onlyOwner {
        rate = _rate;
    }

    function updateTokenRate(
        address _token,
        uint256 _price
    )external onlyOwner{
        require(tokenWL[_token], "Presale: Token not whitelisted");
        require(_price != 0, "Presale: Cannot set price to 0");
        tokenPrices[_token] = _price;
    }

    function startPresale() external onlyOwner {
        require(!isPresaleStarted, "PreSale: Sale has already started");
        isPresaleStarted = true;
    }

    function stopPresale() external onlyOwner {
        require(isPresaleStarted, "PreSale: Sale hasn't started yet!");
        isPresaleStarted = false;
    }

    function startUnlocking() external onlyOwner {
        require(!isUnlockingStarted, "PreSale: Unlocking has already started");
        isUnlockingStarted = true;
    }

    function stopUnlocking() external onlyOwner {
        require(isUnlockingStarted, "PreSale: Unlocking hasn't started yet!");
        isUnlockingStarted = false;
    }

    // Public view function to calculate amount of sale tokens returned if you buy using "amount" of "token"
    function getTokenAmount(address token, uint256 amount)
        public
        view
        returns (uint256)
    {
        if(!isPresaleStarted) {
            return 0;
        }
        uint256 amtOut;
        if(token != address(0)){
            require(tokenWL[token] == true, "Presale: Token not whitelisted");
            uint256 price = tokenPrices[token];
            amtOut = amount.mul(10**saleTokenDec).div(price);
        }
        else{
            amtOut = amount.mul(10**saleTokenDec).div(rate);
        }
        return amtOut;
    }

    // Public Function to buy tokens. APPROVAL needs to be done first
    function buyToken(address _token, uint256 _amount) external payable{
        require(isPresaleStarted, "PreSale: Sale stopped!");

        uint256 saleTokenAmt;
        if(_token != address(0)){
            require(_amount > 0, "Presale: Cannot buy with zero amount");
            require(tokenWL[_token] == true, "Presale: Token not whitelisted");

            saleTokenAmt = getTokenAmount(_token, _amount);

            // check if saleTokenAmt is greater than minBuyLimit
            require(saleTokenAmt >= minBuyLimit, "Presale: Min buy limit not reached");
            require(presaleData[msg.sender] + saleTokenAmt <= maxBuyLimit, "Presale: Max buy limit reached for this phase");
            require((totalTokensSold + saleTokenAmt) <= totalTokensforSale, "PreSale: Total Token Sale Reached!");

            IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
        }
        else{
            saleTokenAmt = getTokenAmount(address(0), msg.value);

            // check if saleTokenAmt is greater than minBuyLimit
            require(saleTokenAmt >= minBuyLimit, "Presale: Min buy limit not reached");
            require(presaleData[msg.sender] + saleTokenAmt <= maxBuyLimit, "Presale: Max buy limit reached for this phase");
            require((totalTokensSold + saleTokenAmt) <= totalTokensforSale, "PreSale: Total Token Sale Reached!");

        }
 
        totalTokensSold += saleTokenAmt;
        buyersAmount[msg.sender].amount += saleTokenAmt;
        presaleData[msg.sender] += saleTokenAmt; 
    }

    function withdrawToken() external {
        uint256 tokensforWithdraw;
        require(buyersAmount[msg.sender].isClaimed == false, "Presale: Already claimed");
        require(isUnlockingStarted, "Presale: Locking period not over yet");
        tokensforWithdraw = buyersAmount[msg.sender].amount;
        buyersAmount[msg.sender].isClaimed = true;
        IERC20(saleToken).safeTransfer(msg.sender, tokensforWithdraw);
    }

    function setMinBuyLimit(uint _minBuyLimit) external onlyOwner {
        minBuyLimit = _minBuyLimit;
    }

    function setMaxBuyLimit(uint _maxBuyLimit) external onlyOwner {
        maxBuyLimit = _maxBuyLimit;
    }
}

Read Contract

buyers 0xf2aa8218 → address
buyersAmount 0x54a9f102 → uint256, bool
getTokenAmount 0x115ece4c → uint256
isPresaleStarted 0x98d6d8ed → bool
isUnlockingStarted 0x3848a771 → bool
maxBuyLimit 0x6aa5b37f → uint256
minBuyLimit 0xb81df742 → uint256
owner 0x8da5cb5b → address
presaleData 0xf8951a00 → uint256
presalePhase 0xd293187c → uint256
rate 0x2c4e722e → uint256
saleToken 0xe985e367 → address
saleTokenDec 0xace1741c → uint256
tokenPrices 0x204120bc → uint256
tokenWL 0x8ce0b9d2 → bool
totalTokensSold 0x63b20117 → uint256
totalTokensforSale 0x6bcedf9c → uint256

Write Contract 17 functions

These functions modify contract state and require a wallet transaction to execute.

addWhiteListedToken 0x444ad5ee
address _token
uint256 _price
buyToken 0x68f8fc10
address _token
uint256 _amount
renounceOwnership 0x715018a6
No parameters
setMaxBuyLimit 0x757765f8
uint256 _maxBuyLimit
setMinBuyLimit 0x99b77032
uint256 _minBuyLimit
setSaleTokenParams 0x89e6ce1e
address _saleToken
uint256 _totalTokensforSale
startPresale 0x04c98b2b
No parameters
startUnlocking 0x2a95c24c
No parameters
stopPresale 0x1ad2ad1a
No parameters
stopUnlocking 0xb5b0763c
No parameters
transferOwnership 0xf2fde38b
address newOwner
updateEthRate 0x3f6f7ed6
uint256 _rate
updateTokenRate 0x226ac321
address _token
uint256 _price
withdraw 0xf3fef3a3
address token
uint256 amt
withdrawAll 0xfa09e630
address token
withdrawCurrency 0x3c00a36c
uint256 amt
withdrawToken 0xca628c78
No parameters

Recent Transactions

No transactions found for this address