UNPKG

token-price-oracles

Version:

tools for creating token price data feeds and oracles that integrate with on-chain dex's

872 lines (871 loc) 98.5 kB
{ "contractName": "TokenPriceDataFeed", "abi": [ { "constant": true, "inputs": [ { "name": "_date", "type": "uint256" } ], "name": "dateHasResult", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "dataSource", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "token2", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "exchangeAdapter", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_index", "type": "uint256" } ], "name": "resultByIndex", "outputs": [ { "name": "", "type": "bytes32" }, { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "latestResult", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "latestResultDate", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_result", "type": "bytes32" }, { "name": "_date", "type": "uint256" } ], "name": "setResult", "outputs": [ { "name": "index", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "name": "_date", "type": "uint256" } ], "name": "resultByDate", "outputs": [ { "name": "", "type": "bytes32" }, { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "totalResults", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "token1", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_index", "type": "uint256" } ], "name": "indexHasResult", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "_result", "type": "bytes32" }, { "indexed": false, "name": "_date", "type": "uint256" }, { "indexed": false, "name": "_index", "type": "uint256" }, { "indexed": false, "name": "_sender", "type": "address" } ], "name": "ResultSet", "type": "event" }, { "constant": false, "inputs": [ { "name": "_token1", "type": "address" }, { "name": "_token2", "type": "address" }, { "name": "_exchangeAdapter", "type": "address" } ], "name": "initialize", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_dataSource", "type": "address" } ], "name": "initialize", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "logResult", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b506110aa806100206000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631a0ba4f2146100e05780631b076edc1461012557806325be124e1461017c5780632cbcda25146101d357806330adb55d1461022a5780636a2ea57e1461027a5780636e4aa4d0146102ad57806371a1c0ae146102d857806392549bf2146102ef578063a25fa35c1461033e578063c0a6ab791461038e578063c0c53b8b146103b9578063c4d66de81461043c578063d21220a71461047f578063dab21b63146104d6575b600080fd5b3480156100ec57600080fd5b5061010b6004803603810190808035906020019092919050505061051b565b604051808215151515815260200191505060405180910390f35b34801561013157600080fd5b5061013a61053a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018857600080fd5b50610191610560565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101df57600080fd5b506101e8610586565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023657600080fd5b50610255600480360381019080803590602001909291905050506105ac565b6040518083600019166000191681526020018281526020019250505060405180910390f35b34801561028657600080fd5b5061028f61067c565b60405180826000191660001916815260200191505060405180910390f35b3480156102b957600080fd5b506102c26106b7565b6040518082815260200191505060405180910390f35b3480156102e457600080fd5b506102ed6106df565b005b3480156102fb57600080fd5b50610328600480360381019080803560001916906020019092919080359060200190929190505050610914565b6040518082815260200191505060405180910390f35b34801561034a57600080fd5b5061036960048036038101908080359060200190929190505050610ad2565b6040518083600019166000191681526020018281526020019250505060405180910390f35b34801561039a57600080fd5b506103a3610b83565b6040518082815260200191505060405180910390f35b3480156103c557600080fd5b5061043a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b93565b005b34801561044857600080fd5b5061047d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c64565b005b34801561048b57600080fd5b50610494610ebc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e257600080fd5b5061050160048036038101908080359060200190929190505050610ee2565b604051808215151515815260200191505060405180910390f35b6000806035600084815260200190815260200160002054119050919050565b603660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806105b883610ee2565b151561062c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f20726573756c742073657420666f72205f696e646578000000000000000081525060200191505060405180910390fd5b6034600060338581548110151561063f57fe5b906000526020600020015481526020019081526020016000205460338481548110151561066857fe5b906000526020600020015491509150915091565b600060346000603361068c610b83565b81548110151561069857fe5b9060005260206000200154815260200190815260200160002054905090565b600060336106c3610b83565b8154811015156106cf57fe5b9060005260206000200154905090565b6000603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635aaaa795603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b505050506040513d602081101561084057600080fd5b810190808051906020019092919050505090503073ffffffffffffffffffffffffffffffffffffffff166392549bf282600102426040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180836000191660001916815260200182815260200192505050602060405180830381600087803b1580156108d557600080fd5b505af11580156108e9573d6000803e3d6000fd5b505050506040513d60208110156108ff57600080fd5b81019080805190602001909291905050505050565b6000603660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f5468652063616c6c6572206973206e6f7420746865206461746120736f75726381526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b81428111151515610a7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f446174652063616e6e6f7420626520696e20746865206675747572650000000081525060200191505060405180910390fd5b60006033805490501115610ab7576033610a92610b83565b815481101515610a9e57fe5b906000526020600020015483111515610ab657600080fd5b5b610ac18484610f6a565b610ac9610b83565b91505092915050565b600080610ade8361051b565b1515610b52576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f20726573756c742073657420666f72205f6461746500000000000000000081525060200191505060405180910390fd5b6034600084815260200190815260200160002054603560008581526020019081526020016000205491509150915091565b6000600160338054905003905090565b82603760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081603860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080603960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c5f30610c64565b505050565b60008060019054906101000a900460ff1680610c845750610c83611069565b5b80610c9b57506000809054906101000a900460ff16155b1515610d35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f436f6e747261637420696e7374616e63652068617320616c726561647920626581526020017f656e20696e697469616c697a656400000000000000000000000000000000000081525060400191505060405180910390fd5b600060019054906101000a900460ff161590508015610d84576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610e29576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5f64617461536f757263652063616e6e6f74206265206164647265737328302981525060200191505060405180910390fd5b81603660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506033600090806001815401808255809150509060018203906000526020600020016000909192909190915055508015610eb85760008060016101000a81548160ff0219169083151502179055505b5050565b603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082111515610f5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5f696e646578206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b81603380549050119050919050565b816034600083815260200190815260200160002081600019169055506033819080600181540180825580915050906001820390600052602060002001600090919290919091505550610fba610b83565b6035600083815260200190815260200160002081905550610fdb828261107a565b7f441cd35745cc95136f39641bf16b52089bd7e481d97d7db059792befa3caec198282611006610b83565b336040518085600019166000191681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a15050565b600080303b90506000811491505090565b50505600a165627a7a723058207c0a3a3a441cfb8f1c3de1cd98f0a57746c5ed3f42ee6e351c0ed40d6b1693df0029", "deployedBytecode": "0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631a0ba4f2146100e05780631b076edc1461012557806325be124e1461017c5780632cbcda25146101d357806330adb55d1461022a5780636a2ea57e1461027a5780636e4aa4d0146102ad57806371a1c0ae146102d857806392549bf2146102ef578063a25fa35c1461033e578063c0a6ab791461038e578063c0c53b8b146103b9578063c4d66de81461043c578063d21220a71461047f578063dab21b63146104d6575b600080fd5b3480156100ec57600080fd5b5061010b6004803603810190808035906020019092919050505061051b565b604051808215151515815260200191505060405180910390f35b34801561013157600080fd5b5061013a61053a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018857600080fd5b50610191610560565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101df57600080fd5b506101e8610586565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023657600080fd5b50610255600480360381019080803590602001909291905050506105ac565b6040518083600019166000191681526020018281526020019250505060405180910390f35b34801561028657600080fd5b5061028f61067c565b60405180826000191660001916815260200191505060405180910390f35b3480156102b957600080fd5b506102c26106b7565b6040518082815260200191505060405180910390f35b3480156102e457600080fd5b506102ed6106df565b005b3480156102fb57600080fd5b50610328600480360381019080803560001916906020019092919080359060200190929190505050610914565b6040518082815260200191505060405180910390f35b34801561034a57600080fd5b5061036960048036038101908080359060200190929190505050610ad2565b6040518083600019166000191681526020018281526020019250505060405180910390f35b34801561039a57600080fd5b506103a3610b83565b6040518082815260200191505060405180910390f35b3480156103c557600080fd5b5061043a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b93565b005b34801561044857600080fd5b5061047d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c64565b005b34801561048b57600080fd5b50610494610ebc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e257600080fd5b5061050160048036038101908080359060200190929190505050610ee2565b604051808215151515815260200191505060405180910390f35b6000806035600084815260200190815260200160002054119050919050565b603660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806105b883610ee2565b151561062c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f20726573756c742073657420666f72205f696e646578000000000000000081525060200191505060405180910390fd5b6034600060338581548110151561063f57fe5b906000526020600020015481526020019081526020016000205460338481548110151561066857fe5b906000526020600020015491509150915091565b600060346000603361068c610b83565b81548110151561069857fe5b9060005260206000200154815260200190815260200160002054905090565b600060336106c3610b83565b8154811015156106cf57fe5b9060005260206000200154905090565b6000603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635aaaa795603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b505050506040513d602081101561084057600080fd5b810190808051906020019092919050505090503073ffffffffffffffffffffffffffffffffffffffff166392549bf282600102426040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180836000191660001916815260200182815260200192505050602060405180830381600087803b1580156108d557600080fd5b505af11580156108e9573d6000803e3d6000fd5b505050506040513d60208110156108ff57600080fd5b81019080805190602001909291905050505050565b6000603660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f5468652063616c6c6572206973206e6f7420746865206461746120736f75726381526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b81428111151515610a7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f446174652063616e6e6f7420626520696e20746865206675747572650000000081525060200191505060405180910390fd5b60006033805490501115610ab7576033610a92610b83565b815481101515610a9e57fe5b906000526020600020015483111515610ab657600080fd5b5b610ac18484610f6a565b610ac9610b83565b91505092915050565b600080610ade8361051b565b1515610b52576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f20726573756c742073657420666f72205f6461746500000000000000000081525060200191505060405180910390fd5b6034600084815260200190815260200160002054603560008581526020019081526020016000205491509150915091565b6000600160338054905003905090565b82603760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081603860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080603960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c5f30610c64565b505050565b60008060019054906101000a900460ff1680610c845750610c83611069565b5b80610c9b57506000809054906101000a900460ff16155b1515610d35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f436f6e747261637420696e7374616e63652068617320616c726561647920626581526020017f656e20696e697469616c697a656400000000000000000000000000000000000081525060400191505060405180910390fd5b600060019054906101000a900460ff161590508015610d84576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610e29576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5f64617461536f757263652063616e6e6f74206265206164647265737328302981525060200191505060405180910390fd5b81603660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506033600090806001815401808255809150509060018203906000526020600020016000909192909190915055508015610eb85760008060016101000a81548160ff0219169083151502179055505b5050565b603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082111515610f5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5f696e646578206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b81603380549050119050919050565b816034600083815260200190815260200160002081600019169055506033819080600181540180825580915050906001820390600052602060002001600090919290919091505550610fba610b83565b6035600083815260200190815260200160002081905550610fdb828261107a565b7f441cd35745cc95136f39641bf16b52089bd7e481d97d7db059792befa3caec198282611006610b83565b336040518085600019166000191681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a15050565b600080303b90506000811491505090565b50505600a165627a7a723058207c0a3a3a441cfb8f1c3de1cd98f0a57746c5ed3f42ee6e351c0ed40d6b1693df0029", "sourceMap": "145:681:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;145:681:1;;;;;;;", "deployedSourceMap": "145:681:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3824:109:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3824:109:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;460:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:25:7;;;;;;;;;;;;;;;;;;;;;;;;;;;224:21:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;224:21:1;;;;;;;;;;;;;;;;;;;;;;;;;;;249:39;;8:9:-1;5:2;;;30:1;27;20:12;5:2;249:39:1;;;;;;;;;;;;;;;;;;;;;;;;;;;2276:209:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2276:209:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3279:123;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3279:123:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3051:114;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3051:114:7;;;;;;;;;;;;;;;;;;;;;;;638:186:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;638:186:1;;;;;;1575:290:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1575:290:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2722:203;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2722:203:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1947:90;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1947:90:7;;;;;;;;;;;;;;;;;;;;;;;293:341:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;293:341:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1138:238:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1138:238:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;199:21:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;199:21:1;;;;;;;;;;;;;;;;;;;;;;;;;;;3526:167:7;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3526:167:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3824:109;3883:4;3926:1;3903:13;:20;3917:5;3903:20;;;;;;;;;;;;:24;3896:31;;3824:109;;;:::o;460:25::-;;;;;;;;;;;;;:::o;224:21:1:-;;;;;;;;;;;;;:::o;249:39::-;;;;;;;;;;;;;:::o;2276:209:7:-;2336:7;2345;2369:22;2384:6;2369:14;:22::i;:::-;2361:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2435:13;:28;2449:5;2455:6;2449:13;;;;;;;;;;;;;;;;;;2435:28;;;;;;;;;;;;2465:5;2471:6;2465:13;;;;;;;;;;;;;;;;;;2427:52;;;;2276:209;;;:::o;3279:123::-;3334:7;3360:13;:36;3374:5;3380:14;:12;:14::i;:::-;3374:21;;;;;;;;;;;;;;;;;;3360:36;;;;;;;;;;;;3353:43;;3279:123;:::o;3051:114::-;3110:7;3137:5;3143:14;:12;:14::i;:::-;3137:21;;;;;;;;;;;;;;;;;;3129:30;;3051:114;:::o;638:186:1:-;672:10;685:15;;;;;;;;;;;:36;;;722:6;;;;;;;;;;;730;;;;;;;;;;;685:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;685:52:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;685:52:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;685:52:1;;;;;;;;;;;;;;;;672:65;;762:4;743:34;;;786:5;778:14;;802:15;743:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;743:76:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;743:76:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;743:76:1;;;;;;;;;;;;;;;;;638:186;:::o;1575:290:7:-;1697:13;942:10;;;;;;;;;;;928:24;;:10;:24;;;920:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1676:5;761:3;752:5;:12;;744:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1741:1;1726:5;:12;;;;:16;1722:77;;;1769:5;1775:14;:12;:14::i;:::-;1769:21;;;;;;;;;;;;;;;;;;1761:5;:29;1753:38;;;;;;;;1722:77;1805:26;1816:7;1825:5;1805:10;:26::i;:::-;1845:14;:12;:14::i;:::-;1838:21;;997:1;1575:290;;;;:::o;2722:203::-;2780:7;2789;2813:20;2827:5;2813:13;:20::i;:::-;2805:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2876:13;:20;2890:5;2876:20;;;;;;;;;;;;2898:13;:20;2912:5;2898:20;;;;;;;;;;;;2868:51;;;;2722:203;;;:::o;1947:90::-;1992:7;2030:1;2015:5;:12;;;;:16;2008:23;;1947:90;:::o;293:341:1:-;426:7;417:6;;:16;;;;;;;;;;;;;;;;;;448:7;439:6;;:16;;;;;;;;;;;;;;;;;;479;461:15;;:34;;;;;;;;;;;;;;;;;;585:44;623:4;585:29;:44::i;:::-;293:341;;;:::o;1138:238:7:-;601:19:9;496:12;;;;;;;;;;;:31;;;;512:15;:13;:15::i;:::-;496:31;:47;;;;532:11;;;;;;;;;;;531:12;496:47;488:106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;624:12;;;;;;;;;;;623:13;601:35;;646:14;642:80;;;685:4;670:12;;:19;;;;;;;;;;;;;;;;;;711:4;697:11;;:18;;;;;;;;;;;;;;;;;;642:80;1236:1:7;1213:25;;:11;:25;;;;1205:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1295:11;1282:10;;:24;;;;;;;;;;;;;;;;;;1313:5;1324:1;1313:13;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1313:13:7;;;;;;;;;;;;;;;;;;;;;;740:14:9;736:55;;;779:5;764:12;;:20;;;;;;;;;;;;;;;;;;736:55;1138:238:7;;:::o;199:21:1:-;;;;;;;;;;;;;:::o;3526:167:7:-;3587:4;3617:1;3608:6;:10;3600:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3681:6;3666:5;:12;;;;:21;3659:28;;3526:167;;;:::o;4102:277::-;4193:7;4170:13;:20;4184:5;4170:20;;;;;;;;;;;:30;;;;;;;4207:5;4218;4207:17;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;4207:17:7;;;;;;;;;;;;;;;;;;;;;;4254:14;:12;:14::i;:::-;4231:13;:20;4245:5;4231:20;;;;;;;;;;;:37;;;;4277:29;4291:7;4300:5;4277:13;:29::i;:::-;4320:53;4330:7;4339:5;4346:14;:12;:14::i;:::-;4362:10;4320:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4102:277;;:::o;881:467:9:-;928:4;1269:10;1314:7;1302:20;1296:26;;1342:1;1336:2;:7;1329:14;;881:467;;:::o;4470:104:7:-;;;:::o", "source": "pragma solidity >=0.4.24;\n\nimport \"tidbit/contracts/DataFeedOracles/DataFeedOracleBase.sol\";\nimport \"../ExchangeAdapters/IExchangeAdapter.sol\";\n\ncontract TokenPriceDataFeed is DataFeedOracleBase {\n address public token1;\n address public token2;\n IExchangeAdapter public exchangeAdapter;\n\n function initialize(\n address _token1,\n address _token2,\n IExchangeAdapter _exchangeAdapter\n )\n public\n {\n token1 = _token1;\n token2 = _token2;\n exchangeAdapter = _exchangeAdapter;\n\n // set dataSource to `this` so setResult can only be called from this contract\n DataFeedOracleBase.initialize(address(this));\n }\n\n function logResult() public {\n uint price = exchangeAdapter.getPriceForTokenPair(token1, token2);\n DataFeedOracleBase(this).setResult(bytes32(price), uint256(block.timestamp));\n }\n}\n", "sourcePath": "/Users/mfcalvanese/dev/eth/token-price-oracles/contracts/DataFeeds/TokenPriceDataFeed.sol", "ast": { "absolutePath": "/Users/mfcalvanese/dev/eth/token-price-oracles/contracts/DataFeeds/TokenPriceDataFeed.sol", "exportedSymbols": { "TokenPriceDataFeed": [ 482 ] }, "id": 483, "nodeType": "SourceUnit", "nodes": [ { "id": 416, "literals": [ "solidity", ">=", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:25:1" }, { "absolutePath": "tidbit/contracts/DataFeedOracles/DataFeedOracleBase.sol", "file": "tidbit/contracts/DataFeedOracles/DataFeedOracleBase.sol", "id": 417, "nodeType": "ImportDirective", "scope": 483, "sourceUnit": 1377, "src": "27:65:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/mfcalvanese/dev/eth/token-price-oracles/contracts/ExchangeAdapters/IExchangeAdapter.sol", "file": "../ExchangeAdapters/IExchangeAdapter.sol", "id": 418, "nodeType": "ImportDirective", "scope": 483, "sourceUnit": 495, "src": "93:50:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 419, "name": "DataFeedOracleBase", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1376, "src": "176:18:1", "typeDescriptions": { "typeIdentifier": "t_contract$_DataFeedOracleBase_$1376", "typeString": "contract DataFeedOracleBase" } }, "id": 420, "nodeType": "InheritanceSpecifier", "src": "176:18:1" } ], "contractDependencies": [ 1376, 1426, 1489 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 482, "linearizedBaseContracts": [ 482, 1376, 1426, 1489 ], "name": "TokenPriceDataFeed", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 422, "name": "token1", "nodeType": "VariableDeclaration", "scope": 482, "src": "199:21:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 421, "name": "address", "nodeType": "ElementaryTypeName", "src": "199:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 424, "name": "token2", "nodeType": "VariableDeclaration", "scope": 482, "src": "224:21:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 423, "name": "address", "nodeType": "ElementaryTypeName", "src": "224:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 426, "name": "exchangeAdapter", "nodeType": "VariableDeclaration", "scope": 482, "src": "249:39:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" }, "typeName": { "contractScope": null, "id": 425, "name": "IExchangeAdapter", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 494, "src": "249:16:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" } }, "value": null, "visibility": "public" }, { "body": { "id": 455, "nodeType": "Block", "src": "411:223:1", "statements": [ { "expression": { "argumentTypes": null, "id": 437, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 435, "name": "token1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 422, "src": "417:6:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 436, "name": "_token1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 428, "src": "426:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "417:16:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 438, "nodeType": "ExpressionStatement", "src": "417:16:1" }, { "expression": { "argumentTypes": null, "id": 441, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 439, "name": "token2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 424, "src": "439:6:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 440, "name": "_token2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 430, "src": "448:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "439:16:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 442, "nodeType": "ExpressionStatement", "src": "439:16:1" }, { "expression": { "argumentTypes": null, "id": 445, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 443, "name": "exchangeAdapter", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 426, "src": "461:15:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 444, "name": "_exchangeAdapter", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 432, "src": "479:16:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" } }, "src": "461:34:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" } }, "id": 446, "nodeType": "ExpressionStatement", "src": "461:34:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 451, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1529, "src": "623:4:1", "typeDescriptions": { "typeIdentifier": "t_contract$_TokenPriceDataFeed_$482", "typeString": "contract TokenPriceDataFeed" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_TokenPriceDataFeed_$482", "typeString": "contract TokenPriceDataFeed" } ], "id": 450, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "615:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 452, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "615:13:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "id": 447, "name": "DataFeedOracleBase", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1376, "src": "585:18:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_DataFeedOracleBase_$1376_$", "typeString": "type(contract DataFeedOracleBase)" } }, "id": 449, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "initialize", "nodeType": "MemberAccess", "referencedDeclaration": 1166, "src": "585:29:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 453, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "585:44:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 454, "nodeType": "ExpressionStatement", "src": "585:44:1" } ] }, "documentation": null, "id": 456, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "initialize", "nodeType": "FunctionDefinition", "parameters": { "id": 433, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 428, "name": "_token1", "nodeType": "VariableDeclaration", "scope": 456, "src": "318:15:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 427, "name": "address", "nodeType": "ElementaryTypeName", "src": "318:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 430, "name": "_token2", "nodeType": "VariableDeclaration", "scope": 456, "src": "339:15:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 429, "name": "address", "nodeType": "ElementaryTypeName", "src": "339:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 432, "name": "_exchangeAdapter", "nodeType": "VariableDeclaration", "scope": 456, "src": "360:33:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" }, "typeName": { "contractScope": null, "id": 431, "name": "IExchangeAdapter", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 494, "src": "360:16:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IExchangeAdapter_$494", "typeString": "contract IExchangeAdapter" } }, "value": null, "visibility": "internal" } ], "src": "312:85:1" }, "payable": false, "returnParameters": { "id": 434, "nodeType": "ParameterList", "parameters": [], "src": "411:0:1" }, "scope": 482, "src": "293:341:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 480, "nodeType": "Block", "src": "666:158:1", "statements": [ { "assignments": [ 460 ], "declarations": [ { "constant": false, "id": 460, "name": "price", "nodeType": "VariableDeclaration", "scope": 481, "src": "672:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 459, "name": "uint", "nodeType": "ElementaryTypeName", "src": "672:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 466, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 463, "name": "token1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 422, "src": "722:6:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 464, "name": "token2", "nodeType": "Identifier",