UNPKG

@sonicswap/periphery

Version:

🎚 Peripheral smart contracts for interacting with the Sonicswap exchanges

629 lines (628 loc) • 313 kB
{ "contractName": "ExampleOracleSimple", "abi": [ { "inputs": [ { "internalType": "address", "name": "factory", "type": "address" }, { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "PERIOD", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "blockTimestampLast", "outputs": [ { "internalType": "uint32", "name": "", "type": "uint32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "price0Average", "outputs": [ { "internalType": "uint224", "name": "_x", "type": "uint224" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "price0CumulativeLast", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "price1Average", "outputs": [ { "internalType": "uint224", "name": "_x", "type": "uint224" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "price1CumulativeLast", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "token0", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "token1", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "update", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "amountIn", "type": "uint256" } ], "name": "consult", "outputs": [ { "internalType": "uint256", "name": "amountOut", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockTimestampLast\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"name\":\"consult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price0Average\",\"outputs\":[{\"internalType\":\"uint224\",\"name\":\"_x\",\"type\":\"uint224\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price0CumulativeLast\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Average\",\"outputs\":[{\"internalType\":\"uint224\",\"name\":\"_x\",\"type\":\"uint224\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1CumulativeLast\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"update\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleOracleSimple.sol\":\"ExampleOracleSimple\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleOracleSimple.sol\":{\"keccak256\":\"0x9f377d8873f1510e07ad12a877ee4ef5aa3de2b3becb4cabe3c308a2642f7972\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://6de932ff0d93b0490974cce0c026ecdbc193dce88329aeb8edbd02e2b65a6d91\",\"dweb:/ipfs/QmU9SZVWat8JZKYNjVjNUbqJWHmatFKgdXwYHLpYhc4QAC\"]},\"/var/www/Sonic/sonicswap-periphery/contracts/libraries/SafeMath.sol\":{\"keccak256\":\"0x97845129a51dbb1869a765595d1c671fa473b97ef800756402afaadc7640a94e\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5928803fe14654103d3f15b57b5b8df40b98f58cbe4e7044888f092f2462af04\",\"dweb:/ipfs/QmdnB83EBtNjwoKFHizxsTo6e2ytKN97SCvYnX28p75DCu\"]},\"/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2Library.sol\":{\"keccak256\":\"0x97bae257510f91855e0f098176f8dbb967702f788492884bca5886dc1d1aec7d\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://310af80b5807f9ca7b8da55e529f44d41cd2f897511191f40d85d41e351bbeb4\",\"dweb:/ipfs/QmXMrQD79HZXN7JrHqNGYp3AKTSN7Kw8TjwrUw8Z33jFU6\"]},\"/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2OracleLibrary.sol\":{\"keccak256\":\"0xa41e7d2548091ad9d2a7d41a7d204dc02de4c239918befdc91d38fe86a45c8a3\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://9b334a4d861aaffed92ad7157e7c272a043ed985f7ebe2054530cec5ac4164dc\",\"dweb:/ipfs/QmcuLSWUDLFXaogTpQNqHavfE1GKDjZHvoWDwcZ5x1eDea\"]},\"@sonicswap/core/contracts/interfaces/IUniswapV2Factory.sol\":{\"keccak256\":\"0xf493893f508c8caa2f5923d1a39080fc5f1f362ea1f1d65ffc38b7782b35c4b7\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://993a51b20f6d79edb33069524ee3a66378f8687d3df52e279561c4ef72e17cb2\",\"dweb:/ipfs/QmQSmgeRkVyA4jyShZStAWVt1CWNZQ8JvYmc2V2jgEUNEE\"]},\"@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol\":{\"keccak256\":\"0xa87a1a8e9d72090e25812f396a9c0766a715dda52d8b6115ca0ab3f2a9c10f87\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://3b179da8f464eaa162ef0f9cfac56989d6fb5aa9667bebd23b355d93ea3ff10b\",\"dweb:/ipfs/QmcgYA55h3VJJRo7fFFNSDDDspdnJVTW83aH657v4E9bGZ\"]},\"@sonicswap/lib/contracts/libraries/Babylonian.sol\":{\"keccak256\":\"0xc2389737a1d4954f93ed88099f8833ccc350a62b8b29b61c2a24f237eb4649bc\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://3d95218a6f0c7c5030e1f81aabcfe297449bf8bb92fcac1c4ba9bcfc8d61e62b\",\"dweb:/ipfs/QmXzJQLQfgqCuxL5JGMrKRQf5ziRNvQiQkNK3ZK6Lkn4CR\"]},\"@sonicswap/lib/contracts/libraries/BitMath.sol\":{\"keccak256\":\"0xa4d662f44b982fc9aa6542249aa79b2b07b3e34d5cdaa03720d3d471ac07f5de\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://4d40d6c87edb8699d5c5c80344b642a516e0a071f173d393678fee58bbc5fde5\",\"dweb:/ipfs/QmXfp4W5jAdpcsv8VTP8RWsPcmASEtmzF9Xg9xehKK7Xdm\"]},\"@sonicswap/lib/contracts/libraries/FixedPoint.sol\":{\"keccak256\":\"0xba90ab07a7e7870d349fd22dda12b02b78a2b5c0f797de591115cde1ae3e47b0\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://b91731ebb4825bcd8512fbf9721d602c298a18392919ddf800f3394231090cb4\",\"dweb:/ipfs/QmUNu1dqnNMyjUeD23KheR1ACVvWmP1T6SmH55Q2kS4nwS\"]},\"@sonicswap/lib/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0x074f43cf798f046118ed21bb9859a7fa1074b9581fe315c8702d6d292fdb2784\",\"license\":\"CC-BY-4.0\",\"urls\":[\"bzz-raw://55a5cb6c5ae9ccc1e6870315bfa5f23f4c758db606f6a292fdff2224fcec082e\",\"dweb:/ipfs/QmRZayK4DWdWHaape9XcVj6VobzX7en7Tejk7gbzv7CHTy\"]}},\"version\":1}", "bytecode": "0x60e06040523480156200001157600080fd5b50604051620011d8380380620011d8833981810160405260608110156200003757600080fd5b5080516020808301516040909301519192919060009062000067908590859085906200045a6200037d821b17901c565b9050806001600160a01b03166080816001600160a01b031660601b81525050806001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620000c057600080fd5b505afa158015620000d5573d6000803e3d6000fd5b505050506040513d6020811015620000ec57600080fd5b505160601b6001600160601b03191660a0526040805163d21220a760e01b815290516001600160a01b0383169163d21220a7916004808301926020929190829003018186803b1580156200013f57600080fd5b505afa15801562000154573d6000803e3d6000fd5b505050506040513d60208110156200016b57600080fd5b505160601b6001600160601b03191660c05260408051635909c0d560e01b815290516001600160a01b03831691635909c0d5916004808301926020929190829003018186803b158015620001be57600080fd5b505afa158015620001d3573d6000803e3d6000fd5b505050506040513d6020811015620001ea57600080fd5b505160005560408051635a3d549360e01b815290516001600160a01b03831691635a3d5493916004808301926020929190829003018186803b1580156200023057600080fd5b505afa15801562000245573d6000803e3d6000fd5b505050506040513d60208110156200025c57600080fd5b505160015560408051630240bc6b60e21b8152905160009182916001600160a01b03851691630902f1ac916004808301926060929190829003018186803b158015620002a757600080fd5b505afa158015620002bc573d6000803e3d6000fd5b505050506040513d6060811015620002d357600080fd5b50805160208201516040909201516002805463ffffffff191663ffffffff909216919091179055925090506001600160701b038216158015906200031f57506001600160701b03811615155b62000371576040805162461bcd60e51b815260206004820181905260248201527f4578616d706c654f7261636c6553696d706c653a204e4f5f5245534552564553604482015290519081900360640190fd5b50505050505062000534565b600080806200038d858562000451565b604080516001600160601b0319606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b600080826001600160a01b0316846001600160a01b03161415620004a75760405162461bcd60e51b8152600401808060200182810382526025815260200180620011b36025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031610620004c9578284620004cc565b83835b90925090506001600160a01b0382166200052d576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b60805160601c60a05160601c60c05160601c610c3f620005746000398061021a528061043852508061017e52806101a45250806102e65250610c3f6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063a2e6204511610066578063a2e6204514610139578063a6bb453914610143578063b4d1d7951461014b578063c5700a0214610153578063d21220a7146101745761009e565b80630dfe1681146100a35780633ddac953146100c75780635909c0d5146101055780635a3d54931461010d5780635e6aaf2c14610115575b600080fd5b6100ab61017c565b604080516001600160a01b039092168252519081900360200190f35b6100f3600480360360408110156100dd57600080fd5b506001600160a01b0381351690602001356101a0565b60408051918252519081900360200190f35b6100f36102c1565b6100f36102c7565b61011d6102cd565b604080516001600160e01b039092168252519081900360200190f35b6101416102dc565b005b61011d610414565b6100f3610423565b61015b61042a565b6040805163ffffffff9092168252519081900360200190f35b6100ab610436565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614156102185760408051602081019091526003546001600160e01b0316815261020890610203908461051a565b6105ae565b6001600160901b031690506102bb565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146102885760405162461bcd60e51b8152600401808060200182810382526022815260200180610bc16022913960400191505060405180910390fd5b60408051602081019091526004546001600160e01b031681526102af90610203908461051a565b6001600160901b031690505b92915050565b60005481565b60015481565b6004546001600160e01b031681565b600080600061030a7f00000000000000000000000000000000000000000000000000000000000000006105b5565b600254929550909350915063ffffffff9081168203906201518090821610156103645760405162461bcd60e51b8152600401808060200182810382526027815260200180610be36027913960400191505060405180910390fd5b60405180602001604052808263ffffffff1660005487038161038257fe5b046001600160e01b039081169091529051600380546001600160e01b031916919092161790556040805160208101909152600154819063ffffffff8416908603816103c957fe5b046001600160e01b039081169091529051600480546001600160e01b03191691909216179055506000929092556001556002805463ffffffff191663ffffffff909216919091179055565b6003546001600160e01b031681565b6201518081565b60025463ffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600061046985856107a4565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b610522610b50565b600082158061054857505082516001600160e01b03168281029083828161054557fe5b04145b610599576040805162461bcd60e51b815260206004820152601960248201527f4669786564506f696e743a3a6d756c3a206f766572666c6f7700000000000000604482015290519081900360640190fd5b60408051602081019091529081529392505050565b5160701c90565b60008060006105c2610882565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156105fd57600080fd5b505afa158015610611573d6000803e3d6000fd5b505050506040513d602081101561062757600080fd5b505160408051635a3d549360e01b815290519194506001600160a01b03861691635a3d549391600480820192602092909190829003018186803b15801561066d57600080fd5b505afa158015610681573d6000803e3d6000fd5b505050506040513d602081101561069757600080fd5b505160408051630240bc6b60e21b81529051919350600091829182916001600160a01b03891691630902f1ac916004808301926060929190829003018186803b1580156106e357600080fd5b505afa1580156106f7573d6000803e3d6000fd5b505050506040513d606081101561070d57600080fd5b5080516020820151604090920151909450909250905063ffffffff8082169085161461079a5780840363ffffffff81166107536001600160701b0380861690871661088c565b600001516001600160e01b031602870196508063ffffffff16610788856001600160701b0316856001600160701b031661088c565b516001600160e01b0316029590950194505b5050509193909250565b600080826001600160a01b0316846001600160a01b031614156107f85760405162461bcd60e51b8152600401808060200182810382526025815260200180610b766025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b03161061081857828461081b565b83835b90925090506001600160a01b03821661087b576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b63ffffffff421690565b610894610b63565b600082116108d35760405162461bcd60e51b8152600401808060200182810382526026815260200180610b9b6026913960400191505060405180910390fd5b826108ed57506040805160208101909152600081526102bb565b6001600160901b03831161098957600082607085901b8161090a57fe5b0490506001600160e01b03811115610969576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b03168152509150506102bb565b600061099a84600160701b856109f8565b90506001600160e01b03811115610969576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6000806000610a078686610ab3565b9150915060008480610a1557fe5b868809905082811115610a29576001820391505b918290039181610a4757848381610a3c57fe5b049350505050610aac565b848210610a9b576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015290519081900360640190fd5b610aa6838387610ae0565b93505050505b9392505050565b6000808060001984860990508385029250828103915082811015610ad8576001820391505b509250929050565b60008181038216808381610af057fe5b049250808581610afc57fe5b049450808160000381610b0b57fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040518060200160405280600081525090565b6040805160208101909152600081529056fe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345534669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f4578616d706c654f7261636c6553696d706c653a20494e56414c49445f544f4b454e4578616d706c654f7261636c6553696d706c653a20504552494f445f4e4f545f454c4150534544a2646970667358221220703ee875f90914c6ac28f5630a87a7c36355fb77429b4b9bd153f4969ec012ff64736f6c634300060c0033556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063a2e6204511610066578063a2e6204514610139578063a6bb453914610143578063b4d1d7951461014b578063c5700a0214610153578063d21220a7146101745761009e565b80630dfe1681146100a35780633ddac953146100c75780635909c0d5146101055780635a3d54931461010d5780635e6aaf2c14610115575b600080fd5b6100ab61017c565b604080516001600160a01b039092168252519081900360200190f35b6100f3600480360360408110156100dd57600080fd5b506001600160a01b0381351690602001356101a0565b60408051918252519081900360200190f35b6100f36102c1565b6100f36102c7565b61011d6102cd565b604080516001600160e01b039092168252519081900360200190f35b6101416102dc565b005b61011d610414565b6100f3610423565b61015b61042a565b6040805163ffffffff9092168252519081900360200190f35b6100ab610436565b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614156102185760408051602081019091526003546001600160e01b0316815261020890610203908461051a565b6105ae565b6001600160901b031690506102bb565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146102885760405162461bcd60e51b8152600401808060200182810382526022815260200180610bc16022913960400191505060405180910390fd5b60408051602081019091526004546001600160e01b031681526102af90610203908461051a565b6001600160901b031690505b92915050565b60005481565b60015481565b6004546001600160e01b031681565b600080600061030a7f00000000000000000000000000000000000000000000000000000000000000006105b5565b600254929550909350915063ffffffff9081168203906201518090821610156103645760405162461bcd60e51b8152600401808060200182810382526027815260200180610be36027913960400191505060405180910390fd5b60405180602001604052808263ffffffff1660005487038161038257fe5b046001600160e01b039081169091529051600380546001600160e01b031916919092161790556040805160208101909152600154819063ffffffff8416908603816103c957fe5b046001600160e01b039081169091529051600480546001600160e01b03191691909216179055506000929092556001556002805463ffffffff191663ffffffff909216919091179055565b6003546001600160e01b031681565b6201518081565b60025463ffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600061046985856107a4565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b610522610b50565b600082158061054857505082516001600160e01b03168281029083828161054557fe5b04145b610599576040805162461bcd60e51b815260206004820152601960248201527f4669786564506f696e743a3a6d756c3a206f766572666c6f7700000000000000604482015290519081900360640190fd5b60408051602081019091529081529392505050565b5160701c90565b60008060006105c2610882565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156105fd57600080fd5b505afa158015610611573d6000803e3d6000fd5b505050506040513d602081101561062757600080fd5b505160408051635a3d549360e01b815290519194506001600160a01b03861691635a3d549391600480820192602092909190829003018186803b15801561066d57600080fd5b505afa158015610681573d6000803e3d6000fd5b505050506040513d602081101561069757600080fd5b505160408051630240bc6b60e21b81529051919350600091829182916001600160a01b03891691630902f1ac916004808301926060929190829003018186803b1580156106e357600080fd5b505afa1580156106f7573d6000803e3d6000fd5b505050506040513d606081101561070d57600080fd5b5080516020820151604090920151909450909250905063ffffffff8082169085161461079a5780840363ffffffff81166107536001600160701b0380861690871661088c565b600001516001600160e01b031602870196508063ffffffff16610788856001600160701b0316856001600160701b031661088c565b516001600160e01b0316029590950194505b5050509193909250565b600080826001600160a01b0316846001600160a01b031614156107f85760405162461bcd60e51b8152600401808060200182810382526025815260200180610b766025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b03161061081857828461081b565b83835b90925090506001600160a01b03821661087b576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b63ffffffff421690565b610894610b63565b600082116108d35760405162461bcd60e51b8152600401808060200182810382526026815260200180610b9b6026913960400191505060405180910390fd5b826108ed57506040805160208101909152600081526102bb565b6001600160901b03831161098957600082607085901b8161090a57fe5b0490506001600160e01b03811115610969576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b03168152509150506102bb565b600061099a84600160701b856109f8565b90506001600160e01b03811115610969576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6000806000610a078686610ab3565b9150915060008480610a1557fe5b868809905082811115610a29576001820391505b918290039181610a4757848381610a3c57fe5b049350505050610aac565b848210610a9b576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015290519081900360640190fd5b610aa6838387610ae0565b93505050505b9392505050565b6000808060001984860990508385029250828103915082811015610ad8576001820391505b509250929050565b60008181038216808381610af057fe5b049250808581610afc57fe5b049450808160000381610b0b57fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040518060200160405280600081525090565b6040805160208101909152600081529056fe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345534669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f4578616d706c654f7261636c6553696d706c653a20494e56414c49445f544f4b454e4578616d706c654f7261636c6553696d706c653a20504552494f445f4e4f545f454c4150534544a2646970667358221220703ee875f90914c6ac28f5630a87a7c36355fb77429b4b9bd153f4969ec012ff64736f6c634300060c0033", "immutableReferences": { "4191": [ { "length": 32, "start": 742 } ], "4193": [ { "length": 32, "start": 382 }, { "length": 32, "start": 420 } ], "4195": [ { "length": 32, "start": 538 }, { "length": 32, "start": 1080 } ] }, "sourceMap": "562:2638:5:-:0;;;997:743;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;997:743:5;;;;;;;;;;;;;;;;1075:20;;1113:49;;997:743;;;;;;1113:24;;;;;:49;;:::i;:::-;1075:88;;1180:5;-1:-1:-1;;;;;1173:12:5;;;-1:-1:-1;;;;;1173:12:5;;;;;;;1204:5;-1:-1:-1;;;;;1204:12:5;;:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1204:14:5;1195:23;;-1:-1:-1;;;;;;1195:23:5;;;1237:14;;;-1:-1:-1;;;1237:14:5;;;;-1:-1:-1;;;;;1237:12:5;;;;;:14;;;;;1204;;1237;;;;;;;:12;:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1237:14:5;1228:23;;-1:-1:-1;;;;;;1228:23:5;;;1284:28;;;-1:-1:-1;;;1284:28:5;;;;-1:-1:-1;;;;;1284:26:5;;;;;:28;;;;;1237:14;;1284:28;;;;;;;:26;:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1284:28:5;1261:20;:51;1398:28;;;-1:-1:-1;;;1398:28:5;;;;-1:-1:-1;;;;;1398:26:5;;;;;:28;;;;;1284;;1398;;;;;;;:26;:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1398:28:5;1375:20;:51;1584:19;;;-1:-1:-1;;;1584:19:5;;;;1489:16;;;;-1:-1:-1;;;;;1584:17:5;;;;;:19;;;;;;;;;;;;;;:17;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1584:19:5;;;;;;;;;;;1562:18;1541:62;;-1:-1:-1;;1541:62:5;;;;;;;;;;;1584:19;-1:-1:-1;1584:19:5;-1:-1:-1;;;;;;1621:13:5;;;;;;:30;;-1:-1:-1;;;;;;1638:13:5;;;;1621:30;1613:75;;;;;-1:-1:-1;;;1613:75:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;997:743;;;;;;562:2638;;750:470:16;839:12;;;898:26;909:6;917;898:10;:26::i;:::-;1058:32;;;-1:-1:-1;;;;;;1058:32:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1048:43;;;;;;964:246;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;954:257;;;;;;;;;750:470;-1:-1:-1;;;;;750:470:16:o;316:345::-;391:14;407;451:6;-1:-1:-1;;;;;441:16:16;:6;-1:-1:-1;;;;;441:16:16;;;433:66;;;;-1:-1:-1;;;433:66:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;537:6;-1:-1:-1;;;;;528:15:16;:6;-1:-1:-1;;;;;528:15:16;;:53;;566:6;574;528:53;;;547:6;555;528:53;509:72;;-1:-1:-1;509:72:16;-1:-1:-1;;;;;;599:20:16;;591:63;;;;;-1:-1:-1;;;591:63:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;316:345;;;;;:::o;562:2638:5:-;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "562:2638:5:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;706:31;;;:::i;:::-;;;;-1:-1:-1;;;;;706:31:5;;;;;;;;;;;;;;2841:357;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2841:357:5;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;781:35;;;:::i;822:::-;;;:::i;949:41::-;;;:::i;:::-;;;;-1:-1:-1;;;;;949:41:5;;;;;;;;;;;;;;1746:988;;;:::i;:::-;;902:41;;;:::i;626:38::-;;;:::i;863:33::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;743:31;;;:::i;706:::-;;;:::o;2841:357::-;2911:14;2950:6;-1:-1:-1;;;;;2941:15:5;:5;-1:-1:-1;;;;;2941:15:5;;2937:255;;;2984:17;;;;;;;;;:13;:17;-1:-1:-1;;;;;2984:17:5;;;:39;;:27;;3002:8;2984:17;:27::i;:::-;:37;:39::i;:::-;-1:-1:-1;;;;;2972:51:5;;;2937:255;;;3071:6;-1:-1:-1;;;;;3062:15:5;:5;-1:-1:-1;;;;;3062:15:5;;3054:62;;;;-1:-1:-1;;;3054:62:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3142:17;;;;;;;;;:13;:17;-1:-1:-1;;;;;3142:17:5;;;:39;;:27;;3160:8;3142:17;:27::i;:39::-;-1:-1:-1;;;;;3130:51:5;;;2937:255;2841:357;;;;:::o;781:35::-;;;;:::o;822:::-;;;;:::o;949:41::-;;;-1:-1:-1;;;;;949:41:5;;:::o;1746:988::-;1784:21;1807;1830;1867:61;1922:4;1867:46;:61::i;:::-;1976:18;;1783:145;;-1:-1:-1;1783:145:5;;-1:-1:-1;1783:145:5;-1:-1:-1;1976:18:5;;;;1959:35;;;656:8;2117:21;;;;;2109:73;;;;-1:-1:-1;;;2109:73:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2385:86;;;;;;;;2458:11;2414:55;;2434:20;;2415:16;:39;2414:55;;;;;;-1:-1:-1;;;;;2385:86:5;;;;;;2369:102;;:13;:102;;-1:-1:-1;;;;;;2369:102:5;;;;;;;;2497:86;;;;;;;;;-1:-1:-1;2546:20:5;2497:86;;2526:55;;;;2527:39;;2526:55;;;;;;-1:-1:-1;;;;;2497:86:5;;;;;;2481:102;;:13;:102;;-1:-1:-1;;;;;;2481:102:5;;;;;;;;-1:-1:-1;;2594:39:5;;;;-1:-1:-1;2643:39:5;2692:18;:35;;-1:-1:-1;;2692:35:5;;;;;;;;;;;1746:988::o;902:41::-;;;-1:-1:-1;;;;;902:41:5;;:::o;626:38::-;656:8;626:38;:::o;863:33::-;;;;;;:::o;743:31::-;;;:::o;750:470:16:-;839:12;864:14;880;898:26;909:6;917;898:10;:26::i;:::-;1058:32;;;-1:-1:-1;;1058:32:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1048:43;;;;;;-1:-1:-1;;;;;;964:246:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;954:257;;;;;;;;;750:470;-1:-1:-1;;;;;750:470:16:o;1694:237:28:-;1764:16;;:::i;:::-;1792:9;1823:6;;;:42;;-1:-1:-1;;1858:7:28;;-1:-1:-1;;;;;1833:32:28;1838:11;;;;1853:1;1838:11;1853:1;1833:21;;;;;:32;1823:42;1815:80;;;;;-1:-1:-1;;;1815:80:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;1912:12;;;;;;;;;;;;;1694:237;-1:-1:-1;;;1694:237:28:o;1472:128::-;1571:7;531:3;1571:21;;1472:128::o;683:1040:18:-;767:21;790;813;863:23;:21;:23::i;:::-;846:40;;930:4;-1:-1:-1;;;;;915:41:18;;:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;915:43:18;987;;;-1:-1:-1;;;987:43:18;;;;915;;-1:-1:-1;;;;;;987:41:18;;;;;:43;;;;;915;;987;;;;;;;;:41;:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;987:43:18;1207:34;;;-1:-1:-1;;;1207:34:18;;;;987:43;;-1:-1:-1;1142:16:18;;;;;;-1:-1:-1;;;;;1207:32:18;;;;;:34;;;;;;;;;;;;;;:32;:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1207:34:18;;;;;;;;;;;;;-1:-1:-1;1207:34:18;;-1:-1:-1;1207:34:18;-1:-1:-1;1255:36:18;;;;;;;;1251:466;;1375:35;;;1518:62;;;1523:39;-1:-1:-1;;;;;1523:39:18;;;;;;:19;:39::i;:::-;:42;;;-1:-1:-1;;;;;1518:48:18;:62;1498:82;;;;1695:11;1644:62;;1649:39;1669:8;-1:-1:-1;;;;;1649:39:18;1679:8;-1:-1:-1;;;;;1649:39:18;:19;:39::i;:::-;:42;-1:-1:-1;;;;;1644:48:18;:62;1624:82;;;;;-1:-1:-1;1251:466:18;683:1040;;;;;;;;:::o;316:345:16:-;391:14;407;451:6;-1:-1:-1;;;;;441:16:16;:6;-1:-1:-1;;;;;441:16:16;;;433:66;;;;-1:-1:-1;;;433:66:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;537:6;-1:-1:-1;;;;;528:15:16;:6;-1:-1:-1;;;;;528:15:16;;:53;;566:6;574;528:53;;;547:6;555;528:53;509:72;;-1:-1:-1;509:72:16;-1:-1:-1;;;;;;599:20:16;;591:63;;;;;-1:-1:-1;;;591:63:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;316:345;;;;;:::o;459:121:18:-;547:25;:15;:25;;459:121::o;4526:706:28:-;4607:16;;:::i;:::-;4657:1;4643:11;:15;4635:66;;;;-1:-1:-1;;;4635:66:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4715:14;4711:50;;-1:-1:-1;4738:23:28;;;;;;;;;-1:-1:-1;4738:23:28;;4731:30;;4711:50;-1:-1:-1;;;;;4776:24:28;;4772:454;;4816:14;4861:11;531:3;4834:23;;;4861:11;4833:39;;;;;;-1:-1:-1;;;;;;4894:21:28;;;4886:64;;;;;-1:-1:-1;;;4886:64:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;4971:26;;;;;;;;4989:6;-1:-1:-1;;;;;4971:26:28;;;;4964:33;;;;;4772:454;5028:14;5045:45;5061:9;-1:-1:-1;;;5078:11:28;5045:15;:45::i;:::-;5028:62;-1:-1:-1;;;;;;5112:21:28;;;5104:64;;;;;-1:-1:-1;;;5104:64:28;;;;;;;;;;;;;;;;;;;;;;;;;;;897:373:29;999:7;1019:9;1030;1043:13;1051:1;1054;1043:7;:13::i;:::-;1018:38;;;;1067:10;1093:1;1080:15;;;;;1090:1;1087;1080:15;1067:28;;1114:1;1109:2;:6;1105:18;;;1122:1;1117:6;;;;1105:18;1133:7;;;;;1155:6;1151:24;;1174:1;1170;:5;;;;;;1163:12;;;;;;;1151:24;1198:1;1194;:5;1186:44;;;;;-1:-1:-1;;;1186:44:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;1247:16;1255:1;1258;1261;1247:7;:16::i;:::-;1240:23;;;;;897:373;;;;;;:::o;216:206::-;278:9;;;-1:-1:-1;;333:1:29;330;323:25;310:38;;366:1;362;:5;358:9;;386:1;381:2;:6;377:10;;406:1;401:2;:6;397:18;;;414:1;409:6;;;;397:18;216:206;;;;;;:::o;428:463::-;530:7;568:2;;;564:6;;;569:1;564:6;580:9;;;;;;;604:4;599:9;;;;;;;;;638:4;630;629:5;;628:14;;;;;685:1;:9;;;713:5;;;709:9;;704:14;737:5;;;733:9;;728:14;761:5;;;757:9;;752:14;785:5;;;781:9;;776:14;809:5;;;805:9;;800:14;833:5;;;829:9;;824:14;857:5;;;853:9;;848:14;;;628;;645:1;628:18;623:24;;;;618:29;;;;879:5;;428:463;-1:-1:-1;;428:463:29:o;-1:-1:-1:-;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;:::o", "source": "// SPDX-License-Identifier: GPL-3.0\npragma solidity =0.6.12;\n\nimport '@sonicswap/core/contracts/interfaces/IUniswapV2Factory.sol';\nimport '@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol';\nimport '@sonicswap/lib/contracts/libraries/FixedPoint.sol';\n\nimport '../libraries/UniswapV2OracleLibrary.sol';\nimport '../libraries/UniswapV2Library.sol';\n\n// fixed window oracle that recomputes the average price for the entire period once every period\n// note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period\ncontract ExampleOracleSimple {\n using FixedPoint for *;\n\n uint public constant PERIOD = 24 hours;\n\n IUniswapV2Pair immutable pair;\n address public immutable token0;\n address public immutable token1;\n\n uint public price0CumulativeLast;\n uint public price1CumulativeLast;\n uint32 public blockTimestampLast;\n FixedPoint.uq112x112 public price0Average;\n FixedPoint.uq112x112 public price1Average;\n\n constructor(address factory, address tokenA, address tokenB) public {\n IUniswapV2Pair _pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, tokenA, tokenB));\n pair = _pair;\n token0 = _pair.token0();\n token1 = _pair.token1();\n price0CumulativeLast = _pair.price0CumulativeLast(); // fetch the current accumulated price value (1 / 0)\n price1CumulativeLast = _pair.price1CumulativeLast(); // fetch the current accumulated price value (0 / 1)\n uint112 reserve0;\n uint112 reserve1;\n (reserve0, reserve1, blockTimestampLast) = _pair.getReserves();\n require(reserve0 != 0 && reserve1 != 0, 'ExampleOracleSimple: NO_RESERVES'); // ensure that there's liquidity in the pair\n }\n\n function update() external {\n (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =\n UniswapV2OracleLibrary.currentCumulativePrices(address(pair));\n uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired\n\n // ensure that at least one full period has passed since the last update\n require(timeElapsed >= PERIOD, 'ExampleOracleSimple: PERIOD_NOT_ELAPSED');\n\n // overflow is desired, casting never truncates\n // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed\n price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed));\n price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed));\n\n price0CumulativeLast = price0Cumulative;\n price1CumulativeLast = price1Cumulative;\n blockTimestampLast = blockTimestamp;\n }\n\n // note this will always return 0 before update has been called successfully for the first time.\n function consult(address token, uint amountIn) external view returns (uint amountOut) {\n if (token == token0) {\n amountOut = price0Average.mul(amountIn).decode144();\n } else {\n require(token == token1, 'ExampleOracleSimple: INVALID_TOKEN');\n amountOut = price1Average.mul(amountIn).decode144();\n }\n }\n}\n", "sourcePath": "/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleOracleSimple.sol", "ast": { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleOracleSimple.sol", "exportedSymbols": { "ExampleOracleSimple": [ 4395 ] }, "id": 4396, "license": "GPL-3.0", "nodeType": "SourceUnit", "nodes": [ { "id": 4179, "literals": [ "solidity", "=", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "36:24:5" }, { "absolutePath": "@sonicswap/core/contracts/interfaces/IUniswapV2Factory.sol", "file": "@sonicswap/core/contracts/interfaces/IUniswapV2Factory.sol", "id": 4180, "nodeType": "ImportDirective", "scope": 4396, "sourceUnit": 8112, "src": "62:68:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol", "file": "@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol", "id": 4181, "nodeType": "ImportDirective", "scope": 4396, "sourceUnit": 8354, "src": "131:65:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@sonicswap/lib/contracts/libraries/FixedPoint.sol", "file": "@sonicswap/lib/contracts/libraries/FixedPoint.sol", "id": 4182, "nodeType": "ImportDirective", "scope": 4396, "sourceUnit": 9464, "src": "197:59:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2OracleLibrary.sol", "file": "../libraries/UniswapV2OracleLibrary.sol", "id": 4183, "nodeType": "ImportDirective", "scope": 4396, "sourceUnit": 6654, "src": "258:49:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2Library.sol", "file": "../libraries/UniswapV2Library.sol", "id": 4184, "nodeType": "ImportDirective", "scope": 4396, "sourceUnit": 6081, "src": "308:43:5", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4395, "linearizedBaseContracts": [ 4395 ], "name": "ExampleOracleSimple", "nodeType": "ContractDefinition", "nodes": [ { "id": 4186, "libraryName": { "contractScope": null, "id": 4185, "name": "FixedPoint", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 9463, "src": "603:10:5", "typeDescriptions": { "typeIdentifier": "t_contract$_FixedPoint_$9463", "typeString": "library FixedPoint" } }, "nodeType": "UsingForDirective", "src": "597:23:5", "typeName": null }, { "constant": true, "functionSelector": "b4d1d795", "id": 4189, "mutability": "constant", "name": "PERIOD", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "626:38:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4187, "name": "uint", "nodeType": "ElementaryTypeName", "src": "626:4:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "3234", "id": 4188, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "656:8:5", "subdenomination": "hours", "typeDescriptions": { "typeIdentifier": "t_rational_86400_by_1", "typeString": "int_const 86400" }, "value": "24" }, "visibility": "public" }, { "constant": false, "id": 4191, "mutability": "immutable", "name": "pair", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "671:29:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$8353", "typeString": "contract IUniswapV2Pair" }, "typeName": { "contractScope": null, "id": 4190, "name": "IUniswapV2Pair", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 8353, "src": "671:14:5", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$8353", "typeString": "contract IUniswapV2Pair" } }, "value": null, "visibility": "internal" }, { "constant": false, "functionSelector": "0dfe1681", "id": 4193, "mutability": "immutable", "name": "token0", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "706:31:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4192, "name": "address", "nodeType": "ElementaryTypeName", "src": "706:7:5", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "d21220a7", "id": 4195, "mutability": "immutable", "name": "token1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "743:31:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4194, "name": "address", "nodeType": "ElementaryTypeName", "src": "743:7:5", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "5909c0d5", "id": 4197, "mutability": "mutable", "name": "price0CumulativeLast", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "781:35:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4196, "name": "uint", "nodeType": "ElementaryTypeName", "src": "781:4:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "5a3d5493", "id": 4199, "mutability": "mutable", "name": "price1CumulativeLast", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "822:35:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4198, "name": "uint", "nodeType": "ElementaryTypeName", "src": "822:4:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "c5700a02", "id": 4201, "mutability": "mutable", "name": "blockTimestampLast", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "863:33:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 4200, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "863:6:5", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "a6bb4539", "id": 4203, "mutability": "mutable", "name": "price0Average", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "902:41:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_uq112x112_$8842_storage", "typeString": "struct FixedPoint.uq112x112" }, "typeName": { "contractScope": null, "id": 4202, "name": "FixedPoint.uq112x112", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 8842, "src": "902:20:5", "typeDescriptions": { "typeIdentifier": "t_struct$_uq112x112_$8842_storage_ptr", "typeString": "struct FixedPoint.uq112x112" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "5e6aaf2c", "id": 4205, "mutability": "mutable", "name": "price1Average", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4395, "src": "949:41:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_uq112x112_$8842_storage", "typeString": "struct FixedPoint.uq112x112" }, "typeName": { "contractScope": null, "id": 4204, "name": "FixedPoint.uq112x112", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 8842, "src": "949:20:5", "typeDescriptions": { "typeIdentifier": "t_struct$_uq112x112_$8842_storage_ptr", "typeString": "struct FixedPoint.uq112x112" } }, "value": null, "visibility": "public" }, { "body": { "id": 4279, "nodeType": "Block", "src": "1065:675:5", "statements": [ { "assignments": [ 4215 ], "declarations": [ { "constant": false, "id": 4215, "mutability": "mutable", "name": "_pair", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4279, "src": "1075:20:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$8353", "typeString": "contract IUniswapV2Pair" }, "typeName": { "contractScope": null, "id": 4214, "name": "IUniswapV2Pair", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 8353, "src": "1075:14:5", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$8353", "typeString": "contract IUniswapV2Pair" } }, "value": null,