ocean-subgraph/abis/FixedRateExchange.json
Alex Coseru 7784de4a97
add FixedRateExchange (#53)
* add FixedRateExchange

* fix lint

* remove duplicate code.

* fix style

* remove newline.

Co-authored-by: ssallam <36411297+ssallam@users.noreply.github.com>
2021-03-10 23:36:51 +02:00

15678 lines
725 KiB
JSON

{
"contractName": "FixedRateExchange",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "exchangeId",
"type": "bytes32"
},
{
"indexed": true,
"name": "baseToken",
"type": "address"
},
{
"indexed": true,
"name": "dataToken",
"type": "address"
},
{
"indexed": false,
"name": "exchangeOwner",
"type": "address"
},
{
"indexed": false,
"name": "fixedRate",
"type": "uint256"
}
],
"name": "ExchangeCreated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "exchangeId",
"type": "bytes32"
},
{
"indexed": true,
"name": "exchangeOwner",
"type": "address"
},
{
"indexed": false,
"name": "newRate",
"type": "uint256"
}
],
"name": "ExchangeRateChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "exchangeId",
"type": "bytes32"
},
{
"indexed": true,
"name": "exchangeOwner",
"type": "address"
}
],
"name": "ExchangeActivated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "exchangeId",
"type": "bytes32"
},
{
"indexed": true,
"name": "exchangeOwner",
"type": "address"
}
],
"name": "ExchangeDeactivated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "exchangeId",
"type": "bytes32"
},
{
"indexed": true,
"name": "by",
"type": "address"
},
{
"indexed": false,
"name": "baseTokenSwappedAmount",
"type": "uint256"
},
{
"indexed": false,
"name": "dataTokenSwappedAmount",
"type": "uint256"
}
],
"name": "Swapped",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"name": "baseToken",
"type": "address"
},
{
"name": "dataToken",
"type": "address"
},
{
"name": "fixedRate",
"type": "uint256"
}
],
"name": "create",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "baseToken",
"type": "address"
},
{
"name": "dataToken",
"type": "address"
},
{
"name": "exchangeOwner",
"type": "address"
}
],
"name": "generateExchangeId",
"outputs": [
{
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
},
{
"name": "dataTokenAmount",
"type": "uint256"
}
],
"name": "CalcInGivenOut",
"outputs": [
{
"name": "baseTokenAmount",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
},
{
"name": "dataTokenAmount",
"type": "uint256"
}
],
"name": "swap",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getNumberOfExchanges",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
},
{
"name": "newRate",
"type": "uint256"
}
],
"name": "setRate",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
}
],
"name": "toggleExchangeState",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
}
],
"name": "getRate",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
}
],
"name": "getSupply",
"outputs": [
{
"name": "supply",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
}
],
"name": "getExchange",
"outputs": [
{
"name": "exchangeOwner",
"type": "address"
},
{
"name": "dataToken",
"type": "address"
},
{
"name": "baseToken",
"type": "address"
},
{
"name": "fixedRate",
"type": "uint256"
},
{
"name": "active",
"type": "bool"
},
{
"name": "supply",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getExchanges",
"outputs": [
{
"name": "",
"type": "bytes32[]"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "exchangeId",
"type": "bytes32"
}
],
"name": "isActive",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.7+commit.6da8b019\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"getExchanges\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"}],\"name\":\"toggleExchangeState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"}],\"name\":\"getExchange\",\"outputs\":[{\"name\":\"exchangeOwner\",\"type\":\"address\"},{\"name\":\"dataToken\",\"type\":\"address\"},{\"name\":\"baseToken\",\"type\":\"address\"},{\"name\":\"fixedRate\",\"type\":\"uint256\"},{\"name\":\"active\",\"type\":\"bool\"},{\"name\":\"supply\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"}],\"name\":\"getSupply\",\"outputs\":[{\"name\":\"supply\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"}],\"name\":\"isActive\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"name\":\"newRate\",\"type\":\"uint256\"}],\"name\":\"setRate\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"}],\"name\":\"getRate\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getNumberOfExchanges\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"name\":\"dataTokenAmount\",\"type\":\"uint256\"}],\"name\":\"CalcInGivenOut\",\"outputs\":[{\"name\":\"baseTokenAmount\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"baseToken\",\"type\":\"address\"},{\"name\":\"dataToken\",\"type\":\"address\"},{\"name\":\"exchangeOwner\",\"type\":\"address\"}],\"name\":\"generateExchangeId\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"name\":\"dataTokenAmount\",\"type\":\"uint256\"}],\"name\":\"swap\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"baseToken\",\"type\":\"address\"},{\"name\":\"dataToken\",\"type\":\"address\"},{\"name\":\"fixedRate\",\"type\":\"uint256\"}],\"name\":\"create\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"baseToken\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"dataToken\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"exchangeOwner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"fixedRate\",\"type\":\"uint256\"}],\"name\":\"ExchangeCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"exchangeOwner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"newRate\",\"type\":\"uint256\"}],\"name\":\"ExchangeRateChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"exchangeOwner\",\"type\":\"address\"}],\"name\":\"ExchangeActivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"exchangeOwner\",\"type\":\"address\"}],\"name\":\"ExchangeDeactivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"exchangeId\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"by\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"baseTokenSwappedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"dataTokenSwappedAmount\",\"type\":\"uint256\"}],\"name\":\"Swapped\",\"type\":\"event\"}],\"devdoc\":{\"details\":\"FixedRateExchange is a fixed rate exchange Contract Marketplaces uses this contract to allow consumers exchanging datatokens with ocean token using a fixed exchange rate.\",\"methods\":{\"CalcInGivenOut(bytes32,uint256)\":{\"details\":\"CalcInGivenOut Calculates how many basetokens are needed to get specifyed amount of datatokens\",\"params\":{\"dataTokenAmount\":\"the amount of data tokens to be exchanged\",\"exchangeId\":\"a unique exchange idnetifier \"}},\"create(address,address,uint256)\":{\"details\":\"create creates new exchange pairs between base token (ocean token) and data tokens.\",\"params\":{\"baseToken\":\"refers to a ocean token contract address\",\"dataToken\":\"refers to a data token contract address\",\"fixedRate\":\"refers to the exact fixed exchange rate in wei\"}},\"generateExchangeId(address,address,address)\":{\"details\":\"generateExchangeId creates unique exchange identifier for two token pairs.\",\"params\":{\"baseToken\":\"refers to a ocean token contract address\",\"dataToken\":\"refers to a data token contract address\",\"exchangeOwner\":\"exchange owner address\"}},\"getExchange(bytes32)\":{\"details\":\"getExchange gets all the exchange details\",\"params\":{\"exchangeId\":\"a unique exchange idnetifier\"},\"return\":\"all the exchange details including the exchange Owner the dataToken contract address, the base token address, the fixed rate, whether the exchange is active and the supply or the the current data token liquidity.\"},\"getExchanges()\":{\"details\":\"getExchanges gets all the exchanges list\",\"return\":\"a list of all registered exchange Ids\"},\"getNumberOfExchanges()\":{\"details\":\"getNumberOfExchanges gets the total number of registered exchanges\",\"return\":\"total number of registered exchange IDs\"},\"getRate(bytes32)\":{\"details\":\"getRate gets the current fixed rate for an exchange\",\"params\":{\"exchangeId\":\"a unique exchange idnetifier\"},\"return\":\"fixed rate value\"},\"getSupply(bytes32)\":{\"details\":\"getSupply gets the current supply of datatokens in an fixed rate exchagne\",\"params\":{\"exchangeId\":\"the exchange ID\"},\"return\":\"supply\"},\"isActive(bytes32)\":{\"details\":\"isActive checks whether exchange is active\",\"params\":{\"exchangeId\":\"a unique exchange idnetifier\"},\"return\":\"true if exchange is true, otherwise returns false\"},\"setRate(bytes32,uint256)\":{\"details\":\"setRate changes the fixed rate for an exchange with a new rate\",\"params\":{\"exchangeId\":\"a unique exchange idnetifier\",\"newRate\":\"new fixed rate value\"}},\"swap(bytes32,uint256)\":{\"details\":\"swap atomic swap between two registered fixed rate exchange.\",\"params\":{\"dataTokenAmount\":\"the amount of data tokens to be exchanged\",\"exchangeId\":\"a unique exchange idnetifier \"}},\"toggleExchangeState(bytes32)\":{\"details\":\"toggleExchangeState toggles the active state of an existing exchange\",\"params\":{\"exchangeId\":\"a unique exchange idnetifier\"}}},\"title\":\"FixedRateExchange\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/ocean/ocean-contracts/contracts/fixedRate/FixedRateExchange.sol\":\"FixedRateExchange\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/ocean/ocean-contracts/contracts/fixedRate/FixedRateExchange.sol\":{\"keccak256\":\"0xff9de548d8fc2ed7f3ba9ec63f839e164152b48f9ca0e50b8c8e31c8d4de14c4\",\"urls\":[\"bzzr://fcff28f27252fc99900599258b20062220c7084b5efec438cedde9bb47723377\"]},\"/ocean/ocean-contracts/contracts/interfaces/IERC20Template.sol\":{\"keccak256\":\"0x022ebed2ba4949e96a05cc394cf690d8fd3190a4733cebe8cbe930ac25cfde18\",\"urls\":[\"bzzr://2fa3d5cae14f0af7d78f6e1d13bc41854082c03ab2f86462ebb09afda88ee6e9\"]},\"openzeppelin-solidity/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzzr://292843005e754e752644f767477ec5ad7a1ffc91ddb18c38b8079c62f3993cad\"]}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b50611243806100206000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c010000000000000000000000000000000000000000000000000000000090048063b32b56f91161008e578063b32b56f914610231578063b42414291461024e578063c030023114610256578063c1f6572e14610279578063de060743146102b1578063ffe5725f146102d4576100d1565b80631e2e3a6b146100d657806324cb477e1461012e5780634c87087d1461014d57806354d9be59146101ae5780635c36901c146101dd578063680819eb1461020e575b600080fd5b6100de61030a565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561011a578181015183820152602001610102565b505050509050019250505060405180910390f35b61014b6004803603602081101561014457600080fd5b5035610362565b005b61016a6004803603602081101561016357600080fd5b5035610465565b60408051600160a060020a0397881681529587166020870152939095168484015260608401919091521515608083015260a082019290925290519081900360c00190f35b6101cb600480360360208110156101c457600080fd5b50356104fc565b60408051918252519081900360200190f35b6101fa600480360360208110156101f357600080fd5b5035610689565b604080519115158252519081900360200190f35b61014b6004803603604081101561022457600080fd5b508035906020013561069e565b6101cb6004803603602081101561024757600080fd5b503561078b565b6101cb6107a0565b6101cb6004803603604081101561026c57600080fd5b50803590602001356107a6565b6101cb6004803603606081101561028f57600080fd5b50600160a060020a03813581169160208101358216916040909101351661085e565b61014b600480360360408110156102c757600080fd5b50803590602001356108a4565b61014b600480360360608110156102ea57600080fd5b50600160a060020a03813581169160208101359091169060400135610b8a565b6060600180548060200260200160405190810160405280929190818152602001828054801561035857602002820191906000526020600020905b815481526020019060010190808311610344575b5050505050905090565b60008181526020819052604090205481906101009004600160a060020a031633146103c15760405160e560020a62461bcd0281526004018080602001828103825260298152602001806110886029913960400191505060405180910390fd5b60008281526020819052604090205460ff161561041d57600082815260208190526040808220805460ff1916905551339184917f03da9148e1de78fba22de63c573465562ebf6ef878a1d3ea83790a560229984c9190a3610461565b600082815260208190526040808220805460ff1916600117905551339184917fc7344c45124818d1d3a4c24ccb9b86d8b88d3bd05209b2a42b494cb32a5035299190a35b5050565b600080600080600080610476610fb2565b5060008781526020818152604091829020825160a081018452815460ff81161515808352610100909104600160a060020a03908116948301859052600184015481169583018690526002840154166060830181905260039093015460808301819052939a509398509096509094509092506104f0886104fc565b91505091939550919395565b60008181526020819052604081205460ff1661051a57506000610684565b6000828152602081815260408083206001810154905482517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a036101009092048216600482015292519116926370a082319260248082019391829003018186803b15801561059057600080fd5b505afa1580156105a4573d6000803e3d6000fd5b505050506040513d60208110156105ba57600080fd5b50516000848152602081815260408083206001810154905482517fdd62ed3e000000000000000000000000000000000000000000000000000000008152610100909104600160a060020a0390811660048301523060248301529251959650939491169263dd62ed3e926044808301939192829003018186803b15801561063f57600080fd5b505afa158015610653573d6000803e3d6000fd5b505050506040513d602081101561066957600080fd5b505190508082101561067d57819250610681565b8092505b50505b919050565b60009081526020819052604090205460ff1690565b60008281526020819052604090205482906101009004600160a060020a031633146106fd5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806110886029913960400191505060405180910390fd5b8161073c5760405160e560020a62461bcd02815260040180806020018281038252602381526020018061103a6023913960400191505060405180910390fd5b6000838152602081815260409182902060030184905581518481529151339286927fe50f9919fdc524004a4ee0cb934f4734f144bec0713a52e5483b753f5de0f08c92918290030190a3505050565b60009081526020819052604090206003015490565b60015490565b6000828152602081905260408120600301548390158015906107db575060008181526020819052604090205460ff1615156001145b6108195760405160e560020a62461bcd02815260040180806020018281038252602b81526020018061100f602b913960400191505060405180910390fd5b60008481526020819052604090206003015461085690670de0b6b3a76400009061084a90869063ffffffff610e6b16565b9063ffffffff610ed016565b949350505050565b60408051600160a060020a039485166020808301919091529385168183015291909316606080830191909152835180830390910181526080909101909252815191012090565b6000828152602081905260409020600301548290158015906108d9575060008181526020819052604090205460ff1615156001145b6109175760405160e560020a62461bcd02815260040180806020018281038252602b81526020018061100f602b913960400191505060405180910390fd5b816109565760405160e560020a62461bcd0281526004018080602001828103825260298152602001806111ef6029913960400191505060405180910390fd5b600061096284846107a6565b6000858152602081815260408083206002810154905482517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a036101009092048216602482015260448101879052925195965016936323b872dd93606480840194938390030190829087803b1580156109e957600080fd5b505af11580156109fd573d6000803e3d6000fd5b505050506040513d6020811015610a1357600080fd5b5051610a535760405160e560020a62461bcd0281526004018080602001828103825260408152602001806110b16040913960400191505060405180910390fd5b6000848152602081815260408083206001810154905482517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03610100909204821660048201523360248201526044810189905292519116936323b872dd93606480850194919392918390030190829087803b158015610adb57600080fd5b505af1158015610aef573d6000803e3d6000fd5b505050506040513d6020811015610b0557600080fd5b5051610b455760405160e560020a62461bcd02815260040180806020018281038252604081526020018061117c6040913960400191505060405180910390fd5b60408051828152602081018590528151339287927f816ecef7c59c8574653ab4522960d26a6d2987e94d760cd775b6c9273ef81f23929081900390910190a350505050565b600160a060020a038316610bd25760405160e560020a62461bcd0281526004018080602001828103825260338152602001806111496033913960400191505060405180910390fd5b600160a060020a038216610c1a5760405160e560020a62461bcd0281526004018080602001828103825260338152602001806111bc6033913960400191505060405180910390fd5b81600160a060020a031683600160a060020a03161415610c6e5760405160e560020a62461bcd0281526004018080602001828103825260378152602001806110f16037913960400191505060405180910390fd5b80610cad5760405160e560020a62461bcd02815260040180806020018281038252602e815260200180610fe1602e913960400191505060405180910390fd5b6000610cba84843361085e565b60008181526020819052604090206003015490915015610d0e5760405160e560020a62461bcd02815260040180806020018281038252602b81526020018061105d602b913960400191505060405180910390fd5b6040805160a0810182526001808252336020808401828152600160a060020a038981168688018181528c83166060890181815260808a018d815260008d81528089528c81209b518c54985188166101000274ffffffffffffffffffffffffffffffffffffffff001991151560ff19909a169990991716979097178b5592518a8a01805491871673ffffffffffffffffffffffffffffffffffffffff19928316179055905160028b018054919096169116179093555160039097019690965584548086018655949091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69093018690558451918252810186905283519293919285927feb7a353641f7d3cc54b497ef1553fdc292b64d9cc3be8587c23dfba01f310b19928290030190a4604051339082907fc7344c45124818d1d3a4c24ccb9b86d8b88d3bd05209b2a42b494cb32a50352990600090a350505050565b600082610e7a57506000610eca565b82820282848281610e8757fe5b0414610ec75760405160e560020a62461bcd0281526004018080602001828103825260218152602001806111286021913960400191505060405180910390fd5b90505b92915050565b6000610ec783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060008183610f9c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f61578181015183820152602001610f49565b50505050905090810190601f168015610f8e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610fa857fe5b0495945050505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe46697865645261746545786368616e67653a20496e76616c69642065786368616e676520726174652076616c756546697865645261746545786368616e67653a2045786368616e676520646f6573206e6f742065786973742146697865645261746545786368616e67653a20526174696f206d757374206265203e3046697865645261746545786368616e67653a2045786368616e676520616c7265616479206578697374732146697865645261746545786368616e67653a20696e76616c69642065786368616e6765206f776e657246697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652062617365546f6b656e20636f6e747261637446697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c2020657175616c732062617365746f6b656e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7746697865645261746545786368616e67653a20496e76616c69642062617365746f6b656e2c20207a65726f206164647265737346697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652064617461546f6b656e20636f6e747261637446697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c20207a65726f206164647265737346697865645261746545786368616e67653a207a65726f206461746120746f6b656e20616d6f756e74a165627a7a723058200ebd6ad886857ade222027637bd88eb2d0c925a0614640e8be3b53efead00de50029",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100d1576000357c010000000000000000000000000000000000000000000000000000000090048063b32b56f91161008e578063b32b56f914610231578063b42414291461024e578063c030023114610256578063c1f6572e14610279578063de060743146102b1578063ffe5725f146102d4576100d1565b80631e2e3a6b146100d657806324cb477e1461012e5780634c87087d1461014d57806354d9be59146101ae5780635c36901c146101dd578063680819eb1461020e575b600080fd5b6100de61030a565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561011a578181015183820152602001610102565b505050509050019250505060405180910390f35b61014b6004803603602081101561014457600080fd5b5035610362565b005b61016a6004803603602081101561016357600080fd5b5035610465565b60408051600160a060020a0397881681529587166020870152939095168484015260608401919091521515608083015260a082019290925290519081900360c00190f35b6101cb600480360360208110156101c457600080fd5b50356104fc565b60408051918252519081900360200190f35b6101fa600480360360208110156101f357600080fd5b5035610689565b604080519115158252519081900360200190f35b61014b6004803603604081101561022457600080fd5b508035906020013561069e565b6101cb6004803603602081101561024757600080fd5b503561078b565b6101cb6107a0565b6101cb6004803603604081101561026c57600080fd5b50803590602001356107a6565b6101cb6004803603606081101561028f57600080fd5b50600160a060020a03813581169160208101358216916040909101351661085e565b61014b600480360360408110156102c757600080fd5b50803590602001356108a4565b61014b600480360360608110156102ea57600080fd5b50600160a060020a03813581169160208101359091169060400135610b8a565b6060600180548060200260200160405190810160405280929190818152602001828054801561035857602002820191906000526020600020905b815481526020019060010190808311610344575b5050505050905090565b60008181526020819052604090205481906101009004600160a060020a031633146103c15760405160e560020a62461bcd0281526004018080602001828103825260298152602001806110886029913960400191505060405180910390fd5b60008281526020819052604090205460ff161561041d57600082815260208190526040808220805460ff1916905551339184917f03da9148e1de78fba22de63c573465562ebf6ef878a1d3ea83790a560229984c9190a3610461565b600082815260208190526040808220805460ff1916600117905551339184917fc7344c45124818d1d3a4c24ccb9b86d8b88d3bd05209b2a42b494cb32a5035299190a35b5050565b600080600080600080610476610fb2565b5060008781526020818152604091829020825160a081018452815460ff81161515808352610100909104600160a060020a03908116948301859052600184015481169583018690526002840154166060830181905260039093015460808301819052939a509398509096509094509092506104f0886104fc565b91505091939550919395565b60008181526020819052604081205460ff1661051a57506000610684565b6000828152602081815260408083206001810154905482517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a036101009092048216600482015292519116926370a082319260248082019391829003018186803b15801561059057600080fd5b505afa1580156105a4573d6000803e3d6000fd5b505050506040513d60208110156105ba57600080fd5b50516000848152602081815260408083206001810154905482517fdd62ed3e000000000000000000000000000000000000000000000000000000008152610100909104600160a060020a0390811660048301523060248301529251959650939491169263dd62ed3e926044808301939192829003018186803b15801561063f57600080fd5b505afa158015610653573d6000803e3d6000fd5b505050506040513d602081101561066957600080fd5b505190508082101561067d57819250610681565b8092505b50505b919050565b60009081526020819052604090205460ff1690565b60008281526020819052604090205482906101009004600160a060020a031633146106fd5760405160e560020a62461bcd0281526004018080602001828103825260298152602001806110886029913960400191505060405180910390fd5b8161073c5760405160e560020a62461bcd02815260040180806020018281038252602381526020018061103a6023913960400191505060405180910390fd5b6000838152602081815260409182902060030184905581518481529151339286927fe50f9919fdc524004a4ee0cb934f4734f144bec0713a52e5483b753f5de0f08c92918290030190a3505050565b60009081526020819052604090206003015490565b60015490565b6000828152602081905260408120600301548390158015906107db575060008181526020819052604090205460ff1615156001145b6108195760405160e560020a62461bcd02815260040180806020018281038252602b81526020018061100f602b913960400191505060405180910390fd5b60008481526020819052604090206003015461085690670de0b6b3a76400009061084a90869063ffffffff610e6b16565b9063ffffffff610ed016565b949350505050565b60408051600160a060020a039485166020808301919091529385168183015291909316606080830191909152835180830390910181526080909101909252815191012090565b6000828152602081905260409020600301548290158015906108d9575060008181526020819052604090205460ff1615156001145b6109175760405160e560020a62461bcd02815260040180806020018281038252602b81526020018061100f602b913960400191505060405180910390fd5b816109565760405160e560020a62461bcd0281526004018080602001828103825260298152602001806111ef6029913960400191505060405180910390fd5b600061096284846107a6565b6000858152602081815260408083206002810154905482517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a036101009092048216602482015260448101879052925195965016936323b872dd93606480840194938390030190829087803b1580156109e957600080fd5b505af11580156109fd573d6000803e3d6000fd5b505050506040513d6020811015610a1357600080fd5b5051610a535760405160e560020a62461bcd0281526004018080602001828103825260408152602001806110b16040913960400191505060405180910390fd5b6000848152602081815260408083206001810154905482517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03610100909204821660048201523360248201526044810189905292519116936323b872dd93606480850194919392918390030190829087803b158015610adb57600080fd5b505af1158015610aef573d6000803e3d6000fd5b505050506040513d6020811015610b0557600080fd5b5051610b455760405160e560020a62461bcd02815260040180806020018281038252604081526020018061117c6040913960400191505060405180910390fd5b60408051828152602081018590528151339287927f816ecef7c59c8574653ab4522960d26a6d2987e94d760cd775b6c9273ef81f23929081900390910190a350505050565b600160a060020a038316610bd25760405160e560020a62461bcd0281526004018080602001828103825260338152602001806111496033913960400191505060405180910390fd5b600160a060020a038216610c1a5760405160e560020a62461bcd0281526004018080602001828103825260338152602001806111bc6033913960400191505060405180910390fd5b81600160a060020a031683600160a060020a03161415610c6e5760405160e560020a62461bcd0281526004018080602001828103825260378152602001806110f16037913960400191505060405180910390fd5b80610cad5760405160e560020a62461bcd02815260040180806020018281038252602e815260200180610fe1602e913960400191505060405180910390fd5b6000610cba84843361085e565b60008181526020819052604090206003015490915015610d0e5760405160e560020a62461bcd02815260040180806020018281038252602b81526020018061105d602b913960400191505060405180910390fd5b6040805160a0810182526001808252336020808401828152600160a060020a038981168688018181528c83166060890181815260808a018d815260008d81528089528c81209b518c54985188166101000274ffffffffffffffffffffffffffffffffffffffff001991151560ff19909a169990991716979097178b5592518a8a01805491871673ffffffffffffffffffffffffffffffffffffffff19928316179055905160028b018054919096169116179093555160039097019690965584548086018655949091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69093018690558451918252810186905283519293919285927feb7a353641f7d3cc54b497ef1553fdc292b64d9cc3be8587c23dfba01f310b19928290030190a4604051339082907fc7344c45124818d1d3a4c24ccb9b86d8b88d3bd05209b2a42b494cb32a50352990600090a350505050565b600082610e7a57506000610eca565b82820282848281610e8757fe5b0414610ec75760405160e560020a62461bcd0281526004018080602001828103825260218152602001806111286021913960400191505060405180910390fd5b90505b92915050565b6000610ec783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060008183610f9c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f61578181015183820152602001610f49565b50505050905090810190601f168015610f8e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610fa857fe5b0495945050505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe46697865645261746545786368616e67653a20496e76616c69642065786368616e676520726174652076616c756546697865645261746545786368616e67653a2045786368616e676520646f6573206e6f742065786973742146697865645261746545786368616e67653a20526174696f206d757374206265203e3046697865645261746545786368616e67653a2045786368616e676520616c7265616479206578697374732146697865645261746545786368616e67653a20696e76616c69642065786368616e6765206f776e657246697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652062617365546f6b656e20636f6e747261637446697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c2020657175616c732062617365746f6b656e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7746697865645261746545786368616e67653a20496e76616c69642062617365746f6b656e2c20207a65726f206164647265737346697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652064617461546f6b656e20636f6e747261637446697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c20207a65726f206164647265737346697865645261746545786368616e67653a207a65726f206461746120746f6b656e20616d6f756e74a165627a7a723058200ebd6ad886857ade222027637bd88eb2d0c925a0614640e8be3b53efead00de50029",
"sourceMap": "530:10457:9:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;530:10457:9;;;;;;;",
"deployedSourceMap": "530:10457:9:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;530:10457:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10486:130;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;10486:130:9;;;;;;;;;;;;;;;;;7632:511;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7632:511:9;;:::i;:::-;;9742:604;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;9742:604:9;;:::i;:::-;;;;-1:-1:-1;;;;;9742:604:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8688:636;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8688:636:9;;:::i;:::-;;;;;;;;;;;;;;;;10824:161;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;10824:161:9;;:::i;:::-;;;;;;;;;;;;;;;;;;7051:411;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7051:411:9;;;;;;;:::i;8327:165::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8327:165:9;;:::i;6711:134::-;;;:::i;4846:336::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;4846:336:9;;;;;;;:::i;4231:343::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;4231:343:9;;;;;;;;;;;;;;;;;;;:::i;5420:1123::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5420:1123:9;;;;;;;:::i;2512:1418::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;2512:1418:9;;;;;;;;;;;;;;;;;:::i;10486:130::-;10559:16;10598:11;10591:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10486:130;:::o;7632:511::-;1306:9;:21;;;;;;;;;;:35;7738:10;;1306:35;;;-1:-1:-1;;;;;1306:35:9;1345:10;1306:49;1285:137;;;;-1:-1:-1;;;;;1285:137:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7767:9;:21;;;;;;;;;;:28;;;7764:373;;;7841:5;7810:21;;;;;;;;;;;:36;;-1:-1:-1;;7810:36:9;;;7865:89;7930:10;;7820;;7865:89;;7841:5;7865:89;7764:373;;;7985:9;:21;;;;;;;;;;;:35;;-1:-1:-1;;7985:35:9;8016:4;7985:35;;;8039:87;8102:10;;7995;;8039:87;;7985:9;8039:87;7764:373;7632:511;;:::o;9742:604::-;9857:21;9892:17;9923;9954;9985:11;10010:14;10049:24;;:::i;:::-;-1:-1:-1;10076:9:9;:21;;;;;;;;;;;;10049:48;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;10049:48:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10049:48:9;;-1:-1:-1;10049:48:9;;-1:-1:-1;10049:48:9;;-1:-1:-1;10049:48:9;;-1:-1:-1;10318:21:9;10076;10318:9;:21::i;:::-;10309:30;;9742:604;;;;;;;;:::o;8688:636::-;8772:14;8805:21;;;;;;;;;;:28;;;8802:516;;-1:-1:-1;8865:1:9;8802:516;;;8895:15;8928:21;;;;;;;;;;;:31;;;;8988:35;;8913:111;;;;;-1:-1:-1;;;;;8928:31:9;8988:35;;;;;8913:111;;;;;;8928:31;;;8913:74;;:111;;;;;;;;;;;8928:31;8913:111;;;5:2:-1;;;;30:1;27;20:12;5:2;8913:111:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8913:111:9;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8913:111:9;9038:17;9073:21;;;8913:111;9073:21;;;;;;;:31;;;;9133:35;;9058:126;;;;;9073:31;9133:35;;;-1:-1:-1;;;;;9133:35:9;;;9058:126;;;;9178:4;9058:126;;;;;;8913:111;;-1:-1:-1;9038:17:9;;9073:31;;;9058:74;;:126;;;;;8913:111;;9058:126;;;;;9073:31;9058:126;;;5:2:-1;;;;30:1;27;20:12;5:2;9058:126:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;9058:126:9;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;9058:126:9;;-1:-1:-1;9201:19:9;;;9198:109;;;9247:7;9238:16;;9198:109;;;9298:9;9289:18;;9198:109;8802:516;;;8688:636;;;:::o;10824:161::-;10923:4;10950:21;;;;;;;;;;:28;;;;10824:161::o;7051:411::-;1306:9;:21;;;;;;;;;;:35;7170:10;;1306:35;;;-1:-1:-1;;;;;1306:35:9;1345:10;1306:49;1285:137;;;;-1:-1:-1;;;;;1285:137:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7217:12;7196:94;;;;-1:-1:-1;;;;;7196:94:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7301:9;:21;;;;;;;;;;;;:31;;:41;;;7357:98;;;;;;;7414:10;;7311;;7357:98;;;;;;;;;7051:411;;;:::o;8327:165::-;8424:7;8454:21;;;;;;;;;;:31;;;;8327:165::o;6711:134::-;6820:11;:18;6711:134;:::o;4846:336::-;5043:23;1029:21;;;;;;;;;;:31;;;5005:10;;1029:36;;;;:88;;-1:-1:-1;1081:9:9;:21;;;;;;;;;;:28;;;:36;;:28;:36;1029:88;1008:178;;;;-1:-1:-1;;;;;1008:178:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5133:9;:21;;;;;;;;;;:31;;;5100:75;;627:8;;5100:65;;:15;;:65;:19;:65;:::i;:::-;:69;:75;:69;:75;:::i;:::-;5082:93;4846:336;-1:-1:-1;;;;4846:336:9:o;4231:343::-;4448:109;;;-1:-1:-1;;;;;4448:109:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;4448:109:9;;;;;;;4425:142;;;;;;4231:343::o;5420:1123::-;1029:9;:21;;;;;;;;;;:31;;;5558:10;;1029:36;;;;:88;;-1:-1:-1;1081:9:9;:21;;;;;;;;;;:28;;;:36;;:28;:36;1029:88;1008:178;;;;-1:-1:-1;;;;;1008:178:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5614:20;5593:108;;;;-1:-1:-1;;;;;5593:108:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5711:23;5737:42;5752:10;5763:15;5737:14;:42::i;:::-;5825:9;:21;;;;;;;;;;;:31;;;;5916:35;;5810:188;;;;;5888:10;5810:188;;;;-1:-1:-1;;;;;5825:31:9;5916:35;;;;;5810:188;;;;;;;;;;;;;;-1:-1:-1;5825:31:9;;5810:60;;:188;;;;;5825:21;5810:188;;;;;;;5825:31;5810:188;;;5:2:-1;;;;30:1;27;20:12;5:2;5810:188:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5810:188:9;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5810:188:9;5789:299;;;;-1:-1:-1;;;;;5789:299:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6134:9;:21;;;;;;;;;;;:31;;;;6197:35;;6119:188;;;;;-1:-1:-1;;;;;6134:31:9;6197:35;;;;;6119:188;;;;6250:10;6119:188;;;;;;;;;;;;6134:31;;;6119:60;;:188;;;;;6134:21;;6119:188;;;;;;;;;6134:31;6119:188;;;5:2:-1;;;;30:1;27;20:12;5:2;6119:188:9;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6119:188:9;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;6119:188:9;6098:299;;;;-1:-1:-1;;;;;6098:299:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6413:123;;;;;;;;;;;;;;6458:10;;6434;;6413:123;;;;;;;;;;;1196:1;5420:1123;;;:::o;2512:1418::-;-1:-1:-1;;;;;2667:23:9;;2646:121;;;;-1:-1:-1;;;;;2646:121:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2798:23:9;;2777:121;;;;-1:-1:-1;;;;;2777:121:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2942:9;-1:-1:-1;;;;;2929:22:9;:9;-1:-1:-1;;;;;2929:22:9;;;2908:124;;;;-1:-1:-1;;;;;2908:124:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3063:14;3042:108;;;;-1:-1:-1;;;;;3042:108:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3160:18;3181:98;3213:9;3236;3259:10;3181:18;:98::i;:::-;3310:9;:21;;;;;;;;;;:31;;;3160:119;;-1:-1:-1;3310:36:9;3289:126;;;;-1:-1:-1;;;;;3289:126:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3449:187;;;;;;;;3480:4;3449:187;;;3513:10;3449:187;;;;;;;-1:-1:-1;;;;;3449:187:9;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3425:21:9;;;;;;;;;:211;;;;;;;;;;-1:-1:-1;;3425:211:9;;;-1:-1:-1;;3425:211:9;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;3425:211:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;23:18;;;45:23;;3646:28:9;;;;;;;;;;;3690:142;;;;;;;;;;;;3449:187;;;;3435:10;;3690:142;;;;;;;;3848:75;;3903:10;;3879;;3848:75;;;;;2512:1418;;;;:::o;2159:459:15:-;2217:7;2458:6;2454:45;;-1:-1:-1;2487:1:15;2480:8;;2454:45;2521:5;;;2525:1;2521;:5;:1;2544:5;;;;;:10;2536:56;;;;-1:-1:-1;;;;;2536:56:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2610:1;-1:-1:-1;2159:459:15;;;;;:::o;3073:130::-;3131:7;3157:39;3161:1;3164;3157:39;;;;;;;;;;;;;;;;;3804:7;3904:12;3897:5;3889:28;;;;-1:-1:-1;;;;;3889:28:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3889:28:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3927:9;3943:1;3939;:5;;;;;;;3718:338;-1:-1:-1;;;;;3718:338:15:o;530:10457:9:-;;;;;;;;;-1:-1:-1;530:10457:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o",
"source": "pragma solidity 0.5.7;\n// Copyright BigchainDB GmbH and Ocean Protocol contributors\n// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)\n// Code is Apache-2.0 and docs are CC-BY-4.0\n\nimport '../interfaces/IERC20Template.sol';\nimport 'openzeppelin-solidity/contracts/math/SafeMath.sol';\n\n/**\n * @title FixedRateExchange\n * @dev FixedRateExchange is a fixed rate exchange Contract\n * Marketplaces uses this contract to allow consumers \n * exchanging datatokens with ocean token using a fixed \n * exchange rate.\n */\ncontract FixedRateExchange {\n using SafeMath for uint256;\n uint256 private constant BASE = 10 ** 18;\n struct Exchange {\n bool active;\n address exchangeOwner;\n address dataToken;\n address baseToken;\n uint256 fixedRate;\n }\n\n // maps an exchangeId to an exchange\n mapping(bytes32 => Exchange) private exchanges;\n bytes32[] private exchangeIds;\n\n modifier onlyActiveExchange(\n bytes32 exchangeId\n )\n {\n require(\n exchanges[exchangeId].fixedRate != 0 &&\n exchanges[exchangeId].active == true,\n 'FixedRateExchange: Exchange does not exist!'\n );\n _;\n }\n\n modifier onlyExchangeOwner(\n bytes32 exchangeId\n )\n {\n require(\n exchanges[exchangeId].exchangeOwner == msg.sender,\n 'FixedRateExchange: invalid exchange owner'\n );\n _;\n }\n\n event ExchangeCreated(\n bytes32 indexed exchangeId,\n address indexed baseToken,\n address indexed dataToken,\n address exchangeOwner,\n uint256 fixedRate\n );\n\n event ExchangeRateChanged(\n bytes32 indexed exchangeId,\n address indexed exchangeOwner,\n uint256 newRate\n );\n\n event ExchangeActivated(\n bytes32 indexed exchangeId,\n address indexed exchangeOwner\n );\n\n event ExchangeDeactivated(\n bytes32 indexed exchangeId,\n address indexed exchangeOwner\n );\n\n event Swapped(\n bytes32 indexed exchangeId,\n address indexed by,\n uint256 baseTokenSwappedAmount,\n uint256 dataTokenSwappedAmount\n );\n\n /**\n * @dev create\n * creates new exchange pairs between base token\n * (ocean token) and data tokens.\n * @param baseToken refers to a ocean token contract address\n * @param dataToken refers to a data token contract address\n * @param fixedRate refers to the exact fixed exchange rate in wei\n */\n function create(\n address baseToken,\n address dataToken,\n uint256 fixedRate\n )\n external\n {\n require(\n baseToken != address(0),\n 'FixedRateExchange: Invalid basetoken, zero address'\n );\n require(\n dataToken != address(0),\n 'FixedRateExchange: Invalid datatoken, zero address'\n );\n require(\n baseToken != dataToken,\n 'FixedRateExchange: Invalid datatoken, equals basetoken'\n );\n require(\n fixedRate != 0, \n 'FixedRateExchange: Invalid exchange rate value'\n );\n bytes32 exchangeId = generateExchangeId(\n baseToken,\n dataToken,\n msg.sender\n );\n require(\n exchanges[exchangeId].fixedRate == 0,\n 'FixedRateExchange: Exchange already exists!'\n );\n exchanges[exchangeId] = Exchange({\n active: true,\n exchangeOwner: msg.sender,\n dataToken: dataToken,\n baseToken: baseToken,\n fixedRate: fixedRate\n });\n exchangeIds.push(exchangeId);\n\n emit ExchangeCreated(\n exchangeId,\n baseToken,\n dataToken,\n msg.sender,\n fixedRate\n );\n\n emit ExchangeActivated(\n exchangeId,\n msg.sender\n );\n }\n\n /**\n * @dev generateExchangeId\n * creates unique exchange identifier for two token pairs.\n * @param baseToken refers to a ocean token contract address\n * @param dataToken refers to a data token contract address\n * @param exchangeOwner exchange owner address\n */\n function generateExchangeId(\n address baseToken,\n address dataToken,\n address exchangeOwner\n )\n public\n pure\n returns (bytes32)\n {\n return keccak256(\n abi.encode(\n baseToken,\n dataToken,\n exchangeOwner\n )\n );\n }\n \n /**\n * @dev CalcInGivenOut\n * Calculates how many basetokens are needed to get specifyed amount of datatokens\n * @param exchangeId a unique exchange idnetifier \n * @param dataTokenAmount the amount of data tokens to be exchanged\n */\n function CalcInGivenOut(\n bytes32 exchangeId,\n uint256 dataTokenAmount\n )\n public\n view\n onlyActiveExchange(\n exchangeId\n )\n returns (uint256 baseTokenAmount)\n {\n baseTokenAmount = dataTokenAmount.mul(\n exchanges[exchangeId].fixedRate).div(BASE);\n }\n \n /**\n * @dev swap\n * atomic swap between two registered fixed rate exchange.\n * @param exchangeId a unique exchange idnetifier \n * @param dataTokenAmount the amount of data tokens to be exchanged\n */\n function swap(\n bytes32 exchangeId,\n uint256 dataTokenAmount\n )\n external\n onlyActiveExchange(\n exchangeId\n )\n {\n require(\n dataTokenAmount != 0,\n 'FixedRateExchange: zero data token amount'\n );\n uint256 baseTokenAmount = CalcInGivenOut(exchangeId,dataTokenAmount);\n require(\n IERC20Template(exchanges[exchangeId].baseToken).transferFrom(\n msg.sender,\n exchanges[exchangeId].exchangeOwner,\n baseTokenAmount\n ),\n 'FixedRateExchange: transferFrom failed in the baseToken contract'\n );\n require(\n IERC20Template(exchanges[exchangeId].dataToken).transferFrom(\n exchanges[exchangeId].exchangeOwner,\n msg.sender,\n dataTokenAmount\n ),\n 'FixedRateExchange: transferFrom failed in the dataToken contract'\n );\n\n emit Swapped(\n exchangeId,\n msg.sender,\n baseTokenAmount,\n dataTokenAmount\n );\n }\n\n /**\n * @dev getNumberOfExchanges\n * gets the total number of registered exchanges\n * @return total number of registered exchange IDs\n */\n function getNumberOfExchanges()\n external\n view\n returns (uint256)\n {\n return exchangeIds.length;\n }\n\n /**\n * @dev setRate\n * changes the fixed rate for an exchange with a new rate\n * @param exchangeId a unique exchange idnetifier\n * @param newRate new fixed rate value\n */\n function setRate(\n bytes32 exchangeId,\n uint256 newRate\n )\n external\n onlyExchangeOwner(exchangeId)\n {\n require(\n newRate != 0,\n 'FixedRateExchange: Ratio must be >0'\n );\n\n exchanges[exchangeId].fixedRate = newRate;\n emit ExchangeRateChanged(\n exchangeId,\n msg.sender,\n newRate\n );\n }\n\n /**\n * @dev toggleExchangeState\n * toggles the active state of an existing exchange\n * @param exchangeId a unique exchange idnetifier\n */\n function toggleExchangeState(\n bytes32 exchangeId\n )\n external\n onlyExchangeOwner(exchangeId)\n {\n if(exchanges[exchangeId].active){\n exchanges[exchangeId].active = false;\n emit ExchangeDeactivated(\n exchangeId,\n msg.sender\n );\n } else {\n exchanges[exchangeId].active = true;\n emit ExchangeActivated(\n exchangeId,\n msg.sender\n );\n }\n }\n\n /**\n * @dev getRate\n * gets the current fixed rate for an exchange\n * @param exchangeId a unique exchange idnetifier\n * @return fixed rate value\n */\n function getRate(\n bytes32 exchangeId\n )\n external\n view\n returns(uint256)\n {\n return exchanges[exchangeId].fixedRate;\n }\n\n /**\n * @dev getSupply\n * gets the current supply of datatokens in an fixed\n * rate exchagne\n * @param exchangeId the exchange ID\n * @return supply\n */\n function getSupply(bytes32 exchangeId)\n public\n view\n returns (uint256 supply)\n {\n if(exchanges[exchangeId].active == false)\n supply = 0;\n else {\n uint256 balance = IERC20Template(exchanges[exchangeId].dataToken)\n .balanceOf(exchanges[exchangeId].exchangeOwner);\n uint256 allowance = IERC20Template(exchanges[exchangeId].dataToken)\n .allowance(exchanges[exchangeId].exchangeOwner, address(this));\n if(balance < allowance)\n supply = balance;\n else\n supply = allowance;\n }\n }\n\n /**\n * @dev getExchange\n * gets all the exchange details\n * @param exchangeId a unique exchange idnetifier\n * @return all the exchange details including the exchange Owner\n * the dataToken contract address, the base token address, the \n * fixed rate, whether the exchange is active and the supply or the \n * the current data token liquidity.\n */\n function getExchange(\n bytes32 exchangeId\n )\n external\n view\n returns (\n address exchangeOwner,\n address dataToken,\n address baseToken,\n uint256 fixedRate,\n bool active,\n uint256 supply\n )\n {\n Exchange memory exchange = exchanges[exchangeId];\n exchangeOwner = exchange.exchangeOwner;\n dataToken = exchange.dataToken;\n baseToken = exchange.baseToken;\n fixedRate = exchange.fixedRate;\n active = exchange.active;\n supply = getSupply(exchangeId);\n }\n\n /**\n * @dev getExchanges\n * gets all the exchanges list\n * @return a list of all registered exchange Ids\n */\n function getExchanges()\n external \n view \n returns (bytes32[] memory)\n {\n return exchangeIds;\n }\n\n /**\n * @dev isActive\n * checks whether exchange is active\n * @param exchangeId a unique exchange idnetifier\n * @return true if exchange is true, otherwise returns false\n */\n function isActive(\n bytes32 exchangeId\n )\n external\n view\n returns (bool)\n {\n return exchanges[exchangeId].active;\n }\n}\n",
"sourcePath": "/ocean/ocean-contracts/contracts/fixedRate/FixedRateExchange.sol",
"ast": {
"absolutePath": "/ocean/ocean-contracts/contracts/fixedRate/FixedRateExchange.sol",
"exportedSymbols": {
"FixedRateExchange": [
4962
]
},
"id": 4963,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4400,
"literals": [
"solidity",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "0:22:9"
},
{
"absolutePath": "/ocean/ocean-contracts/contracts/interfaces/IERC20Template.sol",
"file": "../interfaces/IERC20Template.sol",
"id": 4401,
"nodeType": "ImportDirective",
"scope": 4963,
"sourceUnit": 5071,
"src": "185:42:9",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"file": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"id": 4402,
"nodeType": "ImportDirective",
"scope": 4963,
"sourceUnit": 5927,
"src": "228:59:9",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@title FixedRateExchange\n@dev FixedRateExchange is a fixed rate exchange Contract\n Marketplaces uses this contract to allow consumers \n exchanging datatokens with ocean token using a fixed \n exchange rate.",
"fullyImplemented": true,
"id": 4962,
"linearizedBaseContracts": [
4962
],
"name": "FixedRateExchange",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 4405,
"libraryName": {
"contractScope": null,
"id": 4403,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5926,
"src": "569:8:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$5926",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "563:27:9",
"typeName": {
"id": 4404,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "582:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"constant": true,
"id": 4410,
"name": "BASE",
"nodeType": "VariableDeclaration",
"scope": 4962,
"src": "595:40:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4406,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "595:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_rational_1000000000000000000_by_1",
"typeString": "int_const 1000000000000000000"
},
"id": 4409,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"hexValue": "3130",
"id": 4407,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "627:2:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_10_by_1",
"typeString": "int_const 10"
},
"value": "10"
},
"nodeType": "BinaryOperation",
"operator": "**",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3138",
"id": 4408,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "633:2:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_18_by_1",
"typeString": "int_const 18"
},
"value": "18"
},
"src": "627:8:9",
"typeDescriptions": {
"typeIdentifier": "t_rational_1000000000000000000_by_1",
"typeString": "int_const 1000000000000000000"
}
},
"visibility": "private"
},
{
"canonicalName": "FixedRateExchange.Exchange",
"id": 4421,
"members": [
{
"constant": false,
"id": 4412,
"name": "active",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "667:11:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4411,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "667:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4414,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "688:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4413,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "688:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4416,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "719:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4415,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "719:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4418,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "746:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4417,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "746:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4420,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "773:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4419,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "773:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Exchange",
"nodeType": "StructDefinition",
"scope": 4962,
"src": "641:156:9",
"visibility": "public"
},
{
"constant": false,
"id": 4425,
"name": "exchanges",
"nodeType": "VariableDeclaration",
"scope": 4962,
"src": "844:46:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange)"
},
"typeName": {
"id": 4424,
"keyType": {
"id": 4422,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "852:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Mapping",
"src": "844:28:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange)"
},
"valueType": {
"contractScope": null,
"id": 4423,
"name": "Exchange",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4421,
"src": "863:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage_ptr",
"typeString": "struct FixedRateExchange.Exchange"
}
}
},
"value": null,
"visibility": "private"
},
{
"constant": false,
"id": 4428,
"name": "exchangeIds",
"nodeType": "VariableDeclaration",
"scope": 4962,
"src": "896:29:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 4426,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "896:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 4427,
"length": null,
"nodeType": "ArrayTypeName",
"src": "896:9:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"value": null,
"visibility": "private"
},
{
"body": {
"id": 4450,
"nodeType": "Block",
"src": "998:206:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 4445,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4438,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4433,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "1029:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4435,
"indexExpression": {
"argumentTypes": null,
"id": 4434,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4430,
"src": "1039:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1029:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4436,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "1029:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4437,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1064:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1029:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 4444,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4439,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "1081:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4441,
"indexExpression": {
"argumentTypes": null,
"id": 4440,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4430,
"src": "1091:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1081:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4442,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "1081:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 4443,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1113:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "1081:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "1029:88:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a2045786368616e676520646f6573206e6f7420657869737421",
"id": 4446,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1131:45:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_33934cff4a0fa610a47c77876602b176c21576f21e0c00dbe89561d0224d4982",
"typeString": "literal_string \"FixedRateExchange: Exchange does not exist!\""
},
"value": "FixedRateExchange: Exchange does not exist!"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_33934cff4a0fa610a47c77876602b176c21576f21e0c00dbe89561d0224d4982",
"typeString": "literal_string \"FixedRateExchange: Exchange does not exist!\""
}
],
"id": 4432,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "1008:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4447,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1008:178:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4448,
"nodeType": "ExpressionStatement",
"src": "1008:178:9"
},
{
"id": 4449,
"nodeType": "PlaceholderStatement",
"src": "1196:1:9"
}
]
},
"documentation": null,
"id": 4451,
"name": "onlyActiveExchange",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 4431,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4430,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4451,
"src": "969:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4429,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "969:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "959:34:9"
},
"src": "932:272:9",
"visibility": "internal"
},
{
"body": {
"id": 4467,
"nodeType": "Block",
"src": "1275:165:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4462,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4456,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "1306:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4458,
"indexExpression": {
"argumentTypes": null,
"id": 4457,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4453,
"src": "1316:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1306:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4459,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "1306:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4460,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "1345:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4461,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1345:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1306:49:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20696e76616c69642065786368616e6765206f776e6572",
"id": 4463,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1369:43:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_6953f2de142c64f34f94b55c4652873748f95f81c631ff9f1f451ebbfe788b37",
"typeString": "literal_string \"FixedRateExchange: invalid exchange owner\""
},
"value": "FixedRateExchange: invalid exchange owner"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_6953f2de142c64f34f94b55c4652873748f95f81c631ff9f1f451ebbfe788b37",
"typeString": "literal_string \"FixedRateExchange: invalid exchange owner\""
}
],
"id": 4455,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "1285:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4464,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1285:137:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4465,
"nodeType": "ExpressionStatement",
"src": "1285:137:9"
},
{
"id": 4466,
"nodeType": "PlaceholderStatement",
"src": "1432:1:9"
}
]
},
"documentation": null,
"id": 4468,
"name": "onlyExchangeOwner",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 4454,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4453,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4468,
"src": "1246:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4452,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1246:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1236:34:9"
},
"src": "1210:230:9",
"visibility": "internal"
},
{
"anonymous": false,
"documentation": null,
"id": 4480,
"name": "ExchangeCreated",
"nodeType": "EventDefinition",
"parameters": {
"id": 4479,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4470,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1477:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4469,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1477:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4472,
"indexed": true,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1513:25:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4471,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1513:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4474,
"indexed": true,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1548:25:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4473,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1548:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4476,
"indexed": false,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1583:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4475,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1583:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4478,
"indexed": false,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1614:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4477,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1614:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1467:170:9"
},
"src": "1446:192:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4488,
"name": "ExchangeRateChanged",
"nodeType": "EventDefinition",
"parameters": {
"id": 4487,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4482,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4488,
"src": "1679:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4481,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1679:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4484,
"indexed": true,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4488,
"src": "1715:29:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4483,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1715:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4486,
"indexed": false,
"name": "newRate",
"nodeType": "VariableDeclaration",
"scope": 4488,
"src": "1754:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4485,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1754:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1669:106:9"
},
"src": "1644:132:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4494,
"name": "ExchangeActivated",
"nodeType": "EventDefinition",
"parameters": {
"id": 4493,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4490,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4494,
"src": "1815:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4489,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1815:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4492,
"indexed": true,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4494,
"src": "1851:29:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4491,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1851:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1805:81:9"
},
"src": "1782:105:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4500,
"name": "ExchangeDeactivated",
"nodeType": "EventDefinition",
"parameters": {
"id": 4499,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4496,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4500,
"src": "1928:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4495,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1928:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4498,
"indexed": true,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4500,
"src": "1964:29:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4497,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1964:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1918:81:9"
},
"src": "1893:107:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4510,
"name": "Swapped",
"nodeType": "EventDefinition",
"parameters": {
"id": 4509,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4502,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2029:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4501,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "2029:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4504,
"indexed": true,
"name": "by",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2065:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4503,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2065:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4506,
"indexed": false,
"name": "baseTokenSwappedAmount",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2093:30:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4505,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2093:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4508,
"indexed": false,
"name": "dataTokenSwappedAmount",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2133:30:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4507,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2133:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2019:150:9"
},
"src": "2006:164:9"
},
{
"body": {
"id": 4604,
"nodeType": "Block",
"src": "2636:1294:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4524,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4520,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "2667:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 4522,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2688:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 4521,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2680:7:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 4523,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2680:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "2667:23:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642062617365746f6b656e2c20207a65726f2061646472657373",
"id": 4525,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2704:53:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9e4f79921714a9bf5dc580585dc440da8f598ce27caa8d87778cb9493126de16",
"typeString": "literal_string \"FixedRateExchange: Invalid basetoken, zero address\""
},
"value": "FixedRateExchange: Invalid basetoken, zero address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9e4f79921714a9bf5dc580585dc440da8f598ce27caa8d87778cb9493126de16",
"typeString": "literal_string \"FixedRateExchange: Invalid basetoken, zero address\""
}
],
"id": 4519,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "2646:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4526,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2646:121:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4527,
"nodeType": "ExpressionStatement",
"src": "2646:121:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4533,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4529,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "2798:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 4531,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2819:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 4530,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2811:7:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 4532,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2811:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "2798:23:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c20207a65726f2061646472657373",
"id": 4534,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2835:53:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c4a0d6c9d74c4e7b7eb600c681c94f357f46a1a17500afc03636322ac0a63c22",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, zero address\""
},
"value": "FixedRateExchange: Invalid datatoken, zero address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c4a0d6c9d74c4e7b7eb600c681c94f357f46a1a17500afc03636322ac0a63c22",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, zero address\""
}
],
"id": 4528,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "2777:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4535,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2777:121:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4536,
"nodeType": "ExpressionStatement",
"src": "2777:121:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4540,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4538,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "2929:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"id": 4539,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "2942:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "2929:22:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c2020657175616c732062617365746f6b656e",
"id": 4541,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2965:57:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_8088a8876b7d943bb58f3202d91bc395f378f8d33e9c768b1a854016f72d0175",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, equals basetoken\""
},
"value": "FixedRateExchange: Invalid datatoken, equals basetoken"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_8088a8876b7d943bb58f3202d91bc395f378f8d33e9c768b1a854016f72d0175",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, equals basetoken\""
}
],
"id": 4537,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "2908:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4542,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2908:124:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4543,
"nodeType": "ExpressionStatement",
"src": "2908:124:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4547,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4545,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4516,
"src": "3063:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4546,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3076:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "3063:14:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642065786368616e676520726174652076616c7565",
"id": 4548,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3092:48:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_049c41558b20e3ef0c501ffa5f229a463d9c10ba2b6e269ac1d736dfd92adbc2",
"typeString": "literal_string \"FixedRateExchange: Invalid exchange rate value\""
},
"value": "FixedRateExchange: Invalid exchange rate value"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_049c41558b20e3ef0c501ffa5f229a463d9c10ba2b6e269ac1d736dfd92adbc2",
"typeString": "literal_string \"FixedRateExchange: Invalid exchange rate value\""
}
],
"id": 4544,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "3042:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4549,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3042:108:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4550,
"nodeType": "ExpressionStatement",
"src": "3042:108:9"
},
{
"assignments": [
4552
],
"declarations": [
{
"constant": false,
"id": 4552,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4604,
"src": "3160:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4551,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "3160:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4559,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4554,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "3213:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4555,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "3236:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4556,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3259:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4557,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3259:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4553,
"name": "generateExchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4626,
"src": "3181:18:9",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$_t_address_$returns$_t_bytes32_$",
"typeString": "function (address,address,address) pure returns (bytes32)"
}
},
"id": 4558,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3181:98:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "3160:119:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4566,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4561,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "3310:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4563,
"indexExpression": {
"argumentTypes": null,
"id": 4562,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3320:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "3310:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4564,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "3310:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4565,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3345:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "3310:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a2045786368616e676520616c72656164792065786973747321",
"id": 4567,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3360:45:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_4cbdfa87b7259677de1d4b2bb2aef7a46adf4ea65536670792826c014ead7938",
"typeString": "literal_string \"FixedRateExchange: Exchange already exists!\""
},
"value": "FixedRateExchange: Exchange already exists!"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_4cbdfa87b7259677de1d4b2bb2aef7a46adf4ea65536670792826c014ead7938",
"typeString": "literal_string \"FixedRateExchange: Exchange already exists!\""
}
],
"id": 4560,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "3289:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4568,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3289:126:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4569,
"nodeType": "ExpressionStatement",
"src": "3289:126:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4581,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4570,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "3425:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4572,
"indexExpression": {
"argumentTypes": null,
"id": 4571,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3435:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "3425:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "74727565",
"id": 4574,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3480:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4575,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3513:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4576,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3513:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4577,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "3548:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4578,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "3582:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4579,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4516,
"src": "3616:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4573,
"name": "Exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4421,
"src": "3449:8:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_Exchange_$4421_storage_ptr_$",
"typeString": "type(struct FixedRateExchange.Exchange storage pointer)"
}
},
"id": 4580,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "structConstructorCall",
"lValueRequested": false,
"names": [
"active",
"exchangeOwner",
"dataToken",
"baseToken",
"fixedRate"
],
"nodeType": "FunctionCall",
"src": "3449:187:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"src": "3425:211:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4582,
"nodeType": "ExpressionStatement",
"src": "3425:211:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4586,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3663:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"expression": {
"argumentTypes": null,
"id": 4583,
"name": "exchangeIds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4428,
"src": "3646:11:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[] storage ref"
}
},
"id": 4585,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3646:16:9",
"typeDescriptions": {
"typeIdentifier": "t_function_arraypush_nonpayable$_t_bytes32_$returns$_t_uint256_$",
"typeString": "function (bytes32) returns (uint256)"
}
},
"id": 4587,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3646:28:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4588,
"nodeType": "ExpressionStatement",
"src": "3646:28:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4590,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3719:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 4591,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "3743:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4592,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "3766:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4593,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3789:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4594,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3789:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4595,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4516,
"src": "3813:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4589,
"name": "ExchangeCreated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4480,
"src": "3690:15:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (bytes32,address,address,address,uint256)"
}
},
"id": 4596,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3690:142:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4597,
"nodeType": "EmitStatement",
"src": "3685:147:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4599,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3879:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4600,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3903:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4601,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3903:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4598,
"name": "ExchangeActivated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4494,
"src": "3848:17:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (bytes32,address)"
}
},
"id": 4602,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3848:75:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4603,
"nodeType": "EmitStatement",
"src": "3843:80:9"
}
]
},
"documentation": "@dev create\n creates new exchange pairs between base token\n (ocean token) and data tokens.\n@param baseToken refers to a ocean token contract address\n@param dataToken refers to a data token contract address\n@param fixedRate refers to the exact fixed exchange rate in wei",
"id": 4605,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "create",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4517,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4512,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4605,
"src": "2537:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4511,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2537:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4514,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4605,
"src": "2564:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4513,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2564:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4516,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4605,
"src": "2591:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4515,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2591:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2527:87:9"
},
"returnParameters": {
"id": 4518,
"nodeType": "ParameterList",
"parameters": [],
"src": "2636:0:9"
},
"scope": 4962,
"src": "2512:1418:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4625,
"nodeType": "Block",
"src": "4408:166:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4619,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4607,
"src": "4476:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4620,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4609,
"src": "4503:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4621,
"name": "exchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4611,
"src": "4530:13:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"id": 4617,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6520,
"src": "4448:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 4618,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encode",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "4448:10:9",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$",
"typeString": "function () pure returns (bytes memory)"
}
},
"id": 4622,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4448:109:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 4616,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6527,
"src": "4425:9:9",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 4623,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4425:142:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"functionReturnParameters": 4615,
"id": 4624,
"nodeType": "Return",
"src": "4418:149:9"
}
]
},
"documentation": "@dev generateExchangeId\n creates unique exchange identifier for two token pairs.\n@param baseToken refers to a ocean token contract address\n@param dataToken refers to a data token contract address\n@param exchangeOwner exchange owner address",
"id": 4626,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "generateExchangeId",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4612,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4607,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4268:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4606,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4268:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4609,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4295:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4608,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4295:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4611,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4322:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4610,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4322:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4258:91:9"
},
"returnParameters": {
"id": 4615,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4614,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4395:7:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4613,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "4395:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4394:9:9"
},
"scope": 4962,
"src": "4231:343:9",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 4651,
"nodeType": "Block",
"src": "5072:110:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4649,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4638,
"name": "baseTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4636,
"src": "5082:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4647,
"name": "BASE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4410,
"src": "5170:4:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4641,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "5133:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4643,
"indexExpression": {
"argumentTypes": null,
"id": 4642,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4628,
"src": "5143:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5133:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4644,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "5133:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 4639,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4630,
"src": "5100:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4640,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 5843,
"src": "5100:19:9",
"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": 4645,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5100:65:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4646,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "div",
"nodeType": "MemberAccess",
"referencedDeclaration": 5859,
"src": "5100:69:9",
"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": 4648,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5100:75:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5082:93:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4650,
"nodeType": "ExpressionStatement",
"src": "5082:93:9"
}
]
},
"documentation": "@dev CalcInGivenOut\n Calculates how many basetokens are needed to get specifyed amount of datatokens\n@param exchangeId a unique exchange idnetifier \n@param dataTokenAmount the amount of data tokens to be exchanged",
"id": 4652,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4633,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4628,
"src": "5005:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4634,
"modifierName": {
"argumentTypes": null,
"id": 4632,
"name": "onlyActiveExchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4451,
"src": "4973:18:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "4973:52:9"
}
],
"name": "CalcInGivenOut",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4631,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4628,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4652,
"src": "4879:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4627,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "4879:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4630,
"name": "dataTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4652,
"src": "4907:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4629,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4907:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4869:67:9"
},
"returnParameters": {
"id": 4637,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4636,
"name": "baseTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4652,
"src": "5043:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4635,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5043:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5042:25:9"
},
"scope": 4962,
"src": "4846:336:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 4722,
"nodeType": "Block",
"src": "5583:960:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4665,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4663,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "5614:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4664,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5633:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "5614:20:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a207a65726f206461746120746f6b656e20616d6f756e74",
"id": 4666,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5648:43:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_d2b293ef72dfab6f705b22246c532786cca882499f3fba3ae8114dc40951c5bc",
"typeString": "literal_string \"FixedRateExchange: zero data token amount\""
},
"value": "FixedRateExchange: zero data token amount"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_d2b293ef72dfab6f705b22246c532786cca882499f3fba3ae8114dc40951c5bc",
"typeString": "literal_string \"FixedRateExchange: zero data token amount\""
}
],
"id": 4662,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "5593:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4667,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5593:108:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4668,
"nodeType": "ExpressionStatement",
"src": "5593:108:9"
},
{
"assignments": [
4670
],
"declarations": [
{
"constant": false,
"id": 4670,
"name": "baseTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4722,
"src": "5711:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4669,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5711:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4675,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4672,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5752:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 4673,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "5763:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4671,
"name": "CalcInGivenOut",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4652,
"src": "5737:14:9",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (bytes32,uint256) view returns (uint256)"
}
},
"id": 4674,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5737:42:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5711:68:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4684,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "5888:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4685,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "5888:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4686,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "5916:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4688,
"indexExpression": {
"argumentTypes": null,
"id": 4687,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5926:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5916:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4689,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "5916:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4690,
"name": "baseTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4670,
"src": "5969:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4678,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "5825:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4680,
"indexExpression": {
"argumentTypes": null,
"id": 4679,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5835:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5825:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4681,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "baseToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4418,
"src": "5825:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4677,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "5810:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4682,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5810:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4683,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transferFrom",
"nodeType": "MemberAccess",
"referencedDeclaration": 5045,
"src": "5810:60:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,address,uint256) external returns (bool)"
}
},
"id": 4691,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5810:188:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652062617365546f6b656e20636f6e7472616374",
"id": 4692,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6012:66:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_704d230adb0aeaaf731cbfcd3f10c77132039a7e2520db77d561e3ebcc5b16b9",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the baseToken contract\""
},
"value": "FixedRateExchange: transferFrom failed in the baseToken contract"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_704d230adb0aeaaf731cbfcd3f10c77132039a7e2520db77d561e3ebcc5b16b9",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the baseToken contract\""
}
],
"id": 4676,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "5789:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4693,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5789:299:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4694,
"nodeType": "ExpressionStatement",
"src": "5789:299:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4703,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "6197:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4705,
"indexExpression": {
"argumentTypes": null,
"id": 4704,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "6207:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6197:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4706,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "6197:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4707,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "6250:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4708,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "6250:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4709,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "6278:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4697,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "6134:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4699,
"indexExpression": {
"argumentTypes": null,
"id": 4698,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "6144:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6134:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4700,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "6134:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4696,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "6119:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4701,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6119:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4702,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transferFrom",
"nodeType": "MemberAccess",
"referencedDeclaration": 5045,
"src": "6119:60:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,address,uint256) external returns (bool)"
}
},
"id": 4710,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6119:188:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652064617461546f6b656e20636f6e7472616374",
"id": 4711,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6321:66:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c05b0f5b41acd20d6ba43aff2e398e9afe8f1d66a0a38aeff2f84a7867e95310",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the dataToken contract\""
},
"value": "FixedRateExchange: transferFrom failed in the dataToken contract"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c05b0f5b41acd20d6ba43aff2e398e9afe8f1d66a0a38aeff2f84a7867e95310",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the dataToken contract\""
}
],
"id": 4695,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "6098:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4712,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6098:299:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4713,
"nodeType": "ExpressionStatement",
"src": "6098:299:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4715,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "6434:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4716,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "6458:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4717,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "6458:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4718,
"name": "baseTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4670,
"src": "6482:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 4719,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "6511:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4714,
"name": "Swapped",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4510,
"src": "6413:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (bytes32,address,uint256,uint256)"
}
},
"id": 4720,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6413:123:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4721,
"nodeType": "EmitStatement",
"src": "6408:128:9"
}
]
},
"documentation": "@dev swap\n atomic swap between two registered fixed rate exchange.\n@param exchangeId a unique exchange idnetifier \n@param dataTokenAmount the amount of data tokens to be exchanged",
"id": 4723,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4659,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5558:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4660,
"modifierName": {
"argumentTypes": null,
"id": 4658,
"name": "onlyActiveExchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4451,
"src": "5526:18:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "5526:52:9"
}
],
"name": "swap",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4657,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4654,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4723,
"src": "5443:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4653,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "5443:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4656,
"name": "dataTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4723,
"src": "5471:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4655,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5471:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5433:67:9"
},
"returnParameters": {
"id": 4661,
"nodeType": "ParameterList",
"parameters": [],
"src": "5583:0:9"
},
"scope": 4962,
"src": "5420:1123:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4731,
"nodeType": "Block",
"src": "6803:42:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4728,
"name": "exchangeIds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4428,
"src": "6820:11:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[] storage ref"
}
},
"id": 4729,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "6820:18:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 4727,
"id": 4730,
"nodeType": "Return",
"src": "6813:25:9"
}
]
},
"documentation": "@dev getNumberOfExchanges\n gets the total number of registered exchanges\n@return total number of registered exchange IDs",
"id": 4732,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getNumberOfExchanges",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4724,
"nodeType": "ParameterList",
"parameters": [],
"src": "6740:2:9"
},
"returnParameters": {
"id": 4727,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4726,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4732,
"src": "6790:7:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4725,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6790:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "6789:9:9"
},
"scope": 4962,
"src": "6711:134:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4763,
"nodeType": "Block",
"src": "7186:276:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4745,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4743,
"name": "newRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4736,
"src": "7217:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4744,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7228:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "7217:12:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20526174696f206d757374206265203e30",
"id": 4746,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7243:37:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_36101f33c85b5f047dc985e5d24ae3bcf32f1d4b0a57ccd6a8c04d1cc8672d12",
"typeString": "literal_string \"FixedRateExchange: Ratio must be >0\""
},
"value": "FixedRateExchange: Ratio must be >0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_36101f33c85b5f047dc985e5d24ae3bcf32f1d4b0a57ccd6a8c04d1cc8672d12",
"typeString": "literal_string \"FixedRateExchange: Ratio must be >0\""
}
],
"id": 4742,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "7196:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4747,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7196:94:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4748,
"nodeType": "ExpressionStatement",
"src": "7196:94:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4754,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4749,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7301:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4751,
"indexExpression": {
"argumentTypes": null,
"id": 4750,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4734,
"src": "7311:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7301:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4752,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "7301:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 4753,
"name": "newRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4736,
"src": "7335:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "7301:41:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4755,
"nodeType": "ExpressionStatement",
"src": "7301:41:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4757,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4734,
"src": "7390:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4758,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "7414:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4759,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "7414:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4760,
"name": "newRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4736,
"src": "7438:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4756,
"name": "ExchangeRateChanged",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4488,
"src": "7357:19:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (bytes32,address,uint256)"
}
},
"id": 4761,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7357:98:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4762,
"nodeType": "EmitStatement",
"src": "7352:103:9"
}
]
},
"documentation": "@dev setRate\n changes the fixed rate for an exchange with a new rate\n@param exchangeId a unique exchange idnetifier\n@param newRate new fixed rate value",
"id": 4764,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4739,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4734,
"src": "7170:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4740,
"modifierName": {
"argumentTypes": null,
"id": 4738,
"name": "onlyExchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4468,
"src": "7152:17:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "7152:29:9"
}
],
"name": "setRate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4737,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4734,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4764,
"src": "7077:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4733,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "7077:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4736,
"name": "newRate",
"nodeType": "VariableDeclaration",
"scope": 4764,
"src": "7105:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4735,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7105:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7067:59:9"
},
"returnParameters": {
"id": 4741,
"nodeType": "ParameterList",
"parameters": [],
"src": "7186:0:9"
},
"scope": 4962,
"src": "7051:411:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4805,
"nodeType": "Block",
"src": "7754:389:9",
"statements": [
{
"condition": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4772,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7767:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4774,
"indexExpression": {
"argumentTypes": null,
"id": 4773,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7777:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7767:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4775,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "7767:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 4803,
"nodeType": "Block",
"src": "7971:166:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4795,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4790,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7985:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4792,
"indexExpression": {
"argumentTypes": null,
"id": 4791,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7995:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7985:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4793,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "7985:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 4794,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8016:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "7985:35:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 4796,
"nodeType": "ExpressionStatement",
"src": "7985:35:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4798,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "8074:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4799,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "8102:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4800,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "8102:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4797,
"name": "ExchangeActivated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4494,
"src": "8039:17:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (bytes32,address)"
}
},
"id": 4801,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8039:87:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4802,
"nodeType": "EmitStatement",
"src": "8034:92:9"
}
]
},
"id": 4804,
"nodeType": "IfStatement",
"src": "7764:373:9",
"trueBody": {
"id": 4789,
"nodeType": "Block",
"src": "7796:169:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4781,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4776,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7810:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4778,
"indexExpression": {
"argumentTypes": null,
"id": 4777,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7820:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7810:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4779,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "7810:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 4780,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7841:5:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "7810:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 4782,
"nodeType": "ExpressionStatement",
"src": "7810:36:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4784,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7902:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4785,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "7930:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4786,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "7930:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4783,
"name": "ExchangeDeactivated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4500,
"src": "7865:19:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (bytes32,address)"
}
},
"id": 4787,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7865:89:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4788,
"nodeType": "EmitStatement",
"src": "7860:94:9"
}
]
}
}
]
},
"documentation": "@dev toggleExchangeState\n toggles the active state of an existing exchange\n@param exchangeId a unique exchange idnetifier",
"id": 4806,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4769,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7738:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4770,
"modifierName": {
"argumentTypes": null,
"id": 4768,
"name": "onlyExchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4468,
"src": "7720:17:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "7720:29:9"
}
],
"name": "toggleExchangeState",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4767,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4766,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4806,
"src": "7670:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4765,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "7670:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7660:34:9"
},
"returnParameters": {
"id": 4771,
"nodeType": "ParameterList",
"parameters": [],
"src": "7754:0:9"
},
"scope": 4962,
"src": "7632:511:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4818,
"nodeType": "Block",
"src": "8437:55:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4813,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8454:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4815,
"indexExpression": {
"argumentTypes": null,
"id": 4814,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4808,
"src": "8464:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8454:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4816,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "8454:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 4812,
"id": 4817,
"nodeType": "Return",
"src": "8447:38:9"
}
]
},
"documentation": "@dev getRate\n gets the current fixed rate for an exchange\n@param exchangeId a unique exchange idnetifier\n@return fixed rate value",
"id": 4819,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getRate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4809,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4808,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4819,
"src": "8353:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4807,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "8353:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8343:34:9"
},
"returnParameters": {
"id": 4812,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4811,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4819,
"src": "8424:7:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4810,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "8424:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8423:9:9"
},
"scope": 4962,
"src": "8327:165:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4883,
"nodeType": "Block",
"src": "8792:532:9",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 4831,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4826,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8805:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4828,
"indexExpression": {
"argumentTypes": null,
"id": 4827,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "8815:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8805:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4829,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "8805:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 4830,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8837:5:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "8805:37:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 4881,
"nodeType": "Block",
"src": "8881:437:9",
"statements": [
{
"assignments": [
4837
],
"declarations": [
{
"constant": false,
"id": 4837,
"name": "balance",
"nodeType": "VariableDeclaration",
"scope": 4881,
"src": "8895:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4836,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "8895:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4850,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4845,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8988:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4847,
"indexExpression": {
"argumentTypes": null,
"id": 4846,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "8998:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8988:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4848,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "8988:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4839,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8928:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4841,
"indexExpression": {
"argumentTypes": null,
"id": 4840,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "8938:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8928:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4842,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "8928:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4838,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "8913:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4843,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8913:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4844,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 5052,
"src": "8913:74:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 4849,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8913:111:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "8895:129:9"
},
{
"assignments": [
4852
],
"declarations": [
{
"constant": false,
"id": 4852,
"name": "allowance",
"nodeType": "VariableDeclaration",
"scope": 4881,
"src": "9038:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4851,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9038:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4868,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4860,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "9133:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4862,
"indexExpression": {
"argumentTypes": null,
"id": 4861,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "9143:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "9133:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4863,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "9133:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4865,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6579,
"src": "9178:4:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_FixedRateExchange_$4962",
"typeString": "contract FixedRateExchange"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_FixedRateExchange_$4962",
"typeString": "contract FixedRateExchange"
}
],
"id": 4864,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "9170:7:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 4866,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9170:13:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4854,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "9073:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4856,
"indexExpression": {
"argumentTypes": null,
"id": 4855,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "9083:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "9073:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4857,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "9073:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4853,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "9058:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4858,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9058:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4859,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "allowance",
"nodeType": "MemberAccess",
"referencedDeclaration": 5034,
"src": "9058:74:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$",
"typeString": "function (address,address) view external returns (uint256)"
}
},
"id": 4867,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9058:126:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "9038:146:9"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4871,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4869,
"name": "balance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4837,
"src": "9201:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 4870,
"name": "allowance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4852,
"src": "9211:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9201:19:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"expression": {
"argumentTypes": null,
"id": 4878,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4876,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4824,
"src": "9289:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 4877,
"name": "allowance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4852,
"src": "9298:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9289:18:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4879,
"nodeType": "ExpressionStatement",
"src": "9289:18:9"
},
"id": 4880,
"nodeType": "IfStatement",
"src": "9198:109:9",
"trueBody": {
"expression": {
"argumentTypes": null,
"id": 4874,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4872,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4824,
"src": "9238:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 4873,
"name": "balance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4837,
"src": "9247:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9238:16:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4875,
"nodeType": "ExpressionStatement",
"src": "9238:16:9"
}
}
]
},
"id": 4882,
"nodeType": "IfStatement",
"src": "8802:516:9",
"trueBody": {
"expression": {
"argumentTypes": null,
"id": 4834,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4832,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4824,
"src": "8856:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "30",
"id": 4833,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8865:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "8856:10:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4835,
"nodeType": "ExpressionStatement",
"src": "8856:10:9"
}
}
]
},
"documentation": "@dev getSupply\n gets the current supply of datatokens in an fixed\n rate exchagne\n@param exchangeId the exchange ID\n@return supply",
"id": 4884,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getSupply",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4822,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4821,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4884,
"src": "8707:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4820,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "8707:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8706:20:9"
},
"returnParameters": {
"id": 4825,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4824,
"name": "supply",
"nodeType": "VariableDeclaration",
"scope": 4884,
"src": "8772:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4823,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "8772:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8771:16:9"
},
"scope": 4962,
"src": "8688:636:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 4938,
"nodeType": "Block",
"src": "10039:307:9",
"statements": [
{
"assignments": [
4902
],
"declarations": [
{
"constant": false,
"id": 4902,
"name": "exchange",
"nodeType": "VariableDeclaration",
"scope": 4938,
"src": "10049:24:9",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange"
},
"typeName": {
"contractScope": null,
"id": 4901,
"name": "Exchange",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4421,
"src": "10049:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage_ptr",
"typeString": "struct FixedRateExchange.Exchange"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4906,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4903,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "10076:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4905,
"indexExpression": {
"argumentTypes": null,
"id": 4904,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4886,
"src": "10086:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10076:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "10049:48:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4910,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4907,
"name": "exchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4889,
"src": "10107:13:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4908,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10123:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4909,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "10123:22:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "10107:38:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 4911,
"nodeType": "ExpressionStatement",
"src": "10107:38:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4915,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4912,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4891,
"src": "10155:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4913,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10167:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4914,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "10167:18:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "10155:30:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 4916,
"nodeType": "ExpressionStatement",
"src": "10155:30:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4920,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4917,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4893,
"src": "10195:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4918,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10207:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4919,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "baseToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4418,
"src": "10207:18:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "10195:30:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 4921,
"nodeType": "ExpressionStatement",
"src": "10195:30:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4925,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4922,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4895,
"src": "10235:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4923,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10247:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4924,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "10247:18:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10235:30:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4926,
"nodeType": "ExpressionStatement",
"src": "10235:30:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4930,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4927,
"name": "active",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4897,
"src": "10275:6:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4928,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10284:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4929,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "10284:15:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "10275:24:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 4931,
"nodeType": "ExpressionStatement",
"src": "10275:24:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4936,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4932,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4899,
"src": "10309:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4934,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4886,
"src": "10328:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 4933,
"name": "getSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4884,
"src": "10318:9:9",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$",
"typeString": "function (bytes32) view returns (uint256)"
}
},
"id": 4935,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10318:21:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10309:30:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4937,
"nodeType": "ExpressionStatement",
"src": "10309:30:9"
}
]
},
"documentation": "@dev getExchange\n gets all the exchange details\n@param exchangeId a unique exchange idnetifier\n@return all the exchange details including the exchange Owner\n the dataToken contract address, the base token address, the \n fixed rate, whether the exchange is active and the supply or the \n the current data token liquidity.",
"id": 4939,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getExchange",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4887,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4886,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9772:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4885,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "9772:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9762:34:9"
},
"returnParameters": {
"id": 4900,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4889,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9857:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4888,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9857:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4891,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9892:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4890,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9892:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4893,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9923:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4892,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9923:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4895,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9954:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4894,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9954:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4897,
"name": "active",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9985:11:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4896,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "9985:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4899,
"name": "supply",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "10010:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4898,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "10010:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9843:191:9"
},
"scope": 4962,
"src": "9742:604:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4947,
"nodeType": "Block",
"src": "10581:35:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4945,
"name": "exchangeIds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4428,
"src": "10598:11:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[] storage ref"
}
},
"functionReturnParameters": 4944,
"id": 4946,
"nodeType": "Return",
"src": "10591:18:9"
}
]
},
"documentation": "@dev getExchanges\n gets all the exchanges list\n@return a list of all registered exchange Ids",
"id": 4948,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getExchanges",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4940,
"nodeType": "ParameterList",
"parameters": [],
"src": "10507:2:9"
},
"returnParameters": {
"id": 4944,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4943,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4948,
"src": "10559:16:9",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 4941,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "10559:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 4942,
"length": null,
"nodeType": "ArrayTypeName",
"src": "10559:9:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "10558:18:9"
},
"scope": 4962,
"src": "10486:130:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4960,
"nodeType": "Block",
"src": "10933:52:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4955,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "10950:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4957,
"indexExpression": {
"argumentTypes": null,
"id": 4956,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4950,
"src": "10960:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10950:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4958,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "10950:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 4954,
"id": 4959,
"nodeType": "Return",
"src": "10943:35:9"
}
]
},
"documentation": "@dev isActive\n checks whether exchange is active\n@param exchangeId a unique exchange idnetifier\n@return true if exchange is true, otherwise returns false",
"id": 4961,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isActive",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4951,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4950,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4961,
"src": "10851:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4949,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "10851:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "10841:34:9"
},
"returnParameters": {
"id": 4954,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4953,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4961,
"src": "10923:4:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4952,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "10923:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "10922:6:9"
},
"scope": 4962,
"src": "10824:161:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 4963,
"src": "530:10457:9"
}
],
"src": "0:10988:9"
},
"legacyAST": {
"absolutePath": "/ocean/ocean-contracts/contracts/fixedRate/FixedRateExchange.sol",
"exportedSymbols": {
"FixedRateExchange": [
4962
]
},
"id": 4963,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4400,
"literals": [
"solidity",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "0:22:9"
},
{
"absolutePath": "/ocean/ocean-contracts/contracts/interfaces/IERC20Template.sol",
"file": "../interfaces/IERC20Template.sol",
"id": 4401,
"nodeType": "ImportDirective",
"scope": 4963,
"sourceUnit": 5071,
"src": "185:42:9",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"file": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"id": 4402,
"nodeType": "ImportDirective",
"scope": 4963,
"sourceUnit": 5927,
"src": "228:59:9",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@title FixedRateExchange\n@dev FixedRateExchange is a fixed rate exchange Contract\n Marketplaces uses this contract to allow consumers \n exchanging datatokens with ocean token using a fixed \n exchange rate.",
"fullyImplemented": true,
"id": 4962,
"linearizedBaseContracts": [
4962
],
"name": "FixedRateExchange",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 4405,
"libraryName": {
"contractScope": null,
"id": 4403,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5926,
"src": "569:8:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$5926",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "563:27:9",
"typeName": {
"id": 4404,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "582:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"constant": true,
"id": 4410,
"name": "BASE",
"nodeType": "VariableDeclaration",
"scope": 4962,
"src": "595:40:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4406,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "595:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_rational_1000000000000000000_by_1",
"typeString": "int_const 1000000000000000000"
},
"id": 4409,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"hexValue": "3130",
"id": 4407,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "627:2:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_10_by_1",
"typeString": "int_const 10"
},
"value": "10"
},
"nodeType": "BinaryOperation",
"operator": "**",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3138",
"id": 4408,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "633:2:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_18_by_1",
"typeString": "int_const 18"
},
"value": "18"
},
"src": "627:8:9",
"typeDescriptions": {
"typeIdentifier": "t_rational_1000000000000000000_by_1",
"typeString": "int_const 1000000000000000000"
}
},
"visibility": "private"
},
{
"canonicalName": "FixedRateExchange.Exchange",
"id": 4421,
"members": [
{
"constant": false,
"id": 4412,
"name": "active",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "667:11:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4411,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "667:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4414,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "688:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4413,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "688:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4416,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "719:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4415,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "719:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4418,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "746:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4417,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "746:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4420,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4421,
"src": "773:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4419,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "773:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Exchange",
"nodeType": "StructDefinition",
"scope": 4962,
"src": "641:156:9",
"visibility": "public"
},
{
"constant": false,
"id": 4425,
"name": "exchanges",
"nodeType": "VariableDeclaration",
"scope": 4962,
"src": "844:46:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange)"
},
"typeName": {
"id": 4424,
"keyType": {
"id": 4422,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "852:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Mapping",
"src": "844:28:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange)"
},
"valueType": {
"contractScope": null,
"id": 4423,
"name": "Exchange",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4421,
"src": "863:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage_ptr",
"typeString": "struct FixedRateExchange.Exchange"
}
}
},
"value": null,
"visibility": "private"
},
{
"constant": false,
"id": 4428,
"name": "exchangeIds",
"nodeType": "VariableDeclaration",
"scope": 4962,
"src": "896:29:9",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 4426,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "896:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 4427,
"length": null,
"nodeType": "ArrayTypeName",
"src": "896:9:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"value": null,
"visibility": "private"
},
{
"body": {
"id": 4450,
"nodeType": "Block",
"src": "998:206:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 4445,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4438,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4433,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "1029:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4435,
"indexExpression": {
"argumentTypes": null,
"id": 4434,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4430,
"src": "1039:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1029:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4436,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "1029:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4437,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1064:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1029:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 4444,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4439,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "1081:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4441,
"indexExpression": {
"argumentTypes": null,
"id": 4440,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4430,
"src": "1091:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1081:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4442,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "1081:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 4443,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1113:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "1081:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "1029:88:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a2045786368616e676520646f6573206e6f7420657869737421",
"id": 4446,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1131:45:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_33934cff4a0fa610a47c77876602b176c21576f21e0c00dbe89561d0224d4982",
"typeString": "literal_string \"FixedRateExchange: Exchange does not exist!\""
},
"value": "FixedRateExchange: Exchange does not exist!"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_33934cff4a0fa610a47c77876602b176c21576f21e0c00dbe89561d0224d4982",
"typeString": "literal_string \"FixedRateExchange: Exchange does not exist!\""
}
],
"id": 4432,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "1008:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4447,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1008:178:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4448,
"nodeType": "ExpressionStatement",
"src": "1008:178:9"
},
{
"id": 4449,
"nodeType": "PlaceholderStatement",
"src": "1196:1:9"
}
]
},
"documentation": null,
"id": 4451,
"name": "onlyActiveExchange",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 4431,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4430,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4451,
"src": "969:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4429,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "969:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "959:34:9"
},
"src": "932:272:9",
"visibility": "internal"
},
{
"body": {
"id": 4467,
"nodeType": "Block",
"src": "1275:165:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4462,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4456,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "1306:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4458,
"indexExpression": {
"argumentTypes": null,
"id": 4457,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4453,
"src": "1316:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1306:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4459,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "1306:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4460,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "1345:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4461,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1345:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "1306:49:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20696e76616c69642065786368616e6765206f776e6572",
"id": 4463,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1369:43:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_6953f2de142c64f34f94b55c4652873748f95f81c631ff9f1f451ebbfe788b37",
"typeString": "literal_string \"FixedRateExchange: invalid exchange owner\""
},
"value": "FixedRateExchange: invalid exchange owner"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_6953f2de142c64f34f94b55c4652873748f95f81c631ff9f1f451ebbfe788b37",
"typeString": "literal_string \"FixedRateExchange: invalid exchange owner\""
}
],
"id": 4455,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "1285:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4464,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1285:137:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4465,
"nodeType": "ExpressionStatement",
"src": "1285:137:9"
},
{
"id": 4466,
"nodeType": "PlaceholderStatement",
"src": "1432:1:9"
}
]
},
"documentation": null,
"id": 4468,
"name": "onlyExchangeOwner",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 4454,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4453,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4468,
"src": "1246:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4452,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1246:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1236:34:9"
},
"src": "1210:230:9",
"visibility": "internal"
},
{
"anonymous": false,
"documentation": null,
"id": 4480,
"name": "ExchangeCreated",
"nodeType": "EventDefinition",
"parameters": {
"id": 4479,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4470,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1477:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4469,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1477:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4472,
"indexed": true,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1513:25:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4471,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1513:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4474,
"indexed": true,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1548:25:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4473,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1548:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4476,
"indexed": false,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1583:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4475,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1583:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4478,
"indexed": false,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4480,
"src": "1614:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4477,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1614:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1467:170:9"
},
"src": "1446:192:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4488,
"name": "ExchangeRateChanged",
"nodeType": "EventDefinition",
"parameters": {
"id": 4487,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4482,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4488,
"src": "1679:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4481,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1679:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4484,
"indexed": true,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4488,
"src": "1715:29:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4483,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1715:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4486,
"indexed": false,
"name": "newRate",
"nodeType": "VariableDeclaration",
"scope": 4488,
"src": "1754:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4485,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1754:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1669:106:9"
},
"src": "1644:132:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4494,
"name": "ExchangeActivated",
"nodeType": "EventDefinition",
"parameters": {
"id": 4493,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4490,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4494,
"src": "1815:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4489,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1815:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4492,
"indexed": true,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4494,
"src": "1851:29:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4491,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1851:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1805:81:9"
},
"src": "1782:105:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4500,
"name": "ExchangeDeactivated",
"nodeType": "EventDefinition",
"parameters": {
"id": 4499,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4496,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4500,
"src": "1928:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4495,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1928:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4498,
"indexed": true,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4500,
"src": "1964:29:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4497,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1964:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1918:81:9"
},
"src": "1893:107:9"
},
{
"anonymous": false,
"documentation": null,
"id": 4510,
"name": "Swapped",
"nodeType": "EventDefinition",
"parameters": {
"id": 4509,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4502,
"indexed": true,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2029:26:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4501,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "2029:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4504,
"indexed": true,
"name": "by",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2065:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4503,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2065:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4506,
"indexed": false,
"name": "baseTokenSwappedAmount",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2093:30:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4505,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2093:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4508,
"indexed": false,
"name": "dataTokenSwappedAmount",
"nodeType": "VariableDeclaration",
"scope": 4510,
"src": "2133:30:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4507,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2133:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2019:150:9"
},
"src": "2006:164:9"
},
{
"body": {
"id": 4604,
"nodeType": "Block",
"src": "2636:1294:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4524,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4520,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "2667:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 4522,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2688:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 4521,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2680:7:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 4523,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2680:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "2667:23:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642062617365746f6b656e2c20207a65726f2061646472657373",
"id": 4525,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2704:53:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9e4f79921714a9bf5dc580585dc440da8f598ce27caa8d87778cb9493126de16",
"typeString": "literal_string \"FixedRateExchange: Invalid basetoken, zero address\""
},
"value": "FixedRateExchange: Invalid basetoken, zero address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9e4f79921714a9bf5dc580585dc440da8f598ce27caa8d87778cb9493126de16",
"typeString": "literal_string \"FixedRateExchange: Invalid basetoken, zero address\""
}
],
"id": 4519,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "2646:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4526,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2646:121:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4527,
"nodeType": "ExpressionStatement",
"src": "2646:121:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4533,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4529,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "2798:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 4531,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2819:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 4530,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2811:7:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 4532,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2811:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "2798:23:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c20207a65726f2061646472657373",
"id": 4534,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2835:53:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c4a0d6c9d74c4e7b7eb600c681c94f357f46a1a17500afc03636322ac0a63c22",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, zero address\""
},
"value": "FixedRateExchange: Invalid datatoken, zero address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c4a0d6c9d74c4e7b7eb600c681c94f357f46a1a17500afc03636322ac0a63c22",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, zero address\""
}
],
"id": 4528,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "2777:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4535,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2777:121:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4536,
"nodeType": "ExpressionStatement",
"src": "2777:121:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 4540,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4538,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "2929:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"id": 4539,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "2942:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "2929:22:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642064617461746f6b656e2c2020657175616c732062617365746f6b656e",
"id": 4541,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2965:57:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_8088a8876b7d943bb58f3202d91bc395f378f8d33e9c768b1a854016f72d0175",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, equals basetoken\""
},
"value": "FixedRateExchange: Invalid datatoken, equals basetoken"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_8088a8876b7d943bb58f3202d91bc395f378f8d33e9c768b1a854016f72d0175",
"typeString": "literal_string \"FixedRateExchange: Invalid datatoken, equals basetoken\""
}
],
"id": 4537,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "2908:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4542,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2908:124:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4543,
"nodeType": "ExpressionStatement",
"src": "2908:124:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4547,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4545,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4516,
"src": "3063:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4546,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3076:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "3063:14:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20496e76616c69642065786368616e676520726174652076616c7565",
"id": 4548,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3092:48:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_049c41558b20e3ef0c501ffa5f229a463d9c10ba2b6e269ac1d736dfd92adbc2",
"typeString": "literal_string \"FixedRateExchange: Invalid exchange rate value\""
},
"value": "FixedRateExchange: Invalid exchange rate value"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_049c41558b20e3ef0c501ffa5f229a463d9c10ba2b6e269ac1d736dfd92adbc2",
"typeString": "literal_string \"FixedRateExchange: Invalid exchange rate value\""
}
],
"id": 4544,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "3042:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4549,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3042:108:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4550,
"nodeType": "ExpressionStatement",
"src": "3042:108:9"
},
{
"assignments": [
4552
],
"declarations": [
{
"constant": false,
"id": 4552,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4604,
"src": "3160:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4551,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "3160:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4559,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4554,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "3213:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4555,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "3236:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4556,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3259:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4557,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3259:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4553,
"name": "generateExchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4626,
"src": "3181:18:9",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$_t_address_$returns$_t_bytes32_$",
"typeString": "function (address,address,address) pure returns (bytes32)"
}
},
"id": 4558,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3181:98:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "3160:119:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4566,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4561,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "3310:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4563,
"indexExpression": {
"argumentTypes": null,
"id": 4562,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3320:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "3310:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4564,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "3310:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4565,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3345:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "3310:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a2045786368616e676520616c72656164792065786973747321",
"id": 4567,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3360:45:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_4cbdfa87b7259677de1d4b2bb2aef7a46adf4ea65536670792826c014ead7938",
"typeString": "literal_string \"FixedRateExchange: Exchange already exists!\""
},
"value": "FixedRateExchange: Exchange already exists!"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_4cbdfa87b7259677de1d4b2bb2aef7a46adf4ea65536670792826c014ead7938",
"typeString": "literal_string \"FixedRateExchange: Exchange already exists!\""
}
],
"id": 4560,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "3289:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4568,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3289:126:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4569,
"nodeType": "ExpressionStatement",
"src": "3289:126:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4581,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4570,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "3425:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4572,
"indexExpression": {
"argumentTypes": null,
"id": 4571,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3435:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "3425:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "74727565",
"id": 4574,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3480:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4575,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3513:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4576,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3513:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4577,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "3548:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4578,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "3582:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4579,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4516,
"src": "3616:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4573,
"name": "Exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4421,
"src": "3449:8:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_Exchange_$4421_storage_ptr_$",
"typeString": "type(struct FixedRateExchange.Exchange storage pointer)"
}
},
"id": 4580,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "structConstructorCall",
"lValueRequested": false,
"names": [
"active",
"exchangeOwner",
"dataToken",
"baseToken",
"fixedRate"
],
"nodeType": "FunctionCall",
"src": "3449:187:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"src": "3425:211:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4582,
"nodeType": "ExpressionStatement",
"src": "3425:211:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4586,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3663:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"expression": {
"argumentTypes": null,
"id": 4583,
"name": "exchangeIds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4428,
"src": "3646:11:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[] storage ref"
}
},
"id": 4585,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3646:16:9",
"typeDescriptions": {
"typeIdentifier": "t_function_arraypush_nonpayable$_t_bytes32_$returns$_t_uint256_$",
"typeString": "function (bytes32) returns (uint256)"
}
},
"id": 4587,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3646:28:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4588,
"nodeType": "ExpressionStatement",
"src": "3646:28:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4590,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3719:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 4591,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4512,
"src": "3743:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4592,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4514,
"src": "3766:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4593,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3789:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4594,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3789:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4595,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4516,
"src": "3813:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4589,
"name": "ExchangeCreated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4480,
"src": "3690:15:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (bytes32,address,address,address,uint256)"
}
},
"id": 4596,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3690:142:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4597,
"nodeType": "EmitStatement",
"src": "3685:147:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4599,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4552,
"src": "3879:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4600,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "3903:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4601,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3903:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4598,
"name": "ExchangeActivated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4494,
"src": "3848:17:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (bytes32,address)"
}
},
"id": 4602,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3848:75:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4603,
"nodeType": "EmitStatement",
"src": "3843:80:9"
}
]
},
"documentation": "@dev create\n creates new exchange pairs between base token\n (ocean token) and data tokens.\n@param baseToken refers to a ocean token contract address\n@param dataToken refers to a data token contract address\n@param fixedRate refers to the exact fixed exchange rate in wei",
"id": 4605,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "create",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4517,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4512,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4605,
"src": "2537:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4511,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2537:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4514,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4605,
"src": "2564:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4513,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2564:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4516,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4605,
"src": "2591:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4515,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2591:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2527:87:9"
},
"returnParameters": {
"id": 4518,
"nodeType": "ParameterList",
"parameters": [],
"src": "2636:0:9"
},
"scope": 4962,
"src": "2512:1418:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4625,
"nodeType": "Block",
"src": "4408:166:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4619,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4607,
"src": "4476:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4620,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4609,
"src": "4503:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4621,
"name": "exchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4611,
"src": "4530:13:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"id": 4617,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6520,
"src": "4448:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 4618,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encode",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "4448:10:9",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$",
"typeString": "function () pure returns (bytes memory)"
}
},
"id": 4622,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4448:109:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 4616,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6527,
"src": "4425:9:9",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 4623,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4425:142:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"functionReturnParameters": 4615,
"id": 4624,
"nodeType": "Return",
"src": "4418:149:9"
}
]
},
"documentation": "@dev generateExchangeId\n creates unique exchange identifier for two token pairs.\n@param baseToken refers to a ocean token contract address\n@param dataToken refers to a data token contract address\n@param exchangeOwner exchange owner address",
"id": 4626,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "generateExchangeId",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4612,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4607,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4268:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4606,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4268:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4609,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4295:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4608,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4295:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4611,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4322:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4610,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "4322:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4258:91:9"
},
"returnParameters": {
"id": 4615,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4614,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4626,
"src": "4395:7:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4613,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "4395:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4394:9:9"
},
"scope": 4962,
"src": "4231:343:9",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 4651,
"nodeType": "Block",
"src": "5072:110:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4649,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4638,
"name": "baseTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4636,
"src": "5082:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4647,
"name": "BASE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4410,
"src": "5170:4:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4641,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "5133:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4643,
"indexExpression": {
"argumentTypes": null,
"id": 4642,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4628,
"src": "5143:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5133:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4644,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "5133:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 4639,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4630,
"src": "5100:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4640,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "mul",
"nodeType": "MemberAccess",
"referencedDeclaration": 5843,
"src": "5100:19:9",
"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": 4645,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5100:65:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4646,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "div",
"nodeType": "MemberAccess",
"referencedDeclaration": 5859,
"src": "5100:69:9",
"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": 4648,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5100:75:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5082:93:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4650,
"nodeType": "ExpressionStatement",
"src": "5082:93:9"
}
]
},
"documentation": "@dev CalcInGivenOut\n Calculates how many basetokens are needed to get specifyed amount of datatokens\n@param exchangeId a unique exchange idnetifier \n@param dataTokenAmount the amount of data tokens to be exchanged",
"id": 4652,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4633,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4628,
"src": "5005:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4634,
"modifierName": {
"argumentTypes": null,
"id": 4632,
"name": "onlyActiveExchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4451,
"src": "4973:18:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "4973:52:9"
}
],
"name": "CalcInGivenOut",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4631,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4628,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4652,
"src": "4879:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4627,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "4879:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4630,
"name": "dataTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4652,
"src": "4907:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4629,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4907:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "4869:67:9"
},
"returnParameters": {
"id": 4637,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4636,
"name": "baseTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4652,
"src": "5043:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4635,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5043:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5042:25:9"
},
"scope": 4962,
"src": "4846:336:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 4722,
"nodeType": "Block",
"src": "5583:960:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4665,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4663,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "5614:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4664,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5633:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "5614:20:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a207a65726f206461746120746f6b656e20616d6f756e74",
"id": 4666,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5648:43:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_d2b293ef72dfab6f705b22246c532786cca882499f3fba3ae8114dc40951c5bc",
"typeString": "literal_string \"FixedRateExchange: zero data token amount\""
},
"value": "FixedRateExchange: zero data token amount"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_d2b293ef72dfab6f705b22246c532786cca882499f3fba3ae8114dc40951c5bc",
"typeString": "literal_string \"FixedRateExchange: zero data token amount\""
}
],
"id": 4662,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "5593:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4667,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5593:108:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4668,
"nodeType": "ExpressionStatement",
"src": "5593:108:9"
},
{
"assignments": [
4670
],
"declarations": [
{
"constant": false,
"id": 4670,
"name": "baseTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4722,
"src": "5711:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4669,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5711:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4675,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4672,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5752:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 4673,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "5763:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4671,
"name": "CalcInGivenOut",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4652,
"src": "5737:14:9",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (bytes32,uint256) view returns (uint256)"
}
},
"id": 4674,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5737:42:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "5711:68:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4684,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "5888:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4685,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "5888:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4686,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "5916:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4688,
"indexExpression": {
"argumentTypes": null,
"id": 4687,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5926:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5916:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4689,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "5916:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 4690,
"name": "baseTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4670,
"src": "5969:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4678,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "5825:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4680,
"indexExpression": {
"argumentTypes": null,
"id": 4679,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5835:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "5825:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4681,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "baseToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4418,
"src": "5825:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4677,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "5810:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4682,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5810:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4683,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transferFrom",
"nodeType": "MemberAccess",
"referencedDeclaration": 5045,
"src": "5810:60:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,address,uint256) external returns (bool)"
}
},
"id": 4691,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5810:188:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652062617365546f6b656e20636f6e7472616374",
"id": 4692,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6012:66:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_704d230adb0aeaaf731cbfcd3f10c77132039a7e2520db77d561e3ebcc5b16b9",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the baseToken contract\""
},
"value": "FixedRateExchange: transferFrom failed in the baseToken contract"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_704d230adb0aeaaf731cbfcd3f10c77132039a7e2520db77d561e3ebcc5b16b9",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the baseToken contract\""
}
],
"id": 4676,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "5789:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4693,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "5789:299:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4694,
"nodeType": "ExpressionStatement",
"src": "5789:299:9"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4703,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "6197:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4705,
"indexExpression": {
"argumentTypes": null,
"id": 4704,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "6207:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6197:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4706,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "6197:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4707,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "6250:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4708,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "6250:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4709,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "6278:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4697,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "6134:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4699,
"indexExpression": {
"argumentTypes": null,
"id": 4698,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "6144:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "6134:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4700,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "6134:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4696,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "6119:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4701,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6119:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4702,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transferFrom",
"nodeType": "MemberAccess",
"referencedDeclaration": 5045,
"src": "6119:60:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,address,uint256) external returns (bool)"
}
},
"id": 4710,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6119:188:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a207472616e7366657246726f6d206661696c656420696e207468652064617461546f6b656e20636f6e7472616374",
"id": 4711,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6321:66:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c05b0f5b41acd20d6ba43aff2e398e9afe8f1d66a0a38aeff2f84a7867e95310",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the dataToken contract\""
},
"value": "FixedRateExchange: transferFrom failed in the dataToken contract"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_c05b0f5b41acd20d6ba43aff2e398e9afe8f1d66a0a38aeff2f84a7867e95310",
"typeString": "literal_string \"FixedRateExchange: transferFrom failed in the dataToken contract\""
}
],
"id": 4695,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "6098:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4712,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6098:299:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4713,
"nodeType": "ExpressionStatement",
"src": "6098:299:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4715,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "6434:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4716,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "6458:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4717,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "6458:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4718,
"name": "baseTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4670,
"src": "6482:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 4719,
"name": "dataTokenAmount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4656,
"src": "6511:15:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4714,
"name": "Swapped",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4510,
"src": "6413:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_uint256_$_t_uint256_$returns$__$",
"typeString": "function (bytes32,address,uint256,uint256)"
}
},
"id": 4720,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6413:123:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4721,
"nodeType": "EmitStatement",
"src": "6408:128:9"
}
]
},
"documentation": "@dev swap\n atomic swap between two registered fixed rate exchange.\n@param exchangeId a unique exchange idnetifier \n@param dataTokenAmount the amount of data tokens to be exchanged",
"id": 4723,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4659,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4654,
"src": "5558:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4660,
"modifierName": {
"argumentTypes": null,
"id": 4658,
"name": "onlyActiveExchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4451,
"src": "5526:18:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "5526:52:9"
}
],
"name": "swap",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4657,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4654,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4723,
"src": "5443:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4653,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "5443:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4656,
"name": "dataTokenAmount",
"nodeType": "VariableDeclaration",
"scope": 4723,
"src": "5471:23:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4655,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5471:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "5433:67:9"
},
"returnParameters": {
"id": 4661,
"nodeType": "ParameterList",
"parameters": [],
"src": "5583:0:9"
},
"scope": 4962,
"src": "5420:1123:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4731,
"nodeType": "Block",
"src": "6803:42:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4728,
"name": "exchangeIds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4428,
"src": "6820:11:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[] storage ref"
}
},
"id": 4729,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "6820:18:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 4727,
"id": 4730,
"nodeType": "Return",
"src": "6813:25:9"
}
]
},
"documentation": "@dev getNumberOfExchanges\n gets the total number of registered exchanges\n@return total number of registered exchange IDs",
"id": 4732,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getNumberOfExchanges",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4724,
"nodeType": "ParameterList",
"parameters": [],
"src": "6740:2:9"
},
"returnParameters": {
"id": 4727,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4726,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4732,
"src": "6790:7:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4725,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6790:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "6789:9:9"
},
"scope": 4962,
"src": "6711:134:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4763,
"nodeType": "Block",
"src": "7186:276:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4745,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4743,
"name": "newRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4736,
"src": "7217:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 4744,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7228:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "7217:12:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "46697865645261746545786368616e67653a20526174696f206d757374206265203e30",
"id": 4746,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7243:37:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_36101f33c85b5f047dc985e5d24ae3bcf32f1d4b0a57ccd6a8c04d1cc8672d12",
"typeString": "literal_string \"FixedRateExchange: Ratio must be >0\""
},
"value": "FixedRateExchange: Ratio must be >0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_36101f33c85b5f047dc985e5d24ae3bcf32f1d4b0a57ccd6a8c04d1cc8672d12",
"typeString": "literal_string \"FixedRateExchange: Ratio must be >0\""
}
],
"id": 4742,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
6536,
6537
],
"referencedDeclaration": 6537,
"src": "7196:7:9",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4747,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7196:94:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4748,
"nodeType": "ExpressionStatement",
"src": "7196:94:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4754,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4749,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7301:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4751,
"indexExpression": {
"argumentTypes": null,
"id": 4750,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4734,
"src": "7311:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7301:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4752,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "7301:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 4753,
"name": "newRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4736,
"src": "7335:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "7301:41:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4755,
"nodeType": "ExpressionStatement",
"src": "7301:41:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4757,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4734,
"src": "7390:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4758,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "7414:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4759,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "7414:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 4760,
"name": "newRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4736,
"src": "7438:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 4756,
"name": "ExchangeRateChanged",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4488,
"src": "7357:19:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (bytes32,address,uint256)"
}
},
"id": 4761,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7357:98:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4762,
"nodeType": "EmitStatement",
"src": "7352:103:9"
}
]
},
"documentation": "@dev setRate\n changes the fixed rate for an exchange with a new rate\n@param exchangeId a unique exchange idnetifier\n@param newRate new fixed rate value",
"id": 4764,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4739,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4734,
"src": "7170:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4740,
"modifierName": {
"argumentTypes": null,
"id": 4738,
"name": "onlyExchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4468,
"src": "7152:17:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "7152:29:9"
}
],
"name": "setRate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4737,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4734,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4764,
"src": "7077:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4733,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "7077:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4736,
"name": "newRate",
"nodeType": "VariableDeclaration",
"scope": 4764,
"src": "7105:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4735,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7105:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7067:59:9"
},
"returnParameters": {
"id": 4741,
"nodeType": "ParameterList",
"parameters": [],
"src": "7186:0:9"
},
"scope": 4962,
"src": "7051:411:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4805,
"nodeType": "Block",
"src": "7754:389:9",
"statements": [
{
"condition": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4772,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7767:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4774,
"indexExpression": {
"argumentTypes": null,
"id": 4773,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7777:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7767:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4775,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "7767:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 4803,
"nodeType": "Block",
"src": "7971:166:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4795,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4790,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7985:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4792,
"indexExpression": {
"argumentTypes": null,
"id": 4791,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7995:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7985:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4793,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "7985:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 4794,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8016:4:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "7985:35:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 4796,
"nodeType": "ExpressionStatement",
"src": "7985:35:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4798,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "8074:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4799,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "8102:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4800,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "8102:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4797,
"name": "ExchangeActivated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4494,
"src": "8039:17:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (bytes32,address)"
}
},
"id": 4801,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8039:87:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4802,
"nodeType": "EmitStatement",
"src": "8034:92:9"
}
]
},
"id": 4804,
"nodeType": "IfStatement",
"src": "7764:373:9",
"trueBody": {
"id": 4789,
"nodeType": "Block",
"src": "7796:169:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4781,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4776,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "7810:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4778,
"indexExpression": {
"argumentTypes": null,
"id": 4777,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7820:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "7810:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4779,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "7810:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 4780,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "7841:5:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "7810:36:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 4782,
"nodeType": "ExpressionStatement",
"src": "7810:36:9"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4784,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7902:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4785,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6533,
"src": "7930:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 4786,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "7930:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 4783,
"name": "ExchangeDeactivated",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4500,
"src": "7865:19:9",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$",
"typeString": "function (bytes32,address)"
}
},
"id": 4787,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7865:89:9",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4788,
"nodeType": "EmitStatement",
"src": "7860:94:9"
}
]
}
}
]
},
"documentation": "@dev toggleExchangeState\n toggles the active state of an existing exchange\n@param exchangeId a unique exchange idnetifier",
"id": 4806,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 4769,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4766,
"src": "7738:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"id": 4770,
"modifierName": {
"argumentTypes": null,
"id": 4768,
"name": "onlyExchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4468,
"src": "7720:17:9",
"typeDescriptions": {
"typeIdentifier": "t_modifier$_t_bytes32_$",
"typeString": "modifier (bytes32)"
}
},
"nodeType": "ModifierInvocation",
"src": "7720:29:9"
}
],
"name": "toggleExchangeState",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4767,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4766,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4806,
"src": "7670:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4765,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "7670:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "7660:34:9"
},
"returnParameters": {
"id": 4771,
"nodeType": "ParameterList",
"parameters": [],
"src": "7754:0:9"
},
"scope": 4962,
"src": "7632:511:9",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4818,
"nodeType": "Block",
"src": "8437:55:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4813,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8454:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4815,
"indexExpression": {
"argumentTypes": null,
"id": 4814,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4808,
"src": "8464:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8454:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4816,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "8454:31:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 4812,
"id": 4817,
"nodeType": "Return",
"src": "8447:38:9"
}
]
},
"documentation": "@dev getRate\n gets the current fixed rate for an exchange\n@param exchangeId a unique exchange idnetifier\n@return fixed rate value",
"id": 4819,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getRate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4809,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4808,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4819,
"src": "8353:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4807,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "8353:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8343:34:9"
},
"returnParameters": {
"id": 4812,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4811,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4819,
"src": "8424:7:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4810,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "8424:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8423:9:9"
},
"scope": 4962,
"src": "8327:165:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4883,
"nodeType": "Block",
"src": "8792:532:9",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 4831,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4826,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8805:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4828,
"indexExpression": {
"argumentTypes": null,
"id": 4827,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "8815:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8805:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4829,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "8805:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 4830,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8837:5:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "8805:37:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 4881,
"nodeType": "Block",
"src": "8881:437:9",
"statements": [
{
"assignments": [
4837
],
"declarations": [
{
"constant": false,
"id": 4837,
"name": "balance",
"nodeType": "VariableDeclaration",
"scope": 4881,
"src": "8895:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4836,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "8895:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4850,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4845,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8988:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4847,
"indexExpression": {
"argumentTypes": null,
"id": 4846,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "8998:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8988:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4848,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "8988:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4839,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "8928:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4841,
"indexExpression": {
"argumentTypes": null,
"id": 4840,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "8938:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "8928:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4842,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "8928:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4838,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "8913:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4843,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8913:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4844,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 5052,
"src": "8913:74:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 4849,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8913:111:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "8895:129:9"
},
{
"assignments": [
4852
],
"declarations": [
{
"constant": false,
"id": 4852,
"name": "allowance",
"nodeType": "VariableDeclaration",
"scope": 4881,
"src": "9038:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4851,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9038:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4868,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4860,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "9133:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4862,
"indexExpression": {
"argumentTypes": null,
"id": 4861,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "9143:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "9133:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4863,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "9133:35:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4865,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6579,
"src": "9178:4:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_FixedRateExchange_$4962",
"typeString": "contract FixedRateExchange"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_FixedRateExchange_$4962",
"typeString": "contract FixedRateExchange"
}
],
"id": 4864,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "9170:7:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 4866,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9170:13:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4854,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "9073:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4856,
"indexExpression": {
"argumentTypes": null,
"id": 4855,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4821,
"src": "9083:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "9073:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4857,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "9073:31:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4853,
"name": "IERC20Template",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5070,
"src": "9058:14:9",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Template_$5070_$",
"typeString": "type(contract IERC20Template)"
}
},
"id": 4858,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9058:47:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Template_$5070",
"typeString": "contract IERC20Template"
}
},
"id": 4859,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "allowance",
"nodeType": "MemberAccess",
"referencedDeclaration": 5034,
"src": "9058:74:9",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$",
"typeString": "function (address,address) view external returns (uint256)"
}
},
"id": 4867,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "9058:126:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "9038:146:9"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 4871,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 4869,
"name": "balance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4837,
"src": "9201:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 4870,
"name": "allowance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4852,
"src": "9211:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9201:19:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"expression": {
"argumentTypes": null,
"id": 4878,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4876,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4824,
"src": "9289:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 4877,
"name": "allowance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4852,
"src": "9298:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9289:18:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4879,
"nodeType": "ExpressionStatement",
"src": "9289:18:9"
},
"id": 4880,
"nodeType": "IfStatement",
"src": "9198:109:9",
"trueBody": {
"expression": {
"argumentTypes": null,
"id": 4874,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4872,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4824,
"src": "9238:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 4873,
"name": "balance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4837,
"src": "9247:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "9238:16:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4875,
"nodeType": "ExpressionStatement",
"src": "9238:16:9"
}
}
]
},
"id": 4882,
"nodeType": "IfStatement",
"src": "8802:516:9",
"trueBody": {
"expression": {
"argumentTypes": null,
"id": 4834,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4832,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4824,
"src": "8856:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "30",
"id": 4833,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8865:1:9",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "8856:10:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4835,
"nodeType": "ExpressionStatement",
"src": "8856:10:9"
}
}
]
},
"documentation": "@dev getSupply\n gets the current supply of datatokens in an fixed\n rate exchagne\n@param exchangeId the exchange ID\n@return supply",
"id": 4884,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getSupply",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4822,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4821,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4884,
"src": "8707:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4820,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "8707:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8706:20:9"
},
"returnParameters": {
"id": 4825,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4824,
"name": "supply",
"nodeType": "VariableDeclaration",
"scope": 4884,
"src": "8772:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4823,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "8772:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "8771:16:9"
},
"scope": 4962,
"src": "8688:636:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 4938,
"nodeType": "Block",
"src": "10039:307:9",
"statements": [
{
"assignments": [
4902
],
"declarations": [
{
"constant": false,
"id": 4902,
"name": "exchange",
"nodeType": "VariableDeclaration",
"scope": 4938,
"src": "10049:24:9",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange"
},
"typeName": {
"contractScope": null,
"id": 4901,
"name": "Exchange",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4421,
"src": "10049:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage_ptr",
"typeString": "struct FixedRateExchange.Exchange"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 4906,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4903,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "10076:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4905,
"indexExpression": {
"argumentTypes": null,
"id": 4904,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4886,
"src": "10086:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10076:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "10049:48:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4910,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4907,
"name": "exchangeOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4889,
"src": "10107:13:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4908,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10123:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4909,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "exchangeOwner",
"nodeType": "MemberAccess",
"referencedDeclaration": 4414,
"src": "10123:22:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "10107:38:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 4911,
"nodeType": "ExpressionStatement",
"src": "10107:38:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4915,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4912,
"name": "dataToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4891,
"src": "10155:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4913,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10167:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4914,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "dataToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4416,
"src": "10167:18:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "10155:30:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 4916,
"nodeType": "ExpressionStatement",
"src": "10155:30:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4920,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4917,
"name": "baseToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4893,
"src": "10195:9:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4918,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10207:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4919,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "baseToken",
"nodeType": "MemberAccess",
"referencedDeclaration": 4418,
"src": "10207:18:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "10195:30:9",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 4921,
"nodeType": "ExpressionStatement",
"src": "10195:30:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4925,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4922,
"name": "fixedRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4895,
"src": "10235:9:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4923,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10247:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4924,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "fixedRate",
"nodeType": "MemberAccess",
"referencedDeclaration": 4420,
"src": "10247:18:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10235:30:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4926,
"nodeType": "ExpressionStatement",
"src": "10235:30:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4930,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4927,
"name": "active",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4897,
"src": "10275:6:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 4928,
"name": "exchange",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4902,
"src": "10284:8:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_memory_ptr",
"typeString": "struct FixedRateExchange.Exchange memory"
}
},
"id": 4929,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "10284:15:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "10275:24:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 4931,
"nodeType": "ExpressionStatement",
"src": "10275:24:9"
},
{
"expression": {
"argumentTypes": null,
"id": 4936,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 4932,
"name": "supply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4899,
"src": "10309:6:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 4934,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4886,
"src": "10328:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 4933,
"name": "getSupply",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4884,
"src": "10318:9:9",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$",
"typeString": "function (bytes32) view returns (uint256)"
}
},
"id": 4935,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "10318:21:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "10309:30:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 4937,
"nodeType": "ExpressionStatement",
"src": "10309:30:9"
}
]
},
"documentation": "@dev getExchange\n gets all the exchange details\n@param exchangeId a unique exchange idnetifier\n@return all the exchange details including the exchange Owner\n the dataToken contract address, the base token address, the \n fixed rate, whether the exchange is active and the supply or the \n the current data token liquidity.",
"id": 4939,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getExchange",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4887,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4886,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9772:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4885,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "9772:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9762:34:9"
},
"returnParameters": {
"id": 4900,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4889,
"name": "exchangeOwner",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9857:21:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4888,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9857:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4891,
"name": "dataToken",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9892:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4890,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9892:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4893,
"name": "baseToken",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9923:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4892,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "9923:7:9",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4895,
"name": "fixedRate",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9954:17:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4894,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "9954:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4897,
"name": "active",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "9985:11:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4896,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "9985:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 4899,
"name": "supply",
"nodeType": "VariableDeclaration",
"scope": 4939,
"src": "10010:14:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4898,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "10010:7:9",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "9843:191:9"
},
"scope": 4962,
"src": "9742:604:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4947,
"nodeType": "Block",
"src": "10581:35:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 4945,
"name": "exchangeIds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4428,
"src": "10598:11:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage",
"typeString": "bytes32[] storage ref"
}
},
"functionReturnParameters": 4944,
"id": 4946,
"nodeType": "Return",
"src": "10591:18:9"
}
]
},
"documentation": "@dev getExchanges\n gets all the exchanges list\n@return a list of all registered exchange Ids",
"id": 4948,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getExchanges",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4940,
"nodeType": "ParameterList",
"parameters": [],
"src": "10507:2:9"
},
"returnParameters": {
"id": 4944,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4943,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4948,
"src": "10559:16:9",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 4941,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "10559:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 4942,
"length": null,
"nodeType": "ArrayTypeName",
"src": "10559:9:9",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "10558:18:9"
},
"scope": 4962,
"src": "10486:130:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
},
{
"body": {
"id": 4960,
"nodeType": "Block",
"src": "10933:52:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 4955,
"name": "exchanges",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4425,
"src": "10950:9:9",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Exchange_$4421_storage_$",
"typeString": "mapping(bytes32 => struct FixedRateExchange.Exchange storage ref)"
}
},
"id": 4957,
"indexExpression": {
"argumentTypes": null,
"id": 4956,
"name": "exchangeId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4950,
"src": "10960:10:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "10950:21:9",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Exchange_$4421_storage",
"typeString": "struct FixedRateExchange.Exchange storage ref"
}
},
"id": 4958,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "active",
"nodeType": "MemberAccess",
"referencedDeclaration": 4412,
"src": "10950:28:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 4954,
"id": 4959,
"nodeType": "Return",
"src": "10943:35:9"
}
]
},
"documentation": "@dev isActive\n checks whether exchange is active\n@param exchangeId a unique exchange idnetifier\n@return true if exchange is true, otherwise returns false",
"id": 4961,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isActive",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4951,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4950,
"name": "exchangeId",
"nodeType": "VariableDeclaration",
"scope": 4961,
"src": "10851:18:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 4949,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "10851:7:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "10841:34:9"
},
"returnParameters": {
"id": 4954,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4953,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 4961,
"src": "10923:4:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 4952,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "10923:4:9",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "10922:6:9"
},
"scope": 4962,
"src": "10824:161:9",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 4963,
"src": "530:10457:9"
}
],
"src": "0:10988:9"
},
"compiler": {
"name": "solc",
"version": "0.5.7+commit.6da8b019.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.2.4",
"updatedAt": "2021-02-18T06:54:49.611Z",
"devdoc": {
"details": "FixedRateExchange is a fixed rate exchange Contract Marketplaces uses this contract to allow consumers exchanging datatokens with ocean token using a fixed exchange rate.",
"methods": {
"CalcInGivenOut(bytes32,uint256)": {
"details": "CalcInGivenOut Calculates how many basetokens are needed to get specifyed amount of datatokens",
"params": {
"dataTokenAmount": "the amount of data tokens to be exchanged",
"exchangeId": "a unique exchange idnetifier "
}
},
"create(address,address,uint256)": {
"details": "create creates new exchange pairs between base token (ocean token) and data tokens.",
"params": {
"baseToken": "refers to a ocean token contract address",
"dataToken": "refers to a data token contract address",
"fixedRate": "refers to the exact fixed exchange rate in wei"
}
},
"generateExchangeId(address,address,address)": {
"details": "generateExchangeId creates unique exchange identifier for two token pairs.",
"params": {
"baseToken": "refers to a ocean token contract address",
"dataToken": "refers to a data token contract address",
"exchangeOwner": "exchange owner address"
}
},
"getExchange(bytes32)": {
"details": "getExchange gets all the exchange details",
"params": {
"exchangeId": "a unique exchange idnetifier"
},
"return": "all the exchange details including the exchange Owner the dataToken contract address, the base token address, the fixed rate, whether the exchange is active and the supply or the the current data token liquidity."
},
"getExchanges()": {
"details": "getExchanges gets all the exchanges list",
"return": "a list of all registered exchange Ids"
},
"getNumberOfExchanges()": {
"details": "getNumberOfExchanges gets the total number of registered exchanges",
"return": "total number of registered exchange IDs"
},
"getRate(bytes32)": {
"details": "getRate gets the current fixed rate for an exchange",
"params": {
"exchangeId": "a unique exchange idnetifier"
},
"return": "fixed rate value"
},
"getSupply(bytes32)": {
"details": "getSupply gets the current supply of datatokens in an fixed rate exchagne",
"params": {
"exchangeId": "the exchange ID"
},
"return": "supply"
},
"isActive(bytes32)": {
"details": "isActive checks whether exchange is active",
"params": {
"exchangeId": "a unique exchange idnetifier"
},
"return": "true if exchange is true, otherwise returns false"
},
"setRate(bytes32,uint256)": {
"details": "setRate changes the fixed rate for an exchange with a new rate",
"params": {
"exchangeId": "a unique exchange idnetifier",
"newRate": "new fixed rate value"
}
},
"swap(bytes32,uint256)": {
"details": "swap atomic swap between two registered fixed rate exchange.",
"params": {
"dataTokenAmount": "the amount of data tokens to be exchanged",
"exchangeId": "a unique exchange idnetifier "
}
},
"toggleExchangeState(bytes32)": {
"details": "toggleExchangeState toggles the active state of an existing exchange",
"params": {
"exchangeId": "a unique exchange idnetifier"
}
}
},
"title": "FixedRateExchange"
},
"userdoc": {
"methods": {}
}
}