UNPKG

@sonicswap/periphery

Version:

🎚 Peripheral smart contracts for interacting with the Sonicswap exchanges

526 lines (525 loc) • 184 kB
{ "contractName": "ExampleComputeLiquidityValue", "abi": [ { "inputs": [ { "internalType": "address", "name": "factory_", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "factory", "outputs": [ { "internalType": "address", "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" } ], "name": "getReservesAfterArbitrage", "outputs": [ { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, { "internalType": "uint256", "name": "reserveB", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "uint256", "name": "liquidityAmount", "type": "uint256" } ], "name": "getLiquidityValue", "outputs": [ { "internalType": "uint256", "name": "tokenAAmount", "type": "uint256" }, { "internalType": "uint256", "name": "tokenBAmount", "type": "uint256" } ], "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": "liquidityAmount", "type": "uint256" } ], "name": "getLiquidityValueAfterArbitrageToPrice", "outputs": [ { "internalType": "uint256", "name": "tokenAAmount", "type": "uint256" }, { "internalType": "uint256", "name": "tokenBAmount", "type": "uint256" } ], "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": "liquidityAmount", "type": "uint256" } ], "name": "getGasCostOfGetLiquidityValueAfterArbitrageToPrice", "outputs": [ { "internalType": "uint256", "name": "", "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\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"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\":\"liquidityAmount\",\"type\":\"uint256\"}],\"name\":\"getGasCostOfGetLiquidityValueAfterArbitrageToPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidityAmount\",\"type\":\"uint256\"}],\"name\":\"getLiquidityValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenAAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenBAmount\",\"type\":\"uint256\"}],\"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\":\"liquidityAmount\",\"type\":\"uint256\"}],\"name\":\"getLiquidityValueAfterArbitrageToPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenAAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenBAmount\",\"type\":\"uint256\"}],\"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\"}],\"name\":\"getReservesAfterArbitrage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reserveA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveB\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleComputeLiquidityValue.sol\":\"ExampleComputeLiquidityValue\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleComputeLiquidityValue.sol\":{\"keccak256\":\"0x99ee6106bd365b105bbfc689b3916ceed1d4a1ba9f097963f20deafd141af2db\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://d2185bcc86bcb7fd000bb00d4affeaccafeab49bbbcddaeda3e6cd4cb5dd6782\",\"dweb:/ipfs/Qmar2JLkzPTMWkG97J8gyrfT2nnr2LKZYEZ7rMYMm68ddA\"]},\"/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\"]}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b506040516111003803806111008339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b031661108561007b600039806101a952806101e7528061022a5280610268528061029252506110856000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633558e94c1461005c57806369a2fcbd146100b157806380caa353146100f3578063c45a015514610147578063d9b7a6e71461016b575b600080fd5b6100986004803603608081101561007257600080fd5b506001600160a01b038135811691602081013590911690604081013590606001356101a1565b6040805192835260208301919091528051918290030190f35b610098600480360360a08110156100c757600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356101df565b610135600480360360a081101561010957600080fd5b506001600160a01b0381358116916020810135909116906040810135906060810135906080013561021f565b60408051918252519081900360200190f35b61014f610266565b604080516001600160a01b039092168252519081900360200190f35b6100986004803603606081101561018157600080fd5b506001600160a01b0381358116916020810135909116906040013561028a565b6000806101d17f0000000000000000000000000000000000000000000000000000000000000000878787876102c5565b915091505b94509492505050565b6000806102107f00000000000000000000000000000000000000000000000000000000000000008888888888610389565b915091505b9550959350505050565b6000805a90506102537f00000000000000000000000000000000000000000000000000000000000000008888888888610389565b505060005a909103979650505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806102b97f000000000000000000000000000000000000000000000000000000000000000086868661057a565b91509150935093915050565b6000806102d387878761071c565b909250905081158015906102e75750600081115b6103225760405162461bcd60e51b815260040180806020018281038252602d815260200180610f84602d913960400191505060405180910390fd5b600080610331868686866107ea565b915091508060001415610345575050610215565b81156103665760006103588286866108b0565b94820194909303925061037d565b60006103738285876108b0565b9094039350918201915b50509550959350505050565b6000806000806001600160a01b0316896001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156103d157600080fd5b505afa1580156103e5573d6000803e3d6000fd5b505050506040513d60208110156103fb57600080fd5b50516001600160a01b03161415905060006104178a8a8a610988565b905060008261042757600061048d565b816001600160a01b0316637464fc3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561046057600080fd5b505afa158015610474573d6000803e3d6000fd5b505050506040513d602081101561048a57600080fd5b50515b90506000826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ca57600080fd5b505afa1580156104de573d6000803e3d6000fd5b505050506040513d60208110156104f457600080fd5b505190508681108015906105085750600087115b6105435760405162461bcd60e51b8152600401808060200182810382526027815260200180610ffe6027913960400191505060405180910390fd5b6000806105538e8e8e8e8e6102c5565b915091506105658282858c8a89610a48565b97509750505050505050965096945050505050565b60008060008061058b88888861071c565b91509150600061059c898989610988565b90506000806001600160a01b03168a6001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156105e357600080fd5b505afa1580156105f7573d6000803e3d6000fd5b505050506040513d602081101561060d57600080fd5b50516001600160a01b03161415905060008161062a576000610690565b826001600160a01b0316637464fc3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561066357600080fd5b505afa158015610677573d6000803e3d6000fd5b505050506040513d602081101561068d57600080fd5b50515b90506000836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106cd57600080fd5b505afa1580156106e1573d6000803e3d6000fd5b505050506040513d60208110156106f757600080fd5b505190506107098686838c8787610a48565b9750975050505050505094509492505050565b600080600061072b8585610afd565b50905060008061073c888888610988565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561077457600080fd5b505afa158015610788573d6000803e3d6000fd5b505050506040513d606081101561079e57600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506001600160a01b03878116908416146107d85780826107db565b81815b90999098509650505050505050565b600080856107f9858786610bdb565b10915060006108088585610c96565b9050600061084e61084961081e846103e8610c96565b86610829578961082b565b8a5b6108446103e58961083c578d61083e565b8c5b90610c96565b610bdb565b610cff565b905060006103e58561086b57610866876103e8610c96565b610877565b610877886103e8610c96565b8161087e57fe5b0490508082101561089857600080945094505050506101d6565b6108a28282610e47565b935050505094509492505050565b60008084116108f05760405162461bcd60e51b815260040180806020018281038252602b815260200180611025602b913960400191505060405180910390fd5b6000831180156109005750600082115b61093b5760405162461bcd60e51b8152600401808060200182810382526028815260200180610fd66028913960400191505060405180910390fd5b6000610949856103e5610c96565b905060006109578285610c96565b905060006109718361096b886103e8610c96565b90610e97565b905080828161097c57fe5b04979650505050505050565b60008060006109978585610afd565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b600080838015610a585750600083115b15610ac8576000610a6c6108498a8a610c96565b90506000610a7985610cff565b905080821115610ac557876000610a908484610e47565b90506000610aa38461096b876005610c96565b90506000610ab2848484610bdb565b9050610abe8c82610e97565b9b50505050505b50505b85610ad38987610c96565b81610ada57fe5b0486610ae68988610c96565b81610aed57fe5b0491509150965096945050505050565b600080826001600160a01b0316846001600160a01b03161415610b515760405162461bcd60e51b8152600401808060200182810382526025815260200180610fb16025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031610610b71578284610b74565b83835b90925090506001600160a01b038216610bd4576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6000806000610bea8686610ee6565b9150915060008480610bf857fe5b868809905082811115610c0c576001820391505b918290039181610c2a57848381610c1f57fe5b049350505050610c8f565b848210610c7e576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015290519081900360640190fd5b610c89838387610f13565b93505050505b9392505050565b6000811580610cb157505080820282828281610cae57fe5b04145b610cf9576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b600081610d0e57506000610e42565b816001600160801b8210610d275760809190911c9060401b5b680100000000000000008210610d425760409190911c9060201b5b6401000000008210610d595760209190911c9060101b5b620100008210610d6e5760109190911c9060081b5b6101008210610d825760089190911c9060041b5b60108210610d955760049190911c9060021b5b60088210610da15760011b5b6001818581610dac57fe5b048201901c90506001818581610dbe57fe5b048201901c90506001818581610dd057fe5b048201901c90506001818581610de257fe5b048201901c90506001818581610df457fe5b048201901c90506001818581610e0657fe5b048201901c90506001818581610e1857fe5b048201901c90506000818581610e2a57fe5b049050808210610e3a5780610e3c565b815b93505050505b919050565b80820382811115610cf9576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b80820182811015610cf9576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b6000808060001984860990508385029250828103915082811015610f0b576001820391505b509250929050565b60008181038216808381610f2357fe5b049250808581610f2f57fe5b049450808160000381610f3e57fe5b6002858103808702820302808702820302808702820302808702820302808702820302808702820302958602900390940293046001019390930293909301029291505056fe556e697377617056324172626974726167654c6962726172793a205a45524f5f504149525f5245534552564553556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459436f6d707574654c697175696469747956616c75653a204c49515549444954595f414d4f554e54556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a26469706673582212201f872594c36b67cc60b7d4aaea3e8bccd3d57a77e6060a88283bdd9a8a46168164736f6c634300060c0033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80633558e94c1461005c57806369a2fcbd146100b157806380caa353146100f3578063c45a015514610147578063d9b7a6e71461016b575b600080fd5b6100986004803603608081101561007257600080fd5b506001600160a01b038135811691602081013590911690604081013590606001356101a1565b6040805192835260208301919091528051918290030190f35b610098600480360360a08110156100c757600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356101df565b610135600480360360a081101561010957600080fd5b506001600160a01b0381358116916020810135909116906040810135906060810135906080013561021f565b60408051918252519081900360200190f35b61014f610266565b604080516001600160a01b039092168252519081900360200190f35b6100986004803603606081101561018157600080fd5b506001600160a01b0381358116916020810135909116906040013561028a565b6000806101d17f0000000000000000000000000000000000000000000000000000000000000000878787876102c5565b915091505b94509492505050565b6000806102107f00000000000000000000000000000000000000000000000000000000000000008888888888610389565b915091505b9550959350505050565b6000805a90506102537f00000000000000000000000000000000000000000000000000000000000000008888888888610389565b505060005a909103979650505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806102b97f000000000000000000000000000000000000000000000000000000000000000086868661057a565b91509150935093915050565b6000806102d387878761071c565b909250905081158015906102e75750600081115b6103225760405162461bcd60e51b815260040180806020018281038252602d815260200180610f84602d913960400191505060405180910390fd5b600080610331868686866107ea565b915091508060001415610345575050610215565b81156103665760006103588286866108b0565b94820194909303925061037d565b60006103738285876108b0565b9094039350918201915b50509550959350505050565b6000806000806001600160a01b0316896001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156103d157600080fd5b505afa1580156103e5573d6000803e3d6000fd5b505050506040513d60208110156103fb57600080fd5b50516001600160a01b03161415905060006104178a8a8a610988565b905060008261042757600061048d565b816001600160a01b0316637464fc3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561046057600080fd5b505afa158015610474573d6000803e3d6000fd5b505050506040513d602081101561048a57600080fd5b50515b90506000826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ca57600080fd5b505afa1580156104de573d6000803e3d6000fd5b505050506040513d60208110156104f457600080fd5b505190508681108015906105085750600087115b6105435760405162461bcd60e51b8152600401808060200182810382526027815260200180610ffe6027913960400191505060405180910390fd5b6000806105538e8e8e8e8e6102c5565b915091506105658282858c8a89610a48565b97509750505050505050965096945050505050565b60008060008061058b88888861071c565b91509150600061059c898989610988565b90506000806001600160a01b03168a6001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156105e357600080fd5b505afa1580156105f7573d6000803e3d6000fd5b505050506040513d602081101561060d57600080fd5b50516001600160a01b03161415905060008161062a576000610690565b826001600160a01b0316637464fc3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561066357600080fd5b505afa158015610677573d6000803e3d6000fd5b505050506040513d602081101561068d57600080fd5b50515b90506000836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106cd57600080fd5b505afa1580156106e1573d6000803e3d6000fd5b505050506040513d60208110156106f757600080fd5b505190506107098686838c8787610a48565b9750975050505050505094509492505050565b600080600061072b8585610afd565b50905060008061073c888888610988565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561077457600080fd5b505afa158015610788573d6000803e3d6000fd5b505050506040513d606081101561079e57600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506001600160a01b03878116908416146107d85780826107db565b81815b90999098509650505050505050565b600080856107f9858786610bdb565b10915060006108088585610c96565b9050600061084e61084961081e846103e8610c96565b86610829578961082b565b8a5b6108446103e58961083c578d61083e565b8c5b90610c96565b610bdb565b610cff565b905060006103e58561086b57610866876103e8610c96565b610877565b610877886103e8610c96565b8161087e57fe5b0490508082101561089857600080945094505050506101d6565b6108a28282610e47565b935050505094509492505050565b60008084116108f05760405162461bcd60e51b815260040180806020018281038252602b815260200180611025602b913960400191505060405180910390fd5b6000831180156109005750600082115b61093b5760405162461bcd60e51b8152600401808060200182810382526028815260200180610fd66028913960400191505060405180910390fd5b6000610949856103e5610c96565b905060006109578285610c96565b905060006109718361096b886103e8610c96565b90610e97565b905080828161097c57fe5b04979650505050505050565b60008060006109978585610afd565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f4a8da68f30e6bab8a1cda432a2de48a79d41e83ccf07532497c0762037cdc0cb609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b600080838015610a585750600083115b15610ac8576000610a6c6108498a8a610c96565b90506000610a7985610cff565b905080821115610ac557876000610a908484610e47565b90506000610aa38461096b876005610c96565b90506000610ab2848484610bdb565b9050610abe8c82610e97565b9b50505050505b50505b85610ad38987610c96565b81610ada57fe5b0486610ae68988610c96565b81610aed57fe5b0491509150965096945050505050565b600080826001600160a01b0316846001600160a01b03161415610b515760405162461bcd60e51b8152600401808060200182810382526025815260200180610fb16025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031610610b71578284610b74565b83835b90925090506001600160a01b038216610bd4576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6000806000610bea8686610ee6565b9150915060008480610bf857fe5b868809905082811115610c0c576001820391505b918290039181610c2a57848381610c1f57fe5b049350505050610c8f565b848210610c7e576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604482015290519081900360640190fd5b610c89838387610f13565b93505050505b9392505050565b6000811580610cb157505080820282828281610cae57fe5b04145b610cf9576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b600081610d0e57506000610e42565b816001600160801b8210610d275760809190911c9060401b5b680100000000000000008210610d425760409190911c9060201b5b6401000000008210610d595760209190911c9060101b5b620100008210610d6e5760109190911c9060081b5b6101008210610d825760089190911c9060041b5b60108210610d955760049190911c9060021b5b60088210610da15760011b5b6001818581610dac57fe5b048201901c90506001818581610dbe57fe5b048201901c90506001818581610dd057fe5b048201901c90506001818581610de257fe5b048201901c90506001818581610df457fe5b048201901c90506001818581610e0657fe5b048201901c90506001818581610e1857fe5b048201901c90506000818581610e2a57fe5b049050808210610e3a5780610e3c565b815b93505050505b919050565b80820382811115610cf9576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b80820182811015610cf9576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b6000808060001984860990508385029250828103915082811015610f0b576001820391505b509250929050565b60008181038216808381610f2357fe5b049250808581610f2f57fe5b049450808160000381610f3e57fe5b6002858103808702820302808702820302808702820302808702820302808702820302808702820302958602900390940293046001019390930293909301029291505056fe556e697377617056324172626974726167654c6962726172793a205a45524f5f504149525f5245534552564553556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459436f6d707574654c697175696469747956616c75653a204c49515549444954595f414d4f554e54556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a26469706673582212201f872594c36b67cc60b7d4aaea3e8bccd3d57a77e6060a88283bdd9a8a46168164736f6c634300060c0033", "immutableReferences": { "3673": [ { "length": 32, "start": 425 }, { "length": 32, "start": 487 }, { "length": 32, "start": 554 }, { "length": 32, "start": 616 }, { "length": 32, "start": 658 } ] }, "sourceMap": "120:2433:3:-:0;;;236:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;236:72:3;283:18;;;;-1:-1:-1;;;;;;283:18:3;;;-1:-1:-1;;;;;120:2433:3;;;;;;;;", "deployedSourceMap": "120:2433:3:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;381:422;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;381:422:3;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1328:540;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1328:540:3;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;1941:610::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1941:610:3;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;197:32;;;:::i;:::-;;;;-1:-1:-1;;;;;197:32:3;;;;;;;;;;;;;;868:374;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;868:374:3;;;;;;;;;;;;;;;;;:::i;381:422::-;559:16;577;612:184;681:7;702:6;722;742:15;771;612:55;:184::i;:::-;605:191;;;;381:422;;;;;;;;:::o;1328:540::-;1561:20;1591;1635:226;1717:7;1738:6;1758;1778:15;1807;1836;1635:68;:226::i;:::-;1628:233;;;;1328:540;;;;;;;;;:::o;1941:610::-;2186:7;2210:14;2227:9;2210:26;;2246:226;2328:7;2349:6;2369;2389:15;2418;2447;2246:68;:226::i;:::-;;;2482:13;2498:9;2524:20;;;;1941:610;-1:-1:-1;;;;;;;1941:610:3:o;197:32::-;;;:::o;868:374::-;1014:20;1044;1088:147;1149:7;1170:6;1190;1210:15;1088:47;:147::i;:::-;1081:154;;;;868:374;;;;;;:::o;1718:1161:17:-;1921:16;1939;2036:53;2065:7;2074:6;2082;2036:28;:53::i;:::-;2013:76;;-1:-1:-1;2013:76:17;-1:-1:-1;2108:12:17;;;;;:28;;;2135:1;2124:8;:12;2108:28;2100:86;;;;-1:-1:-1;;;2100:86:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2264:9;2275:16;2295:82;2324:15;2341;2358:8;2368;2295:28;:82::i;:::-;2263:114;;;;2392:8;2404:1;2392:13;2388:71;;;2421:27;;;;2388:71;2521:4;2517:356;;;2541:14;2558:59;2588:8;2598;2608;2558:29;:59::i;:::-;2631:20;;;;2665:21;;;;-1:-1:-1;2517:356:17;;;2717:14;2734:59;2764:8;2774;2784;2734:29;:59::i;:::-;2841:21;;;;-1:-1:-1;2807:20:17;;;;2517:356;1718:1161;;;;;;;;;;:::o;5035:984::-;5293:20;5323;5360:10;5419:1;-1:-1:-1;;;;;5373:48:17;5391:7;-1:-1:-1;;;;;5373:32:17;;:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5373:34:17;-1:-1:-1;;;;;5373:48:17;;;;-1:-1:-1;5431:19:17;5468:49;5493:7;5502:6;5510;5468:24;:49::i;:::-;5431:87;;5528:10;5541:5;:24;;5564:1;5541:24;;;5549:4;-1:-1:-1;;;;;5549:10:17;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5549:12:17;5541:24;5528:37;;5575:16;5594:4;-1:-1:-1;;;;;5594:16:17;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5594:18:17;;-1:-1:-1;5680:30:17;;;;;;:53;;;5732:1;5714:15;:19;5680:53;5672:105;;;;-1:-1:-1;;;5672:105:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5789:14;5805;5823:84;5849:7;5858:6;5866;5874:15;5891;5823:25;:84::i;:::-;5788:119;;;;5925:87;5947:9;5958;5969:11;5982:15;5999:5;6006;5925:21;:87::i;:::-;5918:94;;;;;;;;;;5035:984;;;;;;;;;:::o;4126:683::-;4288:20;4310;4343:17;4362;4383:53;4412:7;4421:6;4429;4383:28;:53::i;:::-;4342:94;;;;4446:19;4483:49;4508:7;4517:6;4525;4483:24;:49::i;:::-;4446:87;;4543:10;4602:1;-1:-1:-1;;;;;4556:48:17;4574:7;-1:-1:-1;;;;;4556:32:17;;:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4556:34:17;-1:-1:-1;;;;;4556:48:17;;;;-1:-1:-1;4614:10:17;4556:48;4627:24;;4650:1;4627:24;;;4635:4;-1:-1:-1;;;;;4635:10:17;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4635:12:17;4627:24;4614:37;;4661:16;4680:4;-1:-1:-1;;;;;4680:16:17;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4680:18:17;;-1:-1:-1;4715:87:17;4737:9;4748;4680:18;4772:15;4789:5;4796;4715:21;:87::i;:::-;4708:94;;;;;;;;;;4126:683;;;;;;;:::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;2208:510:16:-;2301:14;2346:1;2335:8;:12;2327:68;;;;-1:-1:-1;;;2327:68:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2425:1;2413:9;:13;:31;;;;;2443:1;2430:10;:14;2413:31;2405:84;;;;-1:-1:-1;;;2405:84:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2499:20;2522:17;:8;2535:3;2522:12;:17::i;:::-;2499:40;-1:-1:-1;2549:14:16;2566:31;2499:40;2586:10;2566:19;:31::i;:::-;2549:48;-1:-1:-1;2607:16:16;2626:40;2650:15;2626:19;:9;2640:4;2626:13;:19::i;:::-;:23;;:40::i;:::-;2607:59;;2700:11;2688:9;:23;;;;;;;2208:510;-1:-1:-1;;;;;;;2208:510:16: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;2954:910:17:-;3170:20;3192;3228:5;:18;;;;;3245:1;3237:5;:9;3228:18;3224:525;;;3262:10;3275:41;3291:24;:9;3305;3291:13;:24::i;3275:41::-;3262:54;;3330:14;3347:22;3363:5;3347:15;:22::i;:::-;3330:39;;3395:9;3387:5;:17;3383:356;;;3442:11;3424:15;3489:20;:5;3499:9;3489;:20::i;:::-;3471:38;-1:-1:-1;3527:16:17;3546:27;3563:9;3546:12;:5;3556:1;3546:9;:12::i;:27::-;3527:46;;3591:17;3611:52;3627:10;3639;3651:11;3611:15;:52::i;:::-;3591:72;-1:-1:-1;3695:29:17;:11;3591:72;3695:15;:29::i;:::-;3681:43;;3383:356;;;;;3224:525;;;3799:11;3766:30;:9;3780:15;3766:13;:30::i;:::-;:44;;;;;;3845:11;3812:30;:9;3826:15;3812:13;:30::i;:::-;:44;;;;;;3758:99;;;;2954:910;;;;;;;;;:::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;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;;;;;;;;;;;;;;191:126;274:5;;;269:16;;;;261:49;;;;;-1:-1:-1;;;261:49:15;;;;;;;;;;;;-1:-1:-1;;;261:49: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 '../libraries/UniswapV2LiquidityMathLibrary.sol';\n\ncontract ExampleComputeLiquidityValue {\n using SafeMath for uint256;\n\n address public immutable factory;\n\n constructor(address factory_) public {\n factory = factory_;\n }\n\n // see UniswapV2LiquidityMathLibrary#getReservesAfterArbitrage\n function getReservesAfterArbitrage(\n address tokenA,\n address tokenB,\n uint256 truePriceTokenA,\n uint256 truePriceTokenB\n ) external view returns (uint256 reserveA, uint256 reserveB) {\n return UniswapV2LiquidityMathLibrary.getReservesAfterArbitrage(\n factory,\n tokenA,\n tokenB,\n truePriceTokenA,\n truePriceTokenB\n );\n }\n\n // see UniswapV2LiquidityMathLibrary#getLiquidityValue\n function getLiquidityValue(\n address tokenA,\n address tokenB,\n uint256 liquidityAmount\n ) external view returns (\n uint256 tokenAAmount,\n uint256 tokenBAmount\n ) {\n return UniswapV2LiquidityMathLibrary.getLiquidityValue(\n factory,\n tokenA,\n tokenB,\n liquidityAmount\n );\n }\n\n // see UniswapV2LiquidityMathLibrary#getLiquidityValueAfterArbitrageToPrice\n function getLiquidityValueAfterArbitrageToPrice(\n address tokenA,\n address tokenB,\n uint256 truePriceTokenA,\n uint256 truePriceTokenB,\n uint256 liquidityAmount\n ) external view returns (\n uint256 tokenAAmount,\n uint256 tokenBAmount\n ) {\n return UniswapV2LiquidityMathLibrary.getLiquidityValueAfterArbitrageToPrice(\n factory,\n tokenA,\n tokenB,\n truePriceTokenA,\n truePriceTokenB,\n liquidityAmount\n );\n }\n\n // test function to measure the gas cost of the above function\n function getGasCostOfGetLiquidityValueAfterArbitrageToPrice(\n address tokenA,\n address tokenB,\n uint256 truePriceTokenA,\n uint256 truePriceTokenB,\n uint256 liquidityAmount\n ) external view returns (\n uint256\n ) {\n uint gasBefore = gasleft();\n UniswapV2LiquidityMathLibrary.getLiquidityValueAfterArbitrageToPrice(\n factory,\n tokenA,\n tokenB,\n truePriceTokenA,\n truePriceTokenB,\n liquidityAmount\n );\n uint gasAfter = gasleft();\n return gasBefore - gasAfter;\n }\n}\n", "sourcePath": "/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleComputeLiquidityValue.sol", "ast": { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/examples/ExampleComputeLiquidityValue.sol", "exportedSymbols": { "ExampleComputeLiquidityValue": [ 3800 ] }, "id": 3801, "license": "GPL-3.0", "nodeType": "SourceUnit", "nodes": [ { "id": 3667, "literals": [ "solidity", "=", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "36:24:3" }, { "absolutePath": "/var/www/Sonic/sonicswap-periphery/contracts/libraries/UniswapV2LiquidityMathLibrary.sol", "file": "../libraries/UniswapV2LiquidityMathLibrary.sol", "id": 3668, "nodeType": "ImportDirective", "scope": 3801, "sourceUnit": 6547, "src": "62:56:3", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 3800, "linearizedBaseContracts": [ 3800 ], "name": "ExampleComputeLiquidityValue", "nodeType": "ContractDefinition", "nodes": [ { "id": 3671, "libraryName": { "contractScope": null, "id": 3669, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5608, "src": "170:8:3", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$5608", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "164:27:3", "typeName": { "id": 3670, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "183:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": false, "functionSelector": "c45a0155", "id": 3673, "mutability": "immutable", "name": "factory", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3800, "src": "197:32:3", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3672, "name": "address", "nodeType": "ElementaryTypeName", "src": "197:7:3", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "body": { "id": 3682, "nodeType": "Block", "src": "273:35:3", "statements": [ { "expression": { "argumentTypes": null, "id": 3680, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 3678, "name": "factory", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3673, "src": "283:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 3679, "name": "factory_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3675, "src": "293:8:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "283:18:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 3681, "nodeType": "ExpressionStatement", "src": "283:18:3" } ] }, "documentation": null, "id": 3683, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 3676, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3675, "mutability": "mutable", "name": "factory_", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3683, "src": "248:16:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3674, "name": "address", "nodeType": "ElementaryTypeName", "src": "248:7:3", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "247:18:3" }, "returnParameters": { "id": 3677, "nodeType": "ParameterList", "parameters": [], "src": "273:0:3" }, "scope": 3800, "src": "236:72:3", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 3707, "nodeType": "Block", "src": "595:208:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 3700, "name": "factory", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3673, "src": "681:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3701, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3685, "src": "702:6:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3702, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3687, "src": "722:6:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 3703, "name": "truePriceTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3689, "src": "742:15:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 3704, "name": "truePriceTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3691, "src": "771:15:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256",