Address Contract Partially Verified
Address
0xDd01810cCE40cE12e863d3ac58C0dCE0663A77ca
Balance
0 ETH
Nonce
1
Code Size
11647 bytes
Creator
0x2bB6E53D...32B7 at tx 0xb1c90d7f...e9fdd8
Indexed Transactions
0
Contract Bytecode
11647 bytes
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303c7d294146100f657806325c33e1314610129578063371e677a1461015657806357de26a41461018157806359e02dd7146101b457806369b41170146101f257806370dea79a146102295780637f78fc7a146102605780638b2999031461029b578063b8ddb653146102ea578063c5a7f06c14610315578063d0b3b8b214610350578063d4448a4c1461039f578063e184c9be146103fe578063eb804a2514610435578063ee7d72b414610460578063fc8103e01461048d575b600080fd5b34801561010257600080fd5b5061010b6104dc565b60405180826000191660001916815260200191505060405180910390f35b34801561013557600080fd5b50610154600480360381019080803590602001909291905050506104e2565b005b34801561016257600080fd5b5061016b6105d7565b6040518082815260200191505060405180910390f35b34801561018d57600080fd5b5061019661062d565b60405180826000191660001916815260200191505060405180910390f35b3480156101c057600080fd5b506101c961068b565b604051808360001916600019168152602001821515151581526020019250505060405180910390f35b3480156101fe57600080fd5b506102076106e5565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561023557600080fd5b5061023e6106eb565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561026c57600080fd5b50610299600480360381019080803560001916906020019092919080359060200190929190505050610701565b005b3480156102a757600080fd5b506102b06108d0565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102f657600080fd5b506102ff6108dc565b6040518082815260200191505060405180910390f35b34801561032157600080fd5b5061034e6004803603810190808035600019169060200190929190803590602001909291905050506108eb565b005b34801561035c57600080fd5b50610365610ad0565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103ab57600080fd5b506103fc60048036038101908080356fffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af2565b005b34801561040a57600080fd5b50610413610f9f565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561044157600080fd5b5061044a610fb5565b6040518082815260200191505060405180910390f35b34801561046c57600080fd5b5061048b60048036038101908080359060200190929190505050610fbb565b005b34801561049957600080fd5b506104a26110a9565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600c5481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f436861696e4c696e6b2e7365744d61785265776172643a206d73672e73656e6481526020017f65722069736e2774206d656469616e697a65722061646472657373000000000081525060400191505060405180910390fd5b80600b8190555050565b600060096000600c546000191660001916815260200190815260200160002060010160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16905090565b6000600660149054906101000a900463ffffffff1663ffffffff164210151561065257fe5b600760009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16600102905090565b600080600760009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16600102600660149054906101000a900463ffffffff1663ffffffff164210915091509091565b61038481565b600660189054906101000a900463ffffffff1681565b8160056000826000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f536f75726365206d75737420626520746865206f7261636c65206f662074686581526020017f207265717565737400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60056000826000191660001916815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905580600019167f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a60405160405180910390a2610884838361a8c042016110b5565b7f9c5737805a2b5e360460901be6035d12dbbe1b58b0a47db0c830a1c3d004123083836040518083600019166000191681526020018281526020019250505060405180910390a1505050565b670e043da61725000081565b670de0b6b3a764000060020281565b8160056000826000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f536f75726365206d75737420626520746865206f7261636c65206f662074686581526020017f207265717565737400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60056000826000191660001916815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905580600019167f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a60405160405180910390a2610a84600d600085600019166000191681526020019081526020016000205483611443565b7fa774005756cdc262a1a538b61bcbb72491562574463fa0d4511be00f6f59ed4283836040518083600019166000191681526020018281526020019250505060405180910390a1505050565b600760109054906101000a90046fffffffffffffffffffffffffffffffff1681565b600080600660189054906101000a900463ffffffff1663ffffffff164263ffffffff16111515610bb0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f436861696e4c696e6b2e7570646174653a206e6f77206973206c65737320746881526020017f616e2074696d656f75740000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330876fffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d6020811015610ce557600080fd5b81019080805190602001909291905050501515610d90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001807f436861696e4c696e6b2e7570646174653a206661696c656420746f207472616e81526020017f73666572206c696e6b2066726f6d206d73672e73656e6465720000000000000081525060400191505060405180910390fd5b610d998461155d565b915081600c8160001916905550610db08483611845565b905081600d6000836000191660001916815260200190815260200160002081600019169055503360096000846000191660001916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360096000846000191660001916815260200190815260200160002060010160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508260096000846000191660001916815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506103844201600660186101000a81548163ffffffff021916908363ffffffff1602179055507fb0107ea23b4c270df3aebcca424077c6df3c3049f6f9b3f6c271dd309e270742848460405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a150505050565b600660149054906101000a900463ffffffff1681565b61a8c081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110a6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001807f4f7261636c697a652e7365744761734c696d69743a206d73672e73656e64657281526020017f2069736e2774206d656469616e697a657220616464726573730000000000000081525060400191505060405180910390fd5b50565b670f43fc2c04ee000081565b600060096000856000191660001916815260200190815260200160002060010160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555061113b600760009054906101000a90046fffffffffffffffffffffffffffffffff16670e043da617250000611b58565b6fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff161015806111c05750611198600760009054906101000a90046fffffffffffffffffffffffffffffffff16670e043da617250000611bf0565b6fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff1611155b156112555760096000846000191660001916815260200190815260200160002060010160009054906101000a90046fffffffffffffffffffffffffffffffff1660096000856000191660001916815260200190815260200160002060010160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505b81600760006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555080600660146101000a81548163ffffffff021916908363ffffffff160217905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663181783586040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15801561133557600080fd5b505af1158015611349573d6000803e3d6000fd5b50505050600160096000856000191660001916815260200190815260200160002060020160146101000a81548160ff02191690831515021790555060096000846000191660001916815260200190815260200160002060020160159054906101000a900460ff16156113bf576113be83611c80565b5b7ff48d45700298c56d93e4b3130bf4f30fe190524dc3a1026e742bdca4c048dbe6838383604051808460001916600019168152602001836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020018263ffffffff1663ffffffff168152602001935050505060405180910390a1505050565b80600760106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550600160096000846000191660001916815260200190815260200160002060020160156101000a81548160ff02191690831515021790555060096000836000191660001916815260200190815260200160002060020160149054906101000a900460ff16156114ee576114ed82611c80565b5b7f6c601c62014551aae1ebf180137a4f112df92ef8ccbd13414a861badc7f2cb8b8282604051808360001916600019168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b6000611567612cb1565b6115b57f353133393037663936393535343337613861633032613564373065356264656130637f78fc7a7c0100000000000000000000000000000000000000000000000000000000026120d0565b90506116366040805190810160405280600881526020017f656e64706f696e740000000000000000000000000000000000000000000000008152506040805190810160405280600581526020017f7072696365000000000000000000000000000000000000000000000000000000815250836121019092919063ffffffff16565b6116b56040805190810160405280600481526020017f6673796d000000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4254430000000000000000000000000000000000000000000000000000000000815250836121019092919063ffffffff16565b6117346040805190810160405280600581526020017f7473796d730000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5553440000000000000000000000000000000000000000000000000000000000815250836121019092919063ffffffff16565b6117b36040805190810160405280600881526020017f636f7079506174680000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5553440000000000000000000000000000000000000000000000000000000000815250836121019092919063ffffffff16565b6118176040805190810160405280600581526020017f74696d6573000000000000000000000000000000000000000000000000000000815250670de0b6b3a76400006fffffffffffffffffffffffffffffffff16836121349092919063ffffffff16565b61183d81611838856fffffffffffffffffffffffffffffffff166002612167565b61218b565b915050919050565b600061184f612cb1565b600061189f7f35313339303766393639353534333761386163303261356437306535626465613063c5a7f06c7c0100000000000000000000000000000000000000000000000000000000026120d0565b91506119206040805190810160405280600881526020017f656e64706f696e740000000000000000000000000000000000000000000000008152506040805190810160405280600581526020017f7072696365000000000000000000000000000000000000000000000000000000815250846121019092919063ffffffff16565b61199f6040805190810160405280600481526020017f6673796d000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4c494e4b00000000000000000000000000000000000000000000000000000000815250846121019092919063ffffffff16565b611a1e6040805190810160405280600581526020017f7473796d730000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5553440000000000000000000000000000000000000000000000000000000000815250846121019092919063ffffffff16565b611a9d6040805190810160405280600881526020017f636f7079506174680000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5553440000000000000000000000000000000000000000000000000000000000815250846121019092919063ffffffff16565b611b016040805190810160405280600581526020017f74696d6573000000000000000000000000000000000000000000000000000000815250670de0b6b3a76400006fffffffffffffffffffffffffffffffff16846121349092919063ffffffff16565b611b2782611b22876fffffffffffffffffffffffffffffffff166002612167565b61218b565b905083600d600083600019166000191681526020019081526020016000208160001916905550809250505092915050565b6000611be8670de0b6b3a76400006fffffffffffffffffffffffffffffffff166002670de0b6b3a76400006fffffffffffffffffffffffffffffffff16811515611b9e57fe5b046fffffffffffffffffffffffffffffffff16846fffffffffffffffffffffffffffffffff16866fffffffffffffffffffffffffffffffff160201811515611be257fe5b046121c2565b905092915050565b6000611c78826fffffffffffffffffffffffffffffffff166002846fffffffffffffffffffffffffffffffff16811515611c2657fe5b046fffffffffffffffffffffffffffffffff16670de0b6b3a76400006fffffffffffffffffffffffffffffffff16866fffffffffffffffffffffffffffffffff160201811515611c7257fe5b046121c2565b905092915050565b611cf3611ce5600760109054906101000a90046fffffffffffffffffffffffffffffffff1660096000856000191660001916815260200190815260200160002060010160109054906101000a90046fffffffffffffffffffffffffffffffff16611b58565b670f43fc2c04ee0000611b58565b6fffffffffffffffffffffffffffffffff16600881905550611d19600b546008546121e9565b60096000836000191660001916815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611df257600080fd5b505af1158015611e06573d6000803e3d6000fd5b505050506040513d6020811015611e1c57600080fd5b810190808051906020019092919050505010158015611e875750600060096000836000191660001916815260200190815260200160002060010160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16115b1561208e5760096000826000191660001916815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60096000846000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611f33600b546008546121e9565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611fb857600080fd5b505af1158015611fcc573d6000803e3d6000fd5b505050506040513d6020811015611fe257600080fd5b8101908080519060200190929190505050151561208d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f436861696e4c696e6b2e7265776172643a20746f6b656e207472616e7366657281526020017f206661696c65640000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b5b7f1a54e0df4218b555b91c90ac357b97d0e36da21cf34950b19f4dac486c47fbbf8160405180826000191660001916815260200191505060405180910390a150565b6120d8612cb1565b6120e0612cb1565b6120f785858584612203909392919063ffffffff16565b9150509392505050565b6121188284608001516122bd90919063ffffffff16565b61212f8184608001516122bd90919063ffffffff16565b505050565b61214b8284608001516122bd90919063ffffffff16565b6121628184608001516122e290919063ffffffff16565b505050565b6000808211151561217757600080fd5b818381151561218257fe5b04905092915050565b60006121ba600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168484612330565b905092915050565b600081829150816fffffffffffffffffffffffffffffffff161415156121e457fe5b919050565b6000818311156121f957816121fb565b825b905092915050565b61220b612cb1565b61221b85608001516101006126bc565b50838560000190600019169081600019168152505082856020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508185604001907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681525050849050949350505050565b6122ca8260038351612716565b6122dd818361287490919063ffffffff16565b505050565b6000811215156122fd576122f882600083612716565b61232c565b61232b826001837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03612716565b5b5050565b600030600454604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831015156123cc57805182526020820191506020810190506020830392506123a7565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090506004548360600181815250508360056000836000191660001916815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600019167fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af960405160405180910390a2600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634000aea085846124db87612896565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561257e578082015181840152602081019050612563565b50505050905090810190601f1680156125ab5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156125cc57600080fd5b505af11580156125e0573d6000803e3d6000fd5b505050506040513d60208110156125f657600080fd5b810190808051906020019092919050505015156126a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f726181526020017f636c65000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60016004600082825401925050819055508090509392505050565b6126c4612d1f565b60006020838115156126d257fe5b061415156126ef576020828115156126e657fe5b06602003820191505b81836020018181525050604051808452600081528281016020016040525082905092915050565b601781111515612748576127428160058460ff169060020a0260ff161784612ac190919063ffffffff16565b5061286f565b60ff8111151561278f57612772601860058460ff169060020a021784612ac190919063ffffffff16565b5061278981600185612ae19092919063ffffffff16565b5061286e565b61ffff811115156127d7576127ba601960058460ff169060020a021784612ac190919063ffffffff16565b506127d181600285612ae19092919063ffffffff16565b5061286d565b63ffffffff8111151561282157612804601a60058460ff169060020a021784612ac190919063ffffffff16565b5061281b81600485612ae19092919063ffffffff16565b5061286c565b67ffffffffffffffff8111151561286b57612852601b60058460ff169060020a021784612ac190919063ffffffff16565b5061286981600885612ae19092919063ffffffff16565b505b5b5b5b5b505050565b61287c612d1f565b61288e83846000015151848551612b03565b905092915050565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634042994690507c01000000000000000000000000000000000000000000000000000000000260008084600001518560200151866040015187606001516001896080015160000151604051602401808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188815260200187600019166000191681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001857bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612a24578082015181840152602081019050612a09565b50505050905090810190601f168015612a515780820380516001836020036101000a031916815260200191505b509950505050505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050919050565b612ac9612d1f565b612ad98384600001515184612bc0565b905092915050565b612ae9612d1f565b612afa848560000151518585612c10565b90509392505050565b612b0b612d1f565b600080600085518511151515612b2057600080fd5b87602001518588011115612b4b57612b4a886002612b448b602001518b8a01612c71565b02612c8d565b5b875180518860208301019450808988011115612b675788870182525b60208801935050505b602085101515612b955781518352602083019250602082019150602085039450612b70565b6001856020036101000a03905080198251168184511681811785525050879350505050949350505050565b612bc8612d1f565b836020015183101515612be757612be6846002866020015102612c8d565b5b8351805160208583010184815381861415612c03576001820183525b5050508390509392505050565b612c18612d1f565b600085602001518584011115612c3857612c3786600287860102612c8d565b5b6001836101000a0390508551838682010185831982511617815281518588011115612c635784870182525b505085915050949350505050565b600081831115612c8357829050612c87565b8190505b92915050565b606082600001519050612ca083836126bc565b50612cab8382612874565b50505050565b60c06040519081016040528060008019168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200160008152602001612d19612d39565b81525090565b604080519081016040528060608152602001600081525090565b6040805190810160405280606081526020016000815250905600a165627a7a7230582026f9dd8a080e8e067f9a1fd320f4cfbf9b105e4d911177cd48f101b69089027f0029
Verified Source Code Partial Match
Compiler: v0.4.26+commit.4563c3fc
EVM: byzantium
Optimization: No
CryptoCompare.sol 1011 lines
pragma solidity 0.4.26;
library Buffer {
struct buffer {
bytes buf;
uint capacity;
}
function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(32, add(ptr, capacity)))
}
return buf;
}
function fromBytes(bytes memory b) internal pure returns(buffer memory) {
buffer memory buf;
buf.buf = b;
buf.capacity = b.length;
return buf;
}
function resize(buffer memory buf, uint capacity) private pure {
bytes memory oldbuf = buf.buf;
init(buf, capacity);
append(buf, oldbuf);
}
function max(uint a, uint b) private pure returns(uint) {
if (a > b) {
return a;
}
return b;
}
function truncate(buffer memory buf) internal pure returns (buffer memory) {
assembly {
let bufptr := mload(buf)
mstore(bufptr, 0)
}
return buf;
}
function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {
require(len <= data.length);
if (off + len > buf.capacity) {
resize(buf, max(buf.capacity, len + off) * 2);
}
uint dest;
uint src;
assembly {
let bufptr := mload(buf)
let buflen := mload(bufptr)
dest := add(add(bufptr, 32), off)
if gt(add(len, off), buflen) {
mstore(bufptr, add(len, off))
}
src := add(data, 32)
}
for (; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
return buf;
}
function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, data, len);
}
function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, data, data.length);
}
function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {
if (off >= buf.capacity) {
resize(buf, buf.capacity * 2);
}
assembly {
let bufptr := mload(buf)
let buflen := mload(bufptr)
let dest := add(add(bufptr, off), 32)
mstore8(dest, data)
if eq(off, buflen) {
mstore(bufptr, add(buflen, 1))
}
}
return buf;
}
function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {
return writeUint8(buf, buf.buf.length, data);
}
function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {
if (len + off > buf.capacity) {
resize(buf, (len + off) * 2);
}
uint mask = 256 ** len - 1;
data = data >> (8 * (32 - len));
assembly {
let bufptr := mload(buf)
let dest := add(add(bufptr, off), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
if gt(add(off, len), mload(bufptr)) {
mstore(bufptr, add(off, len))
}
}
return buf;
}
function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {
return write(buf, off, bytes32(data), 20);
}
function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, bytes32(data), 20);
}
function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, data, 32);
}
function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {
if (len + off > buf.capacity) {
resize(buf, (len + off) * 2);
}
uint mask = 256 ** len - 1;
assembly {
let bufptr := mload(buf)
let dest := add(add(bufptr, off), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
if gt(add(off, len), mload(bufptr)) {
mstore(bufptr, add(off, len))
}
}
return buf;
}
function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {
return writeInt(buf, buf.buf.length, data, len);
}
}
library CBOR {
using Buffer for Buffer.buffer;
uint8 private constant MAJOR_TYPE_INT = 0;
uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;
uint8 private constant MAJOR_TYPE_BYTES = 2;
uint8 private constant MAJOR_TYPE_STRING = 3;
uint8 private constant MAJOR_TYPE_ARRAY = 4;
uint8 private constant MAJOR_TYPE_MAP = 5;
uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;
function encodeType(Buffer.buffer memory buf, uint8 major, uint value) private pure {
if(value <= 23) {
buf.appendUint8(uint8((major << 5) | value));
} else if(value <= 0xFF) {
buf.appendUint8(uint8((major << 5) | 24));
buf.appendInt(value, 1);
} else if(value <= 0xFFFF) {
buf.appendUint8(uint8((major << 5) | 25));
buf.appendInt(value, 2);
} else if(value <= 0xFFFFFFFF) {
buf.appendUint8(uint8((major << 5) | 26));
buf.appendInt(value, 4);
} else if(value <= 0xFFFFFFFFFFFFFFFF) {
buf.appendUint8(uint8((major << 5) | 27));
buf.appendInt(value, 8);
}
}
function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private pure {
buf.appendUint8(uint8((major << 5) | 31));
}
function encodeUInt(Buffer.buffer memory buf, uint value) internal pure {
encodeType(buf, MAJOR_TYPE_INT, value);
}
function encodeInt(Buffer.buffer memory buf, int value) internal pure {
if(value >= 0) {
encodeType(buf, MAJOR_TYPE_INT, uint(value));
} else {
encodeType(buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - value));
}
}
function encodeBytes(Buffer.buffer memory buf, bytes value) internal pure {
encodeType(buf, MAJOR_TYPE_BYTES, value.length);
buf.append(value);
}
function encodeString(Buffer.buffer memory buf, string value) internal pure {
encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length);
buf.append(bytes(value));
}
function startArray(Buffer.buffer memory buf) internal pure {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);
}
function startMap(Buffer.buffer memory buf) internal pure {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);
}
function endSequence(Buffer.buffer memory buf) internal pure {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);
}
}
library Chainlink {
uint256 internal constant defaultBufferSize = 256;
using CBOR for Buffer.buffer;
struct Request {
bytes32 id;
address callbackAddress;
bytes4 callbackFunctionId;
uint256 nonce;
Buffer.buffer buf;
}
function initialize(
Request memory self,
bytes32 _id,
address _callbackAddress,
bytes4 _callbackFunction
) internal pure returns (Chainlink.Request memory) {
Buffer.init(self.buf, defaultBufferSize);
self.id = _id;
self.callbackAddress = _callbackAddress;
self.callbackFunctionId = _callbackFunction;
return self;
}
function setBuffer(Request memory self, bytes _data)
internal pure
{
Buffer.init(self.buf, _data.length);
Buffer.append(self.buf, _data);
}
function add(Request memory self, string _key, string _value)
internal pure
{
self.buf.encodeString(_key);
self.buf.encodeString(_value);
}
function addBytes(Request memory self, string _key, bytes _value)
internal pure
{
self.buf.encodeString(_key);
self.buf.encodeBytes(_value);
}
function addInt(Request memory self, string _key, int256 _value)
internal pure
{
self.buf.encodeString(_key);
self.buf.encodeInt(_value);
}
function addUint(Request memory self, string _key, uint256 _value)
internal pure
{
self.buf.encodeString(_key);
self.buf.encodeUInt(_value);
}
function addStringArray(Request memory self, string _key, string[] memory _values)
internal pure
{
self.buf.encodeString(_key);
self.buf.startArray();
for (uint256 i = 0; i < _values.length; i++) {
self.buf.encodeString(_values[i]);
}
self.buf.endSequence();
}
}
contract ENSResolver {
function addr(bytes32 node) public view returns (address);
}
interface ENSInterface {
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event Transfer(bytes32 indexed node, address owner);
event NewResolver(bytes32 indexed node, address resolver);
event NewTTL(bytes32 indexed node, uint64 ttl);
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;
function setResolver(bytes32 node, address resolver) external;
function setOwner(bytes32 node, address owner) external;
function setTTL(bytes32 node, uint64 ttl) external;
function owner(bytes32 node) external view returns (address);
function resolver(bytes32 node) external view returns (address);
function ttl(bytes32 node) external view returns (uint64);
}
interface LinkTokenInterface {
function allowance(address owner, address spender) external returns (bool success);
function approve(address spender, uint256 value) external returns (bool success);
function balanceOf(address owner) external returns (uint256 balance);
function decimals() external returns (uint8 decimalPlaces);
function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);
function increaseApproval(address spender, uint256 subtractedValue) external;
function name() external returns (string tokenName);
function symbol() external returns (string tokenSymbol);
function totalSupply() external returns (uint256 totalTokensIssued);
function transfer(address to, uint256 value) external returns (bool success);
function transferAndCall(address to, uint256 value, bytes data) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
}
interface ChainlinkRequestInterface {
function oracleRequest(
address sender,
uint256 payment,
bytes32 id,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 nonce,
uint256 version,
bytes data
) external;
function cancelOracleRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunctionId,
uint256 expiration
) external;
}
interface PointerInterface {
function getAddress() external view returns (address);
}
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
return _a / _b;
}
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract ChainlinkClient {
using Chainlink for Chainlink.Request;
using SafeMath for uint256;
uint256 constant internal LINK = 10**18;
uint256 constant private AMOUNT_OVERRIDE = 0;
address constant private SENDER_OVERRIDE = 0x0;
uint256 constant private ARGS_VERSION = 1;
bytes32 constant private ENS_TOKEN_SUBNAME = keccak256("link");
bytes32 constant private ENS_ORACLE_SUBNAME = keccak256("oracle");
address constant private LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571;
ENSInterface private ens;
bytes32 private ensNode;
LinkTokenInterface private link;
ChainlinkRequestInterface private oracle;
uint256 private requests = 1;
mapping(bytes32 => address) private pendingRequests;
event ChainlinkRequested(bytes32 indexed id);
event ChainlinkFulfilled(bytes32 indexed id);
event ChainlinkCancelled(bytes32 indexed id);
function buildChainlinkRequest(
bytes32 _specId,
address _callbackAddress,
bytes4 _callbackFunctionSignature
) internal pure returns (Chainlink.Request memory) {
Chainlink.Request memory req;
return req.initialize(_specId, _callbackAddress, _callbackFunctionSignature);
}
function sendChainlinkRequest(Chainlink.Request memory _req, uint256 _payment)
internal
returns (bytes32)
{
return sendChainlinkRequestTo(oracle, _req, _payment);
}
function sendChainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)
internal
returns (bytes32 requestId)
{
requestId = keccak256(abi.encodePacked(this, requests));
_req.nonce = requests;
pendingRequests[requestId] = _oracle;
emit ChainlinkRequested(requestId);
require(link.transferAndCall(_oracle, _payment, encodeRequest(_req)), "unable to transferAndCall to oracle");
requests += 1;
return requestId;
}
function cancelChainlinkRequest(
bytes32 _requestId,
uint256 _payment,
bytes4 _callbackFunc,
uint256 _expiration
)
internal
{
ChainlinkRequestInterface requested = ChainlinkRequestInterface(pendingRequests[_requestId]);
delete pendingRequests[_requestId];
emit ChainlinkCancelled(_requestId);
requested.cancelOracleRequest(_requestId, _payment, _callbackFunc, _expiration);
}
function setChainlinkOracle(address _oracle) internal {
oracle = ChainlinkRequestInterface(_oracle);
}
function setChainlinkToken(address _link) internal {
link = LinkTokenInterface(_link);
}
function setPublicChainlinkToken() internal {
setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());
}
function chainlinkTokenAddress()
internal
view
returns (address)
{
return address(link);
}
function chainlinkOracleAddress()
internal
view
returns (address)
{
return address(oracle);
}
function addChainlinkExternalRequest(address _oracle, bytes32 _requestId)
internal
notPendingRequest(_requestId)
{
pendingRequests[_requestId] = _oracle;
}
function useChainlinkWithENS(address _ens, bytes32 _node)
internal
{
ens = ENSInterface(_ens);
ensNode = _node;
bytes32 linkSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME));
ENSResolver resolver = ENSResolver(ens.resolver(linkSubnode));
setChainlinkToken(resolver.addr(linkSubnode));
updateChainlinkOracleWithENS();
}
function updateChainlinkOracleWithENS()
internal
{
bytes32 oracleSubnode = keccak256(abi.encodePacked(ensNode, ENS_ORACLE_SUBNAME));
ENSResolver resolver = ENSResolver(ens.resolver(oracleSubnode));
setChainlinkOracle(resolver.addr(oracleSubnode));
}
function encodeRequest(Chainlink.Request memory _req)
private
view
returns (bytes memory)
{
return abi.encodeWithSelector(
oracle.oracleRequest.selector,
SENDER_OVERRIDE,
AMOUNT_OVERRIDE,
_req.id,
_req.callbackAddress,
_req.callbackFunctionId,
_req.nonce,
ARGS_VERSION,
_req.buf.buf);
}
function validateChainlinkCallback(bytes32 _requestId)
internal
recordChainlinkFulfillment(_requestId)
{}
modifier recordChainlinkFulfillment(bytes32 _requestId) {
require(msg.sender == pendingRequests[_requestId], "Source must be the oracle of the request");
delete pendingRequests[_requestId];
emit ChainlinkFulfilled(_requestId);
_;
}
modifier notPendingRequest(bytes32 _requestId) {
require(pendingRequests[_requestId] == address(0), "Request is already pending");
_;
}
}
contract DSMath {
function add(uint256 x, uint256 y) pure internal returns (uint256 z) {
assert((z = x + y) >= x);
}
function sub(uint256 x, uint256 y) pure internal returns (uint256 z) {
assert((z = x - y) <= x);
}
function mul(uint256 x, uint256 y) pure internal returns (uint256 z) {
assert((z = x * y) >= x);
}
function div(uint256 x, uint256 y) pure internal returns (uint256 z) {
require(y > 0);
z = x / y;
}
function min(uint256 x, uint256 y) pure internal returns (uint256 z) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) pure internal returns (uint256 z) {
return x >= y ? x : y;
}
function hadd(uint128 x, uint128 y) pure internal returns (uint128 z) {
assert((z = x + y) >= x);
}
function hsub(uint128 x, uint128 y) pure internal returns (uint128 z) {
assert((z = x - y) <= x);
}
function hmul(uint128 x, uint128 y) pure internal returns (uint128 z) {
assert((z = x * y) >= x);
}
function hdiv(uint128 x, uint128 y) pure internal returns (uint128 z) {
assert(y > 0);
z = x / y;
}
function hmin(uint128 x, uint128 y) pure internal returns (uint128 z) {
return x <= y ? x : y;
}
function hmax(uint128 x, uint128 y) pure internal returns (uint128 z) {
return x >= y ? x : y;
}
function imin(int256 x, int256 y) pure internal returns (int256 z) {
return x <= y ? x : y;
}
function imax(int256 x, int256 y) pure internal returns (int256 z) {
return x >= y ? x : y;
}
uint128 constant WAD = 10 ** 18;
function wadd(uint128 x, uint128 y) pure internal returns (uint128) {
return hadd(x, y);
}
function wsub(uint128 x, uint128 y) pure internal returns (uint128) {
return hsub(x, y);
}
function wmul(uint128 x, uint128 y) view internal returns (uint128 z) {
z = cast((uint256(x) * y + WAD / 2) / WAD);
}
function wdiv(uint128 x, uint128 y) view internal returns (uint128 z) {
z = cast((uint256(x) * WAD + y / 2) / y);
}
function wmin(uint128 x, uint128 y) pure internal returns (uint128) {
return hmin(x, y);
}
function wmax(uint128 x, uint128 y) pure internal returns (uint128) {
return hmax(x, y);
}
uint128 constant RAY = 10 ** 27;
function radd(uint128 x, uint128 y) pure internal returns (uint128) {
return hadd(x, y);
}
function rsub(uint128 x, uint128 y) pure internal returns (uint128) {
return hsub(x, y);
}
function rmul(uint128 x, uint128 y) view internal returns (uint128 z) {
z = cast((uint256(x) * y + RAY / 2) / RAY);
}
function rdiv(uint128 x, uint128 y) view internal returns (uint128 z) {
z = cast((uint256(x) * RAY + y / 2) / y);
}
function rpow(uint128 x, uint64 n) view internal returns (uint128 z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
function rmin(uint128 x, uint128 y) pure internal returns (uint128) {
return hmin(x, y);
}
function rmax(uint128 x, uint128 y) pure internal returns (uint128) {
return hmax(x, y);
}
function cast(uint256 x) pure internal returns (uint128 z) {
assert((z = uint128(x)) == x);
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface MedianizerInterface {
function oracles(uint256) public view returns (address);
function peek() public view returns (bytes32, bool);
function read() public returns (bytes32);
function poke() public;
function poke(bytes32) public;
function fund (uint256 amount, ERC20 token) public;
}
contract Oracle is DSMath {
uint32 constant public DELAY = 900;
uint128 constant public prem = 1100000000000000000;
uint128 constant public turn = 1010000000000000000;
MedianizerInterface med;
uint32 public expiry;
uint32 public timeout;
uint128 assetPrice;
uint128 public paymentTokenPrice;
uint256 rewardAmount;
mapping(bytes32 => AsyncRequest) asyncRequests;
struct AsyncRequest {
address rewardee;
uint128 payment;
uint128 disbursement;
ERC20 token;
bool assetPriceSet;
bool paymentTokenPriceSet;
}
event SetAssetPrice(bytes32 queryId, uint128 assetPrice_, uint32 expiry_);
event SetPaymentTokenPrice(bytes32 queryId, uint128 paymentTokenPrice_);
event Reward(bytes32 queryId);
function peek() public view returns (bytes32,bool) {
return (bytes32(uint(assetPrice)), now < expiry);
}
function read() public view returns (bytes32) {
assert(now < expiry);
return bytes32(uint(assetPrice));
}
function setAssetPrice(bytes32 queryId, uint128 assetPrice_, uint32 expiry_) internal {
asyncRequests[queryId].disbursement = 0;
if (assetPrice_ >= wmul(assetPrice, turn) || assetPrice_ <= wdiv(assetPrice, turn)) {
asyncRequests[queryId].disbursement = asyncRequests[queryId].payment;
}
assetPrice = assetPrice_;
expiry = expiry_;
med.poke();
asyncRequests[queryId].assetPriceSet = true;
if (asyncRequests[queryId].paymentTokenPriceSet) {reward(queryId);}
emit SetAssetPrice(queryId, assetPrice_, expiry_);
}
function setPaymentTokenPrice(bytes32 queryId, uint128 paymentTokenPrice_) internal {
paymentTokenPrice = paymentTokenPrice_;
asyncRequests[queryId].paymentTokenPriceSet = true;
if (asyncRequests[queryId].assetPriceSet) {reward(queryId);}
emit SetPaymentTokenPrice(queryId, paymentTokenPrice_);
}
function reward(bytes32 queryId) internal {
rewardAmount = wmul(wmul(paymentTokenPrice, asyncRequests[queryId].disbursement), prem);
if (asyncRequests[queryId].token.balanceOf(address(this)) >= rewardAmount && asyncRequests[queryId].disbursement > 0) {
require(asyncRequests[queryId].token.transfer(asyncRequests[queryId].rewardee, rewardAmount), "Oracle.reward: token transfer failed");
}
delete(asyncRequests[queryId]);
emit Reward(queryId);
}
function setMaxReward(uint256 maxReward_) public;
function setGasLimit(uint256 gasLimit_) public;
}
contract ChainLink is ChainlinkClient, Oracle {
ERC20 link;
uint256 maxReward;
bytes32 public lastQueryId;
uint256 public constant DEFAULT_LINK_PAYMENT = 2 * LINK;
uint256 public constant ORACLE_EXPIRY = 12 hours;
mapping(bytes32 => bytes32) linkIdToQueryId;
event Update(uint128 payment_, ERC20 token_);
event ReturnAssetPrice(bytes32 requestId_, uint256 price_);
event ReturnPaymentTokenPrice(bytes32 requestId_, uint256 price_);
event Reward(bytes32 queryId);
constructor(MedianizerInterface med_, ERC20 link_, address oracle_) public {
med = med_;
link = link_;
setChainlinkToken(address(link_));
setChainlinkOracle(oracle_);
asyncRequests[lastQueryId].payment = uint128(DEFAULT_LINK_PAYMENT);
}
function bill() public view returns (uint256) {
return asyncRequests[lastQueryId].payment;
}
function update(uint128 payment_, ERC20 token_) public {
require(uint32(now) > timeout, "ChainLink.update: now is less than timeout");
require(link.transferFrom(msg.sender, address(this), uint(payment_)), "ChainLink.update: failed to transfer link from msg.sender");
bytes32 queryId = getAssetPrice(payment_);
lastQueryId = queryId;
bytes32 linkId = getPaymentTokenPrice(payment_, queryId);
linkIdToQueryId[linkId] = queryId;
asyncRequests[queryId].rewardee = msg.sender;
asyncRequests[queryId].payment = payment_;
asyncRequests[queryId].token = token_;
timeout = uint32(now) + DELAY;
emit Update(payment_, token_);
}
function getAssetPrice(uint128) internal returns (bytes32);
function getPaymentTokenPrice(uint128, bytes32) internal returns (bytes32);
function returnAssetPrice(bytes32 requestId_, uint256 price_) public recordChainlinkFulfillment(requestId_) {
setAssetPrice(requestId_, uint128(price_), uint32(now + ORACLE_EXPIRY));
emit ReturnAssetPrice(requestId_, price_);
}
function returnPaymentTokenPrice(bytes32 requestId_, uint256 price_) public recordChainlinkFulfillment(requestId_) {
setPaymentTokenPrice(linkIdToQueryId[requestId_], uint128(price_));
emit ReturnPaymentTokenPrice(requestId_, price_);
}
function reward(bytes32 queryId) internal {
rewardAmount = wmul(wmul(paymentTokenPrice, asyncRequests[queryId].disbursement), prem);
if (asyncRequests[queryId].token.balanceOf(address(this)) >= min(maxReward, rewardAmount) && asyncRequests[queryId].disbursement > 0) {
require(asyncRequests[queryId].token.transfer(asyncRequests[queryId].rewardee, min(maxReward, rewardAmount)), "ChainLink.reward: token transfer failed");
}
emit Reward(queryId);
}
function setMaxReward(uint256 maxReward_) public {
require(msg.sender == address(med), "ChainLink.setMaxReward: msg.sender isn't medianizer address");
maxReward = maxReward_;
}
function setGasLimit(uint256) public {
require(msg.sender == address(med), "Oraclize.setGasLimit: msg.sender isn't medianizer address");
}
}
contract CryptoCompare is ChainLink {
bytes32 constant UINT256_MUL_JOB = bytes32("513907f96955437a8ac02a5d70e5bdea");
constructor(MedianizerInterface med_, ERC20 link_, address oracle_) public ChainLink(med_, link_, oracle_) {}
function getAssetPrice(uint128 payment_) internal returns (bytes32 queryId) {
Chainlink.Request memory req = buildChainlinkRequest(UINT256_MUL_JOB, this, this.returnAssetPrice.selector);
req.add("endpoint", "price");
req.add("fsym", "BTC");
req.add("tsyms", "USD");
req.add("copyPath", "USD");
req.addInt("times", WAD);
queryId = sendChainlinkRequest(req, div(payment_, 2));
}
function getPaymentTokenPrice(uint128 payment_, bytes32 queryId) internal returns (bytes32) {
Chainlink.Request memory req = buildChainlinkRequest(UINT256_MUL_JOB, this, this.returnPaymentTokenPrice.selector);
req.add("endpoint", "price");
req.add("fsym", "LINK");
req.add("tsyms", "USD");
req.add("copyPath", "USD");
req.addInt("times", WAD);
bytes32 linkId = sendChainlinkRequest(req, div(payment_, 2));
linkIdToQueryId[linkId] = queryId;
return linkId;
}
}
Read Contract
DEFAULT_LINK_PAYMENT 0xb8ddb653 → uint256
DELAY 0x69b41170 → uint32
ORACLE_EXPIRY 0xeb804a25 → uint256
bill 0x371e677a → uint256
expiry 0xe184c9be → uint32
lastQueryId 0x03c7d294 → bytes32
paymentTokenPrice 0xd0b3b8b2 → uint128
peek 0x59e02dd7 → bytes32, bool
prem 0xfc8103e0 → uint128
read 0x57de26a4 → bytes32
timeout 0x70dea79a → uint32
turn 0x8b299903 → uint128
Write Contract 5 functions
These functions modify contract state and require a wallet transaction to execute.
returnAssetPrice 0x7f78fc7a
bytes32 requestId_
uint256 price_
returnPaymentTokenPrice 0xc5a7f06c
bytes32 requestId_
uint256 price_
setGasLimit 0xee7d72b4
uint256
setMaxReward 0x25c33e13
uint256 maxReward_
update 0xd4448a4c
uint128 payment_
address token_
Token Balances (2)
View Transfers →Recent Transactions
No transactions found for this address