Address Contract Partially Verified
Address
0xeFA41F506EAA5c24666d4eE40888bA18FA60a1c7
Balance
0 ETH
Nonce
1
Code Size
19981 bytes
Creator
0x9A077D4f...CE87 at tx 0xfeee1875...941019
Indexed Transactions
0
Contract Bytecode
19981 bytes
0x608060405234801561001057600080fd5b50600436106102a05760003560e01c80635ee0fe32116101675780639ff4dea8116100ce578063bda02e7711610087578063bda02e771461051d578063c13f62e114610525578063d1e92c111461052d578063dd0eef3d14610540578063edfa9a9b14610548578063fcccedc714610550576102a0565b80639ff4dea8146104bf578063a1c4d1e7146104c7578063a765fbea146104e7578063b795f0d4146104fa578063b9a3c84c14610502578063bc1216301461050a576102a0565b806385209ee01161012057806385209ee0146104775780638c382eb21461048c57806392120aec14610494578063975236611461049c5780639b56d6c9146104a45780639f43ddd2146104b7576102a0565b80635ee0fe32146104315780635f1af1ca146104395780636ba2f9921461044c5780637048594b1461045f57806379599f961461046757806381a10ae11461046f576102a0565b80633403c2fc1161020b57806343e4771b116101c457806343e4771b146103b857806348e30c3f146103c05780634f8c4847146103c857806350f49846146103f257806355f57510146103fa5780635617151c1461041e576102a0565b80633403c2fc14610372578063360598e11461037a57806336980f581461038d578063391fe4e2146103955780633cb6ce831461039d5780633ee7a5ce146103a5576102a0565b806322f8e5661161025d57806322f8e5661461030557806324e8cb8d1461031857806325ed4dd81461033857806329cb924d1461035a5780632d5436cf1461036257806333a46ca21461036a576102a0565b80630c9229ca146102a55780630de15fd9146102c357806318928a0c146102d85780631c39c38d146102ed5780631fd00067146102f557806322611280146102fd575b600080fd5b6102ad610558565b6040516102ba9190614539565b60405180910390f35b6102cb61055e565b6040516102ba91906142fd565b6102eb6102e6366004614165565b61056d565b005b6102cb610642565b6102cb610651565b6102eb610660565b6102eb61031336600461427a565b6106e6565b61032b6103263660046140cd565b610760565b6040516102ba9190614cf9565b61034b610346366004614105565b610870565b6040516102ba93929190614d27565b6102ad610db3565b6102ad610e56565b61032b610e5c565b6102eb610fa9565b61032b610388366004614292565b61106d565b6102eb61165c565b6102ad611714565b61032b61171a565b61032b6103b33660046141fd565b6119b6565b61032b611a83565b6102ad611ab1565b6103db6103d636600461419a565b611ab7565b6040516102ba9b9a99989796959493929190614344565b6102ad611b7b565b61040d6104083660046140cd565b611b81565b6040516102ba959493929190614d03565b6102eb61042c3660046140cd565b611bce565b6102ad611da2565b61032b6104473660046141fd565b611da8565b6102eb61045a366004614233565b611ffc565b6102cb61227c565b6102eb61228b565b61032b612310565b61047f612328565b6040516102ba9190614550565b6102ad612331565b6102ad612337565b6102ad61233d565b61032b6104b23660046140cd565b612343565b6102ad61238e565b6102ad612394565b6104da6104d53660046140cd565b61239a565b6040516102ba919061442a565b61032b6104f5366004614292565b6124f8565b6102eb61267f565b6102cb612704565b6102eb6105183660046141fd565b612713565b6102eb61280e565b6102ad61282e565b6102eb61053b3660046141fd565b612834565b6102ad612841565b6102ad612847565b61032b61284d565b60075481565b6001546001600160a01b031681565b610575612ce0565b8161057f81612d08565b61058761171a565b50610590612d32565b610598612d5b565b6105a3826000612c20565b6105c85760405162461bcd60e51b81526004016105bf90614800565b60405180910390fd5b60006105d384612d6a565b90506105df8184612d92565b5082516040516001600160a01b038616907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c90600090a38251600154610634916001600160a01b039091169033903090612db3565b5061063d612e11565b505050565b6000546001600160a01b031681565b600f546001600160a01b031681565b610668612d32565b610670612d5b565b600061067b33612d6a565b90508060010154600014156106a25760405162461bcd60e51b81526004016105bf90614cca565b600281015460405133907f74d8a3658feb89d1a5c335229bbbfc3bbcfaf492769feb7aa4cd2d92efeaf69190600090a36106db81612e26565b506106e4612e11565b565b6000546001600160a01b03166106fb57600080fd5b60005460405163117c72b360e11b81526001600160a01b03909116906322f8e5669061072b908490600401614539565b600060405180830381600087803b15801561074557600080fd5b505af1158015610759573d6000803e3d6000fd5b5050505050565b61076861405f565b61077061171a565b50610779612d32565b610781612d5b565b61078961405f565b6040805160208101918290526370a0823160e01b909152806001600160a01b0385166370a082316107bd30602485016142fd565b60206040518083038186803b1580156107d557600080fd5b505afa1580156107e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080d91906141e5565b90526001549091506001600160a01b03848116911614156108415761083a610833612e40565b8290612e6d565b9150610845565b8091505b600f548251610862916001600160a01b0386811692911690612e90565b5061086b612e11565b919050565b600061087a61405f565b61088261405f565b61088a61171a565b50610893612ce0565b61089b612d32565b6108a3612d5b565b836108ac610db3565b11156108ca5760405162461bcd60e51b81526004016105bf906146a0565b60006108d589612d6a565b90506108fd6108e9368890038801886141fd565b604080516020810190915283548152612eaf565b925061090761405f565b60408051602081019091526003830154815261092290612ecd565b905061092c61405f565b6109366000612bf2565b6040805160208101909152600285015481529091506109559083612ef0565b1561097a57604080516020810190915260028401548152610977908390612e6d565b90505b61098261405f565b506040805160208101909152835481526109b5826109af836109a9368f90038f018f6141fd565b90612ef8565b90612f35565b6109d15760405162461bcd60e51b81526004016105bf906149e4565b6109f0826109ea838e8036038101906109a991906141fd565b90612ef0565b610a0c5760405162461bcd60e51b81526004016105bf90614b4e565b50610a15612f3d565b9350610a1f61405f565b610a2761405f565b610a2f61405f565b604080516020810190915286548152610a49908990612fd8565b9050610a558582612ef8565b9250610a618482612ef8565b9150610a6b61405f565b604080516020810190915260028801548152610a879083612ef8565b9050610a958f8a868461300d565b50610aac90506011610aa78489612c37565b613124565b506001600160a01b038d1660008181526010602090815260409182902080548351610160810185529485523392850192909252909a509190810160018152602001610af5610db3565b8152602001898152602001848152602001838152602001610b1e610b196001612bf2565b6131a5565b815260200160006001600160a01b03168152602001610b3d6000612bf2565b815260209081018990528254600180820185556000948552938290208351600a9092020180546001600160a01b03199081166001600160a01b0393841617825592840151948101805490931694909116939093178082556040830151929392919060ff60a01b1916600160a01b836004811115610bb657fe5b021790555060608201516002820155608082015151600382015560a082015151600482015560c082015151600582015560e08201515160068201556101008201516007820180546001600160a01b0319166001600160a01b039092169190911790556101208201515160088201556101409091015151600990910155610c3a61405f565b506040805160208101909152600d548152600186015415801590610c695750610c61610db3565b866001015411155b8015610c7a5750610c7a8882612f35565b15610c9957610c93601254610c8d610db3565b90612cbb565b60018701555b88336001600160a01b03168f6001600160a01b03167f39b4371645b4132767fd76a1aad3108ff95c20d7b687b24d171555f5459a75978b6000015187600001518760000151610ce6610db3565b604051610cf69493929190614d54565b60405180910390a48751600954610d1c916001600160a01b039091169033903090612db3565b6009548851604051630852cd8d60e31b81526001600160a01b03909216916342966c6891610d4c91600401614539565b600060405180830381600087803b158015610d6657600080fd5b505af1158015610d7a573d6000803e3d6000fd5b50508851600154610d9a93506001600160a01b0316915033903090612db3565b505050505050610da8612e11565b955095509592505050565b600080546001600160a01b031615610e505760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1157600080fd5b505afa158015610e25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4991906141e5565b9050610e53565b50425b90565b60125481565b610e6461405f565b610e6c612ce0565b610e7461171a565b50610e7d612d32565b610e85612d5b565b6000610e9033612d6a565b90508060010154600014158015610eb25750610eaa610db3565b816001015411155b610ece5760405162461bcd60e51b81526004016105bf90614912565b610ed661405f565b5060408051602080820183526002840154825282519081019092526003830154825290610f1e90610f0690612ecd565b604080516020810190915260028501548152906131c8565b15610f4157604080516020810190915260038301548152610f3e90612ecd565b90505b610f4b82826131cf565b9250610f5682612e26565b8251600154610f72916001600160a01b03909116903390612e90565b825160405133907fc86c3298cb79f486674dca87d9247e88b76146160e7d412cc59b26b14c358a6890600090a35050610e53612e11565b610fb1612ce0565b610fb96131f0565b610fc1612d32565b610fc9612d5b565b610fd1613220565b6001600160a01b0316336001600160a01b0316146110015760405162461bcd60e51b81526004016105bf90614980565b6005805460ff19166001179055600b54611019610db3565b600b819055611027906132bb565b600b5460405133917fd39eeb7157d9c446579a0893ecf9ecd87d1f466cdb270c6a189cf38ca1e30f489161105c918591614542565b60405180910390a2506106e4612e11565b61107561405f565b8282611081828261332d565b61108961171a565b50611092612d32565b61109a612d5b565b60006110a685876133a7565b60078101549091506001600160a01b03163314806110d0575060018101546001600160a01b031633145b806110e4575080546001600160a01b031633145b6111005760405162461bcd60e51b81526004016105bf90614605565b61110a8686613444565b61111261405f565b60408051602081019091526006830154815261112d90612ecd565b905061113761405f565b5060408051602081019091526008830154815261115261405f565b6040805160208101909152600385015481526111749084906109a99085612ef8565b905061117e61405f565b60408051602081019091526004860154815261119a9085612ef8565b90506111a461405f565b604080516020810190915260165481526111be9084612ef8565b90506111c861405f565b604080516020810190915260155481526111e29085612ef8565b90506111ec61405f565b60408051602081019091526014548152611207908590612ef8565b905061121161405f565b604080516020810190915260098a0154815261122d9089612ef8565b905061123761405f565b6112416000612bf2565b9050600360018b0154600160a01b900460ff16600481111561125f57fe5b14156114415760078a01546001600160a01b03163314156112b85761128261405f565b611296836112908887612c37565b90612c37565b90506112a28282612c37565b60078c0180546001600160a01b03191690559150505b89546001600160a01b031633141561130f576112d261405f565b6112dc8789612e6d565b90506112e661405f565b6112f08683612c37565b90506112fc8382612c37565b8c546001600160a01b0319168d55925050505b60018a01546001600160a01b03163314156113625761132c61405f565b6113408661133a8a88612e6d565b90612e6d565b905061134c8282612c37565b60018c0180546001600160a01b03191690559150505b60078a01546001600160a01b0316158015611385575089546001600160a01b0316155b801561139c575060018a01546001600160a01b0316155b1561143c57601060008f6001600160a01b03166001600160a01b031681526020019081526020016000208f815481106113d157fe5b600091825260208220600a9091020180546001600160a01b031990811682556001820180546001600160a81b03191690556002820183905560038201839055600482018390556005820183905560068201839055600782018054909116905560088101829055600901555b61159b565b600460018b0154600160a01b900460ff16600481111561145d57fe5b148015611476575060018a01546001600160a01b031633145b156114bb57611489826112908886612c37565b9050601060008f6001600160a01b03166001600160a01b031681526020019081526020016000208f815481106113d157fe5b6001808b0154600160a01b900460ff1660048111156114d657fe5b1480156114ef575060018a01546001600160a01b031633145b1561159b576114fe8683612c37565b9050601060008f6001600160a01b03166001600160a01b031681526020019081526020016000208f8154811061153057fe5b600091825260208220600a9091020180546001600160a01b031990811682556001820180546001600160a81b03191690556002820183905560038201839055600482018390556005820183905560068201839055600782018054909116905560088101829055600901555b6115a6816000612c20565b6115c25760405162461bcd60e51b81526004016105bf90614597565b6115cd60118261359a565b60018b0154909d50600160a01b900460ff1660048111156115ea57fe5b8d51895160405133927f342d1375efc923bbfe4f5b6575b7d47f40247499113546f8689206d3fd1cf82f9261161e92614542565b60405180910390a38c51600154611642916001600160a01b03909116903390612e90565b50505050505050505050611654612e11565b505092915050565b611664612ce0565b61166c612d32565b611674612d5b565b600061167f33612d6a565b905080600401546000146116a55760405162461bcd60e51b81526004016105bf90614c32565b60006116b5600c54610c8d610db3565b9050600b5481106116d85760405162461bcd60e51b81526004016105bf90614b17565b6004820181905560405133907fbf457c80c8bf299d5c48272c4c1168bf87b33d83b13f0ab9aac332ce1161ed1e90600090a250506106e4612e11565b60145481565b61172261405f565b61172a612d32565b611732612d5b565b600061173c613617565b90506000611748610db3565b905061175261405f565b61175a612e40565b9050611767816000613650565b15611774575050506119ae565b816003541415611786575050506119ae565b61178e61405f565b61179661405f565b6003546040516374201feb60e01b81526001600160a01b038716916374201feb916117c8919088908890600401614d3d565b604080518083038186803b1580156117df57600080fd5b505afa1580156117f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611817919061424f565b6003869055909250905061182b8282612c37565b9550611838866000613650565b156118475750505050506119ae565b61185186846131c8565b156118b25761185e61405f565b6118688785612e6d565b905061187261405f565b61187c8383612eaf565b90506118888382612e6d565b92506118948282612e6d565b91506118aa6118a38584612eaf565b8590612e6d565b935084975050505b805182516040517f19b92e73d08d517d71ec46136266e4f5d526a8cd4f8501d73713cebfe4f335ef90600090a36118e98684613667565b6118f4826000612c20565b1561197c578151600154611915916001600160a01b039091169087906136ab565b60015460405163432ce91960e11b81526001600160a01b0387811692638659d23292611949929091169086906004016143ed565b600060405180830381600087803b15801561196357600080fd5b505af1158015611977573d6000803e3d6000fd5b505050505b611987816000612c20565b156119a85780516001546119a8916001600160a01b03909116903390612e90565b50505050505b610e53612e11565b6119be61405f565b6119c6612ce0565b336119d081612d08565b6119d861171a565b506119e1612d32565b6119e9612d5b565b60006119f433612d6a565b9050611a01846000612c20565b611a1d5760405162461bcd60e51b81526004016105bf90614800565b611a278185613750565b80516040519194509033907f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b6590600090a38251600154611a74916001600160a01b03909116903390612e90565b50611a7d612e11565b50919050565b611a8b61405f565b611a93612d32565b60408051602081019091526008548152611aac90612ecd565b905090565b60135481565b60106020528160005260406000208181548110611ad057fe5b6000918252602091829020600a919091020180546001820154600283015460408051808701825260038601548152815180880183526004870154815282518089018452600588015481528351808a0185526006890154815260078901548551808c01875260088b0154815286519b8c019096526009909901548a526001600160a01b039788169b508787169a50600160a01b90960460ff16989497929691959094909391909216918b565b60115481565b600660209081526000918252604091829020825180830184528154815260018201548451808501865260028401548152855194850190955260038301548452600490920154909391929085565b611bd6612ce0565b33611be081612d08565b611be8612d32565b611bf0612d5b565b611c38611bfd6000612bf2565b6001600160a01b03841660009081526006602090815260409182902082519182019092526003909101548152611c3290612ecd565b90613796565b611c545760405162461bcd60e51b81526004016105bf90614a72565b6000611c5f33612d6a565b90508060040154600014158015611c815750611c79610db3565b816004015411155b611c9d5760405162461bcd60e51b81526004016105bf90614949565b600060048083018281556001600160a01b038616808452600660205260408085208654815560018088015481830155600280890154818401556003808a01548185015595549287019290925533808852838820888155918201889055918101879055938401869055929093018490559151919290917ff1a2dcf23621f1a96185c79d39a5776b5ba3dadbea70c5aa86d84c17c7e9418e9190a36040516001600160a01b038416907ff60993fa76f94c9e0a803526ee6e1314814ed4d2b0d223febf1436b36897fb3790600090a260405133907fcad20625296d189a6fc6e5b39d0d544e5bd99dbda0c8f2f0ecffef3e0fbcc28290600090a250611d9e612e11565b5050565b60165481565b611db061405f565b33611dba81612d08565b611dc261171a565b50611dcb612d32565b611dd3612d5b565b6000611dde33612d6a565b604080516020810190915281548152909150611dfb9085906131c8565b15611e185760405162461bcd60e51b81526004016105bf90614703565b611e2061405f565b604080516020810190915282548152611e3a908690612fd8565b9050611e4461405f565b604080516020810190915260038401548152611e6a90611e6390612ecd565b8390612ef8565b604080516020810190915284548152909150611e869087613796565b15611e9b57611e943361379d565b9450611f26565b611ea583826131cf565b9450611eaf61405f565b604080516020810190915284548152611ec89088612e6d565b6040805160208101909152600d548152909150611ee6908290612f35565b611f025760405162461bcd60e51b81526004016105bf90614799565b8051845560408051602081019091526007548152611f209088612e6d565b51600755505b8551855160405133907fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a92990600090a48451600154611f71916001600160a01b03909116903390612e90565b8551600954611f8f916001600160a01b039091169033903090612db3565b6009548651604051630852cd8d60e31b81526001600160a01b03909216916342966c6891611fbf91600401614539565b600060405180830381600087803b158015611fd957600080fd5b505af1158015611fed573d6000803e3d6000fd5b50505050505050611a7d612e11565b612004612ce0565b61200c61171a565b50612015612d32565b61201d612d5b565b336000908152600660209081526040918290208251918201909252600382015481526120709061205290859061129090612ecd565b60408051602081019091528354815261206b9085612c37565b6138af565b80612080575061208083836138af565b61209c5760405162461bcd60e51b81526004016105bf90614a41565b6001810154156120be5760405162461bcd60e51b81526004016105bf906148e6565b6040805160208101909152815481526120d8906000613650565b15612140576040805160208101909152600d5481526120f8908390612f35565b6121145760405162461bcd60e51b81526004016105bf90614799565b60405133907ff60993fa76f94c9e0a803526ee6e1314814ed4d2b0d223febf1436b36897fb3790600090a25b61214a8184612d92565b506040805160208101909152815481526121649083612c37565b518155604080516020810190915260075481526121819083612c37565b516007558151835160405133907f4b82aa16e071a61de1a6b9aeec9edab0356331f8122c78683b469ac8e685dabc90600090a482516001546121d2916001600160a01b039091169033903090612db3565b60095482516040516340c10f1960e01b81526001600160a01b03909216916340c10f199161220591339190600401614311565b602060405180830381600087803b15801561221f57600080fd5b505af1158015612233573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225791906141c5565b6122735760405162461bcd60e51b81526004016105bf906149ad565b50611d9e612e11565b6009546001600160a01b031681565b612293613915565b61229b6131f0565b6122a361171a565b506122ac612d32565b6122b4612d5b565b6005805460ff191660011790556122d2306122cd612f3d565b61393e565b6122dd600b546132bb565b60405133907f18600820405d6cf356e3556301762ca32395e72d8c81494fa344835c9da3633d90600090a26106e4612e11565b61231861405f565b612320612d32565b611aac612e40565b60055460ff1681565b60085481565b600d5481565b600a5481565b61234b61405f565b612353612d32565b6001600160a01b0382166000908152600660209081526040918290208251918201909252600390910154815261238890612ecd565b92915050565b600b5481565b600c5481565b60606123a4612d32565b6001600160a01b038216600090815260106020908152604080832080548251818502810185019093528083529193909284015b828210156124ed5760008481526020908190206040805161016081018252600a860290920180546001600160a01b039081168452600182015490811694840194909452919290830190600160a01b900460ff16600481111561243557fe5b600481111561244057fe5b8152600282015460208083019190915260408051808301825260038501548152818401528051808301825260048501548152606084015280518083018252600585015481526080840152805180830182526006850154815260a084015260078401546001600160a01b031660c0840152805180830182526008850154815260e0840152805180830190915260099093015483526101009091019190915290825260019290920191016123d7565b505050509050919050565b61250061405f565b828261250c8282613a87565b61251461171a565b5061251d612d32565b612525612d5b565b600061253185876133a7565b905061253b61405f565b6040805160208101909152600683015481526125839061255a90612ecd565b604080516020808201835260145482528251908101909252600486015482526109a99190612ef8565b9050612590601182613124565b5060018201805460ff60a01b1916600160a11b1790556007820180546001600160a01b0319163317905560028201546125c8906132bb565b6001820154815160405133926001600160a01b0390811692908a16917fcaca181ccad7979cf36ed4fc921e496001ab5264608f0fac7007ae1b43d3610291612612918d9190614542565b60405180910390a4604080516020810190915260098301548152612637908290612c37565b60408051602081019091526009840154815290955061265790339061393e565b8051600154612675916001600160a01b039091169033903090612db3565b5050611654612e11565b612687612ce0565b61268f612d32565b612697612d5b565b60006126a233612d6a565b90508060040154600014156126c95760405162461bcd60e51b81526004016105bf90614673565b60405133907f2e5702420c76e041698ad7ba57a9ff5cadccf647ea8d96e6007a40b5b2662f5690600090a260006004909101556106e4612e11565b6002546001600160a01b031681565b61271b612ce0565b3361272581612d08565b61272d612d32565b612735612d5b565b600061274033612d6a565b905061274d836000612c20565b801561277a575060408051602081019091526003820154815261277a9061277390612ecd565b8490612ef0565b6127965760405162461bcd60e51b81526004016105bf90614800565b60006127a6600c54610c8d610db3565b9050600b5481106127c95760405162461bcd60e51b81526004016105bf90614b17565b6001820181905583516002830181905560405133907fd33b726e11d2c5d38e6702b16613df0160a07f7ba5185455ee3c45d0494fab1190600090a35050611d9e612e11565b612816612ce0565b61281e612d32565b612826612d5b565b6106e4612e11565b60155481565b61283e338261056d565b50565b60045481565b600e5481565b61285561405f565b61285d613915565b61286561171a565b5061286e612d32565b612876612d5b565b600060055460ff16600281111561288957fe5b14156128a75760405162461bcd60e51b81526004016105bf90614c06565b600260055460ff1660028111156128ba57fe5b146128dc576128ca600b54613ae7565b51600e556005805460ff191660021790555b6128e461405f565b6040805160208101918290526009546370a0823160e01b9092529081906001600160a01b03166370a0823161291c33602485016142fd565b60206040518083038186803b15801561293457600080fd5b505afa158015612948573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061296c91906141e5565b9052905061297861405f565b6040805160208101909152600e548152612993908390612ef8565b3360009081526006602090815260408083208151928301909152600381015482529293506129cb91906129c590612ecd565b90612c20565b15612ac2576129d861405f565b6040805160208082018352600e5482528251908101909252835482526129fe9190612ef8565b9050612a0861405f565b604080516020810190915260038401548152612a2390612ecd565b9050612a2d61405f565b612a378383613c3d565b612a505760405180602001604052806000815250612a5a565b612a5a8284612e6d565b9050612a668582612c37565b336000818152600660205260408082208281556001810183905560028101839055600381018390556004018290555192975090917fcad20625296d189a6fc6e5b39d0d544e5bd99dbda0c8f2f0ecffef3e0fbcc2829190a25050505b612aca61405f565b60408051602081019091526008548152612aed90612ae790612ecd565b84612eaf565b9050612afa60088261359a565b60408051602081019091526007548152909550612b179085612e6d565b516007558351855160405133907f9d349c102bec959fb7f20f9a3621e015819d3ae4ed6e9afd1f56a69d5845600690600090a48451600154612b66916001600160a01b03909116903390612e90565b8351600954612b84916001600160a01b039091169033903090612db3565b6009548451604051630852cd8d60e31b81526001600160a01b03909216916342966c6891612bb491600401614539565b600060405180830381600087803b158015612bce57600080fd5b505af1158015612be2573d6000803e3d6000fd5b5050505050505050610e53612e11565b612bfa61405f565b604080516020810190915280612c1884670de0b6b3a7640000612c7a565b905292915050565b6000612c2b82612bf2565b51835111905092915050565b612c3f61405f565b6040805160208101909152825184518291612c5a9190612cbb565b90529392505050565b6000612c6e82612bf2565b51835110905092915050565b600082612c8957506000612388565b82820282848281612c9657fe5b0414612cb45760405162461bcd60e51b81526004016105bf906148a5565b9392505050565b600082820183811015612cb45760405162461bcd60e51b81526004016105bf9061463c565b600b54612ceb610db3565b106106e45760405162461bcd60e51b81526004016105bf90614aa9565b612d1181612d6a565b600101541561283e5760405162461bcd60e51b81526004016105bf906148e6565b600054600160a01b900460ff166106e45760405162461bcd60e51b81526004016105bf90614bcf565b6000805460ff60a01b19169055565b600081612d7681613c44565b50506001600160a01b0316600090815260066020526040902090565b612d9a61405f565b612da78360030183613124565b50612cb4600883613124565b612e0b846323b872dd60e01b858585604051602401612dd4939291906143c9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613c97565b50505050565b6000805460ff60a01b1916600160a01b179055565b612e306000612bf2565b5160028201556000600190910155565b612e4861405f565b60408051602081019091526011548152611aac90612e6590612ecd565b611290613d7c565b612e7561405f565b6040805160208101909152825184518291612c5a9190613d84565b61063d8363a9059cbb60e01b8484604051602401612dd4929190614311565b612eb761405f565b8151835110612ec65781612cb4565b5090919050565b612ed561405f565b60408051602081019091526004548152612388908390612ef8565b519051111590565b612f0061405f565b6040805160208101909152825184518291670de0b6b3a764000091612f2491612c7a565b81612f2b57fe5b0490529392505050565b519051101590565b612f4561405f565b6000612f4f613617565b600154604051635b97aadd60e01b81529192506001600160a01b0380841692635b97aadd92612f829216906004016142fd565b60206040518083038186803b158015612f9a57600080fd5b505afa158015612fae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd29190614218565b91505090565b612fe061405f565b6040805160208101909152825184518291612c5a9161300790670de0b6b3a7640000612c7a565b90613dc6565b600061301885612d6a565b604080516020810190915281548152909150613035908590613796565b801561305d575060408051602081019091526003820154815261305d908490611c3290612ecd565b156130725761306b8561379d565b5050612e0b565b61307c81846131cf565b5061308561405f565b60408051602081019091528254815261309e9086612e6d565b6040805160208101909152600d5481529091506130bc908290612f35565b6130d85760405162461bcd60e51b81526004016105bf90614799565b805182556040805160208101909152600283015481526130f89084612e6d565b516002830155604080516020810190915260075481526131189086612e6d565b51600755505050505050565b61312c61405f565b61313461405f565b60408051602081019091528454815261314c90612ecd565b905061315661405f565b61315f846131a5565b60408051602081019091528654815290915061317b9082612c37565b51808655604080516020810190915290815261319c90839061133a90612ecd565b95945050505050565b6131ad61405f565b60408051602081019091526004548152612388908390612fd8565b5190511190565b6131d761405f565b6131e4836003018361359a565b50612cb460088361359a565b600060055460ff16600281111561320357fe5b146106e45760405162461bcd60e51b81526004016105bf90614731565b6002546040516302abf57960e61b81526000916001600160a01b03169063aafd5e409061326b90762334b730b731b4b0b621b7b73a3930b1ba39a0b236b4b760491b90600401614539565b60206040518083038186803b15801561328357600080fd5b505afa158015613297573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aac91906140e9565b60006132c5613e08565b600a546040516368ad8ae360e01b81529192506001600160a01b038316916368ad8ae3916132f7918690600401614542565b600060405180830381600087803b15801561331157600080fd5b505af1158015613325573d6000803e3d6000fd5b505050505050565b600061333982846133a7565b600181810154919250600160a01b90910460ff169081600481111561335a57fe5b118061338b5750613369610db3565b61337283613e42565b1115801561338b5750600181600481111561338957fe5b145b612e0b5760405162461bcd60e51b81526004016105bf906145ce565b6001600160a01b0382166000908152601060205260408120805483108015613405575060008184815481106133d857fe5b90600052602060002090600a020160010160149054906101000a900460ff16600481111561340257fe5b14155b6134215760405162461bcd60e51b81526004016105bf906147d0565b80838154811061342d57fe5b90600052602060002090600a020191505092915050565b600061345082846133a7565b905060026001820154600160a01b900460ff16600481111561346e57fe5b146134795750611d9e565b6134868160020154613ae7565b51600882015561349461405f565b6040805160208082018352600885015482528251908101909252600384015482526134bf9190612ef8565b90506134c961405f565b604080516020810190915260135481526134e4908390612ef8565b6040805160208101909152600585015481529091506000906135069083612f35565b905080613514576004613517565b60035b60018501805460ff60a01b1916600160a01b83600481111561353557fe5b0217905550600184015460078501546040516001600160a01b03928316928881169233927f6c5582199868fabbe697f9ea10abe481bacf53ac78c02a965b34dff82fd20e3b9261358a9216908c908890614407565b60405180910390a4505050505050565b6135a261405f565b6135aa61405f565b6040805160208101909152845481526135c290612ecd565b90506135cc61405f565b6135d5846131a5565b6040805160208101909152865481529091506135f19082612e6d565b51808655604080516020810190915290815261319c9061361090612ecd565b8390612e6d565b6002546040516302abf57960e61b81526000916001600160a01b03169063aafd5e409061326b906453746f726560d81b90600401614539565b600061365b82612bf2565b51835114905092915050565b61366f61405f565b6136798383613e5d565b90506136a261368c8261133a6001612bf2565b6040805160208101909152600454815290612ef8565b51600455505050565b600061372f82856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b81526004016136df92919061432a565b60206040518083038186803b1580156136f757600080fd5b505afa15801561370b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d91906141e5565b9050612e0b8463095ea7b360e01b8584604051602401612dd4929190614311565b61375861405f565b613765836003018361359a565b5061376f83613ee7565b61378b5760405162461bcd60e51b81526004016105bf90614a1b565b612cb460088361359a565b5190511490565b6137a561405f565b60006137b083612d6a565b90506137ba61405f565b604080516020810190915260085481526137d390612ecd565b90506137dd61405f565b5060408051602080820183526003850154825282519081019092526008548252906138089082612e6d565b51600855604080516020808201835285548252825190810190925260075482526138329190612e6d565b516007556001600160a01b038516600081815260066020526040808220828155600181018390556002810183905560038101839055600401829055517fcad20625296d189a6fc6e5b39d0d544e5bd99dbda0c8f2f0ecffef3e0fbcc2829190a26040805160208101909152600854815261319c9061361090612ecd565b60006138b961405f565b604080516020810190915260085481526138eb906138d690612ecd565b60408051602081019091526007548152613f1d565b90506138f561405f565b6138ff8585613f1d565b905061390b82826131c8565b1595945050505050565b600b54613920610db3565b10156106e45760405162461bcd60e51b81526004016105bf90614ae0565b613949816000613650565b1561395357611d9e565b6001600160a01b0382163014613986578051600154613981916001600160a01b039091169084903090612db3565b6139ca565b61398e61405f565b613996612e40565b90506139a281836131c8565b6139be5760405162461bcd60e51b81526004016105bf90614c93565b6139c88282613667565b505b80516040517f4f9bf7e8cd0f2456f9c43d2597bedcf1446c9c64544053f1ece6423ae9a07e5290600090a260006139ff613617565b8251600154919250613a1c916001600160a01b03169083906136ab565b60015460405163432ce91960e11b81526001600160a01b0383811692638659d23292613a50929091169086906004016143ed565b600060405180830381600087803b158015613a6a57600080fd5b505af1158015613a7e573d6000803e3d6000fd5b50505050505050565b6000613a9382846133a7565b9050613a9e81613e42565b613aa6610db3565b108015613acb5750600180820154600160a01b900460ff166004811115613ac957fe5b145b61063d5760405162461bcd60e51b81526004016105bf9061486e565b613aef61405f565b6000613af9613e08565b600a5460405163501f440d60e11b81529192506001600160a01b0383169163a03e881a91613b2b918790600401614542565b60206040518083038186803b158015613b4357600080fd5b505afa158015613b57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b7b91906141c5565b613b975760405162461bcd60e51b81526004016105bf90614768565b600a54604051636494078360e11b81526000916001600160a01b0384169163c9280f0691613bc9918890600401614542565b60206040518083038186803b158015613be157600080fd5b505afa158015613bf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c1991906141e5565b90506000811215613c28575060005b60408051602081019091529081529392505050565b5190511090565b6001600160a01b03811660009081526006602090815260408083208151928301909152600301548152613c7b91906129c590612ecd565b61283e5760405162461bcd60e51b81526004016105bf90614837565b613ca9826001600160a01b0316613f4f565b613cc55760405162461bcd60e51b81526004016105bf90614c5c565b60006060836001600160a01b031683604051613ce191906142e1565b6000604051808303816000865af19150503d8060008114613d1e576040519150601f19603f3d011682016040523d82523d6000602084013e613d23565b606091505b509150915081613d455760405162461bcd60e51b81526004016105bf906146ce565b805115612e0b5780806020019051810190613d6091906141c5565b612e0b5760405162461bcd60e51b81526004016105bf90614b85565b611a9361405f565b6000612cb483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613f8b565b6000612cb483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613fb7565b6002546040516302abf57960e61b81526000916001600160a01b03169063aafd5e409061326b90654f7261636c6560d01b90600401614539565b60006123886012548360020154612cbb90919063ffffffff16565b613e6561405f565b8251600090613e7c90670de0b6b3a7640000612c7a565b8351909150600090613e8f908390613dc6565b8451909150600090613ea2908490613fee565b90508015613ece57604080516020810190915280613ec1846001612cbb565b8152509350505050612388565b6040518060200160405280838152509350505050612388565b60408051602081019091526003820154815260009061238890613f0990612ecd565b6040805160208101909152845481526138af565b613f2561405f565b613f30826000612c20565b613f4557613f3e6000612bf2565b9050612388565b613f3e8383612fd8565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590613f8357508115155b949350505050565b60008184841115613faf5760405162461bcd60e51b81526004016105bf9190614564565b505050900390565b60008183613fd85760405162461bcd60e51b81526004016105bf9190614564565b506000838581613fe457fe5b0495945050505050565b6000612cb483836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506000818361404c5760405162461bcd60e51b81526004016105bf9190614564565b5082848161405657fe5b06949350505050565b6040518060200160405280600081525090565b600060208284031215611a7d578081fd5b600060208284031215614094578081fd5b61409e6020614d6f565b9135825250919050565b6000602082840312156140b9578081fd5b6140c36020614d6f565b9151825250919050565b6000602082840312156140de578081fd5b8135612cb481614dc2565b6000602082840312156140fa578081fd5b8151612cb481614dc2565b600080600080600060a0868803121561411c578081fd5b853561412781614dc2565b94506141368760208801614072565b93506141458760408801614072565b92506141548760608801614072565b949793965091946080013592915050565b60008060408385031215614177578182fd5b823561418281614dc2565b91506141918460208501614083565b90509250929050565b600080604083850312156141ac578182fd5b82356141b781614dc2565b946020939093013593505050565b6000602082840312156141d6578081fd5b81518015158114612cb4578182fd5b6000602082840312156141f6578081fd5b5051919050565b60006020828403121561420e578081fd5b612cb48383614083565b600060208284031215614229578081fd5b612cb483836140a8565b60008060408385031215614245578182fd5b6141828484614083565b60008060408385031215614261578182fd5b61426b84846140a8565b915061419184602085016140a8565b60006020828403121561428b578081fd5b5035919050565b600080604083850312156142a4578182fd5b8235915060208301356142b681614dc2565b809150509250929050565b6001600160a01b03169052565b600581106142d857fe5b9052565b519052565b600082516142f3818460208701614d96565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b038c811682528b166020820152610160810160058b1061436757fe5b8a604083015289606083015288516080830152875160a0830152865160c0830152855160e083015261439d6101008301866142c1565b6143ab6101208301856142dc565b6143b96101408301846142dc565b9c9b505050505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0392909216825251602082015260400190565b6001600160a01b0393909316835260208301919091521515604082015260600190565b602080825282518282018190526000919060409081850190868401855b8281101561452c57815161445c8582516142c1565b8681015161446c888701826142c1565b508581015161447d878701826142ce565b506060818101519086015260808082015161449a828801826142dc565b505060a0808201516144ae828801826142dc565b505060c0808201516144c2828801826142dc565b505060e0808201516144d6828801826142dc565b5050610100808201516144eb828801826142c1565b505061012080820151614500828801826142dc565b50506101409081015190614516868201836142dc565b5050610160939093019290850190600101614447565b5091979650505050505050565b90815260200190565b918252602082015260400190565b602081016003831061455e57fe5b91905290565b6000602082528251806020840152614583816040850160208701614d96565b601f01601f19169190910160400192915050565b60208082526019908201527f496e76616c6964207769746864726177616c20616d6f756e7400000000000000604082015260600190565b6020808252601c908201527f4c69717569646174696f6e206e6f7420776974686472617761626c6500000000604082015260600190565b6020808252601e908201527f43616c6c65722063616e6e6f7420776974686472617720726577617264730000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601390820152722737903832b73234b733903a3930b739b332b960691b604082015260600190565b6020808252601490820152734d696e656420616674657220646561646c696e6560601b604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b602080825260149082015273125b9d985b1a59081d1bdad95b88185b5bdd5b9d60621b604082015260600190565b6020808252601a908201527f436f6e7472616374207374617465206973206e6f74204f50454e000000000000604082015260600190565b602080825260179082015276556e7265736f6c766564206f7261636c6520707269636560481b604082015260600190565b6020808252601e908201527f42656c6f77206d696e696d756d2073706f6e736f7220706f736974696f6e0000604082015260600190565b602080825260169082015275125b9d985b1a59081b1a5c5d5a59185d1a5bdb88125160521b604082015260600190565b60208082526019908201527f496e76616c696420636f6c6c61746572616c20616d6f756e7400000000000000604082015260600190565b6020808252601a908201527f506f736974696f6e20686173206e6f20636f6c6c61746572616c000000000000604082015260600190565b6020808252601a908201527f4c69717569646174696f6e206e6f742064697370757461626c65000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526012908201527114195b991a5b99c81dda5d1a191c985dd85b60721b604082015260600190565b60208082526018908201527f496e76616c696420776974686472617720726571756573740000000000000000604082015260600190565b60208082526018908201527f496e76616c6964207472616e7366657220726571756573740000000000000000604082015260600190565b60208082526013908201527221b0b63632b9103737ba1023b7bb32b93737b960691b604082015260600190565b6020808252601f908201527f4d696e74696e672073796e74686574696320746f6b656e73206661696c656400604082015260600190565b6020808252601e908201527f4352206973206d6f7265207468616e206d6178206c69712e2070726963650000604082015260600190565b6020808252600c908201526b21a9103132b637bb9023a1a960a11b604082015260600190565b602080825260179082015276125b9cdd59999a58da595b9d0818dbdb1b185d195c985b604a1b604082015260600190565b6020808252601c908201527f53706f6e736f7220616c72656164792068617320706f736974696f6e00000000604082015260600190565b60208082526018908201527f4f6e6c792063616c6c61626c65207072652d6578706972790000000000000000604082015260600190565b60208082526019908201527f4f6e6c792063616c6c61626c6520706f73742d65787069727900000000000000604082015260600190565b6020808252601b908201527f52657175657374206578706972657320706f73742d6578706972790000000000604082015260600190565b6020808252601e908201527f4352206973206c657373207468616e206d696e206c69712e2070726963650000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601290820152712ab732bc3834b932b2103837b9b4ba34b7b760711b604082015260600190565b60208082526010908201526f2832b73234b733903a3930b739b332b960811b604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b6020808252601a908201527f46696e616c20666565206973206d6f7265207468616e20506643000000000000604082015260600190565b602080825260159082015274139bc81c195b991a5b99c81dda5d1a191c985dd85b605a1b604082015260600190565b9051815260200190565b94518552602085019390935290516040840152516060830152608082015260a00190565b9283529051602083015251604082015260600190565b928352602083019190915251604082015260600190565b93845260208401929092526040830152606082015260800190565b60405181810167ffffffffffffffff81118282101715614d8e57600080fd5b604052919050565b60005b83811015614db1578181015183820152602001614d99565b83811115612e0b5750506000910152565b6001600160a01b038116811461283e57600080fdfea26469706673582212200866abffe7bab1fd437be6e9725da35ac1d3906051c2d8771063069a7d6a78d464736f6c634300060c0033
Verified Source Code Partial Match
Compiler: v0.6.12+commit.27d51765
EVM: istanbul
Optimization: Yes (199 runs)
ExpiringMultiParty.sol 3625 lines
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @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) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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 sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @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) {
// 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 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts 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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts 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 mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.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/Address.sol
pragma solidity ^0.6.2;
/**
* @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) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
pragma solidity ^0.6.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 ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
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));
}
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'
// solhint-disable-next-line max-line-length
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).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_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.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/common/implementation/FixedPoint.sol
pragma solidity ^0.6.0;
/**
* @title Library for fixed point arithmetic on uints
*/
library FixedPoint {
using SafeMath for uint256;
// Supports 18 decimals. E.g., 1e18 represents "1", 5e17 represents "0.5".
// Can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.
uint256 private constant FP_SCALING_FACTOR = 10**18;
struct Unsigned {
uint256 rawValue;
}
/**
* @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5**18`.
* @param a uint to convert into a FixedPoint.
* @return the converted FixedPoint.
*/
function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {
return Unsigned(a.mul(FP_SCALING_FACTOR));
}
/**
* @notice Whether `a` is equal to `b`.
* @param a a FixedPoint.
* @param b a uint256.
* @return True if equal, or False.
*/
function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue == fromUnscaledUint(b).rawValue;
}
/**
* @notice Whether `a` is equal to `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return True if equal, or False.
*/
function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue == b.rawValue;
}
/**
* @notice Whether `a` is greater than `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return True if `a > b`, or False.
*/
function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue > b.rawValue;
}
/**
* @notice Whether `a` is greater than `b`.
* @param a a FixedPoint.
* @param b a uint256.
* @return True if `a > b`, or False.
*/
function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue > fromUnscaledUint(b).rawValue;
}
/**
* @notice Whether `a` is greater than `b`.
* @param a a uint256.
* @param b a FixedPoint.
* @return True if `a > b`, or False.
*/
function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue > b.rawValue;
}
/**
* @notice Whether `a` is greater than or equal to `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return True if `a >= b`, or False.
*/
function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue >= b.rawValue;
}
/**
* @notice Whether `a` is greater than or equal to `b`.
* @param a a FixedPoint.
* @param b a uint256.
* @return True if `a >= b`, or False.
*/
function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue >= fromUnscaledUint(b).rawValue;
}
/**
* @notice Whether `a` is greater than or equal to `b`.
* @param a a uint256.
* @param b a FixedPoint.
* @return True if `a >= b`, or False.
*/
function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue >= b.rawValue;
}
/**
* @notice Whether `a` is less than `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return True if `a < b`, or False.
*/
function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue < b.rawValue;
}
/**
* @notice Whether `a` is less than `b`.
* @param a a FixedPoint.
* @param b a uint256.
* @return True if `a < b`, or False.
*/
function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue < fromUnscaledUint(b).rawValue;
}
/**
* @notice Whether `a` is less than `b`.
* @param a a uint256.
* @param b a FixedPoint.
* @return True if `a < b`, or False.
*/
function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue < b.rawValue;
}
/**
* @notice Whether `a` is less than or equal to `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return True if `a <= b`, or False.
*/
function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue <= b.rawValue;
}
/**
* @notice Whether `a` is less than or equal to `b`.
* @param a a FixedPoint.
* @param b a uint256.
* @return True if `a <= b`, or False.
*/
function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue <= fromUnscaledUint(b).rawValue;
}
/**
* @notice Whether `a` is less than or equal to `b`.
* @param a a uint256.
* @param b a FixedPoint.
* @return True if `a <= b`, or False.
*/
function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue <= b.rawValue;
}
/**
* @notice The minimum of `a` and `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the minimum of `a` and `b`.
*/
function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
return a.rawValue < b.rawValue ? a : b;
}
/**
* @notice The maximum of `a` and `b`.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the maximum of `a` and `b`.
*/
function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
return a.rawValue > b.rawValue ? a : b;
}
/**
* @notice Adds two `Unsigned`s, reverting on overflow.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the sum of `a` and `b`.
*/
function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.add(b.rawValue));
}
/**
* @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.
* @param a a FixedPoint.
* @param b a uint256.
* @return the sum of `a` and `b`.
*/
function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
return add(a, fromUnscaledUint(b));
}
/**
* @notice Subtracts two `Unsigned`s, reverting on overflow.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the difference of `a` and `b`.
*/
function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.sub(b.rawValue));
}
/**
* @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.
* @param a a FixedPoint.
* @param b a uint256.
* @return the difference of `a` and `b`.
*/
function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
return sub(a, fromUnscaledUint(b));
}
/**
* @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.
* @param a a uint256.
* @param b a FixedPoint.
* @return the difference of `a` and `b`.
*/
function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {
return sub(fromUnscaledUint(a), b);
}
/**
* @notice Multiplies two `Unsigned`s, reverting on overflow.
* @dev This will "floor" the product.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the product of `a` and `b`.
*/
function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
// There are two caveats with this computation:
// 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is
// stored internally as a uint256 ~10^59.
// 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which
// would round to 3, but this computation produces the result 2.
// No need to use SafeMath because FP_SCALING_FACTOR != 0.
return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);
}
/**
* @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.
* @dev This will "floor" the product.
* @param a a FixedPoint.
* @param b a uint256.
* @return the product of `a` and `b`.
*/
function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.mul(b));
}
/**
* @notice Multiplies two `Unsigned`s and "ceil's" the product, reverting on overflow.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the product of `a` and `b`.
*/
function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
uint256 mulRaw = a.rawValue.mul(b.rawValue);
uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;
uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);
if (mod != 0) {
return Unsigned(mulFloor.add(1));
} else {
return Unsigned(mulFloor);
}
}
/**
* @notice Multiplies an `Unsigned` and an unscaled uint256 and "ceil's" the product, reverting on overflow.
* @param a a FixedPoint.
* @param b a FixedPoint.
* @return the product of `a` and `b`.
*/
function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
// Since b is an int, there is no risk of truncation and we can just mul it normally
return Unsigned(a.rawValue.mul(b));
}
/**
* @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.
* @dev This will "floor" the quotient.
* @param a a FixedPoint numerator.
* @param b a FixedPoint denominator.
* @return the quotient of `a` divided by `b`.
*/
function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
// There are two caveats with this computation:
// 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.
// 10^41 is stored internally as a uint256 10^59.
// 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which
// would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.
return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));
}
/**
* @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.
* @dev This will "floor" the quotient.
* @param a a FixedPoint numerator.
* @param b a uint256 denominator.
* @return the quotient of `a` divided by `b`.
*/
function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.div(b));
}
/**
* @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.
* @dev This will "floor" the quotient.
* @param a a uint256 numerator.
* @param b a FixedPoint denominator.
* @return the quotient of `a` divided by `b`.
*/
function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {
return div(fromUnscaledUint(a), b);
}
/**
* @notice Divides one `Unsigned` by an `Unsigned` and "ceil's" the quotient, reverting on overflow or division by 0.
* @param a a FixedPoint numerator.
* @param b a FixedPoint denominator.
* @return the quotient of `a` divided by `b`.
*/
function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);
uint256 divFloor = aScaled.div(b.rawValue);
uint256 mod = aScaled.mod(b.rawValue);
if (mod != 0) {
return Unsigned(divFloor.add(1));
} else {
return Unsigned(divFloor);
}
}
/**
* @notice Divides one `Unsigned` by an unscaled uint256 and "ceil's" the quotient, reverting on overflow or division by 0.
* @param a a FixedPoint numerator.
* @param b a uint256 denominator.
* @return the quotient of `a` divided by `b`.
*/
function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
// Because it is possible that a quotient gets truncated, we can't just call "Unsigned(a.rawValue.div(b))"
// similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.
// This creates the possibility of overflow if b is very large.
return divCeil(a, fromUnscaledUint(b));
}
/**
* @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.
* @dev This will "floor" the result.
* @param a a FixedPoint numerator.
* @param b a uint256 denominator.
* @return output is `a` to the power of `b`.
*/
function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {
output = fromUnscaledUint(1);
for (uint256 i = 0; i < b; i = i.add(1)) {
output = mul(output, a);
}
}
}
// File: contracts/common/interfaces/ExpandedIERC20.sol
pragma solidity ^0.6.0;
/**
* @title ERC20 interface that includes burn and mint methods.
*/
abstract contract ExpandedIERC20 is IERC20 {
/**
* @notice Burns a specific amount of the caller's tokens.
* @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.
*/
function burn(uint256 value) external virtual;
/**
* @notice Mints tokens and adds them to the balance of the `to` address.
* @dev This method should be permissioned to only allow designated parties to mint tokens.
*/
function mint(address to, uint256 value) external virtual returns (bool);
}
// File: contracts/oracle/interfaces/OracleInterface.sol
pragma solidity ^0.6.0;
/**
* @title Financial contract facing Oracle interface.
* @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.
*/
interface OracleInterface {
/**
* @notice Enqueues a request (if a request isn't already present) for the given `identifier`, `time` pair.
* @dev Time must be in the past and the identifier must be supported.
* @param identifier uniquely identifies the price requested. eg BTC/USD (encoded as bytes32) could be requested.
* @param time unix timestamp for the price request.
*/
function requestPrice(bytes32 identifier, uint256 time) external;
/**
* @notice Whether the price for `identifier` and `time` is available.
* @dev Time must be in the past and the identifier must be supported.
* @param identifier uniquely identifies the price requested. eg BTC/USD (encoded as bytes32) could be requested.
* @param time unix timestamp for the price request.
* @return bool if the DVM has resolved to a price for the given identifier and timestamp.
*/
function hasPrice(bytes32 identifier, uint256 time) external view returns (bool);
/**
* @notice Gets the price for `identifier` and `time` if it has already been requested and resolved.
* @dev If the price is not available, the method reverts.
* @param identifier uniquely identifies the price requested. eg BTC/USD (encoded as bytes32) could be requested.
* @param time unix timestamp for the price request.
* @return int256 representing the resolved price for the given identifier and timestamp.
*/
function getPrice(bytes32 identifier, uint256 time) external view returns (int256);
}
// File: contracts/oracle/interfaces/IdentifierWhitelistInterface.sol
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
/**
* @title Interface for whitelists of supported identifiers that the oracle can provide prices for.
*/
interface IdentifierWhitelistInterface {
/**
* @notice Adds the provided identifier as a supported identifier.
* @dev Price requests using this identifier will succeed after this call.
* @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.
*/
function addSupportedIdentifier(bytes32 identifier) external;
/**
* @notice Removes the identifier from the whitelist.
* @dev Price requests using this identifier will no longer succeed after this call.
* @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.
*/
function removeSupportedIdentifier(bytes32 identifier) external;
/**
* @notice Checks whether an identifier is on the whitelist.
* @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.
* @return bool if the identifier is supported (or not).
*/
function isIdentifierSupported(bytes32 identifier) external view returns (bool);
}
// File: contracts/oracle/interfaces/AdministrateeInterface.sol
pragma solidity ^0.6.0;
/**
* @title Interface that all financial contracts expose to the admin.
*/
interface AdministrateeInterface {
/**
* @notice Initiates the shutdown process, in case of an emergency.
*/
function emergencyShutdown() external;
/**
* @notice A core contract method called independently or as a part of other financial contract transactions.
* @dev It pays fees and moves money between margin accounts to make sure they reflect the NAV of the contract.
*/
function remargin() external;
}
// File: contracts/oracle/implementation/Constants.sol
pragma solidity ^0.6.0;
/**
* @title Stores common interface names used throughout the DVM by registration in the Finder.
*/
library OracleInterfaces {
bytes32 public constant Oracle = "Oracle";
bytes32 public constant IdentifierWhitelist = "IdentifierWhitelist";
bytes32 public constant Store = "Store";
bytes32 public constant FinancialContractsAdmin = "FinancialContractsAdmin";
bytes32 public constant Registry = "Registry";
bytes32 public constant CollateralWhitelist = "CollateralWhitelist";
}
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.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 GSN 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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.6.0;
/**
* @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 {ERC20MinterPauser}.
*
* 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 guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view 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 {_setupDecimals} is
* called.
*
* 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 returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), 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};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is 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:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, 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
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// File: contracts/common/implementation/MultiRole.sol
pragma solidity ^0.6.0;
library Exclusive {
struct RoleMembership {
address member;
}
function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {
return roleMembership.member == memberToCheck;
}
function resetMember(RoleMembership storage roleMembership, address newMember) internal {
require(newMember != address(0x0), "Cannot set an exclusive role to 0x0");
roleMembership.member = newMember;
}
function getMember(RoleMembership storage roleMembership) internal view returns (address) {
return roleMembership.member;
}
function init(RoleMembership storage roleMembership, address initialMember) internal {
resetMember(roleMembership, initialMember);
}
}
library Shared {
struct RoleMembership {
mapping(address => bool) members;
}
function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {
return roleMembership.members[memberToCheck];
}
function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {
require(memberToAdd != address(0x0), "Cannot add 0x0 to a shared role");
roleMembership.members[memberToAdd] = true;
}
function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {
roleMembership.members[memberToRemove] = false;
}
function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {
for (uint256 i = 0; i < initialMembers.length; i++) {
addMember(roleMembership, initialMembers[i]);
}
}
}
/**
* @title Base class to manage permissions for the derived class.
*/
abstract contract MultiRole {
using Exclusive for Exclusive.RoleMembership;
using Shared for Shared.RoleMembership;
enum RoleType { Invalid, Exclusive, Shared }
struct Role {
uint256 managingRole;
RoleType roleType;
Exclusive.RoleMembership exclusiveRoleMembership;
Shared.RoleMembership sharedRoleMembership;
}
mapping(uint256 => Role) private roles;
event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);
event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);
event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);
/**
* @notice Reverts unless the caller is a member of the specified roleId.
*/
modifier onlyRoleHolder(uint256 roleId) {
require(holdsRole(roleId, msg.sender), "Sender does not hold required role");
_;
}
/**
* @notice Reverts unless the caller is a member of the manager role for the specified roleId.
*/
modifier onlyRoleManager(uint256 roleId) {
require(holdsRole(roles[roleId].managingRole, msg.sender), "Can only be called by a role manager");
_;
}
/**
* @notice Reverts unless the roleId represents an initialized, exclusive roleId.
*/
modifier onlyExclusive(uint256 roleId) {
require(roles[roleId].roleType == RoleType.Exclusive, "Must be called on an initialized Exclusive role");
_;
}
/**
* @notice Reverts unless the roleId represents an initialized, shared roleId.
*/
modifier onlyShared(uint256 roleId) {
require(roles[roleId].roleType == RoleType.Shared, "Must be called on an initialized Shared role");
_;
}
/**
* @notice Whether `memberToCheck` is a member of roleId.
* @dev Reverts if roleId does not correspond to an initialized role.
* @param roleId the Role ...
// [truncated — 158543 bytes total]
Read Contract
collateralCurrency 0x0de15fd9 → address
collateralRequirement 0x48e30c3f → uint256
contractState 0x85209ee0 → uint8
cumulativeFeeMultiplier 0xdd0eef3d → uint256
disputeBondPct 0x391fe4e2 → uint256
disputerDisputeRewardPct 0x5ee0fe32 → uint256
excessTokenBeneficiary 0x1fd00067 → address
expirationTimestamp 0x9f43ddd2 → uint256
expiryPrice 0xedfa9a9b → uint256
finder 0xb9a3c84c → address
getCollateral 0x9b56d6c9 → tuple
getCurrentTime 0x29cb924d → uint256
getLiquidations 0xa1c4d1e7 → tuple[]
liquidationLiveness 0x2d5436cf → uint256
liquidations 0x4f8c4847 → address, address, uint8, uint256, tuple, tuple, tuple, tuple, address, tuple, tuple
minSponsorTokens 0x92120aec → uint256
pfc 0x81a10ae1 → tuple
positions 0x55f57510 → tuple, uint256, tuple, tuple, uint256
priceIdentifier 0x97523661 → bytes32
rawLiquidationCollateral 0x50f49846 → uint256
rawTotalPositionCollateral 0x8c382eb2 → uint256
sponsorDisputeRewardPct 0xc13f62e1 → uint256
timerAddress 0x1c39c38d → address
tokenCurrency 0x7048594b → address
totalPositionCollateral 0x43e4771b → tuple
totalTokensOutstanding 0x0c9229ca → uint256
withdrawalLiveness 0x9ff4dea8 → uint256
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
cancelTransferPosition 0xb795f0d4
No parameters
cancelWithdrawal 0x22611280
No parameters
create 0x4a5d7fc9
tuple collateralAmount
tuple numTokens
createLiquidation 0xb95b30fd
address sponsor
tuple minCollateralPerToken
tuple maxCollateralPerToken
tuple maxTokensToLiquidate
uint256 deadline
returns: uint256, tuple, tuple
deposit 0xe4ca5f40
tuple collateralAmount
depositTo 0xcc83d0ae
address sponsor
tuple collateralAmount
dispute 0xa765fbea
uint256 liquidationId
address sponsor
returns: tuple
emergencyShutdown 0x3403c2fc
No parameters
expire 0x79599f96
No parameters
payRegularFees 0x3cb6ce83
No parameters
returns: tuple
redeem 0xbe3da06b
tuple numTokens
returns: tuple
remargin 0xbda02e77
No parameters
requestTransferPosition 0x36980f58
No parameters
requestWithdrawal 0xe0ec002d
tuple collateralAmount
setCurrentTime 0x22f8e566
uint256 time
settleExpired 0xfcccedc7
No parameters
returns: tuple
transferPositionPassedRequest 0x5617151c
address newSponsorAddress
trimExcess 0x24e8cb8d
address token
returns: tuple
withdraw 0xa3c62f34
tuple collateralAmount
returns: tuple
withdrawLiquidation 0x360598e1
uint256 liquidationId
address sponsor
returns: tuple
withdrawPassedRequest 0x33a46ca2
No parameters
returns: tuple
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address