Address Contract Partially Verified
Address
0xbe1936A67f503e0eaF2434b0cf9f4e3d7100008A
Balance
0 ETH
Nonce
1
Code Size
19128 bytes
Creator
0xb2ed6c08...a0b1 at tx 0x84719bfb...d74a62
Indexed Transactions
0
Contract Bytecode
19128 bytes
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80637e5cd5c11161011a578063a9059cbb116100ad578063e797ec1b1161007c578063e797ec1b146105cd578063e7e11786146105eb578063edf07bb51461061b578063f2fde38b14610639578063f56a44a01461065557610206565b8063a9059cbb14610533578063b19f2fc414610563578063d89135cd1461057f578063dd62ed3e1461059d57610206565b80638da5cb5b116100e95780638da5cb5b146104a957806395d89b41146104c757806398603cca146104e5578063a457c2d71461050357610206565b80637e5cd5c114610433578063853fa8ce14610451578063859e0d3a1461045b57806388ee3b061461047957610206565b806340c10f191161019d5780636e3518f31161016c5780636e3518f31461038f57806370a08231146103ad5780637581a8e6146103dd57806375eb259b146103fb57806379cc67901461041757610206565b806340c10f191461032f57806342966c681461034b57806353d7a6261461036757806355c7ba141461037157610206565b806320c354bd116101d957806320c354bd1461029357806323b872dd146102b1578063313ce567146102e157806339509351146102ff57610206565b806306fdde031461020b57806307aa037a14610229578063095ea7b31461024557806318160ddd14610275575b600080fd5b610213610673565b60405161022091906140cf565b60405180910390f35b610243600480360381019061023e9190614154565b610705565b005b61025f600480360381019061025a91906141b7565b610a75565b60405161026c9190614212565b60405180910390f35b61027d610a98565b60405161028a919061423c565b60405180910390f35b61029b610aa2565b6040516102a89190614212565b60405180910390f35b6102cb60048036038101906102c69190614257565b610ab5565b6040516102d89190614212565b60405180910390f35b6102e9610bbf565b6040516102f691906142c6565b60405180910390f35b610319600480360381019061031491906141b7565b610bd6565b6040516103269190614212565b60405180910390f35b610349600480360381019061034491906141b7565b610c80565b005b610365600480360381019061036091906142e1565b610e08565b005b61036f610e1c565b005b61037961109a565b6040516103869190614212565b60405180910390f35b6103976110ad565b6040516103a49190614212565b60405180910390f35b6103c760048036038101906103c29190614154565b6110c4565b6040516103d4919061423c565b60405180910390f35b6103e561110d565b6040516103f291906140cf565b60405180910390f35b61041560048036038101906104109190614154565b61137d565b005b610431600480360381019061042c91906141b7565b61171f565b005b61043b611821565b60405161044891906140cf565b60405180910390f35b610459611a90565b005b610463611d0e565b6040516104709190614212565b60405180910390f35b610493600480360381019061048e9190614154565b611fa1565b6040516104a09190614212565b60405180910390f35b6104b1611ffb565b6040516104be919061431d565b60405180910390f35b6104cf612024565b6040516104dc91906140cf565b60405180910390f35b6104ed6120b6565b6040516104fa91906140cf565b60405180910390f35b61051d600480360381019061051891906141b7565b612325565b60405161052a9190614212565b60405180910390f35b61054d600480360381019061054891906141b7565b61242b565b60405161055a9190614212565b60405180910390f35b61057d60048036038101906105789190614376565b61244e565b005b61058761262a565b604051610594919061423c565b60405180910390f35b6105b760048036038101906105b291906143a3565b612634565b6040516105c4919061423c565b60405180910390f35b6105d56126bb565b6040516105e291906140cf565b60405180910390f35b610605600480360381019061060091906143e3565b61292b565b6040516106129190614212565b60405180910390f35b610623612bf1565b6040516106309190614212565b60405180910390f35b610653600480360381019061064e9190614154565b612e84565b005b61065d612fee565b60405161066a9190614212565b60405180910390f35b60606009805461068290614452565b80601f01602080910402602001604051908101604052809291908181526020018280546106ae90614452565b80156106fb5780601f106106d0576101008083540402835291602001916106fb565b820191906000526020600020905b8154815290600101906020018083116106de57829003601f168201915b5050505050905090565b61070d613005565b73ffffffffffffffffffffffffffffffffffffffff1661072b611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572815250906107b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b091906140cf565b60405180910390fd5b50600115158173ffffffffffffffffffffffffffffffffffffffff1663e4cea52e306040518263ffffffff1660e01b81526004016107f7919061431d565b602060405180830381865afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083891906144af565b1515146040518060600160405280602e8152602001614854602e913990610895576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088c91906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036109325780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a72565b60011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b235199306040518263ffffffff1660e01b8152600401610991919061431d565b602060405180830381865afa1580156109ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d291906144af565b1515146040518060600160405280603681526020016149b16036913990610a2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2691906140cf565b60405180910390fd5b5080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600080610a80613005565b9050610a8d81858561300d565b600191505092915050565b6000600654905090565b600860019054906101000a900460ff1681565b600080610ac0613005565b9050600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311156040518060600160405280603a81526020016147ee603a913990610b9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9391906140cf565b60405180910390fd5b50610ba885828561324e565b610bb3858585613313565b60019150509392505050565b6000600b60009054906101000a900460ff16905090565b600080610be1613005565b9050610c75818585600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c70919061450b565b61300d565b600191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff16610ca0613005565b73ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f4f7261636c653a2053656e6465722063616e206e6f742062652030783000000081525090610d2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2691906140cf565b60405180910390fd5b50610d40610d3b613005565b611fa1565b80610d9f5750610d4e613005565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6040518060600160405280602b815260200161491a602b913990610df9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df091906140cf565b60405180910390fd5b50610e048282613613565b5050565b610e19610e13613005565b82613a3b565b50565b610e24613005565b73ffffffffffffffffffffffffffffffffffffffff16610e42611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e657281525090610ed0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec791906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156040518060600160405280602c8152602001614828602c913990610f7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7591906140cf565b60405180910390fd5b5060011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4cea52e306040518263ffffffff1660e01b8152600401610fde919061431d565b602060405180830381865afa158015610ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101f91906144af565b1515146040518060600160405280602e8152602001614854602e91399061107c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107391906140cf565b60405180910390fd5b506000600260146101000a81548160ff021916908315150217905550565b600860009054906101000a900460ff1681565b6000600260149054906101000a900460ff16905090565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600073ffffffffffffffffffffffffffffffffffffffff1661112f613005565b73ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601581526020017f4f7261636c653a204e6f206f7261636c65207365740000000000000000000000815250906111be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b591906140cf565b60405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611200613005565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280601e81526020017f4f7261636c653a20596f7520617265206e6f7420746865206f7261636c6500008152509061128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128591906140cf565b60405180910390fd5b50600860019054906101000a900460ff161560405180606001604052806021815260200161494560219139906112fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f191906140cf565b60405180910390fd5b506001600860016101000a81548160ff0219169083151502179055507f65521a0db60169023ef4718a72c0d13775b298d16968758a685e034d2ca1c87560405160405180910390a16040518060400160405280600f81526020017f456e61626c6564204275726e696e670000000000000000000000000000000000815250905090565b600073ffffffffffffffffffffffffffffffffffffffff1661139d613005565b73ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601581526020017f4f7261636c653a204e6f206f7261636c652073657400000000000000000000008152509061142c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142391906140cf565b60405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661146e613005565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280601e81526020017f4f7261636c653a20596f7520617265206e6f7420746865206f7261636c650000815250906114fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114f391906140cf565b60405180910390fd5b5060011515600260149054906101000a900460ff161515146040518060600160405280602f8152602001614a09602f91399061156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156591906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601f81526020017f4f776e61626c653a20416464726573732063616e206e6f74206265203078300081525090611617576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160e91906140cf565b60405180910390fd5b5061162181611fa1565b156040518060600160405280602b81526020016148a7602b91399061167c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167391906140cf565b60405180910390fd5b508073ffffffffffffffffffffffffffffffffffffffff167f29cf5705e8ef0d06742df5af365503ef11d8886f3122b65edca07d64cf3d2f0a60405160405180910390a280600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260146101000a81548160ff02191690831515021790555050565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000611768613005565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111156040518060600160405280603a81526020016147ee603a913990611800576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f791906140cf565b60405180910390fd5b506118138261180d613005565b8361324e565b61181d8282613a3b565b5050565b6060600073ffffffffffffffffffffffffffffffffffffffff16611843613005565b73ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601581526020017f4f7261636c653a204e6f206f7261636c65207365740000000000000000000000815250906118d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c991906140cf565b60405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611914613005565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280601e81526020017f4f7261636c653a20596f7520617265206e6f7420746865206f7261636c650000815250906119a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199991906140cf565b60405180910390fd5b50600860009054906101000a900460ff16604051806060016040528060228152602001614a616022913990611a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0491906140cf565b60405180910390fd5b506000600860006101000a81548160ff0219169083151502179055507faf79b4370f6af9d950564bbe6b81f7f0834c003c455db9248f4e55e6bf865eb760405160405180910390a16040518060400160405280601081526020017f44697361626c6564204d696e74696e6700000000000000000000000000000000815250905090565b611a98613005565b73ffffffffffffffffffffffffffffffffffffffff16611ab6611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e657281525090611b44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3b91906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156040518060600160405280602c8152602001614828602c913990611bf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be991906140cf565b60405180910390fd5b5060011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4cea52e306040518263ffffffff1660e01b8152600401611c52919061431d565b602060405180830381865afa158015611c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9391906144af565b1515146040518060600160405280602e8152602001614854602e913990611cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce791906140cf565b60405180910390fd5b506000600260156101000a81548160ff021916908315150217905550565b6000611d18613005565b73ffffffffffffffffffffffffffffffffffffffff16611d36611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e657281525090611dc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbb91906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156040518060600160405280602c8152602001614828602c913990611e72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6991906140cf565b60405180910390fd5b5060011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4cea52e306040518263ffffffff1660e01b8152600401611ed2919061431d565b602060405180830381865afa158015611eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1391906144af565b1515146040518060600160405280602e8152602001614854602e913990611f70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6791906140cf565b60405180910390fd5b506001600260156101000a81548160ff021916908315150217905550600260159054906101000a900460ff16905090565b60008173ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600a805461203390614452565b80601f016020809104026020016040519081016040528092919081815260200182805461205f90614452565b80156120ac5780601f10612081576101008083540402835291602001916120ac565b820191906000526020600020905b81548152906001019060200180831161208f57829003601f168201915b5050505050905090565b6060600073ffffffffffffffffffffffffffffffffffffffff166120d8613005565b73ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601581526020017f4f7261636c653a204e6f206f7261636c6520736574000000000000000000000081525090612167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215e91906140cf565b60405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166121a9613005565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280601e81526020017f4f7261636c653a20596f7520617265206e6f7420746865206f7261636c65000081525090612237576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222e91906140cf565b60405180910390fd5b50600860019054906101000a900460ff166040518060600160405280602281526020016148f860229139906122a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229991906140cf565b60405180910390fd5b506000600860016101000a81548160ff0219169083151502179055507f9bdcd7b2de47aadf92905c62d9ed9e7d1f02a42a8187d0549f686c76148c7c3560405160405180910390a16040518060400160405280601081526020017f44697361626c6564204275726e696e6700000000000000000000000000000000815250905090565b600080612330613005565b90506000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156040518060600160405280602581526020016148826025913990612411576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240891906140cf565b60405180910390fd5b5061241f828686840361300d565b60019250505092915050565b600080612436613005565b9050612443818585613313565b600191505092915050565b612456613005565b73ffffffffffffffffffffffffffffffffffffffff16612474611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e657281525090612502576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f991906140cf565b60405180910390fd5b5080600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f7420626520307830000000815250906125ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a391906140cf565b60405180910390fd5b506125b5613e2e565b60004711604051806060016040528060298152602001614a386029913990612613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260a91906140cf565b60405180910390fd5b5061261e8247613e7d565b612626613f71565b5050565b6000600754905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6060600073ffffffffffffffffffffffffffffffffffffffff166126dd613005565b73ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601581526020017f4f7261636c653a204e6f206f7261636c652073657400000000000000000000008152509061276c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276391906140cf565b60405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166127ae613005565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280601e81526020017f4f7261636c653a20596f7520617265206e6f7420746865206f7261636c6500008152509061283c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283391906140cf565b60405180910390fd5b50600860009054906101000a900460ff161560405180606001604052806021815260200161496660219139906128a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289f91906140cf565b60405180910390fd5b506001600860006101000a81548160ff0219169083151502179055507f38cb976174a5c48b8f7b2f07f69b47c271ba7f019948915dc12efb770c2a542c60405160405180910390a16040518060400160405280600f81526020017f456e61626c6564204d696e74696e670000000000000000000000000000000000815250905090565b6000612935613005565b73ffffffffffffffffffffffffffffffffffffffff16612953611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572815250906129e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129d891906140cf565b60405180910390fd5b5081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f742062652030783000000081525090612a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8291906140cf565b60405180910390fd5b5060008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612ac7919061431d565b602060405180830381865afa158015612ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b089190614554565b905060008111604051806060016040528060298152602001614a386029913990612b68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b5f91906140cf565b60405180910390fd5b508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85836040518363ffffffff1660e01b8152600401612ba49291906145e0565b6020604051808303816000875af1158015612bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be791906144af565b9250505092915050565b6000612bfb613005565b73ffffffffffffffffffffffffffffffffffffffff16612c19611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e657281525090612ca7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9e91906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156040518060600160405280602c8152602001614828602c913990612d55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d4c91906140cf565b60405180910390fd5b5060011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4cea52e306040518263ffffffff1660e01b8152600401612db5919061431d565b602060405180830381865afa158015612dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df691906144af565b1515146040518060600160405280602e8152602001614854602e913990612e53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4a91906140cf565b60405180910390fd5b506001600260146101000a81548160ff021916908315150217905550600260149054906101000a900460ff16905090565b612e8c613005565b73ffffffffffffffffffffffffffffffffffffffff16612eaa611ffb565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280602081526020017f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e657281525090612f38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f2f91906140cf565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601f81526020017f4f776e61626c653a20416464726573732063616e206e6f74206265203078300081525090612fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fd891906140cf565b60405180910390fd5b50612feb81613f7b565b50565b6000600260159054906101000a900460ff16905090565b600033905090565b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f7420626520307830000000815250906130b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130ad91906140cf565b60405180910390fd5b5082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f742062652030783000000081525090613160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161315791906140cf565b60405180910390fd5b5082600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161323f919061423c565b60405180910390a35050505050565b600061325a8484612634565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461330d57818110156040518060400160405280601d81526020017f546f6b656e3a20496e73756666696369656e7420616c6c6f77616e6365000000815250906132fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132f591906140cf565b60405180910390fd5b5061330c848484840361300d565b5b50505050565b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f7420626520307830000000815250906133bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133b391906140cf565b60405180910390fd5b5082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f742062652030783000000081525090613466576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161345d91906140cf565b60405180910390fd5b506000600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156040518060600160405280602681526020016148d26026913990613509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161350091906140cf565b60405180910390fd5b50838103600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461359f919061450b565b925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613603919061423c565b60405180910390a3505050505050565b600860009054906101000a900460ff166040518060400160405280601a81526020017f546f6b656e3a204d696e74696e672069732064697361626c65640000000000008152509061369a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161369191906140cf565b60405180910390fd5b5081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f742062652030783000000081525090613744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161373b91906140cf565b60405180910390fd5b50816007546006546b033b2e3c9fd0803ce80000006137639190614609565b61376d9190614609565b8111156040518060400160405280601e81526020017f546f6b656e3a20416d6f756e742069732061626f766520746865206361700000815250906137e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137de91906140cf565b60405180910390fd5b5082600660008282546137fa919061450b565b9250508190555082600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613850919061450b565b925050819055508373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516138b5919061423c565b60405180910390a360006138c7613005565b90506138d281611fa1565b15613941578473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fc3b8ae385c02b938fbbbd694d1da0761f755ee2c942f26bbfc6723c986d31b9b86604051613934919061423c565b60405180910390a3613a34565b60011515600260159054906101000a900460ff161515146040518060600160405280602a8152602001614987602a9139906139b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016139a991906140cf565b60405180910390fd5b508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f6de547f9e15aa8eb4e186426345d83ce982c2e4a1f811761da74ff56a2a2373186604051613a10919061423c565b60405180910390a36000600260156101000a81548160ff0219169083151502179055505b5050505050565b600860019054906101000a900460ff166040518060400160405280601a81526020017f546f6b656e3a204275726e696e672069732064697361626c656400000000000081525090613ac2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ab991906140cf565b60405180910390fd5b5081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280601d81526020017f546f6b656e3a20416464726573732063616e206e6f742062652030783000000081525090613b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613b6391906140cf565b60405180910390fd5b506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156040518060600160405280602281526020016149e76022913990613c0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613c0691906140cf565b60405180910390fd5b50828103600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508260066000828254613c689190614609565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051613ccd919061423c565b60405180910390a36000613cdf613005565b9050613cea81611fa1565b80613d425750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15613db1578073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fabf8a0bc0c6341b64dfa026a551cda9d3beb0e0525758303026bacbc11ad1d8c86604051613da4919061423c565b60405180910390a3613e27565b836007600082825401925050819055508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fe89157ccd232bcbcdb51b17ee427bcd37c60c0d26c4d97408b1309a9333c636e86604051613e1e919061423c565b60405180910390a35b5050505050565b600260035403613e73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613e6a90614689565b60405180910390fd5b6002600381905550565b80471015613ec0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613eb7906146f5565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff1682604051613ee690614746565b60006040518083038185875af1925050503d8060008114613f23576040519150601f19603f3d011682016040523d82523d6000602084013e613f28565b606091505b5050905080613f6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f63906147cd565b60405180910390fd5b505050565b6001600381905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561407957808201518184015260208101905061405e565b60008484015250505050565b6000601f19601f8301169050919050565b60006140a18261403f565b6140ab818561404a565b93506140bb81856020860161405b565b6140c481614085565b840191505092915050565b600060208201905081810360008301526140e98184614096565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000614121826140f6565b9050919050565b61413181614116565b811461413c57600080fd5b50565b60008135905061414e81614128565b92915050565b60006020828403121561416a576141696140f1565b5b60006141788482850161413f565b91505092915050565b6000819050919050565b61419481614181565b811461419f57600080fd5b50565b6000813590506141b18161418b565b92915050565b600080604083850312156141ce576141cd6140f1565b5b60006141dc8582860161413f565b92505060206141ed858286016141a2565b9150509250929050565b60008115159050919050565b61420c816141f7565b82525050565b60006020820190506142276000830184614203565b92915050565b61423681614181565b82525050565b6000602082019050614251600083018461422d565b92915050565b6000806000606084860312156142705761426f6140f1565b5b600061427e8682870161413f565b935050602061428f8682870161413f565b92505060406142a0868287016141a2565b9150509250925092565b600060ff82169050919050565b6142c0816142aa565b82525050565b60006020820190506142db60008301846142b7565b92915050565b6000602082840312156142f7576142f66140f1565b5b6000614305848285016141a2565b91505092915050565b61431781614116565b82525050565b6000602082019050614332600083018461430e565b92915050565b6000614343826140f6565b9050919050565b61435381614338565b811461435e57600080fd5b50565b6000813590506143708161434a565b92915050565b60006020828403121561438c5761438b6140f1565b5b600061439a84828501614361565b91505092915050565b600080604083850312156143ba576143b96140f1565b5b60006143c88582860161413f565b92505060206143d98582860161413f565b9150509250929050565b600080604083850312156143fa576143f96140f1565b5b60006144088582860161413f565b925050602061441985828601614361565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061446a57607f821691505b60208210810361447d5761447c614423565b5b50919050565b61448c816141f7565b811461449757600080fd5b50565b6000815190506144a981614483565b92915050565b6000602082840312156144c5576144c46140f1565b5b60006144d38482850161449a565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061451682614181565b915061452183614181565b9250828201905080821115614539576145386144dc565b5b92915050565b60008151905061454e8161418b565b92915050565b60006020828403121561456a576145696140f1565b5b60006145788482850161453f565b91505092915050565b6000819050919050565b60006145a66145a161459c846140f6565b614581565b6140f6565b9050919050565b60006145b88261458b565b9050919050565b60006145ca826145ad565b9050919050565b6145da816145bf565b82525050565b60006040820190506145f560008301856145d1565b614602602083018461422d565b9392505050565b600061461482614181565b915061461f83614181565b9250828203905081811115614637576146366144dc565b5b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000614673601f8361404a565b915061467e8261463d565b602082019050919050565b600060208201905081810360008301526146a281614666565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e6365000000600082015250565b60006146df601d8361404a565b91506146ea826146a9565b602082019050919050565b6000602082019050818103600083015261470e816146d2565b9050919050565b600081905092915050565b50565b6000614730600083614715565b915061473b82614720565b600082019050919050565b600061475182614723565b9150819050919050565b7f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008201527f6563697069656e74206d61792068617665207265766572746564000000000000602082015250565b60006147b7603a8361404a565b91506147c28261475b565b604082019050919050565b600060208201905081810360008301526147e6816147aa565b905091905056fe546f6b656e3a20596f7520617265206e6f7420617070726f76656420746f207370656e64207468697320616d6f756e74206f6620746f6b656e734f7261636c653a20536574207468652068616e646c6572206f7261636c6520616464726573732066697273744f7261636c653a20596f757220746f6b656e206973206e6f7420616c6c6f77656420696e204a4d20427269646765546f6b656e3a2044656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f7261636c653a204164647265737320697320616c72656164792061204272696467652048616e646c6572546f6b656e3a205472616e7366657220616d6f756e7420657863656564732062616c616e6365546f6b656e3a204275726e696e6720697320616c72656164792064697361626c65644f7261636c653a2043616c6c6572206973206e6f7420746865206f7261636c65206f722068616e646c6572546f6b656e3a204275726e696e6720697320616c726561647920656e61626c6564546f6b656e3a204d696e74696e6720697320616c726561647920656e61626c6564546f6b656e3a20596f7520617265206e6f7420617070726f76656420746f206d616e75616c206d696e744f7261636c653a204e6f7420616c6c6f77656420746f2065646974207468652048616e646c6572204f7261636c652061646472657373546f6b656e3a204275726e20616d6f756e7420657863656564732062616c616e63654f7261636c653a204e6f7420616c6c6f77656420746f2065646974207468652048616e646c65722061646472657373546f6b656e3a205468652062616c616e6365206d7573742062652067726561746572207468616e2030546f6b656e3a204d696e74696e6720697320616c72656164792064697361626c6564a2646970667358221220952ad89dbe38eb33491d9378f530e15470b6c325f5638cf5c928735b2d451d4264736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
Token.sol 449 lines
// SPDX-License-Identifier: UNLICENSED
// @Title JustMoney Bridged Token
// @Author Team JustMoney
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./BridgeOracle.sol";
import "./ReentrancyGuard.sol";
import "./Address.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ProspectiveToken is BridgeOracle, IERC20, ReentrancyGuard {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant _max = 1000000000 * (10**18);
uint256 private _totalSupply;
uint256 private _totalBurned;
bool public isMintingEnabled = true;
bool public isBurningEnabled = true;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor() {
_name = "Prospective";
_symbol = "PROS";
_decimals = 18;
}
modifier mintingEnabled() {
require(isMintingEnabled, Errors.MINT_DISABLED);
_;
}
modifier burningEnabled() {
require(isBurningEnabled, Errors.BURN_DISABLED);
_;
}
modifier notZeroAddress(address _account) {
require(_account != address(0), Errors.NOT_ZERO_ADDRESS);
_;
}
modifier belowCap(uint256 amount) {
require(amount <= (_max - _totalSupply - _totalBurned), Errors.ABOVE_CAP);
_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view override returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function totalBurned() public view returns (uint256) {
return _totalBurned;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view 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 override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view 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 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 override returns (bool) {
address spender = _msgSender();
require(amount <= _allowances[from][spender], Errors.NOT_APPROVED);
_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 returns (bool) {
address owner = _msgSender();
_approve(owner, spender, _allowances[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 returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[owner][spender];
require(currentAllowance >= subtractedValue, Errors.ALLOWANCE_BELOW_ZERO);
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
function enableMinting() public onlyHandlerOracle returns (string memory retMsg) {
require(!isMintingEnabled, Errors.MINT_ALREADY_ENABLED);
isMintingEnabled = true;
emit MintingEnabled();
retMsg = "Enabled Minting";
}
function disableMinting() public onlyHandlerOracle returns (string memory retMsg) {
require(isMintingEnabled, Errors.MINT_ALREADY_DISABLED);
isMintingEnabled = false;
emit MintingDisabled();
retMsg = "Disabled Minting";
}
function enableBurning() public onlyHandlerOracle returns (string memory retMsg) {
require(!isBurningEnabled, Errors.BURN_ALREADY_ENABLED);
isBurningEnabled = true;
emit BurningEnabled();
retMsg = "Enabled Burning";
}
function disableBurning() public onlyHandlerOracle returns (string memory retMsg) {
require(isBurningEnabled, Errors.BURN_ALREADY_DISABLED);
isBurningEnabled = false;
emit BurningDisabled();
retMsg = "Disabled Burning";
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* 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 notZeroAddress(from) notZeroAddress(to) {
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, Errors.TRANSFER_EXCEEDS_BALANCE);
unchecked { _balances[from] = fromBalance - amount; }
_balances[to] += amount;
emit Transfer(from, to, amount);
}
/**
* @dev Creates `amount` new tokens for `to`.
*
* See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must be the bridge or owner.
*/
function mint(address to, uint256 amount) public onlyOracleAndBridge {
_mint(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:
*
* - minting and burning must be enabled.
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal mintingEnabled notZeroAddress(account) belowCap(amount) {
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
address mintBy = _msgSender();
if ( isBridgeHandler(mintBy) ) {
emit BridgeMint(mintBy, account, amount);
} else {
require(oracleApprovedToManualMint == true, Errors.NOT_APPROVED_TO_MANUAL_MINT);
emit ManualMint(mintBy, account, amount);
oracleApprovedToManualMint = false;
}
}
/**
* @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 burningEnabled notZeroAddress(account) {
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, Errors.BURN_EXCEEDS_BALANCE);
unchecked { _balances[account] = accountBalance - amount; }
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
address burnBy = _msgSender();
if ( isBridgeHandler(burnBy) || burnBy == address(_handlerOracle) ) {
emit BridgeBurn(account, burnBy, amount);
} else {
unchecked { _totalBurned += amount; }
emit NormalBurn(account, burnBy, amount);
}
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This private 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) private notZeroAddress(owner) notZeroAddress(spender) {
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Spend `amount` form the allowance of `owner` toward `spender`.
*
* 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 {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, Errors.INSUFFICIENT_ALLOWANCE);
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public {
require(amount <= _allowances[account][_msgSender()], Errors.NOT_APPROVED);
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
function withdrawBASE(address payable recipient) external onlyOwner notZeroAddress(recipient) nonReentrant {
require(address(this).balance > 0, Errors.NOTHING_TO_WITHDRAW);
Address.sendValue(recipient, address(this).balance);
}
function withdrawERC20token(address _token, address payable recipient) external onlyOwner notZeroAddress(recipient) returns (bool) {
uint256 bal = IERC20(_token).balanceOf(address(this));
require(bal > 0, Errors.NOTHING_TO_WITHDRAW);
return IERC20(_token).transfer(recipient, bal);
}
event BridgeMint(address indexed by, address indexed to, uint256 value);
event ManualMint(address indexed by, address indexed to, uint256 value);
event BridgeBurn(address indexed from, address indexed by, uint256 value);
event NormalBurn(address indexed from, address indexed to, uint256 value);
event MintingEnabled();
event MintingDisabled();
event BurningEnabled();
event BurningDisabled();
}
Errors.sol 35 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Errors {
string constant MINT_DISABLED = "Token: Minting is disabled";
string constant BURN_DISABLED = "Token: Burning is disabled";
string constant MINT_ALREADY_ENABLED = "Token: Minting is already enabled";
string constant MINT_ALREADY_DISABLED = "Token: Minting is already disabled";
string constant BURN_ALREADY_ENABLED = "Token: Burning is already enabled";
string constant BURN_ALREADY_DISABLED = "Token: Burning is already disabled";
string constant NOT_ZERO_ADDRESS = "Token: Address can not be 0x0";
string constant NOT_APPROVED = "Token: You are not approved to spend this amount of tokens";
string constant NOT_APPROVED_TO_MANUAL_MINT = "Token: You are not approved to manual mint";
string constant TRANSFER_EXCEEDS_BALANCE = "Token: Transfer amount exceeds balance";
string constant BURN_EXCEEDS_BALANCE = "Token: Burn amount exceeds balance";
string constant INSUFFICIENT_ALLOWANCE = "Token: Insufficient allowance";
string constant NOTHING_TO_WITHDRAW = "Token: The balance must be greater than 0";
string constant ALLOWANCE_BELOW_ZERO = "Token: Decreased allowance below zero";
string constant ABOVE_CAP = "Token: Amount is above the cap";
string constant NOT_OWNER = "Ownable: Caller is not the owner";
string constant OWNABLE_NOT_ZERO_ADDRESS = "Ownable: Address can not be 0x0";
string constant NOT_ORACLE_OR_HANDLER = "Oracle: Caller is not the oracle or handler";
string constant ADDRESS_IS_HANDLER = "Oracle: Address is already a Bridge Handler";
string constant ADDRESS_IS_NOT_HANDLER = "Oracle: Address is not a Bridge Handler";
string constant TOKEN_NOT_ALLOWED_IN_BRIDGE = "Oracle: Your token is not allowed in JM Bridge";
string constant SET_HANDLER_ORACLE_FIRST = "Oracle: Set the handler oracle address first";
string constant ORACLE_NOT_SET = "Oracle: No oracle set";
string constant IS_NOT_ORACLE = "Oracle: You are not the oracle";
string constant NOT_ALLOWED_TO_EDIT_ORACLE = "Oracle: Not allowed to edit the Handler Oracle address";
string constant NOT_ALLOWED_TO_EDIT_HANDLER = "Oracle: Not allowed to edit the Handler address";
string constant NOT_ZERO_ADDRESS_SENDER = "Oracle: Sender can not be 0x0";
}
IERC20.sol 93 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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 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);
/**
* @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);
/**
* @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);
}
Address.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
library Address {
/**
* @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");
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 66 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "./Context.sol";
import "./Errors.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 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(), Errors.NOT_OWNER);
_;
}
/**
* @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), Errors.OWNABLE_NOT_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);
}
}
BridgeOracle.sol 107 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface HandlerOracle {
function approveHandlerChange() external returns (bool);
function approveManualMint() external returns (bool);
function isTokenContract(address tokenContract) external view returns (bool);
function isAllowedToChangeOracle(address tokenContract) external view returns (bool);
}
import "./Ownable.sol";
abstract contract BridgeOracle is Ownable {
HandlerOracle internal _handlerOracle;
address private _bridgeHandler;
bool internal oracleApprovedToSetHandler = false;
bool internal oracleApprovedToManualMint = false;
event BridgeHandlerSet(address indexed added);
/**
* @dev Returns true if the address is a bridge handler.
*/
function isBridgeHandler(address account) public view returns (bool) {
return _bridgeHandler == account;
}
/**
* @dev Throws if called by any account other than the oracle or a bridge handler.
*/
modifier onlyOracleAndBridge() {
require(_msgSender() != address(0), Errors.NOT_ZERO_ADDRESS_SENDER);
require(isBridgeHandler(_msgSender()) || address(_handlerOracle) == _msgSender(), Errors.NOT_ORACLE_OR_HANDLER);
_;
}
modifier onlyHandlerOracle() {
require(_msgSender() != address(0), Errors.ORACLE_NOT_SET);
require(_msgSender() == address(_handlerOracle), Errors.IS_NOT_ORACLE);
_;
}
function oracleIsApprovedToSetHandler() public view returns (bool) {
return oracleApprovedToSetHandler;
}
function oracleIsApprovedToManualMint() public view returns (bool) {
return oracleApprovedToManualMint;
}
function approveOracleToSetHandler() public onlyOwner returns (bool) {
require(address(_handlerOracle) != address(0), Errors.SET_HANDLER_ORACLE_FIRST);
require(_handlerOracle.isTokenContract(address(this)) == true, Errors.TOKEN_NOT_ALLOWED_IN_BRIDGE);
oracleApprovedToSetHandler = true;
return oracleApprovedToSetHandler;
}
function removeApproveForOracleToSetHandler() public onlyOwner {
require(address(_handlerOracle) != address(0), Errors.SET_HANDLER_ORACLE_FIRST);
require(_handlerOracle.isTokenContract(address(this)) == true, Errors.TOKEN_NOT_ALLOWED_IN_BRIDGE);
oracleApprovedToSetHandler = false;
}
function approveOracleToManualMint() public onlyOwner returns (bool) {
require(address(_handlerOracle) != address(0), Errors.SET_HANDLER_ORACLE_FIRST);
require(_handlerOracle.isTokenContract(address(this)) == true, Errors.TOKEN_NOT_ALLOWED_IN_BRIDGE);
oracleApprovedToManualMint = true;
return oracleApprovedToManualMint;
}
function removeApproveForOracleToManualMint() public onlyOwner {
require(address(_handlerOracle) != address(0), Errors.SET_HANDLER_ORACLE_FIRST);
require(_handlerOracle.isTokenContract(address(this)) == true, Errors.TOKEN_NOT_ALLOWED_IN_BRIDGE);
oracleApprovedToManualMint = false;
}
/**
* @dev Add handler address (`account`) that can mint and burn.
* Can only be called by the 'Handler Oracle Contract' after it was approved.
*/
function setBridgeHandler(address account) public onlyHandlerOracle {
require(oracleApprovedToSetHandler == true, Errors.NOT_ALLOWED_TO_EDIT_HANDLER);
require(account != address(0), Errors.OWNABLE_NOT_ZERO_ADDRESS);
require(!isBridgeHandler(account), Errors.ADDRESS_IS_HANDLER);
emit BridgeHandlerSet(account);
_bridgeHandler = account;
oracleApprovedToSetHandler = false;
}
function setHandlerOracle(address newHandlerOracle) public onlyOwner {
require(HandlerOracle(newHandlerOracle).isTokenContract(address(this)) == true, Errors.TOKEN_NOT_ALLOWED_IN_BRIDGE);
if ( address(_handlerOracle) == address(0) ) {
_handlerOracle = HandlerOracle(newHandlerOracle);
} else {
require(_handlerOracle.isAllowedToChangeOracle(address(this)) == true, Errors.NOT_ALLOWED_TO_EDIT_ORACLE);
_handlerOracle = HandlerOracle(newHandlerOracle);
}
}
}
ReentrancyGuard.sol 69 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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, _notEntered will be true
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;
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
isBridgeHandler 0x88ee3b06 → bool
isBurningEnabled 0x20c354bd → bool
isMintingEnabled 0x55c7ba14 → bool
name 0x06fdde03 → string
oracleIsApprovedToManualMint 0xf56a44a0 → bool
oracleIsApprovedToSetHandler 0x6e3518f3 → bool
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalBurned 0xd89135cd → uint256
totalSupply 0x18160ddd → uint256
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
approveOracleToManualMint 0x859e0d3a
No parameters
returns: bool
approveOracleToSetHandler 0xedf07bb5
No parameters
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
disableBurning 0x98603cca
No parameters
returns: string
disableMinting 0x7e5cd5c1
No parameters
returns: string
enableBurning 0x7581a8e6
No parameters
returns: string
enableMinting 0xe797ec1b
No parameters
returns: string
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address to
uint256 amount
removeApproveForOracleToManualMint 0x853fa8ce
No parameters
removeApproveForOracleToSetHandler 0x53d7a626
No parameters
setBridgeHandler 0x75eb259b
address account
setHandlerOracle 0x07aa037a
address newHandlerOracle
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
withdrawBASE 0xb19f2fc4
address recipient
withdrawERC20token 0xe7e11786
address _token
address recipient
returns: bool
Recent Transactions
No transactions found for this address