UNPKG

@sonicswap/periphery

Version:

🎚 Peripheral smart contracts for interacting with the Sonicswap exchanges

581 lines (580 loc) • 271 kB
{ "contractName": "ExampleSwapToPrice", "abi": [ { "inputs": [ { "internalType": "address", "name": "factory_", "type": "address" }, { "internalType": "contract IUniswapV2Router01", "name": "router_", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "factory", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "router", "outputs": [ { "internalType": "contract IUniswapV2Router01", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "uint256", "name": "truePriceTokenA", "type": "uint256" }, { "internalType": "uint256", "name": "truePriceTokenB", "type": "uint256" }, { "internalType": "uint256", "name": "maxSpendTokenA", "type": "uint256" }, { "internalType": "uint256", "name": "maxSpendTokenB", "type": "uint256" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" } ], "name": "swapToPrice", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory_\",\"type\":\"address\"},{\"internalType\":\"contract IUniswapV2Router01\",\"name\":\"router_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"router\",\"outputs\":[{\"internalType\":\"contract IUniswapV2Router01\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"truePriceTokenA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"truePriceTokenB\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSpendTokenA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSpendTokenB\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapToPrice\",\"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/ExampleSwapToPrice.sol\":\"ExampleSwapToPrice\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleSwapToPrice.sol\":{\"keccak256\":\"0x13388a71bf4dda023e5bb14a611feb906e1e9db2b7ba607b9dc6072d2b5b4174\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://a30e4ffb0ae8d383fcecd252847b0398e6a8a11074eb78c2f3f74fe5371173ef\",\"dweb:/ipfs/QmP37V1uHJP7FXFEeSZzoswcQhJUxU8BEY7fzmk2hVwSX4\"]},\"/var/www/Sonic/sonicswap-periphery/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x67fa338c5faea823082967992d43d2222446909ad63afa3c826a590b9a7b0cec\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://cfb5c642ffb05e054d1a246994e17aa368fc2bfe4d0f20f2c9e08629a8ee4473\",\"dweb:/ipfs/QmZ6H5boZnm2K5pAgGjf12KXMfNFdNcUsHKLjY7B34xyWx\"]},\"/var/www/Sonic/sonicswap-periphery/contracts/interfaces/IUniswapV2Router01.sol\":{\"keccak256\":\"0x7bf9a68b5be399ce542367291361819989039cdca993e8d60f4dd9c723ff4740\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://9043b6ee74ee1df7fc0fb82b20b69ca97e6edd1cb05eef62c87b29f0cd71bc97\",\"dweb:/ipfs/Qme9RNhgu9R1ypJ1gUgEd8ZVJSFMciAdpLcWQ2UTAPkMUi\"]},\"/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/UniswapV2LiquidityMathLibrary.sol\":{\"keccak256\":\"0x9f8aca4fd78e50148b944be7b6d2158eb2ee902fe98e86b1bc819f4f95172b00\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://a22de09125698ff3a7f13fd6fcf6f39de2816b562ed629d2b9ae2270a74e1617\",\"dweb:/ipfs/QmYCZcAzcMd2Vqf4Epb1UR6ZU1vYT48odVBB6oXnNseEmN\"]},\"@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/FullMath.sol\":{\"keccak256\":\"0x074f43cf798f046118ed21bb9859a7fa1074b9581fe315c8702d6d292fdb2784\",\"license\":\"CC-BY-4.0\",\"urls\":[\"bzz-raw://55a5cb6c5ae9ccc1e6870315bfa5f23f4c758db606f6a292fdff2224fcec082e\",\"dweb:/ipfs/QmRZayK4DWdWHaape9XcVj6VobzX7en7Tejk7gbzv7CHTy\"]},\"@sonicswap/lib/contracts/libraries/TransferHelper.sol\":{\"keccak256\":\"0x8cb60b71be09222b2e240c2e5975788f8a51fa41e6a360c8041a02905a8af0ba\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://671ff2dbbb15d7a9c3a1c248ded68a7a4e3d713a2d3c357259fe1a4a1275988a\",\"dweb:/ipfs/QmUTrzyGpApw16uBZVuYjCdsZjdsy1Ath88qYzArkGKE7z\"]}},\"version\":1}", "bytecode": "0x60c060405234801561001057600080fd5b50604051610f8f380380610f8f8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606092831b811660a052911b1660805260805160601c60a05160601c610f0261008d6000398061019152806104a652508061025b52806102fe52806104ca5250610f026000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063bef90fd314610046578063c45a01551461009d578063f887ea40146100c1575b600080fd5b61009b600480360361010081101561005d57600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359160c0820135169060e001356100c9565b005b6100a56104a4565b604080516001600160a01b039092168252519081900360200190f35b6100a56104c8565b85158015906100d757508415155b610128576040805162461bcd60e51b815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f50524943450000604482015290519081900360640190fd5b8315158061013557508215155b610186576040805162461bcd60e51b815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f5350454e440000604482015290519081900360640190fd5b6000806000806101b77f00000000000000000000000000000000000000000000000000000000000000008d8d6104ec565b915091506101c78a8a84846105ba565b909450925050508061020a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610eab6022913960400191505060405180910390fd5b6000826102175785610219565b865b905080821115610227578091505b600083610234578a610236565b8b5b9050600084610245578c610247565b8b5b905061025582333087610681565b610280827f0000000000000000000000000000000000000000000000000000000000000000866107de565b604080516002808252606080830184529260208301908036833701905050905082816000815181106102ae57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505081816001815181106102dc57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166338ed1739866000848c8c6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156103a1578181015183820152602001610389565b505050509050019650505050505050600060405180830381600087803b1580156103ca57600080fd5b505af11580156103de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561040757600080fd5b810190808051604051939291908464010000000082111561042757600080fd5b90830190602082018581111561043c57600080fd5b825186602082028301116401000000008211171561045957600080fd5b82525081516020918201928201910280838360005b8381101561048657818101518382015260200161046e565b50505050905001604052505050505050505050505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008060006104fb8585610932565b50905060008061050c888888610a10565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561054457600080fd5b505afa158015610558573d6000803e3d6000fd5b505050506040513d606081101561056e57600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506001600160a01b03878116908416146105a85780826105ab565b81815b90999098509650505050505050565b600080856105c9858786610ad0565b10915060006105d88585610b8b565b9050600061061e6106196105ee846103e8610b8b565b866105f957896105fb565b8a5b6106146103e58961060c578d61060e565b8c5b90610b8b565b610ad0565b610bf4565b905060006103e58561063b57610636876103e8610b8b565b610647565b610647886103e8610b8b565b8161064e57fe5b049050808210156106685760008094509450505050610678565b6106728282610d3c565b93505050505b94509492505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b602083106107065780518252601f1990920191602091820191016106e7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610768576040519150601f19603f3d011682016040523d82523d6000602084013e61076d565b606091505b509150915081801561079b57508051158061079b575080806020019051602081101561079857600080fd5b50515b6107d65760405162461bcd60e51b8152600401808060200182810382526031815260200180610e2a6031913960400191505060405180910390fd5b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b6020831061085b5780518252601f19909201916020918201910161083c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146108bd576040519150601f19603f3d011682016040523d82523d6000602084013e6108c2565b606091505b50915091508180156108f05750805115806108f057508080602001905160208110156108ed57600080fd5b50515b61092b5760405162461bcd60e51b815260040180806020018281038252602b815260200180610e80602b913960400191505060405180910390fd5b5050505050565b600080826001600160a01b0316846001600160a01b031614156109865760405162461bcd60e51b8152600401808060200182810382526025815260200180610e5b6025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b0316106109a65782846109a9565b83835b90925090506001600160a01b038216610a09576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6000806000610a1f8585610932565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b6000806000610adf8686610d8c565b9150915060008480610aed57fe5b868809905082811115610b01576001820391505b918290039181610b1f57848381610b1457fe5b049350505050610b84565b848210610b73576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015290519081900360640190fd5b610b7e838387610db9565b93505050505b9392505050565b6000811580610ba657505080820282828281610ba357fe5b04145b610bee576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b600081610c0357506000610d37565b816001600160801b8210610c1c5760809190911c9060401b5b680100000000000000008210610c375760409190911c9060201b5b6401000000008210610c4e5760209190911c9060101b5b620100008210610c635760109190911c9060081b5b6101008210610c775760089190911c9060041b5b60108210610c8a5760049190911c9060021b5b60088210610c965760011b5b6001818581610ca157fe5b048201901c90506001818581610cb357fe5b048201901c90506001818581610cc557fe5b048201901c90506001818581610cd757fe5b048201901c90506001818581610ce957fe5b048201901c90506001818581610cfb57fe5b048201901c90506001818581610d0d57fe5b048201901c90506000818581610d1f57fe5b049050808210610d2f5780610d31565b815b93505050505b919050565b80820382811115610bee576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000808060001984860990508385029250828103915082811015610db1576001820391505b509250929050565b60008181038216808381610dc957fe5b049250808581610dd557fe5b049450808160000381610de457fe5b6002858103808702820302808702820302808702820302808702820302808702820302808702820302958602900390940293046001019390930293909301029291505056fe5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c6564556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345535472616e7366657248656c7065723a3a73616665417070726f76653a20617070726f7665206661696c65644578616d706c6553776170546f50726963653a205a45524f5f414d4f554e545f494ea2646970667358221220c0b35b82fdb71c7d59df885fd00de00671e8dafc03767efbed7067f1635406e264736f6c634300060c0033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063bef90fd314610046578063c45a01551461009d578063f887ea40146100c1575b600080fd5b61009b600480360361010081101561005d57600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359160c0820135169060e001356100c9565b005b6100a56104a4565b604080516001600160a01b039092168252519081900360200190f35b6100a56104c8565b85158015906100d757508415155b610128576040805162461bcd60e51b815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f50524943450000604482015290519081900360640190fd5b8315158061013557508215155b610186576040805162461bcd60e51b815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f5350454e440000604482015290519081900360640190fd5b6000806000806101b77f00000000000000000000000000000000000000000000000000000000000000008d8d6104ec565b915091506101c78a8a84846105ba565b909450925050508061020a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610eab6022913960400191505060405180910390fd5b6000826102175785610219565b865b905080821115610227578091505b600083610234578a610236565b8b5b9050600084610245578c610247565b8b5b905061025582333087610681565b610280827f0000000000000000000000000000000000000000000000000000000000000000866107de565b604080516002808252606080830184529260208301908036833701905050905082816000815181106102ae57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505081816001815181106102dc57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166338ed1739866000848c8c6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156103a1578181015183820152602001610389565b505050509050019650505050505050600060405180830381600087803b1580156103ca57600080fd5b505af11580156103de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561040757600080fd5b810190808051604051939291908464010000000082111561042757600080fd5b90830190602082018581111561043c57600080fd5b825186602082028301116401000000008211171561045957600080fd5b82525081516020918201928201910280838360005b8381101561048657818101518382015260200161046e565b50505050905001604052505050505050505050505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008060006104fb8585610932565b50905060008061050c888888610a10565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561054457600080fd5b505afa158015610558573d6000803e3d6000fd5b505050506040513d606081101561056e57600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506001600160a01b03878116908416146105a85780826105ab565b81815b90999098509650505050505050565b600080856105c9858786610ad0565b10915060006105d88585610b8b565b9050600061061e6106196105ee846103e8610b8b565b866105f957896105fb565b8a5b6106146103e58961060c578d61060e565b8c5b90610b8b565b610ad0565b610bf4565b905060006103e58561063b57610636876103e8610b8b565b610647565b610647886103e8610b8b565b8161064e57fe5b049050808210156106685760008094509450505050610678565b6106728282610d3c565b93505050505b94509492505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b602083106107065780518252601f1990920191602091820191016106e7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610768576040519150601f19603f3d011682016040523d82523d6000602084013e61076d565b606091505b509150915081801561079b57508051158061079b575080806020019051602081101561079857600080fd5b50515b6107d65760405162461bcd60e51b8152600401808060200182810382526031815260200180610e2a6031913960400191505060405180910390fd5b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b6020831061085b5780518252601f19909201916020918201910161083c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146108bd576040519150601f19603f3d011682016040523d82523d6000602084013e6108c2565b606091505b50915091508180156108f05750805115806108f057508080602001905160208110156108ed57600080fd5b50515b61092b5760405162461bcd60e51b815260040180806020018281038252602b815260200180610e80602b913960400191505060405180910390fd5b5050505050565b600080826001600160a01b0316846001600160a01b031614156109865760405162461bcd60e51b8152600401808060200182810382526025815260200180610e5b6025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b0316106109a65782846109a9565b83835b90925090506001600160a01b038216610a09576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6000806000610a1f8585610932565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b6000806000610adf8686610d8c565b9150915060008480610aed57fe5b868809905082811115610b01576001820391505b918290039181610b1f57848381610b1457fe5b049350505050610b84565b848210610b73576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015290519081900360640190fd5b610b7e838387610db9565b93505050505b9392505050565b6000811580610ba657505080820282828281610ba357fe5b04145b610bee576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b600081610c0357506000610d37565b816001600160801b8210610c1c5760809190911c9060401b5b680100000000000000008210610c375760409190911c9060201b5b6401000000008210610c4e5760209190911c9060101b5b620100008210610c635760109190911c9060081b5b6101008210610c775760089190911c9060041b5b60108210610c8a5760049190911c9060021b5b60088210610c965760011b5b6001818581610ca157fe5b048201901c90506001818581610cb357fe5b048201901c90506001818581610cc557fe5b048201901c90506001818581610cd757fe5b048201901c90506001818581610ce957fe5b048201901c90506001818581610cfb57fe5b048201901c90506001818581610d0d57fe5b048201901c90506000818581610d1f57fe5b049050808210610d2f5780610d31565b815b93505050505b919050565b80820382811115610bee576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6000808060001984860990508385029250828103915082811015610db1576001820391505b509250929050565b60008181038216808381610dc957fe5b049250808581610dd557fe5b049450808160000381610de457fe5b6002858103808702820302808702820302808702820302808702820302808702820302808702820302958602900390940293046001019390930293909301029291505056fe5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c6564556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345535472616e7366657248656c7065723a3a73616665417070726f76653a20617070726f7665206661696c65644578616d706c6553776170546f50726963653a205a45524f5f414d4f554e545f494ea2646970667358221220c0b35b82fdb71c7d59df885fd00de00671e8dafc03767efbed7067f1635406e264736f6c634300060c0033", "immutableReferences": { "4766": [ { "length": 32, "start": 603 }, { "length": 32, "start": 766 }, { "length": 32, "start": 1226 } ], "4768": [ { "length": 32, "start": 401 }, { "length": 32, "start": 1190 } ] }, "sourceMap": "473:2414:7:-:0;;;627:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;627:126:7;;;;;;;-1:-1:-1;;;;;;702:18:7;;;;;;;;730:16;;;;;473:2414;;;;;;;;;;;;;;;;", "deployedSourceMap": "473:2414:7:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1027:1858;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1027:1858:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;588:32;;;:::i;:::-;;;;-1:-1:-1;;;;;588:32:7;;;;;;;;;;;;;;540:42;;;:::i;1027:1858::-;1382:20;;;;;:44;;-1:-1:-1;1406:20:7;;;1382:44;1374:87;;;;;-1:-1:-1;;;1374:87:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;1579:19;;;;:42;;-1:-1:-1;1602:19:7;;;1579:42;1571:85;;;;;-1:-1:-1;;;1571:85:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;1667:9;1686:16;1727;1745;1765:53;1794:7;1803:6;1811;1765:28;:53::i;:::-;1726:92;;;;1851:158;1927:15;1944;1977:8;1987;1851:58;:158::i;:::-;1832:177;;-1:-1:-1;1832:177:7;-1:-1:-1;;;2038:12:7;2030:59;;;;-1:-1:-1;;;2030:59:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2153:16;2172:4;:38;;2196:14;2172:38;;;2179:14;2172:38;2153:57;;2235:8;2224;:19;2220:69;;;2270:8;2259:19;;2220:69;2299:15;2317:4;:22;;2333:6;2317:22;;;2324:6;2317:22;2299:40;;2349:16;2368:4;:22;;2384:6;2368:22;;;2375:6;2368:22;2349:41;;2400:77;2432:7;2441:10;2461:4;2468:8;2400:31;:77::i;:::-;2487:62;2514:7;2531:6;2540:8;2487:26;:62::i;:::-;2584:16;;;2598:1;2584:16;;;2560:21;2584:16;;;;;2560:21;2584:16;;;;;;;;;;-1:-1:-1;2584:16:7;2560:40;;2620:7;2610:4;2615:1;2610:7;;;;;;;;;;;;;:17;-1:-1:-1;;;;;2610:17:7;;;-1:-1:-1;;;;;2610:17:7;;;;;2647:8;2637:4;2642:1;2637:7;;;;;;;;;;;;;:18;-1:-1:-1;;;;;2637:18:7;;;-1:-1:-1;;;;;2637:18:7;;;;;2666:6;-1:-1:-1;;;;;2666:31:7;;2711:8;2733:1;2826:4;2844:2;2860:8;2666:212;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2666:212:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2666:212:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2666:212:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1027:1858;;;;;;;;;;;;;;:::o;588:32::-;;;:::o;540:42::-;;;:::o;1275:387:16:-;1368:13;1383;1409:14;1428:26;1439:6;1447;1428:10;:26::i;:::-;1408:46;;;1465:13;1480;1513:32;1521:7;1530:6;1538;1513:7;:32::i;:::-;-1:-1:-1;;;;;1498:60:16;;:62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1498:62:16;;;;;;;1464:96;;;;;-1:-1:-1;1464:96:16;;-1:-1:-1;;;;;;1593:16:16;;;;;;;:62;;1636:8;1646;1593:62;;;1613:8;1623;1593:62;1570:85;;;;-1:-1:-1;1275:387:16;-1:-1:-1;;;;;;;1275:387:16:o;678:903:17:-;863:9;874:16;964:15;909:52;925:8;935:15;952:8;909:15;:52::i;:::-;:70;;-1:-1:-1;990:17:17;1010:22;:8;1023;1010:12;:22::i;:::-;990:42;-1:-1:-1;1043:16:17;1062:232;1091:193;1124:19;990:42;1138:4;1124:13;:19::i;:::-;1161:4;:40;;1186:15;1161:40;;;1168:15;1161:40;1219:51;1266:3;1220:4;:40;;1245:15;1220:40;;;1227:15;1220:40;1219:46;;:51::i;:::-;1091:15;:193::i;:::-;1062:15;:232::i;:::-;1043:251;;1304:17;1375:3;1325:4;:46;;1353:18;:8;1366:4;1353:12;:18::i;:::-;1325:46;;;1332:18;:8;1345:4;1332:12;:18::i;:::-;1324:54;;;;;;1304:74;;1404:9;1393:8;:20;1389:43;;;1423:5;1430:1;1415:17;;;;;;;;;1389:43;1551:23;:8;1564:9;1551:12;:23::i;:::-;1540:34;;678:903;;;;;;;;;;;:::o;1096:486:30:-;1360:51;;;-1:-1:-1;;;;;1360:51:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1360:51:30;-1:-1:-1;;;1360:51:30;;;1349:63;;;;1314:12;;1328:17;;1349:10;;;;1360:51;1349:63;;;1360:51;1349:63;;1360:51;1349:63;;;;;;;;;;-1:-1:-1;;1349:63:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1313:99;;;;1443:7;:57;;;;-1:-1:-1;1455:11:30;;:16;;:44;;;1486:4;1475:24;;;;;;;;;;;;;;;-1:-1:-1;1475:24:30;1455:44;1422:153;;;;-1:-1:-1;;;1422:153:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1096:486;;;;;;:::o;212:434::-;436:45;;;-1:-1:-1;;;;;436:45:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;436:45:30;-1:-1:-1;;;436:45:30;;;425:57;;;;390:12;;404:17;;425:10;;;;436:45;425:57;;;436:45;425:57;;436:45;425:57;;;;;;;;;;-1:-1:-1;;425:57:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;389:93;;;;513:7;:57;;;;-1:-1:-1;525:11:30;;:16;;:44;;;556:4;545:24;;;;;;;;;;;;;;;-1:-1:-1;545:24:30;525:44;492:147;;;;-1:-1:-1;;;492:147:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;212:434;;;;;:::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;750:470::-;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;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;456:140:15:-;508:6;534;;;:30;;-1:-1:-1;;549:5:15;;;563:1;558;549:5;558:1;544:15;;;;;:20;534:30;526:63;;;;;-1:-1:-1;;;526:63:15;;;;;;;;;;;;-1:-1:-1;;;526:63:15;;;;;;;;;;;;;;;456:140;;;;:::o;382:1197:26:-;430:7;453:6;449:20;;-1:-1:-1;468:1:26;461:8;;449:20;644:1;667;-1:-1:-1;;;682:41:26;;678:104;;746:3;739:10;;;;;769:2;763:8;678:104;801:19;795:2;:25;791:87;;843:2;836:9;;;;;865:2;859:8;791:87;897:11;891:2;:17;887:79;;931:2;924:9;;;;;953:2;947:8;887:79;985:7;979:2;:13;975:74;;1015:2;1008:9;;;;;1037:1;1031:7;975:74;1068:5;1062:2;:11;1058:71;;1096:1;1089:8;;;;;1117:1;1111:7;1058:71;1148:4;1142:2;:10;1138:70;;1175:1;1168:8;;;;;1196:1;1190:7;1138:70;1227:3;1221:2;:9;1217:47;;1252:1;1246:7;1217:47;1292:1;1286;1282;:5;;;;;;1278:1;:9;1277:16;;1273:20;;1322:1;1316;1312;:5;;;;;;1308:1;:9;1307:16;;1303:20;;1352:1;1346;1342;:5;;;;;;1338:1;:9;1337:16;;1333:20;;1382:1;1376;1372;:5;;;;;;1368:1;:9;1367:16;;1363:20;;1412:1;1406;1402;:5;;;;;;1398:1;:9;1397:16;;1393:20;;1442:1;1436;1432;:5;;;;;;1428:1;:9;1427:16;;1423:20;;1472:1;1466;1462;:5;;;;;;1458:1;:9;1457:16;;1453:20;;1520:10;1537:1;1533;:5;;;;;;1520:18;;1560:2;1556:1;:6;:15;;1569:2;1556:15;;;1565:1;1556:15;1548:24;;;;;382:1197;;;;:::o;323:127:15:-;406:5;;;401:16;;;;393:50;;;;;-1:-1:-1;;;393:50:15;;;;;;;;;;;;-1:-1:-1;;;393:50:15;;;;;;;;;;;;;;216:206:29;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", "source": "// SPDX-License-Identifier: GPL-3.0\npragma solidity =0.6.12;\n\nimport '@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol';\nimport '@sonicswap/lib/contracts/libraries/Babylonian.sol';\nimport '@sonicswap/lib/contracts/libraries/TransferHelper.sol';\n\nimport '../libraries/UniswapV2LiquidityMathLibrary.sol';\nimport '../interfaces/IERC20.sol';\nimport '../interfaces/IUniswapV2Router01.sol';\nimport '../libraries/SafeMath.sol';\nimport '../libraries/UniswapV2Library.sol';\n\ncontract ExampleSwapToPrice {\n using SafeMath for uint256;\n\n IUniswapV2Router01 public immutable router;\n address public immutable factory;\n\n constructor(address factory_, IUniswapV2Router01 router_) public {\n factory = factory_;\n router = router_;\n }\n\n // swaps an amount of either token such that the trade is profit-maximizing, given an external true price\n // true price is expressed in the ratio of token A to token B\n // caller must approve this contract to spend whichever token is intended to be swapped\n function swapToPrice(\n address tokenA,\n address tokenB,\n uint256 truePriceTokenA,\n uint256 truePriceTokenB,\n uint256 maxSpendTokenA,\n uint256 maxSpendTokenB,\n address to,\n uint256 deadline\n ) public {\n // true price is expressed as a ratio, so both values must be non-zero\n require(truePriceTokenA != 0 && truePriceTokenB != 0, \"ExampleSwapToPrice: ZERO_PRICE\");\n // caller can specify 0 for either if they wish to swap in only one direction, but not both\n require(maxSpendTokenA != 0 || maxSpendTokenB != 0, \"ExampleSwapToPrice: ZERO_SPEND\");\n\n bool aToB;\n uint256 amountIn;\n {\n (uint256 reserveA, uint256 reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);\n (aToB, amountIn) = UniswapV2LiquidityMathLibrary.computeProfitMaximizingTrade(\n truePriceTokenA, truePriceTokenB,\n reserveA, reserveB\n );\n }\n\n require(amountIn > 0, 'ExampleSwapToPrice: ZERO_AMOUNT_IN');\n\n // spend up to the allowance of the token in\n uint256 maxSpend = aToB ? maxSpendTokenA : maxSpendTokenB;\n if (amountIn > maxSpend) {\n amountIn = maxSpend;\n }\n\n address tokenIn = aToB ? tokenA : tokenB;\n address tokenOut = aToB ? tokenB : tokenA;\n TransferHelper.safeTransferFrom(tokenIn, msg.sender, address(this), amountIn);\n TransferHelper.safeApprove(tokenIn, address(router), amountIn);\n\n address[] memory path = new address[](2);\n path[0] = tokenIn;\n path[1] = tokenOut;\n\n router.swapExactTokensForTokens(\n amountIn,\n 0, // amountOutMin: we can skip computing this number because the math is tested\n path,\n to,\n deadline\n );\n }\n}\n", "sourcePath": "/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleSwapToPrice.sol", "ast": { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleSwapToPrice.sol", "exportedSymbols": { "ExampleSwapToPrice": [ 4951 ] }, "id": 4952, "license": "GPL-3.0", "nodeType": "SourceUnit", "nodes": [ { "id": 4753, "literals": [ "solidity", "=", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "36:24:7" }, { "absolutePath": "@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol", "file": "@sonicswap/core/contracts/interfaces/IUniswapV2Pair.sol", "id": 4754, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 8354, "src": "62:65:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@sonicswap/lib/contracts/libraries/Babylonian.sol", "file": "@sonicswap/lib/contracts/libraries/Babylonian.sol", "id": 4755, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 8557, "src": "128:59:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@sonicswap/lib/contracts/libraries/TransferHelper.sol", "file": "@sonicswap/lib/contracts/libraries/TransferHelper.sol", "id": 4756, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 9845, "src": "188:63:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2LiquidityMathLibrary.sol", "file": "../libraries/UniswapV2LiquidityMathLibrary.sol", "id": 4757, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 6547, "src": "253:56:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/interfaces/IERC20.sol", "file": "../interfaces/IERC20.sol", "id": 4758, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 5036, "src": "310:34:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/interfaces/IUniswapV2Router01.sol", "file": "../interfaces/IUniswapV2Router01.sol", "id": 4759, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 5360, "src": "345:46:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/libraries/SafeMath.sol", "file": "../libraries/SafeMath.sol", "id": 4760, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 5609, "src": "392:35:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2Library.sol", "file": "../libraries/UniswapV2Library.sol", "id": 4761, "nodeType": "ImportDirective", "scope": 4952, "sourceUnit": 6081, "src": "428:43:7", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4951, "linearizedBaseContracts": [ 4951 ], "name": "ExampleSwapToPrice", "nodeType": "ContractDefinition", "nodes": [ { "id": 4764, "libraryName": { "contractScope": null, "id": 4762, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5608, "src": "513:8:7", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$5608", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "507:27:7", "typeName": { "id": 4763, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "526:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": false, "functionSelector": "f887ea40", "id": 4766, "mutability": "immutable", "name": "router", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4951, "src": "540:42:7", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" }, "typeName": { "contractScope": null, "id": 4765, "name": "IUniswapV2Router01", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5359, "src": "540:18:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "c45a0155", "id": 4768, "mutability": "immutable", "name": "factory", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4951, "src": "588:32:7", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4767, "name": "address", "nodeType": "ElementaryTypeName", "src": "588:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "body": { "id": 4783, "nodeType": "Block", "src": "692:61:7", "statements": [ { "expression": { "argumentTypes": null, "id": 4777, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 4775, "name": "factory", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4768, "src": "702:7:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 4776, "name": "factory_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4770, "src": "712:8:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "702:18:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 4778, "nodeType": "ExpressionStatement", "src": "702:18:7" }, { "expression": { "argumentTypes": null, "id": 4781, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 4779, "name": "router", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4766, "src": "730:6:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 4780, "name": "router_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4772, "src": "739:7:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" } }, "src": "730:16:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" } }, "id": 4782, "nodeType": "ExpressionStatement", "src": "730:16:7" } ] }, "documentation": null, "id": 4784, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 4773, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4770, "mutability": "mutable", "name": "factory_", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4784, "src": "639:16:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4769, "name": "address", "nodeType": "ElementaryTypeName", "src": "639:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4772, "mutability": "mutable", "name": "router_", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4784, "src": "657:26:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" }, "typeName": { "contractScope": null, "id": 4771, "name": "IUniswapV2Router01", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5359, "src": "657:18:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Router01_$5359", "typeString": "contract IUniswapV2Router01" } }, "value": null, "visibility": "internal" } ], "src": "638:46:7" }, "returnParameters": { "id": 4774, "nodeType": "ParameterList", "parameters": [], "src": "692:0:7" }, "scope": 4951, "src": "627:126:7", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 4949, "nodeType": "Block", "src": "1285:1600:7", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 4810, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4806, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 4804, "name": "truePriceTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4790, "src": "1382:15:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 4805, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number",