cic-internal-integration/apps/cic-eth/tests/testdata/bancor/LiquidTokenConverter.json

19724 lines
945 KiB
JSON
Raw Normal View History

2021-02-01 18:12:51 +01:00
{
"contractName": "LiquidTokenConverter",
"abi": [
{
"inputs": [
{
"internalType": "contract ISmartToken",
"name": "_token",
"type": "address"
},
{
"internalType": "contract IContractRegistry",
"name": "_registry",
"type": "address"
},
{
"internalType": "uint32",
"name": "_maxConversionFee",
"type": "uint32"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint16",
"name": "_type",
"type": "uint16"
},
{
"indexed": true,
"internalType": "contract IConverterAnchor",
"name": "_anchor",
"type": "address"
},
{
"indexed": true,
"internalType": "bool",
"name": "_activated",
"type": "bool"
}
],
"name": "Activation",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "contract IERC20Token",
"name": "_fromToken",
"type": "address"
},
{
"indexed": true,
"internalType": "contract IERC20Token",
"name": "_toToken",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "_trader",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_return",
"type": "uint256"
},
{
"indexed": false,
"internalType": "int256",
"name": "_conversionFee",
"type": "int256"
}
],
"name": "Conversion",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint32",
"name": "_prevFee",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint32",
"name": "_newFee",
"type": "uint32"
}
],
"name": "ConversionFeeUpdate",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_prevOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "OwnerUpdate",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "contract IERC20Token",
"name": "_token1",
"type": "address"
},
{
"indexed": true,
"internalType": "contract IERC20Token",
"name": "_token2",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_rateN",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_rateD",
"type": "uint256"
}
],
"name": "TokenRateUpdate",
"type": "event"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "acceptTokenOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "anchor",
"outputs": [
{
"internalType": "contract IConverterAnchor",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "connectorTokenCount",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_index",
"type": "uint256"
}
],
"name": "connectorTokens",
"outputs": [
{
"internalType": "contract IERC20Token",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_address",
"type": "address"
}
],
"name": "connectors",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "",
"type": "uint32"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "conversionFee",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "conversionWhitelist",
"outputs": [
{
"internalType": "contract IWhitelist",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "conversionsEnabled",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_sourceToken",
"type": "address"
},
{
"internalType": "contract IERC20Token",
"name": "_targetToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
},
{
"internalType": "address payable",
"name": "_beneficiary",
"type": "address"
}
],
"name": "convert",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_connectorToken",
"type": "address"
}
],
"name": "getConnectorBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_sourceToken",
"type": "address"
},
{
"internalType": "contract IERC20Token",
"name": "_targetToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "getReturn",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "hasETHReserve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isActive",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isV28OrHigher",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "maxConversionFee",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "newOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "onlyOwnerCanUpdateRegistry",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "prevRegistry",
"outputs": [
{
"internalType": "contract IContractRegistry",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "registry",
"outputs": [
{
"internalType": "contract IContractRegistry",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_reserveToken",
"type": "address"
}
],
"name": "reserveBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "reserveRatio",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "reserveTokenCount",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "reserveTokens",
"outputs": [
{
"internalType": "contract IERC20Token",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_reserveToken",
"type": "address"
}
],
"name": "reserveWeight",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "",
"type": "address"
}
],
"name": "reserves",
"outputs": [
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "weight",
"type": "uint32"
},
{
"internalType": "bool",
"name": "deprecated1",
"type": "bool"
},
{
"internalType": "bool",
"name": "deprecated2",
"type": "bool"
},
{
"internalType": "bool",
"name": "isSet",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "restoreRegistry",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "_onlyOwnerCanUpdateRegistry",
"type": "bool"
}
],
"name": "restrictRegistryUpdate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_conversionFee",
"type": "uint32"
}
],
"name": "setConversionFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IWhitelist",
"name": "_whitelist",
"type": "address"
}
],
"name": "setConversionWhitelist",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [
{
"internalType": "contract IConverterAnchor",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "transferAnchorOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "transferTokenOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "updateRegistry",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "upgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "_to",
"type": "address"
}
],
"name": "withdrawETH",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "withdrawFromAnchor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "withdrawTokens",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
},
{
"inputs": [],
"name": "converterType",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "acceptAnchorOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_token",
"type": "address"
},
{
"internalType": "uint32",
"name": "_weight",
"type": "uint32"
}
],
"name": "addReserve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Token",
"name": "_sourceToken",
"type": "address"
},
{
"internalType": "contract IERC20Token",
"name": "_targetToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "targetAmountAndFee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ISmartToken\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"contract IContractRegistry\",\"name\":\"_registry\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_maxConversionFee\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_type\",\"type\":\"uint16\"},{\"indexed\":true,\"internalType\":\"contract IConverterAnchor\",\"name\":\"_anchor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_activated\",\"type\":\"bool\"}],\"name\":\"Activation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20Token\",\"name\":\"_fromToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contract IERC20Token\",\"name\":\"_toToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_trader\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_return\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_conversionFee\",\"type\":\"int256\"}],\"name\":\"Conversion\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"_prevFee\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"_newFee\",\"type\":\"uint32\"}],\"name\":\"ConversionFeeUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_prevOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"OwnerUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20Token\",\"name\":\"_token1\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contract IERC20Token\",\"name\":\"_token2\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rateN\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rateD\",\"type\":\"uint256\"}],\"name\":\"TokenRateUpdate\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptAnchorOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptTokenOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_weight\",\"type\":\"uint32\"}],\"name\":\"addReserve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchor\",\"outputs\":[{\"internalType\":\"contract IConverterAnchor\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"connectorTokenCount\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"connectorTokens\",\"outputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"connectors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\"
"bytecode": "0x60806040526003805460ff60a81b19169055600880546001600160601b03191690553480156200002e57600080fd5b50604051620031db380380620031db833981810160405260608110156200005457600080fd5b5080516020820151604090920151600080546001600160a01b03191633179055909190828282818062000087816200011e565b50600280546001600160a01b039092166001600160a01b031992831681179091556003805490921617905582620000be816200011e565b81620000ca816200017d565b5050600480546001600160a01b039094166001600160a01b031990941693909317909255506008805463ffffffff9092166401000000000263ffffffff60201b1990921691909117905550620001dc915050565b6001600160a01b0381166200017a576040805162461bcd60e51b815260206004820152601360248201527f4552525f494e56414c49445f4144445245535300000000000000000000000000604482015290519081900360640190fd5b50565b620f424063ffffffff821611156200017a576040805162461bcd60e51b815260206004820152601a60248201527f4552525f494e56414c49445f434f4e56455253494f4e5f464545000000000000604482015290519081900360640190fd5b612fef80620001ec6000396000f3fe6080604052600436106102765760003560e01c806371f52bf31161014f578063d031370b116100c1578063d89595121161007a578063d8959512146108e7578063dc8de3791461092c578063e8dc12ff1461095f578063ecbca55d146109a5578063f2fde38b146109d5578063fc0c546a14610a085761030d565b8063d031370b14610836578063d260529c14610860578063d3fb73b414610875578063d4ee1d901461088a578063d55ec6971461089f578063d66bd524146108b45761030d565b80639b99a8e2116101135780639b99a8e21461078a578063af94b8d81461079f578063b4a176d3146107e2578063bf754558146107f7578063c45d3d921461080c578063cdc91c69146108215761030d565b806371f52bf31461072157806379ba5097146107365780637b1039991461074b5780638da5cb5b1461076057806394c275ad146107755761030d565b8063395900d4116101e8578063579cd3ca116101ac578063579cd3ca1461060f5780635e35359e1461062457806361cd756e1461066757806367b6d57c1461067c578063690d8320146106af5780636a49d2c4146106e25761030d565b8063395900d4146105435780633e8ff43f1461058657806349d10b64146105b25780634af80f0e146105c757806354fd4d50146105fa5761030d565b80631cfab2901161023a5780631cfab290146104425780631e1401f81461047557806321e6b53d146104d157806322f3e2d4146105045780632fe8a6ad1461051957806338a5e0161461052e5761030d565b8063024c7ec7146103125780630c7d5cd81461033e5780630e53aae91461036c57806312c2aca4146103d357806319b64015146103fc5761030d565b3661030d5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60005260076020527fb2084a3e4595ccf007fb44245853374aaf0de960074375e8e0fb334712e94d0f54600160301b900460ff1661030b576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f5245534552564560681b604482015290519081900360640190fd5b005b600080fd5b34801561031e57600080fd5b5061030b6004803603602081101561033557600080fd5b50351515610a1d565b34801561034a57600080fd5b50610353610a43565b6040805163ffffffff9092168252519081900360200190f35b34801561037857600080fd5b5061039f6004803603602081101561038f57600080fd5b50356001600160a01b0316610a4f565b6040805195865263ffffffff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b3480156103df57600080fd5b506103e8610ae7565b604080519115158252519081900360200190f35b34801561040857600080fd5b506104266004803603602081101561041f57600080fd5b5035610b33565b604080516001600160a01b039092168252519081900360200190f35b34801561044e57600080fd5b506103536004803603602081101561046557600080fd5b50356001600160a01b0316610b5d565b34801561048157600080fd5b506104b86004803603606081101561049857600080fd5b506001600160a01b03813581169160208101359091169060400135610b8f565b6040805192835260208301919091528051918290030190f35b3480156104dd57600080fd5b5061030b600480360360208110156104f457600080fd5b50356001600160a01b0316610baa565b34801561051057600080fd5b506103e8610bbe565b34801561052557600080fd5b506103e8610c3d565b34801561053a57600080fd5b5061030b610c4d565b34801561054f57600080fd5b5061030b6004803603606081101561056657600080fd5b506001600160a01b03813581169160208101359091169060400135610c5f565b34801561059257600080fd5b5061059b610ce5565b6040805161ffff9092168252519081900360200190f35b3480156105be57600080fd5b5061030b610cea565b3480156105d357600080fd5b5061030b600480360360208110156105ea57600080fd5b50356001600160a01b0316610ef2565b34801561060657600080fd5b5061059b
"deployedBytecode": "0x6080604052600436106102765760003560e01c806371f52bf31161014f578063d031370b116100c1578063d89595121161007a578063d8959512146108e7578063dc8de3791461092c578063e8dc12ff1461095f578063ecbca55d146109a5578063f2fde38b146109d5578063fc0c546a14610a085761030d565b8063d031370b14610836578063d260529c14610860578063d3fb73b414610875578063d4ee1d901461088a578063d55ec6971461089f578063d66bd524146108b45761030d565b80639b99a8e2116101135780639b99a8e21461078a578063af94b8d81461079f578063b4a176d3146107e2578063bf754558146107f7578063c45d3d921461080c578063cdc91c69146108215761030d565b806371f52bf31461072157806379ba5097146107365780637b1039991461074b5780638da5cb5b1461076057806394c275ad146107755761030d565b8063395900d4116101e8578063579cd3ca116101ac578063579cd3ca1461060f5780635e35359e1461062457806361cd756e1461066757806367b6d57c1461067c578063690d8320146106af5780636a49d2c4146106e25761030d565b8063395900d4146105435780633e8ff43f1461058657806349d10b64146105b25780634af80f0e146105c757806354fd4d50146105fa5761030d565b80631cfab2901161023a5780631cfab290146104425780631e1401f81461047557806321e6b53d146104d157806322f3e2d4146105045780632fe8a6ad1461051957806338a5e0161461052e5761030d565b8063024c7ec7146103125780630c7d5cd81461033e5780630e53aae91461036c57806312c2aca4146103d357806319b64015146103fc5761030d565b3661030d5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60005260076020527fb2084a3e4595ccf007fb44245853374aaf0de960074375e8e0fb334712e94d0f54600160301b900460ff1661030b576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f5245534552564560681b604482015290519081900360640190fd5b005b600080fd5b34801561031e57600080fd5b5061030b6004803603602081101561033557600080fd5b50351515610a1d565b34801561034a57600080fd5b50610353610a43565b6040805163ffffffff9092168252519081900360200190f35b34801561037857600080fd5b5061039f6004803603602081101561038f57600080fd5b50356001600160a01b0316610a4f565b6040805195865263ffffffff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b3480156103df57600080fd5b506103e8610ae7565b604080519115158252519081900360200190f35b34801561040857600080fd5b506104266004803603602081101561041f57600080fd5b5035610b33565b604080516001600160a01b039092168252519081900360200190f35b34801561044e57600080fd5b506103536004803603602081101561046557600080fd5b50356001600160a01b0316610b5d565b34801561048157600080fd5b506104b86004803603606081101561049857600080fd5b506001600160a01b03813581169160208101359091169060400135610b8f565b6040805192835260208301919091528051918290030190f35b3480156104dd57600080fd5b5061030b600480360360208110156104f457600080fd5b50356001600160a01b0316610baa565b34801561051057600080fd5b506103e8610bbe565b34801561052557600080fd5b506103e8610c3d565b34801561053a57600080fd5b5061030b610c4d565b34801561054f57600080fd5b5061030b6004803603606081101561056657600080fd5b506001600160a01b03813581169160208101359091169060400135610c5f565b34801561059257600080fd5b5061059b610ce5565b6040805161ffff9092168252519081900360200190f35b3480156105be57600080fd5b5061030b610cea565b3480156105d357600080fd5b5061030b600480360360208110156105ea57600080fd5b50356001600160a01b0316610ef2565b34801561060657600080fd5b5061059b610f27565b34801561061b57600080fd5b50610353610f2c565b34801561063057600080fd5b5061030b6004803603606081101561064757600080fd5b506001600160a01b03813581169160208101359091169060400135610f3f565b34801561067357600080fd5b50610426611070565b34801561068857600080fd5b5061030b6004803603602081101561069f57600080fd5b50356001600160a01b031661107f565b3480156106bb57600080fd5b5061030b600480360360208110156106d257600080fd5b50356001600160a01b031661112b565b3480156106ee57600080fd5b5061030b6004803603604081101561070557600080fd5b5080356001600160a01b0316906020013563ffffffff1661125e565b34801561072d57600080fd5b5061059b6112ce565b34801561074257600080fd5b5061030b6112dd565b34801561075757600080fd5b50610426611394565b34801561076c57600080fd5b506104266113a3565b34801561078157600080fd5b506103536113b2565b34801561079657600080fd5b5061059b6113c6565b3480156107ab57600080fd5b506104b8600480360360608110156107c257600080fd5b506001600160a01b038135811691602081013590911690604001356113cc565b3480156107ee57600080fd5b5061030b
"immutableReferences": {},
"sourceMap": "501:10433:24:-:0;;;349:27:59;;;-1:-1:-1;;;;349:27:59;;;2899:30:8;;;-1:-1:-1;;3292:40:8;;;876:211:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;876:211:24;;;;;;;;;;;619:5:57;:18;;-1:-1:-1;;;;;;619:18:57;627:10;619:18;;;876:211:24;;;;;;;;594:23:64;876:211:24;594:13:64;:23::i;:::-;-1:-1:-1;2122:8:56::1;:39:::0;;-1:-1:-1;;;;;2122:39:56;;;::::1;-1:-1:-1::0;;;;;;2122:39:56;;::::1;::::0;::::1;::::0;;;2172:12:::1;:43:::0;;;;::::1;;::::0;;6069:7:8;594:23:64;6069:7:8;594:13:64;:23::i;:::-;6168:17:8;7294:35:::2;6168:17:::0;7294:19:::2;:35::i;:::-;-1:-1:-1::0;;6203:6:8::3;:16:::0;;-1:-1:-1;;;;;;6203:16:8::3;-1:-1:-1::0;;;;;6203:16:8;;;::::3;::::0;;;::::3;::::0;;;-1:-1:-1;6230:16:8::3;:36:::0;;-1:-1:-1;;6230:36:8::3;::::0;::::3;::::0;;::::3;::::0;;;::::3;::::0;;;::::3;::::0;;-1:-1:-1;501:10433:24;;-1:-1:-1;;501:10433:24;692:128:64;-1:-1:-1;;;;;766:22:64;;758:54;;;;;-1:-1:-1;;;758:54:64;;;;;;;;;;;;-1:-1:-1;;;758:54:64;;;;;;;;;;;;;;;692:128;:::o;7404:156:8:-;1846:7;7489:32;;;;;7481:71;;;;;-1:-1:-1;;;7481:71:8;;;;;;;;;;;;;;;;;;;;;;;;;;;501:10433:24;;;;;;;",
"deployedSourceMap": "501:10433:24:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1924:42:8;8454:29;;:8;:29;;:35;;-1:-1:-1;;;8454:35:8;;;;8446:67;;;;;-1:-1:-1;;;8446:67:8;;;;;;;;;;;;-1:-1:-1;;;8446:67:8;;;;;;;;;;;;;;;501:10433:24;;;;;3655:224:56;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3655:224:56;;;;:::i;2899:30:8:-;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;22514:248;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;22514:248:8;-1:-1:-1;;;;;22514:248:8;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17176:113;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;22836:145;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;22836:145:8;;:::i;:::-;;;;-1:-1:-1;;;;;22836:145:8;;;;;;;;;;;;;;16300:204;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16300:204:8;-1:-1:-1;;;;;16300:204:8;;:::i;23471:208::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;23471:208:8;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;22136:130;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;22136:130:8;-1:-1:-1;;;;;22136:130:8;;:::i;10641:121::-;;;;;;;;;;;;;:::i;1333:38:56:-;;;;;;;;;;;;;:::i;22340:100:8:-;;;;;;;;;;;;;:::i;12220:157::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;12220:157:8;;;;;;;;;;;;;;;;;:::i;1232:90:24:-;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2300:925:56;;;;;;;;;;;;;:::i;10268:202:8:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10268:202:8;-1:-1:-1;;;;;10268:202:8;;:::i;2343:35::-;;;;;;;;;;;;;:::i;3292:40::-;;;;;;;;;;;;;:::i;13330:735::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;13330:735:8;;;;;;;;;;;;;;;;;:::i;1243:37:56:-;;;;;;;;;;;;;:::i;11112:198:8:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11112:198:8;-1:-1:-1;;;;;11112:198:8;;:::i;9086:554::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9086:554:8;-1:-1:-1;;;;;9086:554:8;;:::i;2095:272:24:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2095:272:24;;-1:-1:-1;;;;;2095:272:24;;;;;;;;:::i;23055:114:8:-;;;;;;;;;;;;;:::i;1422:217:57:-;;;;;;;;;;;;;:::i;1154:33:56:-;;;;;;;;;;;;;:::i;219:29:57:-;;;;;;;;;;;;;:::i;3041:43:8:-;;;;;;;;;;;;;:::i;14882:112::-;;;;;;;;;;;;;:::i;2809:499:24:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2809:499:24;;;;;;;;;;;;;;;;;:::i;3304:137:56:-;;;;;;;;;;;;;:::i;3417:46:8:-;;;;;;;;;;;;;:::i;2473:::-;;;;;;;;;;;;;:::i;1595:166:24:-;;;;;;;;;;;;;:::i;2613:34:8:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2613:34:8;;:::i;9815:82::-;;;;;;;;;;;;;:::i;2387:39::-;;;;;;;;;;;;;:::i;255:23:57:-;;;;;;;;;;;;;:::i;14288:374:8:-;;;;;;;;;;;;;:::i;2754:48::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2754:48:8;-1:-1:-1;;;;;2754:48:8;;:::i;23243:154::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;23243:154:8;-1:-1:-1;;;;;23243:154:8;;:::i;:::-;;;;;;;;;;;;;;;;16773:225;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16773:225:8;-1:-1:-1;;;;;16773:225:8;;:::i;17872:782::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;17872:782:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;12580:274::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;12580:274:8;;;;:::i;1164:167:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1164:167:57;-1:-1:-1;;;;;1164:167:57;;:::i;21965:97:8:-;;;;;;;;;;;;;:::i;3655:224:56:-;726:12:57;:10;:12::i;:::-;3815:26:56::1;:56:::0;;;::::1;;-1:-1:-1::0;;;3815:56:56::1;-1:-1:-1::0;;;;3815:56:56;;::::1;::::0;;;::::1;::::0;;3655:224::o;2899:30:8:-;;;;;;:::o;22514:248::-;22586:7;22595:6;22603:4;22609;22615;22632:22;;:::i;:::-;-1:-1:-1;;;;;;;;;22657:18:8;;;;;;;;:8;:18;;;;;;;;22632:43;;-1:-1:-1;22632:43:8;;;;;;;;;-1:-1:-1;22632:43:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;22632:43:8;;;;;;;;;;;;;;;;;-1:-1:-1;22657:18:8;;-1:-1:-1;22657:18:8;;22632:43;22514:248::o;17176:113::-;1924:42;17222:4;17246:29;:8;:29;;:35;;-1:-1:-1;;;17246:35:8;;;;;17176:113::o;22836:145::-;22907:11;22938:27;22966:6;22938:35;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;22938:35:8;;;-1:-1:-1;;22836:145:8:o;16300:204::-;16435:6;16402:13;6959:23;6973:8;6959:13;:23::i;:::-;-1:-1:-1;;;;;;;16466:23:8::1;;::::0;;;:8:::1;:23;::::0;;;;-1:-1:-1;16466:30:8::1;::::0;::::1;;::::0;16300:204::o;23471:208::-;23580:7;23589;23616:55;23635:12;23649;23663:7;23616:18;:55::i;:::-;23609:62;;;;23471:208;;;;;;;
"source": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\r\npragma solidity 0.6.12;\r\nimport \"../../ConverterBase.sol\";\r\nimport \"../../../token/interfaces/ISmartToken.sol\";\r\n\r\n/**\r\n * @dev Liquid Token Converter\r\n *\r\n * The liquid token converter is a specialized version of a converter that manages a liquid token.\r\n *\r\n * The converters govern a token with a single reserve and allow converting between the two.\r\n * Liquid tokens usually have fractional reserve (reserve ratio smaller than 100%).\r\n*/\r\ncontract LiquidTokenConverter is ConverterBase {\r\n /**\r\n * @dev initializes a new LiquidTokenConverter instance\r\n *\r\n * @param _token liquid token governed by the converter\r\n * @param _registry address of a contract registry contract\r\n * @param _maxConversionFee maximum conversion fee, represented in ppm\r\n */\r\n constructor(\r\n ISmartToken _token,\r\n IContractRegistry _registry,\r\n uint32 _maxConversionFee\r\n )\r\n ConverterBase(_token, _registry, _maxConversionFee)\r\n public\r\n {\r\n }\r\n\r\n /**\r\n * @dev returns the converter type\r\n *\r\n * @return see the converter types in the the main contract doc\r\n */\r\n function converterType() public pure override returns (uint16) {\r\n return 0;\r\n }\r\n\r\n /**\r\n * @dev accepts ownership of the anchor after an ownership transfer\r\n * also activates the converter\r\n * can only be called by the contract owner\r\n * note that prior to version 28, you should use 'acceptTokenOwnership' instead\r\n */\r\n function acceptAnchorOwnership() public override ownerOnly {\r\n super.acceptAnchorOwnership();\r\n\r\n emit Activation(converterType(), anchor, true);\r\n }\r\n\r\n /**\r\n * @dev defines the reserve token for the converter\r\n * can only be called by the owner while the converter is inactive and the\r\n * reserve wasn't defined yet\r\n *\r\n * @param _token address of the reserve token\r\n * @param _weight reserve weight, represented in ppm, 1-1000000\r\n */\r\n function addReserve(IERC20Token _token, uint32 _weight) public override ownerOnly {\r\n // verify that the converter doesn't have a reserve yet\r\n require(reserveTokenCount() == 0, \"ERR_INVALID_RESERVE_COUNT\");\r\n super.addReserve(_token, _weight);\r\n }\r\n\r\n /**\r\n * @dev returns the expected target amount of converting the source token to the\r\n * target token along with the fee\r\n *\r\n * @param _sourceToken contract address of the source token\r\n * @param _targetToken contract address of the target token\r\n * @param _amount amount of tokens received from the user\r\n *\r\n * @return expected target amount\r\n * @return expected fee\r\n */\r\n function targetAmountAndFee(IERC20Token _sourceToken, IERC20Token _targetToken, uint256 _amount) public view override returns (uint256, uint256) {\r\n if (_targetToken == ISmartToken(address(anchor)) && reserves[_sourceToken].isSet)\r\n return purchaseTargetAmount(_amount);\r\n if (_sourceToken == ISmartToken(address(anchor)) && reserves[_targetToken].isSet)\r\n return saleTargetAmount(_amount);\r\n\r\n // invalid input\r\n revert(\"ERR_INVALID_TOKEN\");\r\n }\r\n\r\n /**\r\n * @dev converts between the liquid token and its reserve\r\n * can only be called by the bancor network contract\r\n *\r\n * @param _sourceToken source ERC20 token\r\n * @param _targetToken target ERC20 token\r\n * @param _amount amount of tokens to convert (in units of the source token)\r\n * @param _trader address of the caller who executed the conversion\r\n * @param _beneficiary wallet to receive the conversion result\r\n *\r\n * @return amount of tokens received (in units of the target token)\r\n */\r\n
"sourcePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/converter/types/liquid-token/LiquidTokenConverter.sol",
"ast": {
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/converter/types/liquid-token/LiquidTokenConverter.sol",
"exportedSymbols": {
"LiquidTokenConverter": [
14362
]
},
"id": 14363,
"license": "SEE LICENSE IN LICENSE",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 13712,
"literals": [
"solidity",
"0.6",
".12"
],
"nodeType": "PragmaDirective",
"src": "52:23:24"
},
{
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/converter/ConverterBase.sol",
"file": "../../ConverterBase.sol",
"id": 13713,
"nodeType": "ImportDirective",
"scope": 14363,
"sourceUnit": 10040,
"src": "77:33:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/token/interfaces/ISmartToken.sol",
"file": "../../../token/interfaces/ISmartToken.sol",
"id": 13714,
"nodeType": "ImportDirective",
"scope": 14363,
"sourceUnit": 21183,
"src": "112:51:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 13716,
"name": "ConverterBase",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 10039,
"src": "534:13:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ConverterBase_$10039",
"typeString": "contract ConverterBase"
}
},
"id": 13717,
"nodeType": "InheritanceSpecifier",
"src": "534:13:24"
}
],
"contractDependencies": [
10039,
13340,
21719,
21818,
22242,
22526,
22575,
22661,
22847,
22907
],
"contractKind": "contract",
"documentation": {
"id": 13715,
"nodeType": "StructuredDocumentation",
"src": "167:332:24",
"text": " @dev Liquid Token Converter\n The liquid token converter is a specialized version of a converter that manages a liquid token.\n The converters govern a token with a single reserve and allow converting between the two.\n Liquid tokens usually have fractional reserve (reserve ratio smaller than 100%)."
},
"fullyImplemented": true,
"id": 14362,
"linearizedBaseContracts": [
14362,
10039,
22242,
21719,
22575,
22661,
21818,
22526,
22907,
13340,
22847
],
"name": "LiquidTokenConverter",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 13732,
"nodeType": "Block",
"src": "1079:8:24",
"statements": []
},
"documentation": {
"id": 13718,
"nodeType": "StructuredDocumentation",
"src": "555:315:24",
"text": " @dev initializes a new LiquidTokenConverter instance\n @param _token liquid token governed by the converter\n @param _registry address of a contract registry contract\n @param _maxConversionFee maximum conversion fee, represented in ppm"
},
"id": 13733,
"implemented": true,
"kind": "constructor",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 13727,
"name": "_token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13720,
"src": "1020:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 13728,
"name": "_registry",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13722,
"src": "1028:9:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IContractRegistry_$22831",
"typeString": "contract IContractRegistry"
}
},
{
"argumentTypes": null,
"id": 13729,
"name": "_maxConversionFee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13724,
"src": "1039:17:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"id": 13730,
"modifierName": {
"argumentTypes": null,
"id": 13726,
"name": "ConverterBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10039,
"src": "1006:13:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ConverterBase_$10039_$",
"typeString": "type(contract ConverterBase)"
}
},
"nodeType": "ModifierInvocation",
"src": "1006:51:24"
}
],
"name": "",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 13725,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13720,
"mutability": "mutable",
"name": "_token",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13733,
"src": "898:18:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
"typeName": {
"contractScope": null,
"id": 13719,
"name": "ISmartToken",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21182,
"src": "898:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13722,
"mutability": "mutable",
"name": "_registry",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13733,
"src": "927:27:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IContractRegistry_$22831",
"typeString": "contract IContractRegistry"
},
"typeName": {
"contractScope": null,
"id": 13721,
"name": "IContractRegistry",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 22831,
"src": "927:17:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IContractRegistry_$22831",
"typeString": "contract IContractRegistry"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13724,
"mutability": "mutable",
"name": "_maxConversionFee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13733,
"src": "965:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 13723,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "965:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "887:109:24"
},
"returnParameters": {
"id": 13731,
"nodeType": "ParameterList",
"parameters": [],
"src": "1079:0:24"
},
"scope": 14362,
"src": "876:211:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9242
],
"body": {
"id": 13742,
"nodeType": "Block",
"src": "1295:27:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13740,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1313:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"functionReturnParameters": 13739,
"id": 13741,
"nodeType": "Return",
"src": "1306:8:24"
}
]
},
"documentation": {
"id": 13734,
"nodeType": "StructuredDocumentation",
"src": "1095:131:24",
"text": " @dev returns the converter type\n @return see the converter types in the the main contract doc"
},
"functionSelector": "3e8ff43f",
"id": 13743,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "converterType",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13736,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "1269:8:24"
},
"parameters": {
"id": 13735,
"nodeType": "ParameterList",
"parameters": [],
"src": "1254:2:24"
},
"returnParameters": {
"id": 13739,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13738,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13743,
"src": "1287:6:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"typeName": {
"id": 13737,
"name": "uint16",
"nodeType": "ElementaryTypeName",
"src": "1287:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1286:8:24"
},
"scope": 14362,
"src": "1232:90:24",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9405
],
"body": {
"id": 13762,
"nodeType": "Block",
"src": "1654:107:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 13750,
"name": "super",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -25,
"src": "1665:5:24",
"typeDescriptions": {
"typeIdentifier": "t_super$_LiquidTokenConverter_$14362",
"typeString": "contract super LiquidTokenConverter"
}
},
"id": 13752,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "acceptAnchorOwnership",
"nodeType": "MemberAccess",
"referencedDeclaration": 9405,
"src": "1665:27:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 13753,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1665:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13754,
"nodeType": "ExpressionStatement",
"src": "1665:29:24"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 13756,
"name": "converterType",
"nodeType": "Identifier",
"overloadedDeclarations": [
13743
],
"referencedDeclaration": 13743,
"src": "1723:13:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$__$returns$_t_uint16_$",
"typeString": "function () pure returns (uint16)"
}
},
"id": 13757,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1723:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
{
"argumentTypes": null,
"id": 13758,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "1740:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
},
{
"argumentTypes": null,
"hexValue": "74727565",
"id": 13759,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1748:4:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
},
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 13755,
"name": "Activation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9063,
"src": "1712:10:24",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_uint16_$_t_contract$_IConverterAnchor_$13349_$_t_bool_$returns$__$",
"typeString": "function (uint16,contract IConverterAnchor,bool)"
}
},
"id": 13760,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1712:41:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13761,
"nodeType": "EmitStatement",
"src": "1707:46:24"
}
]
},
"documentation": {
"id": 13744,
"nodeType": "StructuredDocumentation",
"src": "1330:259:24",
"text": " @dev accepts ownership of the anchor after an ownership transfer\n also activates the converter\n can only be called by the contract owner\n note that prior to version 28, you should use 'acceptTokenOwnership' instead"
},
"functionSelector": "cdc91c69",
"id": 13763,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 13748,
"modifierName": {
"argumentTypes": null,
"id": 13747,
"name": "ownerOnly",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21754,
"src": "1644:9:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "1644:9:24"
}
],
"name": "acceptAnchorOwnership",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13746,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "1635:8:24"
},
"parameters": {
"id": 13745,
"nodeType": "ParameterList",
"parameters": [],
"src": "1625:2:24"
},
"returnParameters": {
"id": 13749,
"nodeType": "ParameterList",
"parameters": [],
"src": "1654:0:24"
},
"scope": 14362,
"src": "1595:166:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9664
],
"body": {
"id": 13789,
"nodeType": "Block",
"src": "2177:190:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"id": 13778,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 13775,
"name": "reserveTokenCount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9561,
"src": "2261:17:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_uint16_$",
"typeString": "function () view returns (uint16)"
}
},
"id": 13776,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2261:19:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13777,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2284:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "2261:24:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f524553455256455f434f554e54",
"id": 13779,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2287:27:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ed94f14d8dcbb423a259b4072978fc0c494c6af1fea066a19023afb1a76ac87f",
"typeString": "literal_string \"ERR_INVALID_RESERVE_COUNT\""
},
"value": "ERR_INVALID_RESERVE_COUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ed94f14d8dcbb423a259b4072978fc0c494c6af1fea066a19023afb1a76ac87f",
"typeString": "literal_string \"ERR_INVALID_RESERVE_COUNT\""
}
],
"id": 13774,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "2253:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 13780,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2253:62:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13781,
"nodeType": "ExpressionStatement",
"src": "2253:62:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13785,
"name": "_token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13766,
"src": "2343:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"id": 13786,
"name": "_weight",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13768,
"src": "2351:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"id": 13782,
"name": "super",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -25,
"src": "2326:5:24",
"typeDescriptions": {
"typeIdentifier": "t_super$_LiquidTokenConverter_$14362",
"typeString": "contract super LiquidTokenConverter"
}
},
"id": 13784,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "addReserve",
"nodeType": "MemberAccess",
"referencedDeclaration": 9664,
"src": "2326:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_uint32_$returns$__$",
"typeString": "function (contract IERC20Token,uint32)"
}
},
"id": 13787,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2326:33:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13788,
"nodeType": "ExpressionStatement",
"src": "2326:33:24"
}
]
},
"documentation": {
"id": 13764,
"nodeType": "StructuredDocumentation",
"src": "1769:320:24",
"text": " @dev defines the reserve token for the converter\n can only be called by the owner while the converter is inactive and the\n reserve wasn't defined yet\n @param _token address of the reserve token\n @param _weight reserve weight, represented in ppm, 1-1000000"
},
"functionSelector": "6a49d2c4",
"id": 13790,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 13772,
"modifierName": {
"argumentTypes": null,
"id": 13771,
"name": "ownerOnly",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21754,
"src": "2167:9:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "2167:9:24"
}
],
"name": "addReserve",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13770,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "2158:8:24"
},
"parameters": {
"id": 13769,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13766,
"mutability": "mutable",
"name": "_token",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13790,
"src": "2115:18:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13765,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "2115:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13768,
"mutability": "mutable",
"name": "_weight",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13790,
"src": "2135:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 13767,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "2135:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2114:36:24"
},
"returnParameters": {
"id": 13773,
"nodeType": "ParameterList",
"parameters": [],
"src": "2177:0:24"
},
"scope": 14362,
"src": "2095:272:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9256
],
"body": {
"id": 13845,
"nodeType": "Block",
"src": "2954:354:24",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13817,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13812,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13805,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13795,
"src": "2969:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13809,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "3005:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13808,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2997:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13807,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2997:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13810,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2997:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13806,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "2985:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13811,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2985:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "2969:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13813,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "3017:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13815,
"indexExpression": {
"argumentTypes": null,
"id": 13814,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13793,
"src": "3026:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "3017:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13816,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "3017:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "2969:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 13822,
"nodeType": "IfStatement",
"src": "2965:131:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13819,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13797,
"src": "3088:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13818,
"name": "purchaseTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14047,
"src": "3067:20:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 13820,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3067:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 13804,
"id": 13821,
"nodeType": "Return",
"src": "3060:36:24"
}
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13835,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13830,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13823,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13793,
"src": "3111:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13827,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "3147:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13826,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "3139:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13825,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3139:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13828,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3139:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13824,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "3127:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13829,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3127:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "3111:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13831,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "3159:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13833,
"indexExpression": {
"argumentTypes": null,
"id": 13832,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13795,
"src": "3168:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "3159:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13834,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "3159:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "3111:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 13840,
"nodeType": "IfStatement",
"src": "3107:127:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13837,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13797,
"src": "3226:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13836,
"name": "saleTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14118,
"src": "3209:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 13838,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3209:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 13804,
"id": 13839,
"nodeType": "Return",
"src": "3202:32:24"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f544f4b454e",
"id": 13842,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3280:19:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
},
"value": "ERR_INVALID_TOKEN"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
}
],
"id": 13841,
"name": "revert",
"nodeType": "Identifier",
"overloadedDeclarations": [
-19,
-19
],
"referencedDeclaration": -19,
"src": "3273:6:24",
"typeDescriptions": {
"typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) pure"
}
},
"id": 13843,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3273:27:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13844,
"nodeType": "ExpressionStatement",
"src": "3273:27:24"
}
]
},
"documentation": {
"id": 13791,
"nodeType": "StructuredDocumentation",
"src": "2375:428:24",
"text": " @dev returns the expected target amount of converting the source token to the\n target token along with the fee\n @param _sourceToken contract address of the source token\n @param _targetToken contract address of the target token\n @param _amount amount of tokens received from the user\n @return expected target amount\n @return expected fee"
},
"functionSelector": "af94b8d8",
"id": 13846,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "targetAmountAndFee",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13799,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "2918:8:24"
},
"parameters": {
"id": 13798,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13793,
"mutability": "mutable",
"name": "_sourceToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2837:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13792,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "2837:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13795,
"mutability": "mutable",
"name": "_targetToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2863:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13794,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "2863:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13797,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2889:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13796,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2889:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2836:69:24"
},
"returnParameters": {
"id": 13804,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13801,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2936:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13800,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2936:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13803,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2945:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13802,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2945:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2935:18:24"
},
"scope": 14362,
"src": "2809:499:24",
"stateMutability": "view",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9789
],
"body": {
"id": 13968,
"nodeType": "Block",
"src": "4083:986:24",
"statements": [
{
"assignments": [
13864
],
"declarations": [
{
"constant": false,
"id": 13864,
"mutability": "mutable",
"name": "targetAmount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4094:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13863,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4094:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13865,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "4094:20:24"
},
{
"assignments": [
13867
],
"declarations": [
{
"constant": false,
"id": 13867,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4125:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13866,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "4125:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13868,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "4125:24:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13881,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13876,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13869,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13851,
"src": "4166:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13873,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4202:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13872,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4194:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13871,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4194:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13874,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4194:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13870,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4182:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13875,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4182:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "4166:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13877,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "4214:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13879,
"indexExpression": {
"argumentTypes": null,
"id": 13878,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13849,
"src": "4223:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "4214:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13880,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "4214:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "4166:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13907,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13902,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13895,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13849,
"src": "4382:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13899,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4418:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13898,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4410:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13897,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4410:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13900,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4410:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13896,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4398:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13901,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4398:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "4382:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13903,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "4430:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13905,
"indexExpression": {
"argumentTypes": null,
"id": 13904,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13851,
"src": "4439:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "4430:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13906,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "4430:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "4382:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 13925,
"nodeType": "Block",
"src": "4595:84:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f544f4b454e",
"id": 13922,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4647:19:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
},
"value": "ERR_INVALID_TOKEN"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
}
],
"id": 13921,
"name": "revert",
"nodeType": "Identifier",
"overloadedDeclarations": [
-19,
-19
],
"referencedDeclaration": -19,
"src": "4640:6:24",
"typeDescriptions": {
"typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) pure"
}
},
"id": 13923,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4640:27:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13924,
"nodeType": "ExpressionStatement",
"src": "4640:27:24"
}
]
},
"id": 13926,
"nodeType": "IfStatement",
"src": "4378:301:24",
"trueBody": {
"id": 13920,
"nodeType": "Block",
"src": "4460:120:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 13910,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13908,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4475:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 13909,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13851,
"src": "4490:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "4475:27:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"id": 13911,
"nodeType": "ExpressionStatement",
"src": "4475:27:24"
},
{
"expression": {
"argumentTypes": null,
"id": 13918,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13912,
"name": "targetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13864,
"src": "4517:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13914,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13853,
"src": "4537:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 13915,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13855,
"src": "4546:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 13916,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13857,
"src": "4555:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 13913,
"name": "sell",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14361,
"src": "4532:4:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_payable_$returns$_t_uint256_$",
"typeString": "function (uint256,address,address payable) returns (uint256)"
}
},
"id": 13917,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4532:36:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4517:51:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13919,
"nodeType": "ExpressionStatement",
"src": "4517:51:24"
}
]
}
},
"id": 13927,
"nodeType": "IfStatement",
"src": "4162:517:24",
"trueBody": {
"id": 13894,
"nodeType": "Block",
"src": "4244:119:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 13884,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13882,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4259:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 13883,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13849,
"src": "4274:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "4259:27:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"id": 13885,
"nodeType": "ExpressionStatement",
"src": "4259:27:24"
},
{
"expression": {
"argumentTypes": null,
"id": 13892,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13886,
"name": "targetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13864,
"src": "4301:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13888,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13853,
"src": "4320:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 13889,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13855,
"src": "4329:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 13890,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13857,
"src": "4338:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 13887,
"name": "buy",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14218,
"src": "4316:3:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_$returns$_t_uint256_$",
"typeString": "function (uint256,address,address) returns (uint256)"
}
},
"id": 13891,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4316:35:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4301:50:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13893,
"nodeType": "ExpressionStatement",
"src": "4301:50:24"
}
]
}
},
{
"assignments": [
13929
],
"declarations": [
{
"constant": false,
"id": 13929,
"mutability": "mutable",
"name": "totalSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4745:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13928,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4745:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13938,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13933,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4787:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13932,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4779:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13931,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4779:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13934,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4779:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13930,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4767:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13935,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4767:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 13936,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "4767:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 13937,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4767:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "4745:64:24"
},
{
"assignments": [
13940
],
"declarations": [
{
"constant": false,
"id": 13940,
"mutability": "mutable",
"name": "reserveWeight",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4820:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 13939,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "4820:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13945,
"initialValue": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13941,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "4843:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13943,
"indexExpression": {
"argumentTypes": null,
"id": 13942,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4852:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "4843:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13944,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "4843:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "4820:52:24"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13950,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4924:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13949,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4916:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13948,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4916:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13951,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4916:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13947,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4904:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13952,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4904:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 13953,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4934:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13958,
"name": "PPM_RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9007,
"src": "4981:14:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13955,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4963:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 13954,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "4948:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 13956,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4948:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13957,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 22327,
"src": "4948:32:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 13959,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4948:48:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13962,
"name": "reserveWeight",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13940,
"src": "5014:13:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"id": 13960,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13929,
"src": "4998:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13961,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 22327,
"src": "4998:15:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 13963,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4998:30:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13946,
"name": "TokenRateUpdate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9089,
"src": "4888:15:24",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,contract IERC20Token,uint256,uint256)"
}
},
"id": 13964,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4888:141:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13965,
"nodeType": "EmitStatement",
"src": "4883:146:24"
},
{
"expression": {
"argumentTypes": null,
"id": 13966,
"name": "targetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13864,
"src": "5049:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 13862,
"id": 13967,
"nodeType": "Return",
"src": "5042:19:24"
}
]
},
"documentation": {
"id": 13847,
"nodeType": "StructuredDocumentation",
"src": "3316:558:24",
"text": " @dev converts between the liquid token and its reserve\n can only be called by the bancor network contract\n @param _sourceToken source ERC20 token\n @param _targetToken target ERC20 token\n @param _amount amount of tokens to convert (in units of the source token)\n @param _trader address of the caller who executed the conversion\n @param _beneficiary wallet to receive the conversion result\n @return amount of tokens received (in units of the target token)"
},
"id": 13969,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "doConvert",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13859,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "4042:8:24"
},
"parameters": {
"id": 13858,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13849,
"mutability": "mutable",
"name": "_sourceToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3899:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13848,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "3899:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13851,
"mutability": "mutable",
"name": "_targetToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3925:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13850,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "3925:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13853,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3951:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13852,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3951:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13855,
"mutability": "mutable",
"name": "_trader",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3968:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 13854,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3968:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13857,
"mutability": "mutable",
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3985:28:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 13856,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3985:15:24",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3898:116:24"
},
"returnParameters": {
"id": 13862,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13861,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "4069:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13860,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4069:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4068:9:24"
},
"scope": 14362,
"src": "3880:1189:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14046,
"nodeType": "Block",
"src": "5555:772:24",
"statements": [
{
"assignments": [
13982
],
"declarations": [
{
"constant": false,
"id": 13982,
"mutability": "mutable",
"name": "totalSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "5566:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13981,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5566:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13991,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13986,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "5608:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13985,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "5600:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13984,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "5600:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13987,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5600:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13983,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "5588:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13988,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5588:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 13989,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "5588:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 13990,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5588:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5566:64:24"
},
{
"assignments": [
13993
],
"declarations": [
{
"constant": false,
"id": 13993,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "5641:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13992,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "5641:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13997,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13994,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "5668:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 13996,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13995,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5682:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5668:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5641:43:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14000,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13998,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13982,
"src": "5814:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13999,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5829:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "5814:16:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 14014,
"nodeType": "IfStatement",
"src": "5810:109:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14006,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "5885:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14008,
"indexExpression": {
"argumentTypes": null,
"id": 14007,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13993,
"src": "5894:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5885:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14009,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "5885:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14003,
"name": "PPM_RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9007,
"src": "5865:14:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"id": 14001,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13972,
"src": "5853:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14002,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 22327,
"src": "5853:11:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14004,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5853:27:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14005,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "div",
"nodeType": "MemberAccess",
"referencedDeclaration": 22353,
"src": "5853:31:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14010,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5853:62:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "30",
"id": 14011,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5917:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 14012,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5852:67:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_rational_0_by_1_$",
"typeString": "tuple(uint256,int_const 0)"
}
},
"functionReturnParameters": 13980,
"id": 14013,
"nodeType": "Return",
"src": "5845:74:24"
}
},
{
"assignments": [
14016
],
"declarations": [
{
"constant": false,
"id": 14016,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "5932:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14015,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5932:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14033,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14023,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13982,
"src": "6026:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14025,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13993,
"src": "6067:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14024,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "6052:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14026,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6052:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14027,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "6095:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14029,
"indexExpression": {
"argumentTypes": null,
"id": 14028,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13993,
"src": "6104:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6095:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14030,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "6095:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
{
"argumentTypes": null,
"id": 14031,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13972,
"src": "6139:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14019,
"name": "BANCOR_FORMULA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21533,
"src": "5974:14:24",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 14018,
"name": "addressOf",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21718,
"src": "5964:9:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$",
"typeString": "function (bytes32) view returns (address)"
}
},
"id": 14020,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5964:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14017,
"name": "IBancorFormula",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13177,
"src": "5949:14:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IBancorFormula_$13177_$",
"typeString": "type(contract IBancorFormula)"
}
},
"id": 14021,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5949:41:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IBancorFormula_$13177",
"typeString": "contract IBancorFormula"
}
},
"id": 14022,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "purchaseTargetAmount",
"nodeType": "MemberAccess",
"referencedDeclaration": 13092,
"src": "5949:62:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_uint256_$_t_uint256_$_t_uint32_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint32,uint256) view external returns (uint256)"
}
},
"id": 14032,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5949:208:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5932:225:24"
},
{
"assignments": [
14035
],
"declarations": [
{
"constant": false,
"id": 14035,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "6248:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14034,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6248:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14039,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14037,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14016,
"src": "6275:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14036,
"name": "calculateFee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9806,
"src": "6262:12:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256)"
}
},
"id": 14038,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6262:20:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "6248:34:24"
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14042,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14040,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14016,
"src": "6301:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 14041,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14035,
"src": "6310:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6301:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14043,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14035,
"src": "6315:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 14044,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "6300:19:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 13980,
"id": 14045,
"nodeType": "Return",
"src": "6293:26:24"
}
]
},
"documentation": {
"id": 13970,
"nodeType": "StructuredDocumentation",
"src": "5077:336:24",
"text": " @dev returns the expected target amount of buying with a given amount of tokens\n @param _amount amount of reserve tokens to get the target amount for\n @return amount of liquid tokens that the user will receive\n @return amount of liquid tokens that the user will pay as fee"
},
"id": 14047,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 13975,
"modifierName": {
"argumentTypes": null,
"id": 13974,
"name": "active",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9134,
"src": "5507:6:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "5507:6:24"
}
],
"name": "purchaseTargetAmount",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 13973,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13972,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14047,
"src": "5449:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13971,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5449:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5448:17:24"
},
"returnParameters": {
"id": 13980,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13977,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14047,
"src": "5532:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13976,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5532:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13979,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14047,
"src": "5541:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13978,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5541:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5531:18:24"
},
"scope": 14362,
"src": "5419:908:24",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14117,
"nodeType": "Block",
"src": "6736:702:24",
"statements": [
{
"assignments": [
14060
],
"declarations": [
{
"constant": false,
"id": 14060,
"mutability": "mutable",
"name": "totalSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "6747:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14059,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6747:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14069,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14064,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "6789:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14063,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "6781:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14062,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6781:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14065,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6781:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14061,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "6769:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14066,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6769:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14067,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "6769:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 14068,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6769:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "6747:64:24"
},
{
"assignments": [
14071
],
"declarations": [
{
"constant": false,
"id": 14071,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "6824:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 14070,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "6824:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14075,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14072,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "6851:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 14074,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14073,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6865:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6851:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "6824:43:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14078,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14076,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14060,
"src": "6957:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14077,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14050,
"src": "6972:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6957:22:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 14085,
"nodeType": "IfStatement",
"src": "6953:81:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14080,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14071,
"src": "7017:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14079,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "7002:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14081,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7002:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "30",
"id": 14082,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7032:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 14083,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "7001:33:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_rational_0_by_1_$",
"typeString": "tuple(uint256,int_const 0)"
}
},
"functionReturnParameters": 14058,
"id": 14084,
"nodeType": "Return",
"src": "6994:40:24"
}
},
{
"assignments": [
14087
],
"declarations": [
{
"constant": false,
"id": 14087,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "7047:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14086,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7047:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14104,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14094,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14060,
"src": "7137:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14096,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14071,
"src": "7178:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14095,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "7163:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14097,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7163:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14098,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "7206:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14100,
"indexExpression": {
"argumentTypes": null,
"id": 14099,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14071,
"src": "7215:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7206:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14101,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "7206:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
{
"argumentTypes": null,
"id": 14102,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14050,
"src": "7250:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14090,
"name": "BANCOR_FORMULA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21533,
"src": "7089:14:24",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 14089,
"name": "addressOf",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21718,
"src": "7079:9:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$",
"typeString": "function (bytes32) view returns (address)"
}
},
"id": 14091,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7079:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14088,
"name": "IBancorFormula",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13177,
"src": "7064:14:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IBancorFormula_$13177_$",
"typeString": "type(contract IBancorFormula)"
}
},
"id": 14092,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7064:41:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IBancorFormula_$13177",
"typeString": "contract IBancorFormula"
}
},
"id": 14093,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "saleTargetAmount",
"nodeType": "MemberAccess",
"referencedDeclaration": 13105,
"src": "7064:58:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_uint256_$_t_uint256_$_t_uint32_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint32,uint256) view external returns (uint256)"
}
},
"id": 14103,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7064:204:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "7047:221:24"
},
{
"assignments": [
14106
],
"declarations": [
{
"constant": false,
"id": 14106,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "7359:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14105,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7359:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14110,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14108,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14087,
"src": "7386:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14107,
"name": "calculateFee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9806,
"src": "7373:12:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256)"
}
},
"id": 14109,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7373:20:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "7359:34:24"
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14113,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14111,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14087,
"src": "7412:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 14112,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14106,
"src": "7421:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "7412:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14114,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14106,
"src": "7426:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 14115,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "7411:19:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 14058,
"id": 14116,
"nodeType": "Return",
"src": "7404:26:24"
}
]
},
"documentation": {
"id": 14048,
"nodeType": "StructuredDocumentation",
"src": "6335:263:24",
"text": " @dev returns the expected target amount of selling a given amount of tokens\n @param _amount amount of liquid tokens to get the target amount for\n @return expected reserve tokens\n @return expected fee"
},
"id": 14118,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 14053,
"modifierName": {
"argumentTypes": null,
"id": 14052,
"name": "active",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9134,
"src": "6688:6:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "6688:6:24"
}
],
"name": "saleTargetAmount",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 14051,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14050,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14118,
"src": "6630:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14049,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6630:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "6629:17:24"
},
"returnParameters": {
"id": 14058,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14055,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14118,
"src": "6713:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14054,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6713:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14057,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14118,
"src": "6722:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14056,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6722:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "6712:18:24"
},
"scope": 14362,
"src": "6604:834:24",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14217,
"nodeType": "Block",
"src": "7914:1040:24",
"statements": [
{
"assignments": [
14131,
14133
],
"declarations": [
{
"constant": false,
"id": 14131,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14217,
"src": "7973:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14130,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7973:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14133,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14217,
"src": "7989:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14132,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7989:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14137,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14135,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8025:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14134,
"name": "purchaseTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14047,
"src": "8004:20:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 14136,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8004:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "7972:61:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14141,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14139,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8109:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14140,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8119:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "8109:11:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f5a45524f5f5441524745545f414d4f554e54",
"id": 14142,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8122:24:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
},
"value": "ERR_ZERO_TARGET_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
}
],
"id": 14138,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "8101:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14143,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8101:46:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14144,
"nodeType": "ExpressionStatement",
"src": "8101:46:24"
},
{
"assignments": [
14146
],
"declarations": [
{
"constant": false,
"id": 14146,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14217,
"src": "8160:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 14145,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "8160:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14150,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14147,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "8187:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 14149,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14148,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8201:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8187:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "8160:43:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 14153,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14151,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8283:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14152,
"name": "ETH_RESERVE_ADDRESS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9012,
"src": "8299:19:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "8283:35:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 14181,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14166,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 14163,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "8426:3:24",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 14164,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "value",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "8426:9:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14165,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8439:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "8426:14:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14180,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14176,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8501:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14175,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "8486:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14177,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8486:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14171,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "8475:4:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
],
"id": 14170,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8467:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14169,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8467:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14172,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8467:13:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"expression": {
"argumentTypes": null,
"id": 14167,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8444:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"id": 14168,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 21088,
"src": "8444:22:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 14173,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8444:37:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14174,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 22293,
"src": "8444:41:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14178,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8444:71:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 14179,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8519:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "8444:82:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "8426:100:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f414d4f554e54",
"id": 14182,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8528:20:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
},
"value": "ERR_INVALID_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
}
],
"id": 14162,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "8418:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14183,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8418:131:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14184,
"nodeType": "ExpressionStatement",
"src": "8418:131:24"
},
"id": 14185,
"nodeType": "IfStatement",
"src": "8279:270:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14158,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 14155,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "8341:3:24",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 14156,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "value",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "8341:9:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14157,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8354:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "8341:20:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4554485f414d4f554e545f4d49534d41544348",
"id": 14159,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8363:25:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_b27c160ac497b67c4fef6b5554e0b1a41f3c9b44e4bd8482662df760b76c093b",
"typeString": "literal_string \"ERR_ETH_AMOUNT_MISMATCH\""
},
"value": "ERR_ETH_AMOUNT_MISMATCH"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_b27c160ac497b67c4fef6b5554e0b1a41f3c9b44e4bd8482662df760b76c093b",
"typeString": "literal_string \"ERR_ETH_AMOUNT_MISMATCH\""
}
],
"id": 14154,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "8333:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14160,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8333:56:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14161,
"nodeType": "ExpressionStatement",
"src": "8333:56:24"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14187,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8618:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14186,
"name": "syncReserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9844,
"src": "8599:18:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$returns$__$",
"typeString": "function (contract IERC20Token)"
}
},
"id": 14188,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8599:32:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14189,
"nodeType": "ExpressionStatement",
"src": "8599:32:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14197,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14125,
"src": "8746:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 14198,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8760:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14193,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "8731:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14192,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8723:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14191,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8723:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14194,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8723:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14190,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "8711:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14195,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8711:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14196,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "issue",
"nodeType": "MemberAccess",
"referencedDeclaration": 21174,
"src": "8711:34:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,uint256) external"
}
},
"id": 14199,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8711:56:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14200,
"nodeType": "ExpressionStatement",
"src": "8711:56:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14202,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8846:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14206,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "8880:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14205,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8872:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14204,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8872:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14207,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8872:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14203,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "8860:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14208,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8860:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 14209,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14123,
"src": "8890:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 14210,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8899:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14211,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8908:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14212,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14133,
"src": "8916:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14201,
"name": "dispatchConversionEvent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9908,
"src": "8822:23:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$_t_address_$_t_uint256_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,contract IERC20Token,address,uint256,uint256,uint256)"
}
},
"id": 14213,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8822:98:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14214,
"nodeType": "ExpressionStatement",
"src": "8822:98:24"
},
{
"expression": {
"argumentTypes": null,
"id": 14215,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8940:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 14129,
"id": 14216,
"nodeType": "Return",
"src": "8933:13:24"
}
]
},
"documentation": {
"id": 14119,
"nodeType": "StructuredDocumentation",
"src": "7446:366:24",
"text": " @dev buys the liquid token by depositing in its reserve\n @param _amount amount of reserve token to buy the token for\n @param _trader address of the caller who executed the conversion\n @param _beneficiary wallet to receive the conversion result\n @return amount of liquid tokens received"
},
"id": 14218,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "buy",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 14126,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14121,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7831:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14120,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7831:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14123,
"mutability": "mutable",
"name": "_trader",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7848:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 14122,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7848:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14125,
"mutability": "mutable",
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7865:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 14124,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7865:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7830:56:24"
},
"returnParameters": {
"id": 14129,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14128,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7905:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14127,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7905:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7904:9:24"
},
"scope": 14362,
"src": "7818:1136:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14360,
"nodeType": "Block",
"src": "9431:1500:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14244,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14231,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "9513:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14241,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "9571:4:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
],
"id": 14240,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "9563:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14239,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9563:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14242,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9563:13:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14235,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "9544:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14234,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "9536:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14233,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9536:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14236,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9536:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14232,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "9524:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14237,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9524:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14238,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 21088,
"src": "9524:38:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 14243,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9524:53:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9513:64:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f414d4f554e54",
"id": 14245,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9579:20:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
},
"value": "ERR_INVALID_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
}
],
"id": 14230,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "9505:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14246,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9505:95:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14247,
"nodeType": "ExpressionStatement",
"src": "9505:95:24"
},
{
"assignments": [
14249,
14251
],
"declarations": [
{
"constant": false,
"id": 14249,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "9661:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14248,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9661:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14251,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "9677:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14250,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9677:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14255,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14253,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "9709:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14252,
"name": "saleTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14118,
"src": "9692:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 14254,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9692:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "9660:57:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14259,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14257,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "9793:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14258,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9803:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "9793:11:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f5a45524f5f5441524745545f414d4f554e54",
"id": 14260,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9806:24:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
},
"value": "ERR_ZERO_TARGET_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
}
],
"id": 14256,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "9785:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14261,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9785:46:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14262,
"nodeType": "ExpressionStatement",
"src": "9785:46:24"
},
{
"assignments": [
14264
],
"declarations": [
{
"constant": false,
"id": 14264,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "9844:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 14263,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "9844:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14268,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14265,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "9871:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 14267,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14266,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9885:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "9871:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "9844:43:24"
},
{
"assignments": [
14270
],
"declarations": [
{
"constant": false,
"id": 14270,
"mutability": "mutable",
"name": "tokenSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "10012:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14269,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "10012:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14279,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14274,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "10054:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14273,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10046:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14272,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10046:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14275,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10046:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14271,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "10034:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14276,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10034:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14277,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "10034:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 14278,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10034:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "10012:64:24"
},
{
"assignments": [
14281
],
"declarations": [
{
"constant": false,
"id": 14281,
"mutability": "mutable",
"name": "rsvBalance",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "10087:18:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14280,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "10087:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14285,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14283,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10123:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14282,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "10108:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14284,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10108:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "10087:49:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 14298,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14289,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14287,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10154:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 14288,
"name": "rsvBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14281,
"src": "10163:10:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10154:19:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "||",
"rightExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 14296,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14292,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14290,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10178:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14291,
"name": "rsvBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14281,
"src": "10188:10:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10178:20:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14295,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14293,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "10202:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14294,
"name": "tokenSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14270,
"src": "10213:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10202:22:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "10178:46:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"id": 14297,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "10177:48:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "10154:71:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 14286,
"name": "assert",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -3,
"src": "10147:6:24",
"typeDescriptions": {
"typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 14299,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10147:79:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14300,
"nodeType": "ExpressionStatement",
"src": "10147:79:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14310,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "10362:4:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
],
"id": 14309,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10354:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14308,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10354:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14311,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10354:13:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 14312,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "10369:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14304,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "10337:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14303,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10329:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14302,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10329:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14305,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10329:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14301,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "10317:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14306,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10317:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14307,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "destroy",
"nodeType": "MemberAccess",
"referencedDeclaration": 21181,
"src": "10317:36:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,uint256) external"
}
},
"id": 14313,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10317:60:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14314,
"nodeType": "ExpressionStatement",
"src": "10317:60:24"
},
{
"expression": {
"argumentTypes": null,
"id": 14326,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14315,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "10429:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14317,
"indexExpression": {
"argumentTypes": null,
"id": 14316,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10438:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10429:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14318,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "balance",
"nodeType": "MemberAccess",
"referencedDeclaration": 9014,
"src": "10429:30:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14324,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10497:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14319,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "10462:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14321,
"indexExpression": {
"argumentTypes": null,
"id": 14320,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10471:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10462:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14322,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"referencedDeclaration": 9014,
"src": "10462:30:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14323,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 22293,
"src": "10462:34:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14325,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10462:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10429:75:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14327,
"nodeType": "ExpressionStatement",
"src": "10429:75:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 14330,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14328,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10588:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14329,
"name": "ETH_RESERVE_ADDRESS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9012,
"src": "10604:19:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "10588:35:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14338,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10709:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"id": 14339,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14225,
"src": "10723:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 14340,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10737:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14337,
"name": "safeTransfer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22475,
"src": "10696:12:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,address,uint256)"
}
},
"id": 14341,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10696:48:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14342,
"nodeType": "ExpressionStatement",
"src": "10696:48:24"
},
"id": 14343,
"nodeType": "IfStatement",
"src": "10584:160:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14334,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10660:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 14331,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14225,
"src": "10638:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"id": 14333,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transfer",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "10638:21:24",
"typeDescriptions": {
"typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256)"
}
},
"id": 14335,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10638:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14336,
"nodeType": "ExpressionStatement",
"src": "10638:29:24"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14348,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "10843:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14347,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10835:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14346,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10835:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14349,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10835:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14345,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "10823:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14350,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10823:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 14351,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10853:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"id": 14352,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14223,
"src": "10867:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 14353,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "10876:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14354,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10885:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14355,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14251,
"src": "10893:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14344,
"name": "dispatchConversionEvent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9908,
"src": "10799:23:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$_t_address_$_t_uint256_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,contract IERC20Token,address,uint256,uint256,uint256)"
}
},
"id": 14356,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10799:98:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14357,
"nodeType": "ExpressionStatement",
"src": "10799:98:24"
},
{
"expression": {
"argumentTypes": null,
"id": 14358,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10917:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 14229,
"id": 14359,
"nodeType": "Return",
"src": "10910:13:24"
}
]
},
"documentation": {
"id": 14219,
"nodeType": "StructuredDocumentation",
"src": "8962:358:24",
"text": " @dev sells the liquid token by withdrawing from its reserve\n @param _amount amount of liquid tokens to sell\n @param _trader address of the caller who executed the conversion\n @param _beneficiary wallet to receive the conversion result\n @return amount of reserve tokens received"
},
"id": 14361,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sell",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 14226,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14221,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9340:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14220,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9340:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14223,
"mutability": "mutable",
"name": "_trader",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9357:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 14222,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9357:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14225,
"mutability": "mutable",
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9374:28:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 14224,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9374:15:24",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9339:64:24"
},
"returnParameters": {
"id": 14229,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14228,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9422:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14227,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9422:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9421:9:24"
},
"scope": 14362,
"src": "9326:1605:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
}
],
"scope": 14363,
"src": "501:10433:24"
}
],
"src": "52:10884:24"
},
"legacyAST": {
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/converter/types/liquid-token/LiquidTokenConverter.sol",
"exportedSymbols": {
"LiquidTokenConverter": [
14362
]
},
"id": 14363,
"license": "SEE LICENSE IN LICENSE",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 13712,
"literals": [
"solidity",
"0.6",
".12"
],
"nodeType": "PragmaDirective",
"src": "52:23:24"
},
{
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/converter/ConverterBase.sol",
"file": "../../ConverterBase.sol",
"id": 13713,
"nodeType": "ImportDirective",
"scope": 14363,
"sourceUnit": 10040,
"src": "77:33:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/token/interfaces/ISmartToken.sol",
"file": "../../../token/interfaces/ISmartToken.sol",
"id": 13714,
"nodeType": "ImportDirective",
"scope": 14363,
"sourceUnit": 21183,
"src": "112:51:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 13716,
"name": "ConverterBase",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 10039,
"src": "534:13:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ConverterBase_$10039",
"typeString": "contract ConverterBase"
}
},
"id": 13717,
"nodeType": "InheritanceSpecifier",
"src": "534:13:24"
}
],
"contractDependencies": [
10039,
13340,
21719,
21818,
22242,
22526,
22575,
22661,
22847,
22907
],
"contractKind": "contract",
"documentation": {
"id": 13715,
"nodeType": "StructuredDocumentation",
"src": "167:332:24",
"text": " @dev Liquid Token Converter\n The liquid token converter is a specialized version of a converter that manages a liquid token.\n The converters govern a token with a single reserve and allow converting between the two.\n Liquid tokens usually have fractional reserve (reserve ratio smaller than 100%)."
},
"fullyImplemented": true,
"id": 14362,
"linearizedBaseContracts": [
14362,
10039,
22242,
21719,
22575,
22661,
21818,
22526,
22907,
13340,
22847
],
"name": "LiquidTokenConverter",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 13732,
"nodeType": "Block",
"src": "1079:8:24",
"statements": []
},
"documentation": {
"id": 13718,
"nodeType": "StructuredDocumentation",
"src": "555:315:24",
"text": " @dev initializes a new LiquidTokenConverter instance\n @param _token liquid token governed by the converter\n @param _registry address of a contract registry contract\n @param _maxConversionFee maximum conversion fee, represented in ppm"
},
"id": 13733,
"implemented": true,
"kind": "constructor",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 13727,
"name": "_token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13720,
"src": "1020:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 13728,
"name": "_registry",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13722,
"src": "1028:9:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IContractRegistry_$22831",
"typeString": "contract IContractRegistry"
}
},
{
"argumentTypes": null,
"id": 13729,
"name": "_maxConversionFee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13724,
"src": "1039:17:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"id": 13730,
"modifierName": {
"argumentTypes": null,
"id": 13726,
"name": "ConverterBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10039,
"src": "1006:13:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ConverterBase_$10039_$",
"typeString": "type(contract ConverterBase)"
}
},
"nodeType": "ModifierInvocation",
"src": "1006:51:24"
}
],
"name": "",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 13725,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13720,
"mutability": "mutable",
"name": "_token",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13733,
"src": "898:18:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
"typeName": {
"contractScope": null,
"id": 13719,
"name": "ISmartToken",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21182,
"src": "898:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13722,
"mutability": "mutable",
"name": "_registry",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13733,
"src": "927:27:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IContractRegistry_$22831",
"typeString": "contract IContractRegistry"
},
"typeName": {
"contractScope": null,
"id": 13721,
"name": "IContractRegistry",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 22831,
"src": "927:17:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IContractRegistry_$22831",
"typeString": "contract IContractRegistry"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13724,
"mutability": "mutable",
"name": "_maxConversionFee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13733,
"src": "965:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 13723,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "965:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "887:109:24"
},
"returnParameters": {
"id": 13731,
"nodeType": "ParameterList",
"parameters": [],
"src": "1079:0:24"
},
"scope": 14362,
"src": "876:211:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9242
],
"body": {
"id": 13742,
"nodeType": "Block",
"src": "1295:27:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13740,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1313:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"functionReturnParameters": 13739,
"id": 13741,
"nodeType": "Return",
"src": "1306:8:24"
}
]
},
"documentation": {
"id": 13734,
"nodeType": "StructuredDocumentation",
"src": "1095:131:24",
"text": " @dev returns the converter type\n @return see the converter types in the the main contract doc"
},
"functionSelector": "3e8ff43f",
"id": 13743,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "converterType",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13736,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "1269:8:24"
},
"parameters": {
"id": 13735,
"nodeType": "ParameterList",
"parameters": [],
"src": "1254:2:24"
},
"returnParameters": {
"id": 13739,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13738,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13743,
"src": "1287:6:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"typeName": {
"id": 13737,
"name": "uint16",
"nodeType": "ElementaryTypeName",
"src": "1287:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1286:8:24"
},
"scope": 14362,
"src": "1232:90:24",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9405
],
"body": {
"id": 13762,
"nodeType": "Block",
"src": "1654:107:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 13750,
"name": "super",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -25,
"src": "1665:5:24",
"typeDescriptions": {
"typeIdentifier": "t_super$_LiquidTokenConverter_$14362",
"typeString": "contract super LiquidTokenConverter"
}
},
"id": 13752,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "acceptAnchorOwnership",
"nodeType": "MemberAccess",
"referencedDeclaration": 9405,
"src": "1665:27:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 13753,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1665:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13754,
"nodeType": "ExpressionStatement",
"src": "1665:29:24"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 13756,
"name": "converterType",
"nodeType": "Identifier",
"overloadedDeclarations": [
13743
],
"referencedDeclaration": 13743,
"src": "1723:13:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$__$returns$_t_uint16_$",
"typeString": "function () pure returns (uint16)"
}
},
"id": 13757,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1723:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
{
"argumentTypes": null,
"id": 13758,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "1740:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
},
{
"argumentTypes": null,
"hexValue": "74727565",
"id": 13759,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1748:4:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
},
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 13755,
"name": "Activation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9063,
"src": "1712:10:24",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_uint16_$_t_contract$_IConverterAnchor_$13349_$_t_bool_$returns$__$",
"typeString": "function (uint16,contract IConverterAnchor,bool)"
}
},
"id": 13760,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1712:41:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13761,
"nodeType": "EmitStatement",
"src": "1707:46:24"
}
]
},
"documentation": {
"id": 13744,
"nodeType": "StructuredDocumentation",
"src": "1330:259:24",
"text": " @dev accepts ownership of the anchor after an ownership transfer\n also activates the converter\n can only be called by the contract owner\n note that prior to version 28, you should use 'acceptTokenOwnership' instead"
},
"functionSelector": "cdc91c69",
"id": 13763,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 13748,
"modifierName": {
"argumentTypes": null,
"id": 13747,
"name": "ownerOnly",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21754,
"src": "1644:9:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "1644:9:24"
}
],
"name": "acceptAnchorOwnership",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13746,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "1635:8:24"
},
"parameters": {
"id": 13745,
"nodeType": "ParameterList",
"parameters": [],
"src": "1625:2:24"
},
"returnParameters": {
"id": 13749,
"nodeType": "ParameterList",
"parameters": [],
"src": "1654:0:24"
},
"scope": 14362,
"src": "1595:166:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9664
],
"body": {
"id": 13789,
"nodeType": "Block",
"src": "2177:190:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"id": 13778,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 13775,
"name": "reserveTokenCount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9561,
"src": "2261:17:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_uint16_$",
"typeString": "function () view returns (uint16)"
}
},
"id": 13776,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2261:19:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13777,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2284:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "2261:24:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f524553455256455f434f554e54",
"id": 13779,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2287:27:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ed94f14d8dcbb423a259b4072978fc0c494c6af1fea066a19023afb1a76ac87f",
"typeString": "literal_string \"ERR_INVALID_RESERVE_COUNT\""
},
"value": "ERR_INVALID_RESERVE_COUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ed94f14d8dcbb423a259b4072978fc0c494c6af1fea066a19023afb1a76ac87f",
"typeString": "literal_string \"ERR_INVALID_RESERVE_COUNT\""
}
],
"id": 13774,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "2253:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 13780,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2253:62:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13781,
"nodeType": "ExpressionStatement",
"src": "2253:62:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13785,
"name": "_token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13766,
"src": "2343:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"id": 13786,
"name": "_weight",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13768,
"src": "2351:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"id": 13782,
"name": "super",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -25,
"src": "2326:5:24",
"typeDescriptions": {
"typeIdentifier": "t_super$_LiquidTokenConverter_$14362",
"typeString": "contract super LiquidTokenConverter"
}
},
"id": 13784,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "addReserve",
"nodeType": "MemberAccess",
"referencedDeclaration": 9664,
"src": "2326:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_uint32_$returns$__$",
"typeString": "function (contract IERC20Token,uint32)"
}
},
"id": 13787,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2326:33:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13788,
"nodeType": "ExpressionStatement",
"src": "2326:33:24"
}
]
},
"documentation": {
"id": 13764,
"nodeType": "StructuredDocumentation",
"src": "1769:320:24",
"text": " @dev defines the reserve token for the converter\n can only be called by the owner while the converter is inactive and the\n reserve wasn't defined yet\n @param _token address of the reserve token\n @param _weight reserve weight, represented in ppm, 1-1000000"
},
"functionSelector": "6a49d2c4",
"id": 13790,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 13772,
"modifierName": {
"argumentTypes": null,
"id": 13771,
"name": "ownerOnly",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21754,
"src": "2167:9:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "2167:9:24"
}
],
"name": "addReserve",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13770,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "2158:8:24"
},
"parameters": {
"id": 13769,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13766,
"mutability": "mutable",
"name": "_token",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13790,
"src": "2115:18:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13765,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "2115:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13768,
"mutability": "mutable",
"name": "_weight",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13790,
"src": "2135:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 13767,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "2135:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2114:36:24"
},
"returnParameters": {
"id": 13773,
"nodeType": "ParameterList",
"parameters": [],
"src": "2177:0:24"
},
"scope": 14362,
"src": "2095:272:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9256
],
"body": {
"id": 13845,
"nodeType": "Block",
"src": "2954:354:24",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13817,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13812,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13805,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13795,
"src": "2969:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13809,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "3005:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13808,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2997:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13807,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2997:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13810,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2997:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13806,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "2985:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13811,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2985:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "2969:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13813,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "3017:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13815,
"indexExpression": {
"argumentTypes": null,
"id": 13814,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13793,
"src": "3026:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "3017:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13816,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "3017:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "2969:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 13822,
"nodeType": "IfStatement",
"src": "2965:131:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13819,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13797,
"src": "3088:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13818,
"name": "purchaseTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14047,
"src": "3067:20:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 13820,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3067:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 13804,
"id": 13821,
"nodeType": "Return",
"src": "3060:36:24"
}
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13835,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13830,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13823,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13793,
"src": "3111:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13827,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "3147:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13826,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "3139:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13825,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3139:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13828,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3139:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13824,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "3127:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13829,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3127:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "3111:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13831,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "3159:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13833,
"indexExpression": {
"argumentTypes": null,
"id": 13832,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13795,
"src": "3168:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "3159:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13834,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "3159:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "3111:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 13840,
"nodeType": "IfStatement",
"src": "3107:127:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13837,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13797,
"src": "3226:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13836,
"name": "saleTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14118,
"src": "3209:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 13838,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3209:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 13804,
"id": 13839,
"nodeType": "Return",
"src": "3202:32:24"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f544f4b454e",
"id": 13842,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3280:19:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
},
"value": "ERR_INVALID_TOKEN"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
}
],
"id": 13841,
"name": "revert",
"nodeType": "Identifier",
"overloadedDeclarations": [
-19,
-19
],
"referencedDeclaration": -19,
"src": "3273:6:24",
"typeDescriptions": {
"typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) pure"
}
},
"id": 13843,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3273:27:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13844,
"nodeType": "ExpressionStatement",
"src": "3273:27:24"
}
]
},
"documentation": {
"id": 13791,
"nodeType": "StructuredDocumentation",
"src": "2375:428:24",
"text": " @dev returns the expected target amount of converting the source token to the\n target token along with the fee\n @param _sourceToken contract address of the source token\n @param _targetToken contract address of the target token\n @param _amount amount of tokens received from the user\n @return expected target amount\n @return expected fee"
},
"functionSelector": "af94b8d8",
"id": 13846,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "targetAmountAndFee",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13799,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "2918:8:24"
},
"parameters": {
"id": 13798,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13793,
"mutability": "mutable",
"name": "_sourceToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2837:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13792,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "2837:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13795,
"mutability": "mutable",
"name": "_targetToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2863:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13794,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "2863:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13797,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2889:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13796,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2889:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2836:69:24"
},
"returnParameters": {
"id": 13804,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13801,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2936:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13800,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2936:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13803,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13846,
"src": "2945:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13802,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2945:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2935:18:24"
},
"scope": 14362,
"src": "2809:499:24",
"stateMutability": "view",
"virtual": false,
"visibility": "public"
},
{
"baseFunctions": [
9789
],
"body": {
"id": 13968,
"nodeType": "Block",
"src": "4083:986:24",
"statements": [
{
"assignments": [
13864
],
"declarations": [
{
"constant": false,
"id": 13864,
"mutability": "mutable",
"name": "targetAmount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4094:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13863,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4094:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13865,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "4094:20:24"
},
{
"assignments": [
13867
],
"declarations": [
{
"constant": false,
"id": 13867,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4125:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13866,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "4125:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13868,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "4125:24:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13881,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13876,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13869,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13851,
"src": "4166:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13873,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4202:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13872,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4194:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13871,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4194:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13874,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4194:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13870,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4182:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13875,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4182:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "4166:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13877,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "4214:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13879,
"indexExpression": {
"argumentTypes": null,
"id": 13878,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13849,
"src": "4223:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "4214:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13880,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "4214:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "4166:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 13907,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 13902,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13895,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13849,
"src": "4382:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13899,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4418:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13898,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4410:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13897,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4410:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13900,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4410:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13896,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4398:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13901,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4398:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"src": "4382:44:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13903,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "4430:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13905,
"indexExpression": {
"argumentTypes": null,
"id": 13904,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13851,
"src": "4439:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "4430:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13906,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "isSet",
"nodeType": "MemberAccess",
"referencedDeclaration": 9022,
"src": "4430:28:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "4382:76:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 13925,
"nodeType": "Block",
"src": "4595:84:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f544f4b454e",
"id": 13922,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4647:19:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
},
"value": "ERR_INVALID_TOKEN"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_ebb7677ef55bf004ceacedca2d0ee2121b64fc0fddbb89e9252a1965146107fb",
"typeString": "literal_string \"ERR_INVALID_TOKEN\""
}
],
"id": 13921,
"name": "revert",
"nodeType": "Identifier",
"overloadedDeclarations": [
-19,
-19
],
"referencedDeclaration": -19,
"src": "4640:6:24",
"typeDescriptions": {
"typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) pure"
}
},
"id": 13923,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4640:27:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13924,
"nodeType": "ExpressionStatement",
"src": "4640:27:24"
}
]
},
"id": 13926,
"nodeType": "IfStatement",
"src": "4378:301:24",
"trueBody": {
"id": 13920,
"nodeType": "Block",
"src": "4460:120:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 13910,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13908,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4475:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 13909,
"name": "_targetToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13851,
"src": "4490:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "4475:27:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"id": 13911,
"nodeType": "ExpressionStatement",
"src": "4475:27:24"
},
{
"expression": {
"argumentTypes": null,
"id": 13918,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13912,
"name": "targetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13864,
"src": "4517:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13914,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13853,
"src": "4537:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 13915,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13855,
"src": "4546:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 13916,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13857,
"src": "4555:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 13913,
"name": "sell",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14361,
"src": "4532:4:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_payable_$returns$_t_uint256_$",
"typeString": "function (uint256,address,address payable) returns (uint256)"
}
},
"id": 13917,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4532:36:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4517:51:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13919,
"nodeType": "ExpressionStatement",
"src": "4517:51:24"
}
]
}
},
"id": 13927,
"nodeType": "IfStatement",
"src": "4162:517:24",
"trueBody": {
"id": 13894,
"nodeType": "Block",
"src": "4244:119:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 13884,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13882,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4259:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 13883,
"name": "_sourceToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13849,
"src": "4274:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "4259:27:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"id": 13885,
"nodeType": "ExpressionStatement",
"src": "4259:27:24"
},
{
"expression": {
"argumentTypes": null,
"id": 13892,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 13886,
"name": "targetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13864,
"src": "4301:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13888,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13853,
"src": "4320:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 13889,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13855,
"src": "4329:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 13890,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13857,
"src": "4338:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 13887,
"name": "buy",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14218,
"src": "4316:3:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_$returns$_t_uint256_$",
"typeString": "function (uint256,address,address) returns (uint256)"
}
},
"id": 13891,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4316:35:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4301:50:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13893,
"nodeType": "ExpressionStatement",
"src": "4301:50:24"
}
]
}
},
{
"assignments": [
13929
],
"declarations": [
{
"constant": false,
"id": 13929,
"mutability": "mutable",
"name": "totalSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4745:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13928,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4745:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13938,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13933,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4787:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13932,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4779:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13931,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4779:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13934,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4779:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13930,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4767:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13935,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4767:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 13936,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "4767:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 13937,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4767:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "4745:64:24"
},
{
"assignments": [
13940
],
"declarations": [
{
"constant": false,
"id": 13940,
"mutability": "mutable",
"name": "reserveWeight",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13968,
"src": "4820:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
"typeName": {
"id": 13939,
"name": "uint32",
"nodeType": "ElementaryTypeName",
"src": "4820:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13945,
"initialValue": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13941,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "4843:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 13943,
"indexExpression": {
"argumentTypes": null,
"id": 13942,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4852:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "4843:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 13944,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "4843:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "4820:52:24"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13950,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "4924:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13949,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4916:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13948,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4916:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13951,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4916:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13947,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "4904:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13952,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4904:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 13953,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4934:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13958,
"name": "PPM_RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9007,
"src": "4981:14:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13955,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13867,
"src": "4963:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 13954,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "4948:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 13956,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4948:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13957,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 22327,
"src": "4948:32:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 13959,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4948:48:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13962,
"name": "reserveWeight",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13940,
"src": "5014:13:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"id": 13960,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13929,
"src": "4998:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13961,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 22327,
"src": "4998:15:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 13963,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4998:30:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13946,
"name": "TokenRateUpdate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9089,
"src": "4888:15:24",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,contract IERC20Token,uint256,uint256)"
}
},
"id": 13964,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4888:141:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 13965,
"nodeType": "EmitStatement",
"src": "4883:146:24"
},
{
"expression": {
"argumentTypes": null,
"id": 13966,
"name": "targetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13864,
"src": "5049:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 13862,
"id": 13967,
"nodeType": "Return",
"src": "5042:19:24"
}
]
},
"documentation": {
"id": 13847,
"nodeType": "StructuredDocumentation",
"src": "3316:558:24",
"text": " @dev converts between the liquid token and its reserve\n can only be called by the bancor network contract\n @param _sourceToken source ERC20 token\n @param _targetToken target ERC20 token\n @param _amount amount of tokens to convert (in units of the source token)\n @param _trader address of the caller who executed the conversion\n @param _beneficiary wallet to receive the conversion result\n @return amount of tokens received (in units of the target token)"
},
"id": 13969,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "doConvert",
"nodeType": "FunctionDefinition",
"overrides": {
"id": 13859,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "4042:8:24"
},
"parameters": {
"id": 13858,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13849,
"mutability": "mutable",
"name": "_sourceToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3899:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13848,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "3899:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13851,
"mutability": "mutable",
"name": "_targetToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3925:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13850,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "3925:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13853,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3951:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13852,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3951:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13855,
"mutability": "mutable",
"name": "_trader",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3968:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 13854,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3968:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13857,
"mutability": "mutable",
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "3985:28:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 13856,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3985:15:24",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3898:116:24"
},
"returnParameters": {
"id": 13862,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13861,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 13969,
"src": "4069:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13860,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4069:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4068:9:24"
},
"scope": 14362,
"src": "3880:1189:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14046,
"nodeType": "Block",
"src": "5555:772:24",
"statements": [
{
"assignments": [
13982
],
"declarations": [
{
"constant": false,
"id": 13982,
"mutability": "mutable",
"name": "totalSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "5566:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13981,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5566:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13991,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 13986,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "5608:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 13985,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "5600:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 13984,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "5600:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 13987,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5600:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 13983,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "5588:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 13988,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5588:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 13989,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "5588:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 13990,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5588:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5566:64:24"
},
{
"assignments": [
13993
],
"declarations": [
{
"constant": false,
"id": 13993,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "5641:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 13992,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "5641:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 13997,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 13994,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "5668:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 13996,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13995,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5682:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5668:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5641:43:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14000,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 13998,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13982,
"src": "5814:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 13999,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5829:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "5814:16:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 14014,
"nodeType": "IfStatement",
"src": "5810:109:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14006,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "5885:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14008,
"indexExpression": {
"argumentTypes": null,
"id": 14007,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13993,
"src": "5894:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5885:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14009,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "5885:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14003,
"name": "PPM_RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9007,
"src": "5865:14:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
],
"expression": {
"argumentTypes": null,
"id": 14001,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13972,
"src": "5853:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14002,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 22327,
"src": "5853:11:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14004,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5853:27:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14005,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "div",
"nodeType": "MemberAccess",
"referencedDeclaration": 22353,
"src": "5853:31:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14010,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5853:62:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "30",
"id": 14011,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5917:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 14012,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5852:67:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_rational_0_by_1_$",
"typeString": "tuple(uint256,int_const 0)"
}
},
"functionReturnParameters": 13980,
"id": 14013,
"nodeType": "Return",
"src": "5845:74:24"
}
},
{
"assignments": [
14016
],
"declarations": [
{
"constant": false,
"id": 14016,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "5932:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14015,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5932:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14033,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14023,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13982,
"src": "6026:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14025,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13993,
"src": "6067:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14024,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "6052:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14026,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6052:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14027,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "6095:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14029,
"indexExpression": {
"argumentTypes": null,
"id": 14028,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13993,
"src": "6104:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6095:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14030,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "6095:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
{
"argumentTypes": null,
"id": 14031,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13972,
"src": "6139:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14019,
"name": "BANCOR_FORMULA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21533,
"src": "5974:14:24",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 14018,
"name": "addressOf",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21718,
"src": "5964:9:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$",
"typeString": "function (bytes32) view returns (address)"
}
},
"id": 14020,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5964:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14017,
"name": "IBancorFormula",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13177,
"src": "5949:14:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IBancorFormula_$13177_$",
"typeString": "type(contract IBancorFormula)"
}
},
"id": 14021,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5949:41:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IBancorFormula_$13177",
"typeString": "contract IBancorFormula"
}
},
"id": 14022,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "purchaseTargetAmount",
"nodeType": "MemberAccess",
"referencedDeclaration": 13092,
"src": "5949:62:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_uint256_$_t_uint256_$_t_uint32_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint32,uint256) view external returns (uint256)"
}
},
"id": 14032,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5949:208:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5932:225:24"
},
{
"assignments": [
14035
],
"declarations": [
{
"constant": false,
"id": 14035,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14046,
"src": "6248:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14034,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6248:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14039,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14037,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14016,
"src": "6275:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14036,
"name": "calculateFee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9806,
"src": "6262:12:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256)"
}
},
"id": 14038,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6262:20:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "6248:34:24"
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14042,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14040,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14016,
"src": "6301:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 14041,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14035,
"src": "6310:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6301:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14043,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14035,
"src": "6315:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 14044,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "6300:19:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 13980,
"id": 14045,
"nodeType": "Return",
"src": "6293:26:24"
}
]
},
"documentation": {
"id": 13970,
"nodeType": "StructuredDocumentation",
"src": "5077:336:24",
"text": " @dev returns the expected target amount of buying with a given amount of tokens\n @param _amount amount of reserve tokens to get the target amount for\n @return amount of liquid tokens that the user will receive\n @return amount of liquid tokens that the user will pay as fee"
},
"id": 14047,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 13975,
"modifierName": {
"argumentTypes": null,
"id": 13974,
"name": "active",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9134,
"src": "5507:6:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "5507:6:24"
}
],
"name": "purchaseTargetAmount",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 13973,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13972,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14047,
"src": "5449:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13971,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5449:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5448:17:24"
},
"returnParameters": {
"id": 13980,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13977,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14047,
"src": "5532:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13976,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5532:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 13979,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14047,
"src": "5541:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13978,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5541:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5531:18:24"
},
"scope": 14362,
"src": "5419:908:24",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14117,
"nodeType": "Block",
"src": "6736:702:24",
"statements": [
{
"assignments": [
14060
],
"declarations": [
{
"constant": false,
"id": 14060,
"mutability": "mutable",
"name": "totalSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "6747:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14059,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6747:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14069,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14064,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "6789:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14063,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "6781:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14062,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6781:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14065,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6781:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14061,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "6769:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14066,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6769:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14067,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "6769:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 14068,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6769:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "6747:64:24"
},
{
"assignments": [
14071
],
"declarations": [
{
"constant": false,
"id": 14071,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "6824:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 14070,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "6824:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14075,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14072,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "6851:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 14074,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14073,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6865:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6851:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "6824:43:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14078,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14076,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14060,
"src": "6957:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14077,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14050,
"src": "6972:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6957:22:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 14085,
"nodeType": "IfStatement",
"src": "6953:81:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14080,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14071,
"src": "7017:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14079,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "7002:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14081,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7002:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "30",
"id": 14082,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7032:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 14083,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "7001:33:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_rational_0_by_1_$",
"typeString": "tuple(uint256,int_const 0)"
}
},
"functionReturnParameters": 14058,
"id": 14084,
"nodeType": "Return",
"src": "6994:40:24"
}
},
{
"assignments": [
14087
],
"declarations": [
{
"constant": false,
"id": 14087,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "7047:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14086,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7047:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14104,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14094,
"name": "totalSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14060,
"src": "7137:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14096,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14071,
"src": "7178:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14095,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "7163:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14097,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7163:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14098,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "7206:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14100,
"indexExpression": {
"argumentTypes": null,
"id": 14099,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14071,
"src": "7215:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7206:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14101,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "weight",
"nodeType": "MemberAccess",
"referencedDeclaration": 9016,
"src": "7206:29:24",
"typeDescriptions": {
"typeIdentifier": "t_uint32",
"typeString": "uint32"
}
},
{
"argumentTypes": null,
"id": 14102,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14050,
"src": "7250:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint32",
"typeString": "uint32"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14090,
"name": "BANCOR_FORMULA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21533,
"src": "7089:14:24",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 14089,
"name": "addressOf",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21718,
"src": "7079:9:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$",
"typeString": "function (bytes32) view returns (address)"
}
},
"id": 14091,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7079:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14088,
"name": "IBancorFormula",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13177,
"src": "7064:14:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IBancorFormula_$13177_$",
"typeString": "type(contract IBancorFormula)"
}
},
"id": 14092,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7064:41:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IBancorFormula_$13177",
"typeString": "contract IBancorFormula"
}
},
"id": 14093,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "saleTargetAmount",
"nodeType": "MemberAccess",
"referencedDeclaration": 13105,
"src": "7064:58:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_uint256_$_t_uint256_$_t_uint32_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint32,uint256) view external returns (uint256)"
}
},
"id": 14103,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7064:204:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "7047:221:24"
},
{
"assignments": [
14106
],
"declarations": [
{
"constant": false,
"id": 14106,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14117,
"src": "7359:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14105,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7359:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14110,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14108,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14087,
"src": "7386:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14107,
"name": "calculateFee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9806,
"src": "7373:12:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256)"
}
},
"id": 14109,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7373:20:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "7359:34:24"
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14113,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14111,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14087,
"src": "7412:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 14112,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14106,
"src": "7421:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "7412:12:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14114,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14106,
"src": "7426:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 14115,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "7411:19:24",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"functionReturnParameters": 14058,
"id": 14116,
"nodeType": "Return",
"src": "7404:26:24"
}
]
},
"documentation": {
"id": 14048,
"nodeType": "StructuredDocumentation",
"src": "6335:263:24",
"text": " @dev returns the expected target amount of selling a given amount of tokens\n @param _amount amount of liquid tokens to get the target amount for\n @return expected reserve tokens\n @return expected fee"
},
"id": 14118,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 14053,
"modifierName": {
"argumentTypes": null,
"id": 14052,
"name": "active",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9134,
"src": "6688:6:24",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "6688:6:24"
}
],
"name": "saleTargetAmount",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 14051,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14050,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14118,
"src": "6630:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14049,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6630:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "6629:17:24"
},
"returnParameters": {
"id": 14058,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14055,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14118,
"src": "6713:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14054,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6713:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14057,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14118,
"src": "6722:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14056,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6722:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "6712:18:24"
},
"scope": 14362,
"src": "6604:834:24",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14217,
"nodeType": "Block",
"src": "7914:1040:24",
"statements": [
{
"assignments": [
14131,
14133
],
"declarations": [
{
"constant": false,
"id": 14131,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14217,
"src": "7973:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14130,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7973:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14133,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14217,
"src": "7989:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14132,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7989:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14137,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14135,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8025:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14134,
"name": "purchaseTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14047,
"src": "8004:20:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 14136,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8004:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "7972:61:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14141,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14139,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8109:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14140,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8119:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "8109:11:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f5a45524f5f5441524745545f414d4f554e54",
"id": 14142,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8122:24:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
},
"value": "ERR_ZERO_TARGET_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
}
],
"id": 14138,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "8101:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14143,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8101:46:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14144,
"nodeType": "ExpressionStatement",
"src": "8101:46:24"
},
{
"assignments": [
14146
],
"declarations": [
{
"constant": false,
"id": 14146,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14217,
"src": "8160:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 14145,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "8160:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14150,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14147,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "8187:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 14149,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14148,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8201:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8187:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "8160:43:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 14153,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14151,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8283:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14152,
"name": "ETH_RESERVE_ADDRESS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9012,
"src": "8299:19:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "8283:35:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 14181,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14166,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 14163,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "8426:3:24",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 14164,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "value",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "8426:9:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14165,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8439:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "8426:14:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14180,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14176,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8501:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14175,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "8486:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14177,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8486:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14171,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "8475:4:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
],
"id": 14170,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8467:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14169,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8467:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14172,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8467:13:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"expression": {
"argumentTypes": null,
"id": 14167,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8444:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"id": 14168,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 21088,
"src": "8444:22:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 14173,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8444:37:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14174,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 22293,
"src": "8444:41:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14178,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8444:71:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 14179,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8519:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "8444:82:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "8426:100:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f414d4f554e54",
"id": 14182,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8528:20:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
},
"value": "ERR_INVALID_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
}
],
"id": 14162,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "8418:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14183,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8418:131:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14184,
"nodeType": "ExpressionStatement",
"src": "8418:131:24"
},
"id": 14185,
"nodeType": "IfStatement",
"src": "8279:270:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14158,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 14155,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "8341:3:24",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 14156,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "value",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "8341:9:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14157,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8354:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "8341:20:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4554485f414d4f554e545f4d49534d41544348",
"id": 14159,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8363:25:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_b27c160ac497b67c4fef6b5554e0b1a41f3c9b44e4bd8482662df760b76c093b",
"typeString": "literal_string \"ERR_ETH_AMOUNT_MISMATCH\""
},
"value": "ERR_ETH_AMOUNT_MISMATCH"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_b27c160ac497b67c4fef6b5554e0b1a41f3c9b44e4bd8482662df760b76c093b",
"typeString": "literal_string \"ERR_ETH_AMOUNT_MISMATCH\""
}
],
"id": 14154,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "8333:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14160,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8333:56:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14161,
"nodeType": "ExpressionStatement",
"src": "8333:56:24"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14187,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8618:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14186,
"name": "syncReserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9844,
"src": "8599:18:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$returns$__$",
"typeString": "function (contract IERC20Token)"
}
},
"id": 14188,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8599:32:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14189,
"nodeType": "ExpressionStatement",
"src": "8599:32:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14197,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14125,
"src": "8746:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 14198,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8760:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14193,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "8731:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14192,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8723:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14191,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8723:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14194,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8723:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14190,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "8711:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14195,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8711:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14196,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "issue",
"nodeType": "MemberAccess",
"referencedDeclaration": 21174,
"src": "8711:34:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,uint256) external"
}
},
"id": 14199,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8711:56:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14200,
"nodeType": "ExpressionStatement",
"src": "8711:56:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14202,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14146,
"src": "8846:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14206,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "8880:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14205,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8872:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14204,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8872:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14207,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8872:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14203,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "8860:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14208,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8860:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 14209,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14123,
"src": "8890:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 14210,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14121,
"src": "8899:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14211,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8908:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14212,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14133,
"src": "8916:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14201,
"name": "dispatchConversionEvent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9908,
"src": "8822:23:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$_t_address_$_t_uint256_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,contract IERC20Token,address,uint256,uint256,uint256)"
}
},
"id": 14213,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8822:98:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14214,
"nodeType": "ExpressionStatement",
"src": "8822:98:24"
},
{
"expression": {
"argumentTypes": null,
"id": 14215,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14131,
"src": "8940:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 14129,
"id": 14216,
"nodeType": "Return",
"src": "8933:13:24"
}
]
},
"documentation": {
"id": 14119,
"nodeType": "StructuredDocumentation",
"src": "7446:366:24",
"text": " @dev buys the liquid token by depositing in its reserve\n @param _amount amount of reserve token to buy the token for\n @param _trader address of the caller who executed the conversion\n @param _beneficiary wallet to receive the conversion result\n @return amount of liquid tokens received"
},
"id": 14218,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "buy",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 14126,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14121,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7831:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14120,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7831:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14123,
"mutability": "mutable",
"name": "_trader",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7848:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 14122,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7848:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14125,
"mutability": "mutable",
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7865:20:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 14124,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7865:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7830:56:24"
},
"returnParameters": {
"id": 14129,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14128,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14218,
"src": "7905:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14127,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7905:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7904:9:24"
},
"scope": 14362,
"src": "7818:1136:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 14360,
"nodeType": "Block",
"src": "9431:1500:24",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14244,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14231,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "9513:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14241,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "9571:4:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
],
"id": 14240,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "9563:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14239,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9563:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14242,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9563:13:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14235,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "9544:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14234,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "9536:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14233,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9536:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14236,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9536:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14232,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "9524:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14237,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9524:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14238,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 21088,
"src": "9524:38:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 14243,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9524:53:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9513:64:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f494e56414c49445f414d4f554e54",
"id": 14245,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9579:20:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
},
"value": "ERR_INVALID_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c44007bfe4e704be0ed1393660a827b4f88825f4b6fe1bc10cd38fc3fcb7d839",
"typeString": "literal_string \"ERR_INVALID_AMOUNT\""
}
],
"id": 14230,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "9505:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14246,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9505:95:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14247,
"nodeType": "ExpressionStatement",
"src": "9505:95:24"
},
{
"assignments": [
14249,
14251
],
"declarations": [
{
"constant": false,
"id": 14249,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "9661:14:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14248,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9661:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14251,
"mutability": "mutable",
"name": "fee",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "9677:11:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14250,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9677:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14255,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14253,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "9709:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14252,
"name": "saleTargetAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14118,
"src": "9692:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256,uint256)"
}
},
"id": 14254,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9692:25:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$",
"typeString": "tuple(uint256,uint256)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "9660:57:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14259,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14257,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "9793:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14258,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9803:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "9793:11:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f5a45524f5f5441524745545f414d4f554e54",
"id": 14260,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9806:24:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
},
"value": "ERR_ZERO_TARGET_AMOUNT"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_29cb0846c2d5a859f661a5b4c4a8be47a80ca27c24af6f007bda101871b53e03",
"typeString": "literal_string \"ERR_ZERO_TARGET_AMOUNT\""
}
],
"id": 14256,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "9785:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 14261,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9785:46:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14262,
"nodeType": "ExpressionStatement",
"src": "9785:46:24"
},
{
"assignments": [
14264
],
"declarations": [
{
"constant": false,
"id": 14264,
"mutability": "mutable",
"name": "reserveToken",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "9844:24:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"typeName": {
"contractScope": null,
"id": 14263,
"name": "IERC20Token",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 21127,
"src": "9844:11:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14268,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14265,
"name": "reserveTokens",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9036,
"src": "9871:13:24",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_contract$_IERC20Token_$21127_$dyn_storage",
"typeString": "contract IERC20Token[] storage ref"
}
},
"id": 14267,
"indexExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 14266,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "9885:1:24",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "9871:16:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "9844:43:24"
},
{
"assignments": [
14270
],
"declarations": [
{
"constant": false,
"id": 14270,
"mutability": "mutable",
"name": "tokenSupply",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "10012:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14269,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "10012:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14279,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14274,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "10054:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14273,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10046:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14272,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10046:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14275,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10046:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14271,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "10034:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14276,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10034:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14277,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalSupply",
"nodeType": "MemberAccess",
"referencedDeclaration": 21081,
"src": "10034:40:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 14278,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10034:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "10012:64:24"
},
{
"assignments": [
14281
],
"declarations": [
{
"constant": false,
"id": 14281,
"mutability": "mutable",
"name": "rsvBalance",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14360,
"src": "10087:18:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14280,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "10087:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 14285,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14283,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10123:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
],
"id": 14282,
"name": "reserveBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9699,
"src": "10108:14:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$",
"typeString": "function (contract IERC20Token) view returns (uint256)"
}
},
"id": 14284,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10108:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "10087:49:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 14298,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14289,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14287,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10154:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 14288,
"name": "rsvBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14281,
"src": "10163:10:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10154:19:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "||",
"rightExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 14296,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14292,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14290,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10178:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14291,
"name": "rsvBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14281,
"src": "10188:10:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10178:20:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 14295,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14293,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "10202:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14294,
"name": "tokenSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14270,
"src": "10213:11:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10202:22:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "10178:46:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"id": 14297,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "10177:48:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "10154:71:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 14286,
"name": "assert",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -3,
"src": "10147:6:24",
"typeDescriptions": {
"typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 14299,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10147:79:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14300,
"nodeType": "ExpressionStatement",
"src": "10147:79:24"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14310,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "10362:4:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_LiquidTokenConverter_$14362",
"typeString": "contract LiquidTokenConverter"
}
],
"id": 14309,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10354:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14308,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10354:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14311,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10354:13:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 14312,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "10369:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14304,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "10337:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14303,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10329:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14302,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10329:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14305,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10329:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14301,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "10317:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14306,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10317:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
"id": 14307,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "destroy",
"nodeType": "MemberAccess",
"referencedDeclaration": 21181,
"src": "10317:36:24",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,uint256) external"
}
},
"id": 14313,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10317:60:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14314,
"nodeType": "ExpressionStatement",
"src": "10317:60:24"
},
{
"expression": {
"argumentTypes": null,
"id": 14326,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14315,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "10429:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14317,
"indexExpression": {
"argumentTypes": null,
"id": 14316,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10438:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10429:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14318,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "balance",
"nodeType": "MemberAccess",
"referencedDeclaration": 9014,
"src": "10429:30:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14324,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10497:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 14319,
"name": "reserves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9040,
"src": "10462:8:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_struct$_Reserve_$9023_storage_$",
"typeString": "mapping(contract IERC20Token => struct ConverterBase.Reserve storage ref)"
}
},
"id": 14321,
"indexExpression": {
"argumentTypes": null,
"id": 14320,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10471:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10462:22:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Reserve_$9023_storage",
"typeString": "struct ConverterBase.Reserve storage ref"
}
},
"id": 14322,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"referencedDeclaration": 9014,
"src": "10462:30:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14323,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 22293,
"src": "10462:34:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 14325,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10462:42:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10429:75:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 14327,
"nodeType": "ExpressionStatement",
"src": "10429:75:24"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
"id": 14330,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 14328,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10588:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 14329,
"name": "ETH_RESERVE_ADDRESS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9012,
"src": "10604:19:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
"src": "10588:35:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14338,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10709:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"id": 14339,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14225,
"src": "10723:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 14340,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10737:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14337,
"name": "safeTransfer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22475,
"src": "10696:12:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,address,uint256)"
}
},
"id": 14341,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10696:48:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14342,
"nodeType": "ExpressionStatement",
"src": "10696:48:24"
},
"id": 14343,
"nodeType": "IfStatement",
"src": "10584:160:24",
"trueBody": {
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14334,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10660:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 14331,
"name": "_beneficiary",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14225,
"src": "10638:12:24",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"id": 14333,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transfer",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "10638:21:24",
"typeDescriptions": {
"typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256)"
}
},
"id": 14335,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10638:29:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14336,
"nodeType": "ExpressionStatement",
"src": "10638:29:24"
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 14348,
"name": "anchor",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9030,
"src": "10843:6:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_IConverterAnchor_$13349",
"typeString": "contract IConverterAnchor"
}
],
"id": 14347,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "10835:7:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 14346,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "10835:7:24",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 14349,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10835:15:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 14345,
"name": "ISmartToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21182,
"src": "10823:11:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ISmartToken_$21182_$",
"typeString": "type(contract ISmartToken)"
}
},
"id": 14350,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10823:28:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
}
},
{
"argumentTypes": null,
"id": 14351,
"name": "reserveToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14264,
"src": "10853:12:24",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
}
},
{
"argumentTypes": null,
"id": 14352,
"name": "_trader",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14223,
"src": "10867:7:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 14353,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14221,
"src": "10876:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14354,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10885:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 14355,
"name": "fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14251,
"src": "10893:3:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ISmartToken_$21182",
"typeString": "contract ISmartToken"
},
{
"typeIdentifier": "t_contract$_IERC20Token_$21127",
"typeString": "contract IERC20Token"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 14344,
"name": "dispatchConversionEvent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9908,
"src": "10799:23:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$_t_address_$_t_uint256_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (contract IERC20Token,contract IERC20Token,address,uint256,uint256,uint256)"
}
},
"id": 14356,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10799:98:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14357,
"nodeType": "ExpressionStatement",
"src": "10799:98:24"
},
{
"expression": {
"argumentTypes": null,
"id": 14358,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 14249,
"src": "10917:6:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 14229,
"id": 14359,
"nodeType": "Return",
"src": "10910:13:24"
}
]
},
"documentation": {
"id": 14219,
"nodeType": "StructuredDocumentation",
"src": "8962:358:24",
"text": " @dev sells the liquid token by withdrawing from its reserve\n @param _amount amount of liquid tokens to sell\n @param _trader address of the caller who executed the conversion\n @param _beneficiary wallet to receive the conversion result\n @return amount of reserve tokens received"
},
"id": 14361,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sell",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 14226,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14221,
"mutability": "mutable",
"name": "_amount",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9340:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14220,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9340:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14223,
"mutability": "mutable",
"name": "_trader",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9357:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 14222,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9357:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 14225,
"mutability": "mutable",
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9374:28:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 14224,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9374:15:24",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9339:64:24"
},
"returnParameters": {
"id": 14229,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14228,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 14361,
"src": "9422:7:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 14227,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9422:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9421:9:24"
},
"scope": 14362,
"src": "9326:1605:24",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
}
],
"scope": 14363,
"src": "501:10433:24"
}
],
"src": "52:10884:24"
},
"compiler": {
"name": "solc",
"version": "0.6.12+commit.27d51765.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.2.3",
"updatedAt": "2020-11-10T14:20:44.681Z",
"networkType": "ethereum",
"devdoc": {
"details": "Liquid Token Converter The liquid token converter is a specialized version of a converter that manages a liquid token. The converters govern a token with a single reserve and allow converting between the two. Liquid tokens usually have fractional reserve (reserve ratio smaller than 100%).",
"kind": "dev",
"methods": {
"acceptAnchorOwnership()": {
"details": "accepts ownership of the anchor after an ownership transfer also activates the converter can only be called by the contract owner note that prior to version 28, you should use 'acceptTokenOwnership' instead"
},
"acceptOwnership()": {
"details": "used by a new owner to accept an ownership transfer"
},
"acceptTokenOwnership()": {
"details": "deprecated, backward compatibility"
},
"addReserve(address,uint32)": {
"details": "defines the reserve token for the converter can only be called by the owner while the converter is inactive and the reserve wasn't defined yet",
"params": {
"_token": "address of the reserve token",
"_weight": "reserve weight, represented in ppm, 1-1000000"
}
},
"connectorTokenCount()": {
"details": "deprecated, backward compatibility"
},
"connectorTokens(uint256)": {
"details": "deprecated, backward compatibility"
},
"connectors(address)": {
"details": "deprecated, backward compatibility"
},
"constructor": {
"details": "initializes a new LiquidTokenConverter instance",
"params": {
"_maxConversionFee": "maximum conversion fee, represented in ppm",
"_registry": "address of a contract registry contract",
"_token": "liquid token governed by the converter"
}
},
"convert(address,address,uint256,address,address)": {
"details": "converts a specific amount of source tokens to target tokens can only be called by the bancor network contract",
"params": {
"_amount": "amount of tokens to convert (in units of the source token)",
"_beneficiary": "wallet to receive the conversion result",
"_sourceToken": "source ERC20 token",
"_targetToken": "target ERC20 token",
"_trader": "address of the caller who executed the conversion"
},
"returns": {
"_0": "amount of tokens received (in units of the target token)"
}
},
"converterType()": {
"details": "returns the converter type",
"returns": {
"_0": "see the converter types in the the main contract doc"
}
},
"getConnectorBalance(address)": {
"details": "deprecated, backward compatibility"
},
"getReturn(address,address,uint256)": {
"details": "deprecated, backward compatibility"
},
"hasETHReserve()": {
"details": "checks whether or not the converter has an ETH reserve",
"returns": {
"_0": "true if the converter has an ETH reserve, false otherwise"
}
},
"isActive()": {
"details": "returns true if the converter is active, false otherwise",
"returns": {
"_0": "true if the converter is active, false otherwise"
}
},
"isV28OrHigher()": {
"details": "checks whether or not the converter version is 28 or higher",
"returns": {
"_0": "true, since the converter version is 28 or higher"
}
},
"reserveBalance(address)": {
"details": "returns the reserve's balance note that prior to version 17, you should use 'getConnectorBalance' instead",
"params": {
"_reserveToken": "reserve token contract address"
},
"returns": {
"_0": "reserve balance"
}
},
"reserveTokenCount()": {
"details": "returns the number of reserve tokens defined note that prior to version 17, you should use 'connectorTokenCount' instead",
"returns": {
"_0": "number of reserve tokens"
}
},
"reserveWeight(address)": {
"details": "returns the reserve's weight added in version 28",
"params": {
"_reserveToken": "reserve token contract address"
},
"returns": {
"_0": "reserve weight"
}
},
"restoreRegistry()": {
"details": "restores the previous contract-registry"
},
"restrictRegistryUpdate(bool)": {
"details": "restricts the permission to update the contract-registry",
"params": {
"_onlyOwnerCanUpdateRegistry": "indicates whether or not permission is restricted to owner only"
}
},
"setConversionFee(uint32)": {
"details": "updates the current conversion fee can only be called by the contract owner",
"params": {
"_conversionFee": "new conversion fee, represented in ppm"
}
},
"setConversionWhitelist(address)": {
"details": "allows the owner to update & enable the conversion whitelist contract address when set, only addresses that are whitelisted are actually allowed to use the converter note that the whitelist check is actually done by the BancorNetwork contract",
"params": {
"_whitelist": "address of a whitelist contract"
}
},
"targetAmountAndFee(address,address,uint256)": {
"details": "returns the expected target amount of converting the source token to the target token along with the fee",
"params": {
"_amount": "amount of tokens received from the user",
"_sourceToken": "contract address of the source token",
"_targetToken": "contract address of the target token"
},
"returns": {
"_0": "expected target amount",
"_1": "expected fee"
}
},
"token()": {
"details": "deprecated since version 28, backward compatibility - use only for earlier versions"
},
"transferAnchorOwnership(address)": {
"details": "transfers the anchor ownership the new owner needs to accept the transfer can only be called by the converter upgrder while the upgrader is the owner note that prior to version 28, you should use 'transferAnchorOwnership' instead",
"params": {
"_newOwner": "new token owner"
}
},
"transferOwnership(address)": {
"details": "allows transferring the contract ownership the new owner still needs to accept the transfer can only be called by the contract owner",
"params": {
"_newOwner": "new contract owner"
}
},
"transferTokenOwnership(address)": {
"details": "deprecated, backward compatibility"
},
"updateRegistry()": {
"details": "updates to the new contract-registry"
},
"upgrade()": {
"details": "upgrades the converter to the latest version can only be called by the owner note that the owner needs to call acceptOwnership on the new converter after the upgrade"
},
"withdrawETH(address)": {
"details": "withdraws ether can only be called by the owner if the converter is inactive or by upgrader contract can only be called after the upgrader contract has accepted the ownership of this contract can only be called if the converter has an ETH reserve",
"params": {
"_to": "address to send the ETH to"
}
},
"withdrawFromAnchor(address,address,uint256)": {
"details": "withdraws tokens held by the anchor and sends them to an account can only be called by the owner",
"params": {
"_amount": "amount to withdraw",
"_to": "account to receive the new amount",
"_token": "ERC20 token contract address"
}
},
"withdrawTokens(address,address,uint256)": {
"details": "withdraws tokens held by the converter and sends them to an account can only be called by the owner note that reserve tokens can only be withdrawn by the owner while the converter is inactive unless the owner is the converter upgrader contract",
"params": {
"_amount": "amount to withdraw",
"_to": "account to receive the new amount",
"_token": "ERC20 token contract address"
}
}
},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}