UNPKG

@valueswap/v2-periphery

Version:

🎚 Peripheral smart contracts for interacting with Valueswap V2

545 lines • 382 kB
{ "contractName": "ExampleSwapToPrice", "abi": [ { "inputs": [ { "internalType": "address", "name": "factory_", "type": "address" }, { "internalType": "contract IValueswapV2Router01", "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 IValueswapV2Router01", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "truePriceTokenA", "type": "uint256" }, { "internalType": "uint256", "name": "truePriceTokenB", "type": "uint256" }, { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, { "internalType": "uint256", "name": "reserveB", "type": "uint256" } ], "name": "computeProfitMaximizingTrade", "outputs": [ { "internalType": "bool", "name": "aToB", "type": "bool" }, { "internalType": "uint256", "name": "amountIn", "type": "uint256" } ], "stateMutability": "pure", "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.6+commit.6c089d02\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory_\",\"type\":\"address\"},{\"internalType\":\"contract IValueswapV2Router01\",\"name\":\"router_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"truePriceTokenA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"truePriceTokenB\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveB\",\"type\":\"uint256\"}],\"name\":\"computeProfitMaximizingTrade\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"aToB\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"router\",\"outputs\":[{\"internalType\":\"contract IValueswapV2Router01\",\"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\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/second/Documents/work/valueswap-v2-periphery/contracts/examples/ExampleSwapToPrice.sol\":\"ExampleSwapToPrice\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"/Users/second/Documents/work/valueswap-v2-periphery/contracts/examples/ExampleSwapToPrice.sol\":{\"keccak256\":\"0x4b13db2bae2c74b4bbf1065d870fb53180cd520941ca207ac62198ac3ccc5126\",\"urls\":[\"bzz-raw://9040bc91d7215b5ab6a54fdc4c08b5e88c9063d6f80c23a6896766caf89c6ca3\",\"dweb:/ipfs/QmXa7jYrLUPNUgzXy1MPG1xCWx7rgmiEiiYSig1LMrsVJJ\"]},\"/Users/second/Documents/work/valueswap-v2-periphery/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x61db17aebc5d812c7002d15c1da954065e56abe49d64b14c034abe5604d70eb3\",\"urls\":[\"bzz-raw://b006685e753f9120469f10b09c159f222d4cb8b507a6c1f0c14ed50c883ebe66\",\"dweb:/ipfs/QmSyY7iTugbczPwfGK67etiyPULenYGzzRYbt8aabwwkUb\"]},\"/Users/second/Documents/work/valueswap-v2-periphery/contracts/interfaces/IValueswapV2Router01.sol\":{\"keccak256\":\"0x36353f46a62274a8eba493ea0bed9284da4f97e30025def7688d84de95552826\",\"urls\":[\"bzz-raw://e258df9bf935cb183c593417f96967ffcb32e438d834a6840cc8c51ab61dfce8\",\"dweb:/ipfs/QmWqucAgec2mSqtMzMDFSaJWQFUByvw1L6oodDZEwYm5vk\"]},\"/Users/second/Documents/work/valueswap-v2-periphery/contracts/libraries/SafeMath.sol\":{\"keccak256\":\"0x27f0ea82f879b3b01387b583e6d9d0ec858dca3b22b0aad173f8fbda06e761e1\",\"urls\":[\"bzz-raw://0db9cf37793eb7035f0bfced36323d240f0212150009c39a3a108701d9b50b6c\",\"dweb:/ipfs/QmUAdiG9XNcieXkKfiMB49zQqD34FbXFE15csV2KQzwEqg\"]},\"/Users/second/Documents/work/valueswap-v2-periphery/contracts/libraries/ValueswapV2Library.sol\":{\"keccak256\":\"0xf676dcf67bcef334c141c95ae2c8328c76bcaf316edd882fe9bf960dc7887904\",\"urls\":[\"bzz-raw://37aa805cf7db173d7465a186acb5d9a958c8d1628c2335807c054e7864501dc5\",\"dweb:/ipfs/QmbZhcmRJkPLzsfMoNbeRZ8UKrqsjF86QNiZjsYyfxg9t6\"]},\"@valueswap/lib/contracts/libraries/Babylonian.sol\":{\"keccak256\":\"0xeb1c2a281a00f4660775f75ccfa1e51fbe1d75f86aeb9d0d297151ecdb900177\",\"urls\":[\"bzz-raw://68515f0265381bddfb1d1356ea10ce4e5784276fc09f197fcdcedfa5c75cc069\",\"dweb:/ipfs/QmXWVVPnuJwRUAu3Qpu1s7Fyc5WPQxmZPczVEe5cJ5wVHZ\"]},\"@valueswap/lib/contracts/libraries/TransferHelper.sol\":{\"keccak256\":\"0xaff99b54915f57e2a4e71b8d15afd4ee425410e5a6f45c07517ae1beb806f8bd\",\"urls\":[\"bzz-raw://15432ec031f4cfa6709921289e198b030a0c5eac75b5a3e0eb64827a2b3b5595\",\"dweb:/ipfs/QmZvR1KuuDvuzXFiADCngTKyMCTy31uhq9U6CazP59B55j\"]},\"@valueswap/v2-core/contracts/interfaces/IValueswapV2Pair.sol\":{\"keccak256\":\"0x4899f60670cbc336cd8f5fefb631d6ce27ae4226ad4aac5d0963cd23db2fc36a\",\"urls\":[\"bzz-raw://7aa68c3572d1a4713c4af9ba99dd1907a9dc5a104273dab86e1d02797f6b1dd6\",\"dweb:/ipfs/QmXq89Vb6D4XeA2PDqNy13VkNeevTJePCrLF7KUHkver4q\"]}},\"version\":1}", "bytecode": "0x60c060405234801561001057600080fd5b506040516111123803806111128339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606092831b811660a052911b1660805260805160601c60a05160601c61108561008d6000398061023452806105915250806102c4528061039b52806105b552506110856000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063bef90fd314610051578063c45a0155146100b5578063f887ea40146100e6578063fa653154146100ee575b600080fd5b6100b3600480360361010081101561006857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013582169160408201359160608101359160808201359160a08101359160c0820135169060e00135610138565b005b6100bd61058f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100bd6105b3565b61011d6004803603608081101561010457600080fd5b50803590602081013590604081013590606001356105d7565b60408051921515835260208301919091528051918290030190f35b851580159061014657508415155b6101b157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f50524943450000604482015290519081900360640190fd5b831515806101be57508215155b61022957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f5350454e440000604482015290519081900360640190fd5b60008060008061025a7f00000000000000000000000000000000000000000000000000000000000000008d8d6106bc565b9150915061026a8a8a84846105d7565b9094509250600091508390506102805785610282565b865b905080821115610290578091505b60008361029d578a61029f565b8b5b90506000846102ae578c6102b0565b8b5b90506102be823330876107a4565b6102e9827f000000000000000000000000000000000000000000000000000000000000000086610974565b6040805160028082526060808301845292602083019080368337019050509050828160008151811061031757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818160018151811061035f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed1739866000848c8c6040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561046e578181015183820152602001610456565b505050509050019650505050505050600060405180830381600087803b15801561049757600080fd5b505af11580156104ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405260208110156104f257600080fd5b810190808051604051939291908464010000000082111561051257600080fd5b90830190602082018581111561052757600080fd5b825186602082028301116401000000008211171561054457600080fd5b82525081516020918201928201910280838360005b83811015610571578181015183820152602001610559565b50505050905001604052505050505050505050505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008085836105ec868863ffffffff610b3b16565b816105f357fe5b041091506000610609858563ffffffff610b3b16565b9050600061065f61062f6103e586610621578a610623565b895b9063ffffffff610b3b16565b6106526103e861062388610643578b610645565b8c5b879063ffffffff610b3b16565b8161065957fe5b04610bc7565b905060006103e5856106825761067d876103e863ffffffff610b3b16565b610694565b610694886103e863ffffffff610b3b16565b8161069b57fe5b0490506106ae828263ffffffff610d1c16565b935050505094509492505050565b60008060006106cb8585610d8e565b5090506000806106dc888888610ee1565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561072157600080fd5b505afa158015610735573d6000803e3d6000fd5b505050506040513d606081101561074b57600080fd5b5080516020909101516dffffffffffffffffffffffffffff918216935016905073ffffffffffffffffffffffffffffffffffffffff87811690841614610792578082610795565b81815b90999098509650505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b6020831061088257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610845565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146108e4576040519150601f19603f3d011682016040523d82523d6000602084013e6108e9565b606091505b5091509150818015610917575080511580610917575080806020019051602081101561091457600080fd5b50515b61096c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180610fcd6031913960400191505060405180910390fd5b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b60208310610a4a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a0d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610aac576040519150601f19603f3d011682016040523d82523d6000602084013e610ab1565b606091505b5091509150818015610adf575080511580610adf5750808060200190516020811015610adc57600080fd5b50515b610b34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611025602b913960400191505060405180910390fd5b5050505050565b6000811580610b5657505080820282828281610b5357fe5b04145b610bc157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b600081610bd657506000610d17565b8160017001000000000000000000000000000000008210610bfc5760809190911c9060401b5b680100000000000000008210610c175760409190911c9060201b5b6401000000008210610c2e5760209190911c9060101b5b620100008210610c435760109190911c9060081b5b6101008210610c575760089190911c9060041b5b60108210610c6a5760049190911c9060021b5b60088210610c765760011b5b6001818581610c8157fe5b048201901c90506001818581610c9357fe5b048201901c90506001818581610ca557fe5b048201901c90506001818581610cb757fe5b048201901c90506001818581610cc957fe5b048201901c90506001818581610cdb57fe5b048201901c90506001818581610ced57fe5b048201901c90506000818581610cff57fe5b049050808210610d0f5780610d11565b815b93505050505b919050565b80820382811115610bc157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180610ffe6027913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610e50578284610e53565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216610eda57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f56616c75657377617056324c6962726172793a205a45524f5f41444452455353604482015290519081900360640190fd5b9250929050565b6000806000610ef08585610d8e565b604080517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527ff27fee3fc000c2148077e3c1de2bfc88ca0e8881a5c9fbb18615dc16f0cc1b75609d808401919091528851808403909101815260bd90920190975280519601959095209594505050505056fe5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c656456616c75657377617056324c6962726172793a204944454e544943414c5f4144445245535345535472616e7366657248656c7065723a3a73616665417070726f76653a20617070726f7665206661696c6564a2646970667358221220edfa77cafac9c984e2c7be2894bbb3e0f265bcc974385d867be87bf0b83928d264736f6c63430006060033", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063bef90fd314610051578063c45a0155146100b5578063f887ea40146100e6578063fa653154146100ee575b600080fd5b6100b3600480360361010081101561006857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013582169160408201359160608101359160808201359160a08101359160c0820135169060e00135610138565b005b6100bd61058f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100bd6105b3565b61011d6004803603608081101561010457600080fd5b50803590602081013590604081013590606001356105d7565b60408051921515835260208301919091528051918290030190f35b851580159061014657508415155b6101b157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f50524943450000604482015290519081900360640190fd5b831515806101be57508215155b61022957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4578616d706c6553776170546f50726963653a205a45524f5f5350454e440000604482015290519081900360640190fd5b60008060008061025a7f00000000000000000000000000000000000000000000000000000000000000008d8d6106bc565b9150915061026a8a8a84846105d7565b9094509250600091508390506102805785610282565b865b905080821115610290578091505b60008361029d578a61029f565b8b5b90506000846102ae578c6102b0565b8b5b90506102be823330876107a4565b6102e9827f000000000000000000000000000000000000000000000000000000000000000086610974565b6040805160028082526060808301845292602083019080368337019050509050828160008151811061031757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818160018151811061035f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed1739866000848c8c6040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561046e578181015183820152602001610456565b505050509050019650505050505050600060405180830381600087803b15801561049757600080fd5b505af11580156104ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405260208110156104f257600080fd5b810190808051604051939291908464010000000082111561051257600080fd5b90830190602082018581111561052757600080fd5b825186602082028301116401000000008211171561054457600080fd5b82525081516020918201928201910280838360005b83811015610571578181015183820152602001610559565b50505050905001604052505050505050505050505050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008085836105ec868863ffffffff610b3b16565b816105f357fe5b041091506000610609858563ffffffff610b3b16565b9050600061065f61062f6103e586610621578a610623565b895b9063ffffffff610b3b16565b6106526103e861062388610643578b610645565b8c5b879063ffffffff610b3b16565b8161065957fe5b04610bc7565b905060006103e5856106825761067d876103e863ffffffff610b3b16565b610694565b610694886103e863ffffffff610b3b16565b8161069b57fe5b0490506106ae828263ffffffff610d1c16565b935050505094509492505050565b60008060006106cb8585610d8e565b5090506000806106dc888888610ee1565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561072157600080fd5b505afa158015610735573d6000803e3d6000fd5b505050506040513d606081101561074b57600080fd5b5080516020909101516dffffffffffffffffffffffffffff918216935016905073ffffffffffffffffffffffffffffffffffffffff87811690841614610792578082610795565b81815b90999098509650505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b6020831061088257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610845565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146108e4576040519150601f19603f3d011682016040523d82523d6000602084013e6108e9565b606091505b5091509150818015610917575080511580610917575080806020019051602081101561091457600080fd5b50515b61096c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180610fcd6031913960400191505060405180910390fd5b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b60208310610a4a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a0d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610aac576040519150601f19603f3d011682016040523d82523d6000602084013e610ab1565b606091505b5091509150818015610adf575080511580610adf5750808060200190516020811015610adc57600080fd5b50515b610b34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611025602b913960400191505060405180910390fd5b5050505050565b6000811580610b5657505080820282828281610b5357fe5b04145b610bc157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b600081610bd657506000610d17565b8160017001000000000000000000000000000000008210610bfc5760809190911c9060401b5b680100000000000000008210610c175760409190911c9060201b5b6401000000008210610c2e5760209190911c9060101b5b620100008210610c435760109190911c9060081b5b6101008210610c575760089190911c9060041b5b60108210610c6a5760049190911c9060021b5b60088210610c765760011b5b6001818581610c8157fe5b048201901c90506001818581610c9357fe5b048201901c90506001818581610ca557fe5b048201901c90506001818581610cb757fe5b048201901c90506001818581610cc957fe5b048201901c90506001818581610cdb57fe5b048201901c90506001818581610ced57fe5b048201901c90506000818581610cff57fe5b049050808210610d0f5780610d11565b815b93505050505b919050565b80820382811115610bc157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180610ffe6027913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610e50578284610e53565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216610eda57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f56616c75657377617056324c6962726172793a205a45524f5f41444452455353604482015290519081900360640190fd5b9250929050565b6000806000610ef08585610d8e565b604080517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527ff27fee3fc000c2148077e3c1de2bfc88ca0e8881a5c9fbb18615dc16f0cc1b75609d808401919091528851808403909101815260bd90920190975280519601959095209594505050505056fe5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c656456616c75657377617056324c6962726172793a204944454e544943414c5f4144445245535345535472616e7366657248656c7065723a3a73616665417070726f76653a20617070726f7665206661696c6564a2646970667358221220edfa77cafac9c984e2c7be2894bbb3e0f265bcc974385d867be87bf0b83928d264736f6c63430006060033", "immutableReferences": { "4663": [ { "length": 32, "start": 708 }, { "length": 32, "start": 923 }, { "length": 32, "start": 1461 } ], "4665": [ { "length": 32, "start": 564 }, { "length": 32, "start": 1425 } ] }, "sourceMap": "388:3181:7:-:0;;;544:128;5:9:-1;2:2;;;27:1;24;17:12;2:2;544:128:7;;;;;;;;;;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;544:128:7;;;;;;;-1:-1:-1;;;;;;621:18:7;;;;;;;;649:16;;;;;388:3181;;;;;;;;;;;;;;;;", "deployedSourceMap": "388:3181:7:-:0;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;388:3181:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;9;2:12;1807:1760:7;;;;;;15:3:-1;10;7:12;4:2;;;32:1;29;22:12;4:2;-1:-1;1807:1760:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;505:32;;;:::i;:::-;;;;;;;;;;;;;;;;;;;455:44;;;:::i;753:780::-;;;;;;15:3:-1;10;7:12;4:2;;;32:1;29;22:12;4:2;-1:-1;753:780:7;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;1807:1760;2162:20;;;;;:44;;-1:-1:-1;2186:20:7;;;2162:44;2154:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2359:19;;;;:42;;-1:-1:-1;2382:19:7;;;2359:42;2351:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2447:9;2466:16;2507;2525;2545:55;2576:7;2585:6;2593;2545:30;:55::i;:::-;2506:94;;;;2633:128;2679:15;2696;2729:8;2739;2633:28;:128::i;:::-;2614:147;;-1:-1:-1;2614:147:7;-1:-1:-1;2835:16:7;;-1:-1:-1;2614:147:7;;-1:-1:-1;2854:38:7;;2878:14;2854:38;;;2861:14;2854:38;2835:57;;2917:8;2906;:19;2902:69;;;2952:8;2941:19;;2902:69;2981:15;2999:4;:22;;3015:6;2999:22;;;3006:6;2999:22;2981:40;;3031:16;3050:4;:22;;3066:6;3050:22;;;3057:6;3050:22;3031:41;;3082:77;3114:7;3123:10;3143:4;3150:8;3082:31;:77::i;:::-;3169:62;3196:7;3213:6;3222:8;3169:26;:62::i;:::-;3266:16;;;3280:1;3266:16;;;3242:21;3266:16;;;;;3242:21;3266:16;;;;;109:14:-1;3266:16:7;88:42:-1;144:17;;-1:-1;3266:16:7;3242:40;;3302:7;3292:4;3297:1;3292:7;;;;;;;;;;;;;:17;;;;;;;;;;;3329:8;3319:4;3324:1;3319:7;;;;;;;;;;;;;:18;;;;;;;;;;;3348:6;:31;;;3393:8;3415:1;3508:4;3526:2;3542:8;3348:212;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3348:212:7;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;3348:212:7;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3348:212:7;;;;;;39:16:-1;36:1;17:17;2:54;101:4;3348:212:7;80:15:-1;;;97:9;76:31;65:43;;120:4;113:20;15:2;7:11;;4:2;;;31:1;28;21:12;4:2;3348:212:7;;;;;;;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;219:3;213:10;331:9;325:2;311:12;307:21;289:16;285:44;282:59;261:11;247:12;244:29;233:116;230:2;;;362:1;359;352:12;230:2;373:25;;-1:-1;3348:212:7;;421:4:-1;412:14;;;;3348:212:7;;;;;412:14:-1;3348:212:7;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3348:212:7;;;;;;;;;;;;1807:1760;;;;;;;;;;;;;;:::o;505:32::-;;;:::o;455:44::-;;;:::o;753:780::-;936:9;;1025:15;1014:8;982:29;:8;995:15;982:29;:12;:29;:::i;:::-;:40;;;;;;:58;;-1:-1:-1;1051:17:7;1071:22;:8;1084;1071:22;:12;:22;:::i;:::-;1051:42;;1104:16;1123:177;1232:58;1286:3;1240:4;:40;;1265:15;1240:40;;;1247:15;1240:40;1232:53;:58;:53;:58;:::i;:::-;1152:65;1212:4;1152:55;1166:4;:40;;1191:15;1166:40;;;1173:15;1166:40;1152:9;;:55;:13;:55;:::i;:65::-;:138;;;;;;1123:15;:177::i;:::-;1104:196;;1310:17;1381:3;1331:4;:46;;1359:18;:8;1372:4;1359:18;:12;:18;:::i;:::-;1331:46;;;1338:18;:8;1351:4;1338:18;:12;:18;:::i;:::-;1330:54;;;;;;;-1:-1:-1;1503:23:7;:8;1330:54;1503:23;:12;:23;:::i;:::-;1492:34;;753:780;;;;;;;;;;:::o;1250:389:16:-;1343:13;1358;1384:14;1403:26;1414:6;1422;1403:10;:26::i;:::-;1383:46;;;1440:13;1455;1490:32;1498:7;1507:6;1515;1490:7;:32::i;:::-;1473:62;;;:64;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;1473:64:16;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1473:64:16;;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;1473:64:16;;;;;;;1439:98;;;;;-1:-1:-1;1439:98:16;;-1:-1:-1;1570:16:16;;;;;;;;:62;;1613:8;1623;1570:62;;;1590:8;1600;1570:62;1547:85;;;;-1:-1:-1;1250:389:16;-1:-1:-1;;;;;;;1250:389:16:o;1096:486:26:-;1360:51;;;1349:10;1360:51;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;1360:51:26;;;;;;;25:18:-1;;61:17;;96:58;182:15;1360:51:26;179:29:-1;160:49;;1349:63:26;;;;1314:12;;1328:17;;1349:10;;;;1360:51;1349:63;;;25:18:-1;1349:63:26;;25:18:-1;36:153;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1349:63:26;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;19;14:27;;;;67:4;61:11;56:16;;134:4;130:9;123:4;105:16;101:27;97:43;94:1;90:51;84:4;77:65;157:16;154:1;147:27;211:16;208:1;201:4;198:1;194:12;179:49;5:228;;14:27;32:4;27:9;;5:228;;1313:99:26;;;;1443:7;:57;;;;-1:-1:-1;1455:11:26;;:16;;:44;;;1486:4;1475:24;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;1475:24:26;1455:44;1422:153;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1096:486;;;;;;:::o;212:434::-;436:45;;;425:10;436:45;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;436:45:26;;;;;;;25:18:-1;;61:17;;96:58;182:15;436:45:26;179:29:-1;160:49;;425:57:26;;;;390:12;;404:17;;425:10;;;;436:45;425:57;;;25:18:-1;425:57:26;;25:18:-1;36:153;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;425:57:26;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;19;14:27;;;;67:4;61:11;56:16;;134:4;130:9;123:4;105:16;101:27;97:43;94:1;90:51;84:4;77:65;157:16;154:1;147:27;211:16;208:1;201:4;198:1;194:12;179:49;5:228;;14:27;32:4;27:9;;5:228;;389:93:26;;;;513:7;:57;;;;-1:-1:-1;525:11:26;;:16;;:44;;;556:4;545:24;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;545:24:26;525:44;492:147;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;212:434;;;;;:::o;419:140:15:-;471:6;497;;;:30;;-1:-1:-1;;512:5:15;;;526:1;521;512:5;521:1;507:15;;;;;:20;497:30;489:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;419:140;;;;:::o;382:1197:22:-;430:7;453:6;449:20;;-1:-1:-1;468:1:22;461:8;;449:20;644:1;667;688:35;682:41;;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;286:127:15:-;369:5;;;364:16;;;;356:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;287:349:16;362:14;378;422:6;412:16;;:6;:16;;;;404:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;510:6;501:15;;:6;:15;;;:53;;539:6;547;501:53;;;520:6;528;501:53;482:72;;-1:-1:-1;482:72:16;-1:-1:-1;572:20:16;;;564:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;287:349;;;;;:::o;725:470::-;814:12;839:14;855;873:26;884:6;892;873:10;:26::i;:::-;1033:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22::-1;26:21;;;22:32;6:49;;1033:32:16;;;;;1023:43;;;;;;939:246;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;939:246:16;;;;;;;929:257;;;;;;;;;725:470;-1:-1:-1;;;;;725:470:16:o", "source": "pragma solidity =0.6.6;\n\nimport '@valueswap/v2-core/contracts/interfaces/IValueswapV2Pair.sol';\nimport '@valueswap/lib/contracts/libraries/Babylonian.sol';\nimport '@valueswap/lib/contracts/libraries/TransferHelper.sol';\n\nimport '../interfaces/IERC20.sol';\nimport '../interfaces/IValueswapV2Router01.sol';\nimport '../libraries/SafeMath.sol';\nimport '../libraries/ValueswapV2Library.sol';\n\ncontract ExampleSwapToPrice {\n using SafeMath for uint256;\n\n IValueswapV2Router01 public immutable router;\n address public immutable factory;\n\n constructor(address factory_, IValueswapV2Router01 router_) public {\n factory = factory_;\n router = router_;\n }\n\n // computes the direction and magnitude of the profit-maximizing trade\n function computeProfitMaximizingTrade(\n uint256 truePriceTokenA,\n uint256 truePriceTokenB,\n uint256 reserveA,\n uint256 reserveB\n ) pure public returns (bool aToB, uint256 amountIn) {\n aToB = reserveA.mul(truePriceTokenB) / reserveB < truePriceTokenA;\n\n uint256 invariant = reserveA.mul(reserveB);\n\n uint256 leftSide = Babylonian.sqrt(\n invariant.mul(aToB ? truePriceTokenA : truePriceTokenB).mul(1000) /\n uint256(aToB ? truePriceTokenB : truePriceTokenA).mul(997)\n );\n uint256 rightSide = (aToB ? reserveA.mul(1000) : reserveB.mul(1000)) / 997;\n\n // compute the amount that must be sent to move the price to the profit-maximizing price\n amountIn = leftSide.sub(rightSide);\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) = ValueswapV2Library.getReserves(factory, tokenA, tokenB);\n (aToB, amountIn) = computeProfitMaximizingTrade(\n truePriceTokenA, truePriceTokenB,\n reserveA, reserveB\n );\n }\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": "/Users/second/Documents/work/valueswap-v2-periphery/contracts/examples/ExampleSwapToPrice.sol", "ast": { "absolutePath": "/Users/second/Documents/work/valueswap-v2-periphery/contracts/examples/ExampleSwapToPrice.sol", "exportedSymbols": { "ExampleSwapToPrice": [ 4924 ] }, "id": 4925, "nodeType": "SourceUnit", "nodes": [ { "id": 4651, "literals": [ "solidity", "=", "0.6", ".6" ], "nodeType": "PragmaDirective", "src": "0:23:7" }, { "absolutePath": "@valueswap/v2-core/contracts/interfaces/IValueswapV2Pair.sol", "file": "@valueswap/v2-core/contracts/interfaces/IValueswapV2Pair.sol", "id": 4652, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 9359, "src": "25:70:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@valueswap/lib/contracts/libraries/Babylonian.sol", "file": "@valueswap/lib/contracts/libraries/Babylonian.sol", "id": 4653, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 7752, "src": "96:59:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@valueswap/lib/contracts/libraries/TransferHelper.sol", "file": "@valueswap/lib/contracts/libraries/TransferHelper.sol", "id": 4654, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 9040, "src": "156:63:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/second/Documents/work/valueswap-v2-periphery/contracts/interfaces/IERC20.sol", "file": "../interfaces/IERC20.sol", "id": 4655, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 5009, "src": "221:34:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/second/Documents/work/valueswap-v2-periphery/contracts/interfaces/IValueswapV2Router01.sol", "file": "../interfaces/IValueswapV2Router01.sol", "id": 4656, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 5333, "src": "256:48:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/second/Documents/work/valueswap-v2-periphery/contracts/libraries/SafeMath.sol", "file": "../libraries/SafeMath.sol", "id": 4657, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 5582, "src": "305:35:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/second/Documents/work/valueswap-v2-periphery/contracts/libraries/ValueswapV2Library.sol", "file": "../libraries/ValueswapV2Library.sol", "id": 4658, "nodeType": "ImportDirective", "scope": 4925, "sourceUnit": 6054, "src": "341:45:7", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4924, "linearizedBaseContracts": [ 4924 ], "name": "ExampleSwapToPrice", "nodeType": "ContractDefinition", "nodes": [ { "id": 4661, "libraryName": { "contractScope": null, "id": 4659, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5581, "src": "428:8:7", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$5581", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "422:27:7", "typeName": { "id": 4660, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "441:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": false, "functionSelector": "f887ea40", "id": 4663, "mutability": "immutable", "name": "router", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4924, "src": "455:44:7", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" }, "typeName": { "contractScope": null, "id": 4662, "name": "IValueswapV2Router01", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5332, "src": "455:20:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "c45a0155", "id": 4665, "mutability": "immutable", "name": "factory", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4924, "src": "505:32:7", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4664, "name": "address", "nodeType": "ElementaryTypeName", "src": "505:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "body": { "id": 4680, "nodeType": "Block", "src": "611:61:7", "statements": [ { "expression": { "argumentTypes": null, "id": 4674, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 4672, "name": "factory", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4665, "src": "621:7:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 4673, "name": "factory_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4667, "src": "631:8:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "621:18:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 4675, "nodeType": "ExpressionStatement", "src": "621:18:7" }, { "expression": { "argumentTypes": null, "id": 4678, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 4676, "name": "router", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4663, "src": "649:6:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 4677, "name": "router_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4669, "src": "658:7:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" } }, "src": "649:16:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" } }, "id": 4679, "nodeType": "ExpressionStatement", "src": "649:16:7" } ] }, "documentation": null, "id": 4681, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 4670, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4667, "mutability": "mutable", "name": "factory_", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4681, "src": "556:16:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4666, "name": "address", "nodeType": "ElementaryTypeName", "src": "556:7:7", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4669, "mutability": "mutable", "name": "router_", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4681, "src": "574:28:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" }, "typeName": { "contractScope": null, "id": 4668, "name": "IValueswapV2Router01", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5332, "src": "574:20:7", "typeDescriptions": { "typeIdentifier": "t_contract$_IValueswapV2Router01_$5332", "typeString": "contract IValueswapV2Router01" } }, "value": null, "visibility": "internal" } ], "src": "555:48:7" }, "returnParameters": { "id": 4671, "nodeType": "ParameterList", "parameters": [], "src": "61