diff --git a/.gitignore b/.gitignore index 4105b140..c209872f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,12 @@ test/unit/coverage test/e2e/reports selenium-debug.log + +build/contracts/ + +TODO +THOUGHTS + # Editor directories and files .idea *.suo diff --git a/README.md b/README.md index bee4b9d0..cd7bd1e4 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,21 @@ Initial scaffolding thanks to: https://github.com/wespr/truffle-vue -1. Install [Truffle](http://truffleframework.com) and an Ethereum client - like [EthereumJS TestRPC](https://github.com/ethereumjs/testrpc). Note I couldn't get this to work on our VMs so I installed them directly on the Mac. +1. Install [Truffle](http://truffleframework.com) and an Ethereum client - like [Ganache-cli](https://github.com/trufflesuite/ganache-cli). ``` [sudo] npm install -g truffle // Version 3.0.5+ required. - [sudo] npm install -g ethereumjs-testrpc + [sudo] npm install -g ganache-cli ``` -2. Pull down the repo and install dependancies +2. Pull down the repo and install dependencies ``` git clone https://github.com/jsaur/lending-dapp npm install ``` -3. Launch [`testrpc`](https://github.com/ethereumjs/testrpc) in it's own command prompt tab. +3. Launch [`ganache-cli`](https://github.com/trufflesuite/ganache-cli) in its own command prompt tab. Default settings should work out of the box, no args required ``` - testrpc + ganache-cli ``` 4. Compile and migrate the contracts. @@ -27,11 +27,29 @@ Initial scaffolding thanks to: https://github.com/wespr/truffle-vue truffle migrate ``` -4. Run the webpack server for front-end hot reloading. Smart contract changes do not support hot reloading for now. +5. Install [go-ipfs](https://dist.ipfs.io/#go-ipfs) and initialize by running + ``` + sudo ./install.sh + ipfs init + ``` +6. You will need to allow cross-origin resource sharing (CORS) for the ipfs API +to work. For local testing, add localhost:8080 + ``` + ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://localhost:8080\"]" + ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]" + ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]" + ``` + +7. Start the ipfs daemon in its own command prompt tab with + ``` + ipfs daemon + ``` + +8. Run the webpack server for front-end hot reloading. Smart contract changes do not support hot reloading for now. ``` npm run start ``` - + ## Tests This box comes with everything bundled for `unit`, `e2e` and `truffle` contracts testing. The tests are incomplete at the moment. @@ -60,9 +78,9 @@ npm run build 1. Install Metamask in your browser: https://metamask.io/ -2. Change network to: Localhost 8545 +2. Change network to: 127.0.0.1:8545 -3. When you started testrpc, it should have printed out a list of available accounts and private keys. Copy one of the private keys. +3. When you started ganache-cli, it should have printed out a list of available accounts and private keys. Copy one of the private keys. 4. In meta mask, click the circular arrows, then "Import Account", then paste the private key. Now you can spend your test accounts ether. diff --git a/build/contracts/LoanContract.json b/build/contracts/LoanContract.json index 1727a973..2920cc7a 100644 --- a/build/contracts/LoanContract.json +++ b/build/contracts/LoanContract.json @@ -1,20 +1,6 @@ { "contractName": "LoanContract", "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -43,29 +29,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "amountLeftToFund", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "makeExpired", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [ @@ -85,52 +48,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "repay", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "use", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "borrowerWithdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "amountLeftToRepay", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [ @@ -246,34 +163,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [ - { - "name": "lenderAddr", - "type": "address" - } - ], - "name": "amountLenderCanWithdraw", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "lend", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -291,11 +180,11 @@ { "constant": true, "inputs": [], - "name": "numLenders", + "name": "ipfsHash", "outputs": [ { "name": "", - "type": "uint256" + "type": "string" } ], "payable": false, @@ -316,20 +205,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "isDelinquent", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -344,15 +219,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": false, - "inputs": [], - "name": "lenderWithdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -372,11 +238,7 @@ "type": "uint256" }, { - "name": "_name", - "type": "string" - }, - { - "name": "_use", + "name": "_ipfsHash", "type": "string" } ], @@ -503,8342 +365,15025 @@ "inputs": [], "name": "LoanRepaid", "type": "event" - } - ], - "bytecode": "0x606060405234156200001057600080fd5b604051620017763803806200177683398101604052808051906020019091908051906020019091908051906020019091908051906020019091908051820191906020018051820191905050856000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550670de0b6b3a76400008502600181905550826002819055506201518084024201600381905550620151808302600354016004819055508160059080519060200190620000e99291906200016a565b508060069080519060200190620001029291906200016a565b50600c8054806001018281620001199190620001f1565b91600052602060002090600202016000604080519081016040528060045481526020016001548152509091909150600082015181600001556020820151816001015550505050505050505062000280565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620001ad57805160ff1916838001178555620001de565b82800160010185558215620001de579182015b82811115620001dd578251825591602001919060010190620001c0565b5b509050620001ed919062000226565b5090565b81548183558181151162000221576002028160020283600052602060002091820191016200022091906200024e565b5b505050565b6200024b91905b80821115620002475760008160009055506001016200022d565b5090565b90565b6200027d91905b80821115620002795760008082016000905560018201600090555060020162000255565b5090565b90565b6114e680620002906000396000f30060606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101435780630c3f6acf146101d157806319cc3aaa14610208578063281380e81461023157806328b4e8561461025a5780632d6963ce1461026f578063402d8883146102d25780634c97d71a146102dc5780635cdb98291461036a5780635edf0c9e1461037f5780635f97a7d8146103a85780636fbfd409146104035780637b3e5e7b146104415780637ba61ea51461046a57806387d81789146104bf5780638e362394146104fd57806395e723141461052657806397dffc61146105735780639d585f7f1461057d578063bb927c46146105a6578063cbc9130e146105cf578063d0bf4de6146105f8578063ee86afd814610625578063f14f6e171461064e575b600080fd5b341561014e57600080fd5b610156610663565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b6101e4610701565b604051808260048111156101f457fe5b60ff16815260200191505060405180910390f35b341561021357600080fd5b61021b610714565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b61024461071a565b6040518082815260200191505060405180910390f35b341561026557600080fd5b61026d610728565b005b341561027a57600080fd5b6102906004808035906020019091905050610795565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da6107d4565b005b34156102e757600080fd5b6102ef610b22565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032f578082015181840152602081019050610314565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561037557600080fd5b61037d610bc0565b005b341561038a57600080fd5b610392610d51565b6040518082815260200191505060405180910390f35b34156103b357600080fd5b6103df600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d5f565b60405180848152602001838152602001828152602001935050505060405180910390f35b341561040e57600080fd5b6104246004808035906020019091905050610d89565b604051808381526020018281526020019250505060405180910390f35b341561044c57600080fd5b610454610dbc565b6040518082815260200191505060405180910390f35b341561047557600080fd5b61047d610dc2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ca57600080fd5b6104e06004808035906020019091905050610de7565b604051808381526020018281526020019250505060405180910390f35b341561050857600080fd5b610510610e1a565b6040518082815260200191505060405180910390f35b341561053157600080fd5b61055d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e20565b6040518082815260200191505060405180910390f35b61057b610f1f565b005b341561058857600080fd5b610590611198565b6040518082815260200191505060405180910390f35b34156105b157600080fd5b6105b961119e565b6040518082815260200191505060405180910390f35b34156105da57600080fd5b6105e26111ab565b6040518082815260200191505060405180910390f35b341561060357600080fd5b61060b6111b1565b604051808215151515815260200191505060405180910390f35b341561063057600080fd5b6106386111f0565b6040518082815260200191505060405180910390f35b341561065957600080fd5b6106616111f6565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106f95780601f106106ce576101008083540402835291602001916106f9565b820191906000526020600020905b8154815290600101906020018083116106dc57829003601f168201915b505050505081565b600b60009054906101000a900460ff1681565b60045481565b600060075460015403905090565b600354421015801561073d5750600154600754105b15610793576004600b60006101000a81548160ff0219169083600481111561076157fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b6009818154811015156107a457fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561083757600080fd5b6002600481111561084457fe5b600b60009054906101000a900460ff16600481111561085f57fe5b14151561086b57600080fd5b610873610d51565b341115151561088157600080fd5b346008600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600d80548060010182816109319190611408565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b600980549050831015610b135760098381548110151561099a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150610a3a85600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060606040519081016040529081600082015481526020016001820154815260200160028201548152505061130b565b90506000811115610b06577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b828060010193505061097e565b610b1b611349565b5050505050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb85780601f10610b8d57610100808354040283529160200191610bb8565b820191906000526020600020905b815481529060010190602001808311610b9b57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1b57600080fd5b60016004811115610c2857fe5b600b60009054906101000a900460ff166004811115610c4357fe5b141515610c4f57600080fd5b60006007541115610d4f576002600b60006101000a81548160ff02191690836004811115610c7957fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6007549081150290604051600060405180830381858888f193505050501515610cc057600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600754604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060085460015403905090565b600a6020528060005260406000206000915090508060000154908060010154908060020154905083565b600c81815481101515610d9857fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d81815481101515610df657fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610e7557fe5b600b60009054906101000a900460ff166004811115610e9057fe5b1415610ea85780600201548160000154039150610f15565b60026004811115610eb557fe5b600b60009054906101000a900460ff166004811115610ed057fe5b1480610f01575060036004811115610ee457fe5b600b60009054906101000a900460ff166004811115610eff57fe5b145b15610f1457806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610f7b57600080fd5b610f8361071a565b3411151515610f9157600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156110c25760098054806001018281610ff0919061143a565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050611113565b34600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346007600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16111966113a8565b565b60015481565b6000600980549050905090565b60035481565b600060045442101580156111eb5750600360048111156111cd57fe5b600b60009054906101000a900460ff1660048111156111e857fe5b14155b905090565b60085481565b600061120133610e20565b905060008111156113085780600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561129c57600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b6000600154600854141515611335576001548260000151840281151561132d57fe5b049050611343565b816020015182600001510390505b92915050565b60015460085414156113a6576003600b60006101000a81548160ff0219169083600481111561137457fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b600154600754101515611406576001600b60006101000a81548160ff021916908360048111156113d457fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b815481835581811511611435576002028160020283600052602060002091820191016114349190611466565b5b505050565b815481835581811511611461578183600052602060002091820191016114609190611495565b5b505050565b61149291905b8082111561148e5760008082016000905560018201600090555060020161146c565b5090565b90565b6114b791905b808211156114b357600081600090555060010161149b565b5090565b905600a165627a7a7230582050dd2c8af2fd968e86ac93ddd745c85ebde3789d75900b041da51405192706230029", - "deployedBytecode": "0x60606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101435780630c3f6acf146101d157806319cc3aaa14610208578063281380e81461023157806328b4e8561461025a5780632d6963ce1461026f578063402d8883146102d25780634c97d71a146102dc5780635cdb98291461036a5780635edf0c9e1461037f5780635f97a7d8146103a85780636fbfd409146104035780637b3e5e7b146104415780637ba61ea51461046a57806387d81789146104bf5780638e362394146104fd57806395e723141461052657806397dffc61146105735780639d585f7f1461057d578063bb927c46146105a6578063cbc9130e146105cf578063d0bf4de6146105f8578063ee86afd814610625578063f14f6e171461064e575b600080fd5b341561014e57600080fd5b610156610663565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b6101e4610701565b604051808260048111156101f457fe5b60ff16815260200191505060405180910390f35b341561021357600080fd5b61021b610714565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b61024461071a565b6040518082815260200191505060405180910390f35b341561026557600080fd5b61026d610728565b005b341561027a57600080fd5b6102906004808035906020019091905050610795565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da6107d4565b005b34156102e757600080fd5b6102ef610b22565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032f578082015181840152602081019050610314565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561037557600080fd5b61037d610bc0565b005b341561038a57600080fd5b610392610d51565b6040518082815260200191505060405180910390f35b34156103b357600080fd5b6103df600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d5f565b60405180848152602001838152602001828152602001935050505060405180910390f35b341561040e57600080fd5b6104246004808035906020019091905050610d89565b604051808381526020018281526020019250505060405180910390f35b341561044c57600080fd5b610454610dbc565b6040518082815260200191505060405180910390f35b341561047557600080fd5b61047d610dc2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ca57600080fd5b6104e06004808035906020019091905050610de7565b604051808381526020018281526020019250505060405180910390f35b341561050857600080fd5b610510610e1a565b6040518082815260200191505060405180910390f35b341561053157600080fd5b61055d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e20565b6040518082815260200191505060405180910390f35b61057b610f1f565b005b341561058857600080fd5b610590611198565b6040518082815260200191505060405180910390f35b34156105b157600080fd5b6105b961119e565b6040518082815260200191505060405180910390f35b34156105da57600080fd5b6105e26111ab565b6040518082815260200191505060405180910390f35b341561060357600080fd5b61060b6111b1565b604051808215151515815260200191505060405180910390f35b341561063057600080fd5b6106386111f0565b6040518082815260200191505060405180910390f35b341561065957600080fd5b6106616111f6565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106f95780601f106106ce576101008083540402835291602001916106f9565b820191906000526020600020905b8154815290600101906020018083116106dc57829003601f168201915b505050505081565b600b60009054906101000a900460ff1681565b60045481565b600060075460015403905090565b600354421015801561073d5750600154600754105b15610793576004600b60006101000a81548160ff0219169083600481111561076157fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b6009818154811015156107a457fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561083757600080fd5b6002600481111561084457fe5b600b60009054906101000a900460ff16600481111561085f57fe5b14151561086b57600080fd5b610873610d51565b341115151561088157600080fd5b346008600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600d80548060010182816109319190611408565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b600980549050831015610b135760098381548110151561099a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150610a3a85600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060606040519081016040529081600082015481526020016001820154815260200160028201548152505061130b565b90506000811115610b06577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b828060010193505061097e565b610b1b611349565b5050505050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb85780601f10610b8d57610100808354040283529160200191610bb8565b820191906000526020600020905b815481529060010190602001808311610b9b57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1b57600080fd5b60016004811115610c2857fe5b600b60009054906101000a900460ff166004811115610c4357fe5b141515610c4f57600080fd5b60006007541115610d4f576002600b60006101000a81548160ff02191690836004811115610c7957fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6007549081150290604051600060405180830381858888f193505050501515610cc057600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600754604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060085460015403905090565b600a6020528060005260406000206000915090508060000154908060010154908060020154905083565b600c81815481101515610d9857fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d81815481101515610df657fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610e7557fe5b600b60009054906101000a900460ff166004811115610e9057fe5b1415610ea85780600201548160000154039150610f15565b60026004811115610eb557fe5b600b60009054906101000a900460ff166004811115610ed057fe5b1480610f01575060036004811115610ee457fe5b600b60009054906101000a900460ff166004811115610eff57fe5b145b15610f1457806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610f7b57600080fd5b610f8361071a565b3411151515610f9157600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156110c25760098054806001018281610ff0919061143a565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050611113565b34600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346007600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16111966113a8565b565b60015481565b6000600980549050905090565b60035481565b600060045442101580156111eb5750600360048111156111cd57fe5b600b60009054906101000a900460ff1660048111156111e857fe5b14155b905090565b60085481565b600061120133610e20565b905060008111156113085780600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561129c57600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b6000600154600854141515611335576001548260000151840281151561132d57fe5b049050611343565b816020015182600001510390505b92915050565b60015460085414156113a6576003600b60006101000a81548160ff0219169083600481111561137457fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b600154600754101515611406576001600b60006101000a81548160ff021916908360048111156113d457fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b815481835581811511611435576002028160020283600052602060002091820191016114349190611466565b5b505050565b815481835581811511611461578183600052602060002091820191016114609190611495565b5b505050565b61149291905b8082111561148e5760008082016000905560018201600090555060020161146c565b5090565b90565b6114b791905b808211156114b357600081600090555060010161149b565b5090565b905600a165627a7a7230582050dd2c8af2fd968e86ac93ddd745c85ebde3789d75900b041da51405192706230029", - "sourceMap": "110:7445:0:-;;;1459:717;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1714:16;1696:15;;:34;;;;;;;;;;;;;;;;;;1775:7;1753:19;:29;1740:10;:42;;;;1812:24;1792:17;:44;;;;1903:6;1874:26;:35;1868:3;:41;1846:19;:63;;;;1988:6;1961:24;:33;1939:19;;:55;1919:17;:75;;;;2011:5;2004:4;:12;;;;;;;;;;;;:::i;:::-;;2032:4;2026:3;:10;;;;;;;;;;;;:::i;:::-;;2111:8;:58;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;2125:43;;;;;;;;;2138:17;;2125:43;;;;2157:10;;2125:43;;;2111:58;;;;;;;;;;;;;;;;;;;;;;;;1459:717;;;;;;110:7445;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", - "deployedSourceMap": "110:7445:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;332:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;739:25:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;297:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7191:104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6847:188;;;;;;;;;;;;;;580:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3719:1121;;;;;;356:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3226:412:0;;;;;;;;;;;;;;7305:105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;618:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;885:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;402:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;161:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;921;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;225:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6004:757;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2255:638;;;;;;197:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7086:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;260:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7420:133;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;432:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5583:340;;;;;;;;;;;;;;332:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;739:25::-;;;;;;;;;;;;;:::o;297:29::-;;;;:::o;7191:104::-;7240:4;7276:12;;7263:10;;:25;7256:32;;7191:104;:::o;6847:188::-;6899:19;;6892:3;:26;;:55;;;;;6937:10;;6922:12;;:25;6892:55;6888:141;;;6978:13;6963:12;;:28;;;;;;;;;;;;;;;;;;;;;;;;7005:13;;;;;;;;;;6888:141;6847:188::o;580:32::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3719:1121::-;4244:23;4289:22;4330:6;4389:21;4445:20;3862:15;;;;;;;;;;;3848:29;;:10;:29;;;3840:38;;;;;;;;3912:14;3896:30;;;;;;;;:12;;;;;;;;;;;:30;;;;;;;;;3888:39;;;;;;;;3958:19;:17;:19::i;:::-;3945:9;:32;;3937:41;;;;;;;;4013:9;3997:12;;:25;;;;;;;;;;;4032:44;4049:15;;;;;;;;;;;4066:9;4032:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;4086:8;:43;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;4100:28;;;;;;;;;4113:3;4100:28;;;;4118:9;4100:28;;;4086:43;;;;;;;;;;;;;;;;;;;;;;;;4270:9;4244:35;;4314:1;4289:26;;4339:1;4330:10;;4325:473;4346:15;:22;;;;4342:1;:26;4325:473;;;4413:15;4429:1;4413:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;4389:42;;4468:69;4487:18;4507:14;:29;4522:13;4507:29;;;;;;;;;;;;;;;4468:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;:69::i;:::-;4445:92;;4573:1;4555:15;:19;4551:237;;;4594:46;4609:13;4624:15;4594:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;4704:15;4658:14;:29;4673:13;4658:29;;;;;;;;;;;;;;;:42;;;:61;;;;;;;;;;;4758:15;4737:36;;;;4551:237;4370:3;;;;;;;4325:473;;;4816:17;:15;:17::i;:::-;3719:1121;;;;;:::o;356:17::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3226:412::-;3363:15;;;;;;;;;;;3349:29;;:10;:29;;;3341:38;;;;;;;;3413:12;3397:28;;;;;;;;:12;;;;;;;;;;;:28;;;;;;;;;3389:37;;;;;;;;3464:1;3449:12;;:16;3445:187;;;3496:14;3481:12;;:29;;;;;;;;;;;;;;;;;;;;;;;;3524:10;:19;;:33;3544:12;;3524:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3571:50;3591:15;;;;;;;;;;;3608:12;;3571:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;3445:187;3226:412::o;7305:105::-;7355:4;7391:12;;7378:10;;:25;7371:32;;7305:105;:::o;618:55::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;885:30::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;402:24::-;;;;:::o;161:30::-;;;;;;;;;;;;;:::o;921:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;225:29::-;;;;:::o;6004:757::-;6078:4;6094:22;6130:35;6119:1;6094:26;;6168:14;:26;6183:10;6168:26;;;;;;;;;;;;;;;6130:64;;6224:13;6208:29;;;;;;;;:12;;;;;;;;;;;:29;;;;;;;;;6204:517;;;6384:13;:29;;;6357:13;:24;;;:56;6337:76;;6204:517;;;6450:14;6434:30;;;;;;;;:12;;;;;;;;;;;:30;;;;;;;;;:62;;;;6484:12;6468:28;;;;;;;;:12;;;;;;;;;;;:28;;;;;;;;;6434:62;6430:291;;;6681:13;:29;;;6652:13;:26;;;:58;6632:78;;6430:291;6204:517;6737:17;6730:24;;6004:757;;;;;:::o;2255:638::-;2381:15;;;;;;;;;;;2367:29;;:10;:29;;;;2359:38;;;;;;;;2428:18;:16;:18::i;:::-;2415:9;:31;;2407:40;;;;;;;;2550:1;2509:14;:26;2524:10;2509:26;;;;;;;;;;;;;;;:37;;;:42;2505:259;;;2567:15;:32;;;;;;;;;;;:::i;:::-;;;;;;;;;;2588:10;2567:32;;;;;;;;;;;;;;;;;;;;;;;2642:30;;;;;;;;;2656:9;2642:30;;;;2667:1;2642:30;;;;2670:1;2642:30;;;2613:14;:26;2628:10;2613:26;;;;;;;;;;;;;;;:59;;;;;;;;;;;;;;;;;;;;;;;;;;;2505:259;;;2744:9;2703:14;:26;2718:10;2703:26;;;;;;;;;;;;;;;:37;;;:50;;;;;;;;;;;2505:259;2798:9;2782:12;;:25;;;;;;;;;;;2817:33;2828:10;2840:9;2817:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;2869:17;:15;:17::i;:::-;2255:638::o;197:22::-;;;;:::o;7086:95::-;7129:4;7152:15;:22;;;;7145:29;;7086:95;:::o;260:31::-;;;;:::o;7420:133::-;7465:4;7496:17;;7489:3;:24;;:56;;;;;7533:12;7517:28;;;;;;;;:12;;;;;;;;;;;:28;;;;;;;;;;7489:56;7481:65;;7420:133;:::o;432:24::-;;;;:::o;5583:340::-;5626:21;5650:35;5674:10;5650:23;:35::i;:::-;5626:59;;5718:1;5699:16;:20;5695:222;;;5781:16;5735:14;:26;5750:10;5735:26;;;;;;;;;;;;;;;:42;;;:62;;;;;;;;;;;5811:10;:19;;:37;5831:16;5811:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5862:44;5877:10;5889:16;5862:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;5695:222;5583:340;:::o;4850:461::-;4948:4;4984:10;;4968:12;;:26;;4964:341;;;5137:10;;5115:7;:18;;;5094;:39;5093:54;;;;;;;;5086:61;;;;4964:341;5274:7;:20;;;5253:7;:18;;;:41;5246:48;;4850:461;;;;;:::o;5321:161::-;5386:10;;5370:12;;:26;5366:110;;;5427:12;5412;;:27;;;;;;;;;;;;;;;;;;;;;;;;5453:12;;;;;;;;;;5366:110;5321:161::o;2976:::-;3041:10;;3025:12;;:26;;3021:110;;;3082:12;3067;;:27;;;;;;;;;;;;;;;;;;;;;;;;3108:12;;;;;;;;;;3021:110;2976:161::o;110:7445::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.4.15;\n/*\n A simple loan contract which allows lenders to lend and borrowers to repay\n*/\ncontract LoanContract {\n //Constructor vars\n address public borrowerAddress;\n uint public loanAmount;\n uint public repaymentDuration;\n uint public fundRaisingDeadline;\n uint public repaymentDeadline;\n string public name;\n string public use;\n \n //Useful vars\n uint public amountRaised;\n uint public amountRepaid;\n /* Since solidity doesn't allow iterating over mapping, we need 2 data structures to represent lender accounts */\n address[] public lenderAddresses;\n mapping(address => LenderAccount) public lenderAccounts;\n enum State {raising, funded, repaying, repaid, expired}\n State public currentState;\n struct LenderAccount {\n uint amountLent;\n uint amountRepaid;\n uint amountWithdrawn;\n }\n PaymentEntry[] public schedule;\n PaymentEntry[] public payments;\n struct PaymentEntry {\n uint date;\n uint amount;\n }\n \n //Events\n event LentToLoan(address addr, uint amount);\n event DisbursedToBorrower(address addr, uint amount);\n event RepaidByBorrower(address addr, uint amount);\n event RepaidToLender(address addr, uint amount);\n event SentBack(address addr, uint amount);\n event LenderWithdrew(address addr, uint amount);\n event LoanFunded();\n event LoanExpired();\n event LoanRepaid();\n \n // Constructor\n function LoanContract(\n address _borrowerAddress, \n uint _loanAmountInEthers,\n uint _fundRaisingDurationInDays,\n uint _repaymentDurationInDays,\n string _name,\n string _use\n ) public {\n borrowerAddress = _borrowerAddress;\n loanAmount = _loanAmountInEthers * 1 ether;\n repaymentDuration = _repaymentDurationInDays;\n fundRaisingDeadline = now + _fundRaisingDurationInDays * 1 days;\n repaymentDeadline = fundRaisingDeadline + _repaymentDurationInDays * 1 days;\n name = _name;\n use = _use;\n // For now just do a single scheduled payment at the end\n schedule.push(PaymentEntry(repaymentDeadline, loanAmount));\n }\n \n // Lender sends wei to the contract, we store how much they lent\n function lend() payable public {\n // Don't allow borrowers to lend, or allow overfunding\n require(msg.sender != borrowerAddress);\n require(msg.value <= amountLeftToFund());\n \n // Handle lender lending twice\n if (lenderAccounts[msg.sender].amountLent == 0) {\n lenderAddresses.push(msg.sender);\n lenderAccounts[msg.sender] = LenderAccount(msg.value, 0, 0);\n } else {\n lenderAccounts[msg.sender].amountLent += msg.value;\n }\n \n amountRaised += msg.value;\n LentToLoan(msg.sender, msg.value);\n \n checkLoanFunded();\n }\n \n // If we have raised the full loan amount, then transition to funded\n function checkLoanFunded() private {\n if (amountRaised >= loanAmount) {\n currentState = State.funded;\n LoanFunded();\n }\n }\n \n // The recommended pattern for disbursals is to have the borrower withdraw\n function borrowerWithdraw() public {\n // Only borrowers can withdraw, and only in the funded state\n require(msg.sender == borrowerAddress);\n require(currentState == State.funded);\n \n if (amountRaised > 0) {\n currentState = State.repaying;\n msg.sender.transfer(amountRaised);\n DisbursedToBorrower(borrowerAddress, amountRaised);\n }\n }\n \n // Borrower sends wei to the contract, we record the amount repaid\n function repay() payable public {\n // Only borrowers can repay, and can't repay more than the amount left\n require(msg.sender == borrowerAddress);\n require(currentState == State.repaying);\n require(msg.value <= amountLeftToRepay());\n \n amountRepaid += msg.value;\n RepaidByBorrower(borrowerAddress, msg.value);\n payments.push(PaymentEntry(now, msg.value));\n \n // Distribute wei evenly to lenders, if there's a remainder we'll distribute at the end\n uint amountToDistribute = msg.value;\n uint amountDistributed = 0;\n for (uint i = 0; i < lenderAddresses.length; i++) {\n address currentLender = lenderAddresses[i];\n uint amountForLender = getAmountForLender(amountToDistribute, lenderAccounts[currentLender]);\n if (amountForLender > 0) {\n RepaidToLender(currentLender, amountForLender);\n lenderAccounts[currentLender].amountRepaid += amountForLender;\n amountDistributed += amountForLender;\n }\n }\n \n checkLoanRepaid();\n }\n \n function getAmountForLender(uint amountToDistribute, LenderAccount account) private view returns (uint) {\n if (amountRepaid != loanAmount) {\n // Regular case, division in solidity throws away the remainder\n return (amountToDistribute * account.amountLent) / loanAmount;\n } else {\n // Last repayment case, make sure everyone is topped up\n return account.amountLent - account.amountRepaid;\n }\n }\n \n function checkLoanRepaid() private {\n if (amountRepaid == loanAmount) {\n currentState = State.repaid;\n LoanRepaid();\n }\n }\n \n // The recommended pattern for lender's to recieve repayments is to have them withdraw\n function lenderWithdraw() public {\n uint amountToWithdraw = amountLenderCanWithdraw(msg.sender);\n if (amountToWithdraw > 0) {\n lenderAccounts[msg.sender].amountWithdrawn += amountToWithdraw;\n msg.sender.transfer(amountToWithdraw);\n LenderWithdrew(msg.sender, amountToWithdraw);\n }\n }\n \n // Calculates how much the lender can withdraw based on loan state\n function amountLenderCanWithdraw(address lenderAddr) public view returns (uint) {\n uint amountCanWithdraw = 0;\n LenderAccount storage lenderAccount = lenderAccounts[lenderAddr];\n if (currentState == State.expired) {\n /* If the loan expired, lenders can withdraw their contributed amount*/\n amountCanWithdraw = lenderAccount.amountLent - lenderAccount.amountWithdrawn;\n } else if (currentState == State.repaying || currentState == State.repaid) {\n /* If the loan is repaying or fully repaid the lenders can withdraw however much has been repaid to them */\n amountCanWithdraw = lenderAccount.amountRepaid - lenderAccount.amountWithdrawn;\n }\n return amountCanWithdraw;\n }\n\n // Solidity doesn't support timer calls, so an admin will have to call this\n function makeExpired() public {\n if (now >= fundRaisingDeadline && amountRaised < loanAmount) {\n currentState = State.expired;\n LoanExpired();\n }\n }\n \n /* Useful constant functions */\n \n function numLenders() public view returns (uint) {\n return lenderAddresses.length;\n }\n \n function amountLeftToFund() public view returns (uint) {\n return loanAmount - amountRaised;\n }\n \n function amountLeftToRepay() public view returns (uint) {\n return loanAmount - amountRepaid;\n }\n \n function isDelinquent() public view returns (bool) {\n return (now >= repaymentDeadline && currentState != State.repaid);\n }\n}", - "sourcePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/LoanContract.sol", - "ast": { - "attributes": { - "absolutePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/LoanContract.sol", - "exportedSymbols": { - "LoanContract": [ - 600 - ] - } }, - "children": [ - { - "attributes": { - "literals": [ - "solidity", - "^", - "0.4", - ".15" - ] - }, - "id": 1, - "name": "PragmaDirective", - "src": "0:24:0" - }, - { - "attributes": { - "baseContracts": [ - null - ], - "contractDependencies": [ - null - ], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "linearizedBaseContracts": [ - 600 - ], - "name": "LoanContract", - "scope": 601 - }, - "children": [ - { - "attributes": { - "constant": false, - "name": "borrowerAddress", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 2, - "name": "ElementaryTypeName", - "src": "161:7:0" - } - ], - "id": 3, - "name": "VariableDeclaration", - "src": "161:30:0" - }, - { - "attributes": { - "constant": false, - "name": "loanAmount", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 4, - "name": "ElementaryTypeName", - "src": "197:4:0" - } - ], - "id": 5, - "name": "VariableDeclaration", - "src": "197:22:0" - }, - { - "attributes": { - "constant": false, - "name": "repaymentDuration", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 6, - "name": "ElementaryTypeName", - "src": "225:4:0" - } - ], - "id": 7, - "name": "VariableDeclaration", - "src": "225:29:0" - }, - { - "attributes": { - "constant": false, - "name": "fundRaisingDeadline", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 8, - "name": "ElementaryTypeName", - "src": "260:4:0" - } - ], - "id": 9, - "name": "VariableDeclaration", - "src": "260:31:0" - }, - { - "attributes": { - "constant": false, - "name": "repaymentDeadline", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 10, - "name": "ElementaryTypeName", - "src": "297:4:0" - } - ], - "id": 11, - "name": "VariableDeclaration", - "src": "297:29:0" - }, - { - "attributes": { - "constant": false, - "name": "name", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "string storage ref", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "string", - "type": "string storage pointer" - }, - "id": 12, - "name": "ElementaryTypeName", - "src": "332:6:0" - } - ], - "id": 13, - "name": "VariableDeclaration", - "src": "332:18:0" - }, - { - "attributes": { - "constant": false, - "name": "use", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "string storage ref", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "string", - "type": "string storage pointer" - }, - "id": 14, - "name": "ElementaryTypeName", - "src": "356:6:0" - } - ], - "id": 15, - "name": "VariableDeclaration", - "src": "356:17:0" - }, - { - "attributes": { - "constant": false, - "name": "amountRaised", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 16, - "name": "ElementaryTypeName", - "src": "402:4:0" - } - ], - "id": 17, - "name": "VariableDeclaration", - "src": "402:24:0" - }, - { - "attributes": { - "constant": false, - "name": "amountRepaid", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 18, - "name": "ElementaryTypeName", - "src": "432:4:0" - } - ], - "id": 19, - "name": "VariableDeclaration", - "src": "432:24:0" - }, - { - "attributes": { - "constant": false, - "name": "lenderAddresses", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "address[] storage ref", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "length": null, - "type": "address[] storage pointer" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 20, - "name": "ElementaryTypeName", - "src": "580:7:0" - } - ], - "id": 21, - "name": "ArrayTypeName", - "src": "580:9:0" - } - ], - "id": 22, - "name": "VariableDeclaration", - "src": "580:32:0" - }, - { - "attributes": { - "constant": false, - "name": "lenderAccounts", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 23, - "name": "ElementaryTypeName", - "src": "626:7:0" - }, - { - "attributes": { - "contractScope": null, - "name": "LenderAccount", - "referencedDeclaration": 41, - "type": "struct LoanContract.LenderAccount storage pointer" - }, - "id": 24, - "name": "UserDefinedTypeName", - "src": "637:13:0" - } - ], - "id": 25, - "name": "Mapping", - "src": "618:33:0" - } - ], - "id": 26, - "name": "VariableDeclaration", - "src": "618:55:0" - }, - { - "attributes": { - "canonicalName": "LoanContract.State", - "name": "State" - }, - "children": [ - { - "attributes": { - "name": "raising" - }, - "id": 27, - "name": "EnumValue", - "src": "691:7:0" - }, - { - "attributes": { - "name": "funded" - }, - "id": 28, - "name": "EnumValue", - "src": "700:6:0" - }, - { - "attributes": { - "name": "repaying" - }, - "id": 29, - "name": "EnumValue", - "src": "708:8:0" - }, - { - "attributes": { - "name": "repaid" - }, - "id": 30, - "name": "EnumValue", - "src": "718:6:0" - }, - { - "attributes": { - "name": "expired" - }, - "id": 31, - "name": "EnumValue", - "src": "726:7:0" - } - ], - "id": 32, - "name": "EnumDefinition", - "src": "679:55:0" + { + "constant": false, + "inputs": [], + "name": "lend", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "borrowerWithdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repay", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "lenderWithdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "lenderAddr", + "type": "address" + } + ], + "name": "amountLenderCanWithdraw", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "makeExpired", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "numLenders", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "amountLeftToFund", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "amountLeftToRepay", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isDelinquent", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x606060405234156200001057600080fd5b6040516200161c3803806200161c83398101604052808051906020019091908051906020019091908051906020019091908051906020019091908051820191905050846000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550670de0b6b3a76400008402600181905550816002819055506201518083024201600381905550620151808202600354016004819055508060059080519060200190620000e092919062000147565b50600b8054806001018281620000f79190620001ce565b91600052602060002090600202016000604080519081016040528060045481526020016001548152509091909150600082015181600001556020820151816001015550505050505050506200025d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018a57805160ff1916838001178555620001bb565b82800160010185558215620001bb579182015b82811115620001ba5782518255916020019190600101906200019d565b5b509050620001ca919062000203565b5090565b815481835581811511620001fe57600202816002028360005260206000209182019101620001fd91906200022b565b5b505050565b6200022891905b80821115620002245760008160009055506001016200020a565b5090565b90565b6200025a91905b80821115620002565760008082016000905560018201600090555060020162000232565b5090565b90565b6113af806200026d6000396000f300606060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c3f6acf1461013857806319cc3aaa1461016f578063281380e81461019857806328b4e856146101c15780632d6963ce146101d6578063402d8883146102395780635cdb9829146102435780635edf0c9e146102585780635f97a7d8146102815780636fbfd409146102dc5780637b3e5e7b1461031a5780637ba61ea51461034357806387d81789146103985780638e362394146103d657806395e72314146103ff57806397dffc611461044c5780639d585f7f14610456578063bb927c461461047f578063c623674f146104a8578063cbc9130e14610536578063d0bf4de61461055f578063ee86afd81461058c578063f14f6e17146105b5575b600080fd5b341561014357600080fd5b61014b6105ca565b6040518082600481111561015b57fe5b60ff16815260200191505060405180910390f35b341561017a57600080fd5b6101826105dd565b6040518082815260200191505060405180910390f35b34156101a357600080fd5b6101ab6105e3565b6040518082815260200191505060405180910390f35b34156101cc57600080fd5b6101d46105f1565b005b34156101e157600080fd5b6101f7600480803590602001909190505061065e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024161069d565b005b341561024e57600080fd5b6102566109eb565b005b341561026357600080fd5b61026b610b7c565b6040518082815260200191505060405180910390f35b341561028c57600080fd5b6102b8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b8a565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156102e757600080fd5b6102fd6004808035906020019091905050610bb4565b604051808381526020018281526020019250505060405180910390f35b341561032557600080fd5b61032d610be7565b6040518082815260200191505060405180910390f35b341561034e57600080fd5b610356610bed565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103a357600080fd5b6103b96004808035906020019091905050610c12565b604051808381526020018281526020019250505060405180910390f35b34156103e157600080fd5b6103e9610c45565b6040518082815260200191505060405180910390f35b341561040a57600080fd5b610436600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c4b565b6040518082815260200191505060405180910390f35b610454610d4a565b005b341561046157600080fd5b610469610fc3565b6040518082815260200191505060405180910390f35b341561048a57600080fd5b610492610fc9565b6040518082815260200191505060405180910390f35b34156104b357600080fd5b6104bb610fd6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104fb5780820151818401526020810190506104e0565b50505050905090810190601f1680156105285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054157600080fd5b610549611074565b6040518082815260200191505060405180910390f35b341561056a57600080fd5b61057261107a565b604051808215151515815260200191505060405180910390f35b341561059757600080fd5b61059f6110b9565b6040518082815260200191505060405180910390f35b34156105c057600080fd5b6105c86110bf565b005b600a60009054906101000a900460ff1681565b60045481565b600060065460015403905090565b60035442101580156106065750600154600654105b1561065c576004600a60006101000a81548160ff0219169083600481111561062a57fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b60088181548110151561066d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070057600080fd5b6002600481111561070d57fe5b600a60009054906101000a900460ff16600481111561072857fe5b14151561073457600080fd5b61073c610b7c565b341115151561074a57600080fd5b346007600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600c80548060010182816107fa91906112d1565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b6008805490508310156109dc5760088381548110151561086357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915061090385600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206060604051908101604052908160008201548152602001600182015481526020016002820154815250506111d4565b905060008111156109cf577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b8280600101935050610847565b6109e4611212565b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4657600080fd5b60016004811115610a5357fe5b600a60009054906101000a900460ff166004811115610a6e57fe5b141515610a7a57600080fd5b60006006541115610b7a576002600a60006101000a81548160ff02191690836004811115610aa457fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6006549081150290604051600060405180830381858888f193505050501515610aeb57600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060075460015403905090565b60096020528060005260406000206000915090508060000154908060010154908060020154905083565b600b81815481101515610bc357fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c81815481101515610c2157fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610ca057fe5b600a60009054906101000a900460ff166004811115610cbb57fe5b1415610cd35780600201548160000154039150610d40565b60026004811115610ce057fe5b600a60009054906101000a900460ff166004811115610cfb57fe5b1480610d2c575060036004811115610d0f57fe5b600a60009054906101000a900460ff166004811115610d2a57fe5b145b15610d3f57806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610da657600080fd5b610dae6105e3565b3411151515610dbc57600080fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610eed5760088054806001018281610e1b9190611303565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050610f3e565b34600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346006600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1610fc1611271565b565b60015481565b6000600880549050905090565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561106c5780601f106110415761010080835404028352916020019161106c565b820191906000526020600020905b81548152906001019060200180831161104f57829003601f168201915b505050505081565b60035481565b600060045442101580156110b457506003600481111561109657fe5b600a60009054906101000a900460ff1660048111156110b157fe5b14155b905090565b60075481565b60006110ca33610c4b565b905060008111156111d15780600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561116557600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60006001546007541415156111fe57600154826000015184028115156111f657fe5b04905061120c565b816020015182600001510390505b92915050565b600154600754141561126f576003600a60006101000a81548160ff0219169083600481111561123d57fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b6001546006541015156112cf576001600a60006101000a81548160ff0219169083600481111561129d57fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b8154818355818115116112fe576002028160020283600052602060002091820191016112fd919061132f565b5b505050565b81548183558181151161132a57818360005260206000209182019101611329919061135e565b5b505050565b61135b91905b8082111561135757600080820160009055600182016000905550600201611335565b5090565b90565b61138091905b8082111561137c576000816000905550600101611364565b5090565b905600a165627a7a72305820dd36fb267f9b7e36e90fc74ddb485c0c7f4fb92d6c293f494e942c215b1da3d50029", + "deployedBytecode": "0x606060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c3f6acf1461013857806319cc3aaa1461016f578063281380e81461019857806328b4e856146101c15780632d6963ce146101d6578063402d8883146102395780635cdb9829146102435780635edf0c9e146102585780635f97a7d8146102815780636fbfd409146102dc5780637b3e5e7b1461031a5780637ba61ea51461034357806387d81789146103985780638e362394146103d657806395e72314146103ff57806397dffc611461044c5780639d585f7f14610456578063bb927c461461047f578063c623674f146104a8578063cbc9130e14610536578063d0bf4de61461055f578063ee86afd81461058c578063f14f6e17146105b5575b600080fd5b341561014357600080fd5b61014b6105ca565b6040518082600481111561015b57fe5b60ff16815260200191505060405180910390f35b341561017a57600080fd5b6101826105dd565b6040518082815260200191505060405180910390f35b34156101a357600080fd5b6101ab6105e3565b6040518082815260200191505060405180910390f35b34156101cc57600080fd5b6101d46105f1565b005b34156101e157600080fd5b6101f7600480803590602001909190505061065e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024161069d565b005b341561024e57600080fd5b6102566109eb565b005b341561026357600080fd5b61026b610b7c565b6040518082815260200191505060405180910390f35b341561028c57600080fd5b6102b8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b8a565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156102e757600080fd5b6102fd6004808035906020019091905050610bb4565b604051808381526020018281526020019250505060405180910390f35b341561032557600080fd5b61032d610be7565b6040518082815260200191505060405180910390f35b341561034e57600080fd5b610356610bed565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103a357600080fd5b6103b96004808035906020019091905050610c12565b604051808381526020018281526020019250505060405180910390f35b34156103e157600080fd5b6103e9610c45565b6040518082815260200191505060405180910390f35b341561040a57600080fd5b610436600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c4b565b6040518082815260200191505060405180910390f35b610454610d4a565b005b341561046157600080fd5b610469610fc3565b6040518082815260200191505060405180910390f35b341561048a57600080fd5b610492610fc9565b6040518082815260200191505060405180910390f35b34156104b357600080fd5b6104bb610fd6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104fb5780820151818401526020810190506104e0565b50505050905090810190601f1680156105285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054157600080fd5b610549611074565b6040518082815260200191505060405180910390f35b341561056a57600080fd5b61057261107a565b604051808215151515815260200191505060405180910390f35b341561059757600080fd5b61059f6110b9565b6040518082815260200191505060405180910390f35b34156105c057600080fd5b6105c86110bf565b005b600a60009054906101000a900460ff1681565b60045481565b600060065460015403905090565b60035442101580156106065750600154600654105b1561065c576004600a60006101000a81548160ff0219169083600481111561062a57fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b60088181548110151561066d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070057600080fd5b6002600481111561070d57fe5b600a60009054906101000a900460ff16600481111561072857fe5b14151561073457600080fd5b61073c610b7c565b341115151561074a57600080fd5b346007600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600c80548060010182816107fa91906112d1565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b6008805490508310156109dc5760088381548110151561086357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915061090385600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206060604051908101604052908160008201548152602001600182015481526020016002820154815250506111d4565b905060008111156109cf577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b8280600101935050610847565b6109e4611212565b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4657600080fd5b60016004811115610a5357fe5b600a60009054906101000a900460ff166004811115610a6e57fe5b141515610a7a57600080fd5b60006006541115610b7a576002600a60006101000a81548160ff02191690836004811115610aa457fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6006549081150290604051600060405180830381858888f193505050501515610aeb57600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060075460015403905090565b60096020528060005260406000206000915090508060000154908060010154908060020154905083565b600b81815481101515610bc357fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c81815481101515610c2157fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610ca057fe5b600a60009054906101000a900460ff166004811115610cbb57fe5b1415610cd35780600201548160000154039150610d40565b60026004811115610ce057fe5b600a60009054906101000a900460ff166004811115610cfb57fe5b1480610d2c575060036004811115610d0f57fe5b600a60009054906101000a900460ff166004811115610d2a57fe5b145b15610d3f57806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610da657600080fd5b610dae6105e3565b3411151515610dbc57600080fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610eed5760088054806001018281610e1b9190611303565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050610f3e565b34600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346006600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1610fc1611271565b565b60015481565b6000600880549050905090565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561106c5780601f106110415761010080835404028352916020019161106c565b820191906000526020600020905b81548152906001019060200180831161104f57829003601f168201915b505050505081565b60035481565b600060045442101580156110b457506003600481111561109657fe5b600a60009054906101000a900460ff1660048111156110b157fe5b14155b905090565b60075481565b60006110ca33610c4b565b905060008111156111d15780600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561116557600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60006001546007541415156111fe57600154826000015184028115156111f657fe5b04905061120c565b816020015182600001510390505b92915050565b600154600754141561126f576003600a60006101000a81548160ff0219169083600481111561123d57fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b6001546006541015156112cf576001600a60006101000a81548160ff0219169083600481111561129d57fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b8154818355818115116112fe576002028160020283600052602060002091820191016112fd919061132f565b5b505050565b81548183558181151161132a57818360005260206000209182019101611329919061135e565b5b505050565b61135b91905b8082111561135757600080820160009055600182016000905550600201611335565b5090565b90565b61138091905b8082111561137c576000816000905550600101611364565b5090565b905600a165627a7a72305820dd36fb267f9b7e36e90fc74ddb485c0c7f4fb92d6c293f494e942c215b1da3d50029", + "sourceMap": "110:7397:0:-;;;1440:688;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1678:16;1660:15;;:34;;;;;;;;;;;;;;;;;;1739:7;1717:19;:29;1704:10;:42;;;;1776:24;1756:17;:44;;;;1867:6;1838:26;:35;1832:3;:41;1810:19;:63;;;;1952:6;1925:24;:33;1903:19;;:55;1883:17;:75;;;;1979:9;1968:8;:20;;;;;;;;;;;;:::i;:::-;;2063:8;:58;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;2077:43;;;;;;;;;2090:17;;2077:43;;;;2109:10;;2077:43;;;2063:58;;;;;;;;;;;;;;;;;;;;;;;;1440:688;;;;;110:7397;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", + "deployedSourceMap": "110:7397:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;720:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;297:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7143:104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6799:188;;;;;;;;;;;;;;561:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3671:1121;;;;;;3178:412;;;;;;;;;;;;;;7257:105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;599:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;866:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;383:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;161:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;902;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;225:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5956:757;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2207:638;;;;;;197:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7038:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;332:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;260:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7372:133;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;413:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5535:340;;;;;;;;;;;;;;720:25;;;;;;;;;;;;;:::o;297:29::-;;;;:::o;7143:104::-;7192:4;7228:12;;7215:10;;:25;7208:32;;7143:104;:::o;6799:188::-;6851:19;;6844:3;:26;;:55;;;;;6889:10;;6874:12;;:25;6844:55;6840:141;;;6930:13;6915:12;;:28;;;;;;;;;;;;;;;;;;;;;;;;6957:13;;;;;;;;;;6840:141;6799:188::o;561:32::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3671:1121::-;4196:23;4241:22;4282:6;4341:21;4397:20;3814:15;;;;;;;;;;;3800:29;;:10;:29;;;3792:38;;;;;;;;3864:14;3848:30;;;;;;;;:12;;;;;;;;;;;:30;;;;;;;;;3840:39;;;;;;;;3910:19;:17;:19::i;:::-;3897:9;:32;;3889:41;;;;;;;;3965:9;3949:12;;:25;;;;;;;;;;;3984:44;4001:15;;;;;;;;;;;4018:9;3984:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;4038:8;:43;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;4052:28;;;;;;;;;4065:3;4052:28;;;;4070:9;4052:28;;;4038:43;;;;;;;;;;;;;;;;;;;;;;;;4222:9;4196:35;;4266:1;4241:26;;4291:1;4282:10;;4277:473;4298:15;:22;;;;4294:1;:26;4277:473;;;4365:15;4381:1;4365:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;4341:42;;4420:69;4439:18;4459:14;:29;4474:13;4459:29;;;;;;;;;;;;;;;4420:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;:69::i;:::-;4397:92;;4525:1;4507:15;:19;4503:237;;;4546:46;4561:13;4576:15;4546:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;4656:15;4610:14;:29;4625:13;4610:29;;;;;;;;;;;;;;;:42;;;:61;;;;;;;;;;;4710:15;4689:36;;;;4503:237;4322:3;;;;;;;4277:473;;;4768:17;:15;:17::i;:::-;3671:1121;;;;;:::o;3178:412::-;3315:15;;;;;;;;;;;3301:29;;:10;:29;;;3293:38;;;;;;;;3365:12;3349:28;;;;;;;;:12;;;;;;;;;;;:28;;;;;;;;;3341:37;;;;;;;;3416:1;3401:12;;:16;3397:187;;;3448:14;3433:12;;:29;;;;;;;;;;;;;;;;;;;;;;;;3476:10;:19;;:33;3496:12;;3476:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3523:50;3543:15;;;;;;;;;;;3560:12;;3523:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;3397:187;3178:412::o;7257:105::-;7307:4;7343:12;;7330:10;;:25;7323:32;;7257:105;:::o;599:55::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;866:30::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;383:24::-;;;;:::o;161:30::-;;;;;;;;;;;;;:::o;902:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;225:29::-;;;;:::o;5956:757::-;6030:4;6046:22;6082:35;6071:1;6046:26;;6120:14;:26;6135:10;6120:26;;;;;;;;;;;;;;;6082:64;;6176:13;6160:29;;;;;;;;:12;;;;;;;;;;;:29;;;;;;;;;6156:517;;;6336:13;:29;;;6309:13;:24;;;:56;6289:76;;6156:517;;;6402:14;6386:30;;;;;;;;:12;;;;;;;;;;;:30;;;;;;;;;:62;;;;6436:12;6420:28;;;;;;;;:12;;;;;;;;;;;:28;;;;;;;;;6386:62;6382:291;;;6633:13;:29;;;6604:13;:26;;;:58;6584:78;;6382:291;6156:517;6689:17;6682:24;;5956:757;;;;;:::o;2207:638::-;2333:15;;;;;;;;;;;2319:29;;:10;:29;;;;2311:38;;;;;;;;2380:18;:16;:18::i;:::-;2367:9;:31;;2359:40;;;;;;;;2502:1;2461:14;:26;2476:10;2461:26;;;;;;;;;;;;;;;:37;;;:42;2457:259;;;2519:15;:32;;;;;;;;;;;:::i;:::-;;;;;;;;;;2540:10;2519:32;;;;;;;;;;;;;;;;;;;;;;;2594:30;;;;;;;;;2608:9;2594:30;;;;2619:1;2594:30;;;;2622:1;2594:30;;;2565:14;:26;2580:10;2565:26;;;;;;;;;;;;;;;:59;;;;;;;;;;;;;;;;;;;;;;;;;;;2457:259;;;2696:9;2655:14;:26;2670:10;2655:26;;;;;;;;;;;;;;;:37;;;:50;;;;;;;;;;;2457:259;2750:9;2734:12;;:25;;;;;;;;;;;2769:33;2780:10;2792:9;2769:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;2821:17;:15;:17::i;:::-;2207:638::o;197:22::-;;;;:::o;7038:95::-;7081:4;7104:15;:22;;;;7097:29;;7038:95;:::o;332:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;260:31::-;;;;:::o;7372:133::-;7417:4;7448:17;;7441:3;:24;;:56;;;;;7485:12;7469:28;;;;;;;;:12;;;;;;;;;;;:28;;;;;;;;;;7441:56;7433:65;;7372:133;:::o;413:24::-;;;;:::o;5535:340::-;5578:21;5602:35;5626:10;5602:23;:35::i;:::-;5578:59;;5670:1;5651:16;:20;5647:222;;;5733:16;5687:14;:26;5702:10;5687:26;;;;;;;;;;;;;;;:42;;;:62;;;;;;;;;;;5763:10;:19;;:37;5783:16;5763:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5814:44;5829:10;5841:16;5814:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;5647:222;5535:340;:::o;4802:461::-;4900:4;4936:10;;4920:12;;:26;;4916:341;;;5089:10;;5067:7;:18;;;5046;:39;5045:54;;;;;;;;5038:61;;;;4916:341;5226:7;:20;;;5205:7;:18;;;:41;5198:48;;4802:461;;;;;:::o;5273:161::-;5338:10;;5322:12;;:26;5318:110;;;5379:12;5364;;:27;;;;;;;;;;;;;;;;;;;;;;;;5405:12;;;;;;;;;;5318:110;5273:161::o;2928:::-;2993:10;;2977:12;;:26;;2973:110;;;3034:12;3019;;:27;;;;;;;;;;;;;;;;;;;;;;;;3060:12;;;;;;;;;;2973:110;2928:161::o;110:7397::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "source": "pragma solidity ^0.4.15;\n/*\n A simple loan contract which allows lenders to lend and borrowers to repay\n*/\ncontract LoanContract {\n //Constructor vars\n address public borrowerAddress;\n uint public loanAmount;\n uint public repaymentDuration;\n uint public fundRaisingDeadline;\n uint public repaymentDeadline;\n string public ipfsHash;\n \n //Useful vars\n uint public amountRaised;\n uint public amountRepaid;\n /* Since solidity doesn't allow iterating over mapping, we need 2 data structures to represent lender accounts */\n address[] public lenderAddresses;\n mapping(address => LenderAccount) public lenderAccounts;\n enum State {raising, funded, repaying, repaid, expired}\n State public currentState;\n struct LenderAccount {\n uint amountLent;\n uint amountRepaid;\n uint amountWithdrawn;\n }\n PaymentEntry[] public schedule;\n PaymentEntry[] public payments;\n struct PaymentEntry {\n uint date;\n uint amount;\n }\n \n //Events\n event LentToLoan(address addr, uint amount);\n event DisbursedToBorrower(address addr, uint amount);\n event RepaidByBorrower(address addr, uint amount);\n event RepaidToLender(address addr, uint amount);\n event SentBack(address addr, uint amount);\n event LenderWithdrew(address addr, uint amount);\n event LoanFunded();\n event LoanExpired();\n event LoanRepaid();\n \n // Constructor\n function LoanContract(\n address _borrowerAddress, \n uint _loanAmountInEthers,\n uint _fundRaisingDurationInDays,\n uint _repaymentDurationInDays,\n string _ipfsHash\n ) public {\n borrowerAddress = _borrowerAddress;\n loanAmount = _loanAmountInEthers * 1 ether;\n repaymentDuration = _repaymentDurationInDays;\n fundRaisingDeadline = now + _fundRaisingDurationInDays * 1 days;\n repaymentDeadline = fundRaisingDeadline + _repaymentDurationInDays * 1 days;\n ipfsHash = _ipfsHash;\n // For now just do a single scheduled payment at the end\n schedule.push(PaymentEntry(repaymentDeadline, loanAmount));\n }\n \n // Lender sends wei to the contract, we store how much they lent\n function lend() payable public {\n // Don't allow borrowers to lend, or allow overfunding\n require(msg.sender != borrowerAddress);\n require(msg.value <= amountLeftToFund());\n \n // Handle lender lending twice\n if (lenderAccounts[msg.sender].amountLent == 0) {\n lenderAddresses.push(msg.sender);\n lenderAccounts[msg.sender] = LenderAccount(msg.value, 0, 0);\n } else {\n lenderAccounts[msg.sender].amountLent += msg.value;\n }\n \n amountRaised += msg.value;\n LentToLoan(msg.sender, msg.value);\n \n checkLoanFunded();\n }\n \n // If we have raised the full loan amount, then transition to funded\n function checkLoanFunded() private {\n if (amountRaised >= loanAmount) {\n currentState = State.funded;\n LoanFunded();\n }\n }\n \n // The recommended pattern for disbursals is to have the borrower withdraw\n function borrowerWithdraw() public {\n // Only borrowers can withdraw, and only in the funded state\n require(msg.sender == borrowerAddress);\n require(currentState == State.funded);\n \n if (amountRaised > 0) {\n currentState = State.repaying;\n msg.sender.transfer(amountRaised);\n DisbursedToBorrower(borrowerAddress, amountRaised);\n }\n }\n \n // Borrower sends wei to the contract, we record the amount repaid\n function repay() payable public {\n // Only borrowers can repay, and can't repay more than the amount left\n require(msg.sender == borrowerAddress);\n require(currentState == State.repaying);\n require(msg.value <= amountLeftToRepay());\n \n amountRepaid += msg.value;\n RepaidByBorrower(borrowerAddress, msg.value);\n payments.push(PaymentEntry(now, msg.value));\n \n // Distribute wei evenly to lenders, if there's a remainder we'll distribute at the end\n uint amountToDistribute = msg.value;\n uint amountDistributed = 0;\n for (uint i = 0; i < lenderAddresses.length; i++) {\n address currentLender = lenderAddresses[i];\n uint amountForLender = getAmountForLender(amountToDistribute, lenderAccounts[currentLender]);\n if (amountForLender > 0) {\n RepaidToLender(currentLender, amountForLender);\n lenderAccounts[currentLender].amountRepaid += amountForLender;\n amountDistributed += amountForLender;\n }\n }\n \n checkLoanRepaid();\n }\n \n function getAmountForLender(uint amountToDistribute, LenderAccount account) private view returns (uint) {\n if (amountRepaid != loanAmount) {\n // Regular case, division in solidity throws away the remainder\n return (amountToDistribute * account.amountLent) / loanAmount;\n } else {\n // Last repayment case, make sure everyone is topped up\n return account.amountLent - account.amountRepaid;\n }\n }\n \n function checkLoanRepaid() private {\n if (amountRepaid == loanAmount) {\n currentState = State.repaid;\n LoanRepaid();\n }\n }\n \n // The recommended pattern for lender's to recieve repayments is to have them withdraw\n function lenderWithdraw() public {\n uint amountToWithdraw = amountLenderCanWithdraw(msg.sender);\n if (amountToWithdraw > 0) {\n lenderAccounts[msg.sender].amountWithdrawn += amountToWithdraw;\n msg.sender.transfer(amountToWithdraw);\n LenderWithdrew(msg.sender, amountToWithdraw);\n }\n }\n \n // Calculates how much the lender can withdraw based on loan state\n function amountLenderCanWithdraw(address lenderAddr) public view returns (uint) {\n uint amountCanWithdraw = 0;\n LenderAccount storage lenderAccount = lenderAccounts[lenderAddr];\n if (currentState == State.expired) {\n /* If the loan expired, lenders can withdraw their contributed amount*/\n amountCanWithdraw = lenderAccount.amountLent - lenderAccount.amountWithdrawn;\n } else if (currentState == State.repaying || currentState == State.repaid) {\n /* If the loan is repaying or fully repaid the lenders can withdraw however much has been repaid to them */\n amountCanWithdraw = lenderAccount.amountRepaid - lenderAccount.amountWithdrawn;\n }\n return amountCanWithdraw;\n }\n\n // Solidity doesn't support timer calls, so an admin will have to call this\n function makeExpired() public {\n if (now >= fundRaisingDeadline && amountRaised < loanAmount) {\n currentState = State.expired;\n LoanExpired();\n }\n }\n \n /* Useful constant functions */\n \n function numLenders() public view returns (uint) {\n return lenderAddresses.length;\n }\n \n function amountLeftToFund() public view returns (uint) {\n return loanAmount - amountRaised;\n }\n \n function amountLeftToRepay() public view returns (uint) {\n return loanAmount - amountRepaid;\n }\n \n function isDelinquent() public view returns (bool) {\n return (now >= repaymentDeadline && currentState != State.repaid);\n }\n}\n", + "sourcePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanContract.sol", + "ast": { + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanContract.sol", + "exportedSymbols": { + "LoanContract": [ + 592 + ] + }, + "id": 593, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".15" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 592, + "linearizedBaseContracts": [ + 592 + ], + "name": "LoanContract", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3, + "name": "borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "161:30:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "161:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 5, + "name": "loanAmount", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "197:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "197:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 7, + "name": "repaymentDuration", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "225:29:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "225:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 9, + "name": "fundRaisingDeadline", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "260:31:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "260:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 11, + "name": "repaymentDeadline", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "297:29:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 10, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "297:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 13, + "name": "ipfsHash", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "332:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + }, + "typeName": { + "id": 12, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "332:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 15, + "name": "amountRaised", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "383:24:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 14, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "383:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 17, + "name": "amountRepaid", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "413:24:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 16, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "413:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 20, + "name": "lenderAddresses", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "561:32:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + }, + "typeName": { + "baseType": { + "id": 18, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "561:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 19, + "length": null, + "nodeType": "ArrayTypeName", + "src": "561:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[] storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 24, + "name": "lenderAccounts", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "599:55:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + }, + "typeName": { + "id": 23, + "keyType": { + "id": 21, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "607:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "599:33:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + }, + "valueType": { + "contractScope": null, + "id": 22, + "name": "LenderAccount", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 39, + "src": "618:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + } + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "name": "currentState", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "enum LoanContract.State", - "value": null, - "visibility": "public" - }, - "children": [ + "canonicalName": "LoanContract.State", + "id": 30, + "members": [ { - "attributes": { - "contractScope": null, - "name": "State", - "referencedDeclaration": 32, - "type": "enum LoanContract.State" - }, - "id": 33, - "name": "UserDefinedTypeName", - "src": "739:5:0" + "id": 25, + "name": "raising", + "nodeType": "EnumValue", + "src": "672:7:0" + }, + { + "id": 26, + "name": "funded", + "nodeType": "EnumValue", + "src": "681:6:0" + }, + { + "id": 27, + "name": "repaying", + "nodeType": "EnumValue", + "src": "689:8:0" + }, + { + "id": 28, + "name": "repaid", + "nodeType": "EnumValue", + "src": "699:6:0" + }, + { + "id": 29, + "name": "expired", + "nodeType": "EnumValue", + "src": "707:7:0" } ], - "id": 34, - "name": "VariableDeclaration", - "src": "739:25:0" + "name": "State", + "nodeType": "EnumDefinition", + "src": "660:55:0" }, { - "attributes": { - "canonicalName": "LoanContract.LenderAccount", - "name": "LenderAccount", - "scope": 600, - "visibility": "public" + "constant": false, + "id": 32, + "name": "currentState", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "720:25:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "typeName": { + "contractScope": null, + "id": 31, + "name": "State", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 30, + "src": "720:5:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - "children": [ + "value": null, + "visibility": "public" + }, + { + "canonicalName": "LoanContract.LenderAccount", + "id": 39, + "members": [ { - "attributes": { - "constant": false, - "name": "amountLent", - "scope": 41, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "constant": false, + "id": 34, + "name": "amountLent", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "782:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 35, - "name": "ElementaryTypeName", - "src": "801:4:0" + "typeName": { + "id": 33, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "782:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 36, - "name": "VariableDeclaration", - "src": "801:15:0" + }, + "value": null, + "visibility": "internal" }, { - "attributes": { - "constant": false, - "name": "amountRepaid", - "scope": 41, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "constant": false, + "id": 36, + "name": "amountRepaid", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "807:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 37, - "name": "ElementaryTypeName", - "src": "826:4:0" + "typeName": { + "id": 35, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "807:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 38, - "name": "VariableDeclaration", - "src": "826:17:0" + }, + "value": null, + "visibility": "internal" }, { - "attributes": { - "constant": false, - "name": "amountWithdrawn", - "scope": 41, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "constant": false, + "id": 38, + "name": "amountWithdrawn", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "834:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 39, - "name": "ElementaryTypeName", - "src": "853:4:0" + "typeName": { + "id": 37, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "834:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 40, - "name": "VariableDeclaration", - "src": "853:20:0" + }, + "value": null, + "visibility": "internal" } ], - "id": 41, - "name": "StructDefinition", - "src": "770:110:0" + "name": "LenderAccount", + "nodeType": "StructDefinition", + "scope": 592, + "src": "751:110:0", + "visibility": "public" }, { - "attributes": { - "constant": false, - "name": "schedule", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "struct LoanContract.PaymentEntry storage ref[] storage ref", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "length": null, - "type": "struct LoanContract.PaymentEntry storage ref[] storage pointer" - }, - "children": [ - { - "attributes": { - "contractScope": null, - "name": "PaymentEntry", - "referencedDeclaration": 52, - "type": "struct LoanContract.PaymentEntry storage pointer" - }, - "id": 42, - "name": "UserDefinedTypeName", - "src": "885:12:0" - } - ], - "id": 43, - "name": "ArrayTypeName", - "src": "885:14:0" + "constant": false, + "id": 42, + "name": "schedule", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "866:30:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 40, + "name": "PaymentEntry", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 50, + "src": "866:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage pointer" + } + }, + "id": 41, + "length": null, + "nodeType": "ArrayTypeName", + "src": "866:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage pointer" } - ], - "id": 44, - "name": "VariableDeclaration", - "src": "885:30:0" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "name": "payments", - "scope": 600, - "stateVariable": true, - "storageLocation": "default", - "type": "struct LoanContract.PaymentEntry storage ref[] storage ref", - "value": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "length": null, - "type": "struct LoanContract.PaymentEntry storage ref[] storage pointer" - }, - "children": [ - { - "attributes": { - "contractScope": null, - "name": "PaymentEntry", - "referencedDeclaration": 52, - "type": "struct LoanContract.PaymentEntry storage pointer" - }, - "id": 45, - "name": "UserDefinedTypeName", - "src": "921:12:0" - } - ], - "id": 46, - "name": "ArrayTypeName", - "src": "921:14:0" + "constant": false, + "id": 45, + "name": "payments", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "902:30:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 43, + "name": "PaymentEntry", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 50, + "src": "902:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage pointer" + } + }, + "id": 44, + "length": null, + "nodeType": "ArrayTypeName", + "src": "902:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage pointer" } - ], - "id": 47, - "name": "VariableDeclaration", - "src": "921:30:0" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "canonicalName": "LoanContract.PaymentEntry", - "name": "PaymentEntry", - "scope": 600, - "visibility": "public" - }, - "children": [ + "canonicalName": "LoanContract.PaymentEntry", + "id": 50, + "members": [ { - "attributes": { - "constant": false, - "name": "date", - "scope": 52, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "constant": false, + "id": 47, + "name": "date", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "968:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 48, - "name": "ElementaryTypeName", - "src": "987:4:0" + "typeName": { + "id": 46, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "968:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 49, - "name": "VariableDeclaration", - "src": "987:9:0" + }, + "value": null, + "visibility": "internal" }, { - "attributes": { + "constant": false, + "id": 49, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "987:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 48, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "987:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "PaymentEntry", + "nodeType": "StructDefinition", + "scope": 592, + "src": "938:67:0", + "visibility": "public" + }, + { + "anonymous": false, + "id": 56, + "name": "LentToLoan", + "nodeType": "EventDefinition", + "parameters": { + "id": 55, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 52, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1045:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 51, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1045:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { "constant": false, + "id": 54, + "indexed": false, "name": "amount", - "scope": 52, + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1059:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 53, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1059:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1044:27:0" + }, + "src": "1028:44:0" + }, + { + "anonymous": false, + "id": 62, + "name": "DisbursedToBorrower", + "nodeType": "EventDefinition", + "parameters": { + "id": 61, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 58, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 62, + "src": "1103:12:0", "stateVariable": false, "storageLocation": "default", - "type": "uint256", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 57, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1103:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, "value": null, "visibility": "internal" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 50, - "name": "ElementaryTypeName", - "src": "1006:4:0" - } - ], - "id": 51, - "name": "VariableDeclaration", - "src": "1006:11:0" - } - ], - "id": 52, - "name": "StructDefinition", - "src": "957:67:0" + { + "constant": false, + "id": 60, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 62, + "src": "1117:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 59, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1117:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1102:27:0" + }, + "src": "1077:53:0" }, { - "attributes": { - "anonymous": false, - "name": "LentToLoan" + "anonymous": false, + "id": 68, + "name": "RepaidByBorrower", + "nodeType": "EventDefinition", + "parameters": { + "id": 67, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 64, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 68, + "src": "1158:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 63, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1158:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 66, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 68, + "src": "1172:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 65, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1172:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1157:27:0" }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": false, - "name": "addr", - "scope": 58, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 53, - "name": "ElementaryTypeName", - "src": "1064:7:0" - } - ], - "id": 54, - "name": "VariableDeclaration", - "src": "1064:12:0" + "src": "1135:50:0" + }, + { + "anonymous": false, + "id": 74, + "name": "RepaidToLender", + "nodeType": "EventDefinition", + "parameters": { + "id": 73, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 70, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 74, + "src": "1211:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "amount", - "scope": 58, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 55, - "name": "ElementaryTypeName", - "src": "1078:4:0" - } - ], - "id": 56, - "name": "VariableDeclaration", - "src": "1078:11:0" - } - ], - "id": 57, - "name": "ParameterList", - "src": "1063:27:0" - } - ], - "id": 58, - "name": "EventDefinition", - "src": "1047:44:0" + "typeName": { + "id": 69, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1211:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 72, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 74, + "src": "1225:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 71, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1225:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1210:27:0" + }, + "src": "1190:48:0" }, { - "attributes": { - "anonymous": false, - "name": "DisbursedToBorrower" + "anonymous": false, + "id": 80, + "name": "SentBack", + "nodeType": "EventDefinition", + "parameters": { + "id": 79, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 76, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 80, + "src": "1258:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 75, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1258:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 78, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 80, + "src": "1272:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 77, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1272:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1257:27:0" }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": false, - "name": "addr", - "scope": 64, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 59, - "name": "ElementaryTypeName", - "src": "1122:7:0" - } - ], - "id": 60, - "name": "VariableDeclaration", - "src": "1122:12:0" + "src": "1243:42:0" + }, + { + "anonymous": false, + "id": 86, + "name": "LenderWithdrew", + "nodeType": "EventDefinition", + "parameters": { + "id": 85, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 82, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 86, + "src": "1311:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "amount", - "scope": 64, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 61, - "name": "ElementaryTypeName", - "src": "1136:4:0" - } - ], - "id": 62, - "name": "VariableDeclaration", - "src": "1136:11:0" - } - ], - "id": 63, - "name": "ParameterList", - "src": "1121:27:0" - } - ], - "id": 64, - "name": "EventDefinition", - "src": "1096:53:0" + "typeName": { + "id": 81, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1311:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 84, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 86, + "src": "1325:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 83, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1325:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1310:27:0" + }, + "src": "1290:48:0" }, { - "attributes": { - "anonymous": false, - "name": "RepaidByBorrower" + "anonymous": false, + "id": 88, + "name": "LoanFunded", + "nodeType": "EventDefinition", + "parameters": { + "id": 87, + "nodeType": "ParameterList", + "parameters": [], + "src": "1359:2:0" }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": false, - "name": "addr", - "scope": 70, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 65, - "name": "ElementaryTypeName", - "src": "1177:7:0" - } - ], - "id": 66, - "name": "VariableDeclaration", - "src": "1177:12:0" - }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "amount", - "scope": 70, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 67, - "name": "ElementaryTypeName", - "src": "1191:4:0" - } - ], - "id": 68, - "name": "VariableDeclaration", - "src": "1191:11:0" - } - ], - "id": 69, - "name": "ParameterList", - "src": "1176:27:0" - } - ], - "id": 70, - "name": "EventDefinition", - "src": "1154:50:0" + "src": "1343:19:0" }, { - "attributes": { - "anonymous": false, - "name": "RepaidToLender" + "anonymous": false, + "id": 90, + "name": "LoanExpired", + "nodeType": "EventDefinition", + "parameters": { + "id": 89, + "nodeType": "ParameterList", + "parameters": [], + "src": "1384:2:0" }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": false, - "name": "addr", - "scope": 76, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 71, - "name": "ElementaryTypeName", - "src": "1230:7:0" - } - ], - "id": 72, - "name": "VariableDeclaration", - "src": "1230:12:0" - }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "amount", - "scope": 76, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 73, - "name": "ElementaryTypeName", - "src": "1244:4:0" - } - ], - "id": 74, - "name": "VariableDeclaration", - "src": "1244:11:0" - } - ], - "id": 75, - "name": "ParameterList", - "src": "1229:27:0" - } - ], - "id": 76, - "name": "EventDefinition", - "src": "1209:48:0" + "src": "1367:20:0" }, { - "attributes": { - "anonymous": false, - "name": "SentBack" + "anonymous": false, + "id": 92, + "name": "LoanRepaid", + "nodeType": "EventDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [], + "src": "1408:2:0" }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": false, - "name": "addr", - "scope": 82, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" + "src": "1392:19:0" + }, + { + "body": { + "id": 148, + "nodeType": "Block", + "src": "1650:478:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 105, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "1660:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 77, - "name": "ElementaryTypeName", - "src": "1277:7:0" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 106, + "name": "_borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1678:16:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 78, - "name": "VariableDeclaration", - "src": "1277:12:0" + }, + "src": "1660:34:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "amount", - "scope": 82, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "id": 108, + "nodeType": "ExpressionStatement", + "src": "1660:34:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 113, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 109, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "1704:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 110, + "name": "_loanAmountInEthers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "1717:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1739:7:0", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" }, - "id": 79, - "name": "ElementaryTypeName", - "src": "1291:4:0" + "value": "1" + }, + "src": "1717:29:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 80, - "name": "VariableDeclaration", - "src": "1291:11:0" - } - ], - "id": 81, - "name": "ParameterList", - "src": "1276:27:0" - } - ], - "id": 82, - "name": "EventDefinition", - "src": "1262:42:0" - }, - { - "attributes": { - "anonymous": false, - "name": "LenderWithdrew" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": false, - "name": "addr", - "scope": 88, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 83, - "name": "ElementaryTypeName", - "src": "1330:7:0" - } - ], - "id": 84, - "name": "VariableDeclaration", - "src": "1330:12:0" + "src": "1704:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "amount", - "scope": 88, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 85, - "name": "ElementaryTypeName", - "src": "1344:4:0" - } - ], - "id": 86, - "name": "VariableDeclaration", - "src": "1344:11:0" - } - ], - "id": 87, - "name": "ParameterList", - "src": "1329:27:0" - } - ], - "id": 88, - "name": "EventDefinition", - "src": "1309:48:0" - }, - { - "attributes": { - "anonymous": false, - "name": "LoanFunded" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 89, - "name": "ParameterList", - "src": "1378:2:0" - } - ], - "id": 90, - "name": "EventDefinition", - "src": "1362:19:0" - }, - { - "attributes": { - "anonymous": false, - "name": "LoanExpired" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 91, - "name": "ParameterList", - "src": "1403:2:0" - } - ], - "id": 92, - "name": "EventDefinition", - "src": "1386:20:0" - }, - { - "attributes": { - "anonymous": false, - "name": "LoanRepaid" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] + "id": 114, + "nodeType": "ExpressionStatement", + "src": "1704:42:0" }, - "children": [], - "id": 93, - "name": "ParameterList", - "src": "1427:2:0" - } - ], - "id": 94, - "name": "EventDefinition", - "src": "1411:19:0" - }, - { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": true, - "modifiers": [ - null - ], - "name": "LoanContract", - "payable": false, - "scope": 600, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_borrowerAddress", - "scope": 157, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 95, - "name": "ElementaryTypeName", - "src": "1490:7:0" + { + "expression": { + "argumentTypes": null, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 115, + "name": "repaymentDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7, + "src": "1756:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 96, - "name": "VariableDeclaration", - "src": "1490:24:0" - }, - { - "attributes": { - "constant": false, - "name": "_loanAmountInEthers", - "scope": 157, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 97, - "name": "ElementaryTypeName", - "src": "1525:4:0" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 116, + "name": "_repaymentDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1776:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 98, - "name": "VariableDeclaration", - "src": "1525:24:0" + }, + "src": "1756:44:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { - "constant": false, - "name": "_fundRaisingDurationInDays", - "scope": 157, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "id": 118, + "nodeType": "ExpressionStatement", + "src": "1756:44:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 119, + "name": "fundRaisingDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "1810:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 120, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "1832:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 121, + "name": "_fundRaisingDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "1838:26:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 122, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1867:6:0", + "subdenomination": "days", + "typeDescriptions": { + "typeIdentifier": "t_rational_86400_by_1", + "typeString": "int_const 86400" + }, + "value": "1" }, - "id": 99, - "name": "ElementaryTypeName", - "src": "1559:4:0" + "src": "1838:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1832:41:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 100, - "name": "VariableDeclaration", - "src": "1559:31:0" + }, + "src": "1810:63:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { - "constant": false, - "name": "_repaymentDurationInDays", - "scope": 157, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "id": 126, + "nodeType": "ExpressionStatement", + "src": "1810:63:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 127, + "name": "repaymentDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "1883:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 132, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 128, + "name": "fundRaisingDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "1903:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 131, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 129, + "name": "_repaymentDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1925:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "id": 101, - "name": "ElementaryTypeName", - "src": "1600:4:0" + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1952:6:0", + "subdenomination": "days", + "typeDescriptions": { + "typeIdentifier": "t_rational_86400_by_1", + "typeString": "int_const 86400" + }, + "value": "1" + }, + "src": "1925:33:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1903:55:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 102, - "name": "VariableDeclaration", - "src": "1600:29:0" + }, + "src": "1883:75:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { - "constant": false, - "name": "_name", - "scope": 157, - "stateVariable": false, - "storageLocation": "default", - "type": "string memory", - "value": null, - "visibility": "internal" + "id": 134, + "nodeType": "ExpressionStatement", + "src": "1883:75:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 137, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 135, + "name": "ipfsHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1968:8:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } }, - "children": [ - { - "attributes": { - "name": "string", - "type": "string storage pointer" - }, - "id": 103, - "name": "ElementaryTypeName", - "src": "1639:6:0" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 136, + "name": "_ipfsHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 102, + "src": "1979:9:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" } - ], - "id": 104, - "name": "VariableDeclaration", - "src": "1639:12:0" - }, - { - "attributes": { - "constant": false, - "name": "_use", - "scope": 157, - "stateVariable": false, - "storageLocation": "default", - "type": "string memory", - "value": null, - "visibility": "internal" }, - "children": [ + "src": "1968:20:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 138, + "nodeType": "ExpressionStatement", + "src": "1968:20:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "string", - "type": "string storage pointer" + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 143, + "name": "repaymentDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "2090:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 144, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "2109:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 142, + "name": "PaymentEntry", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 50, + "src": "2077:12:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_PaymentEntry_$50_storage_ptr_$", + "typeString": "type(struct LoanContract.PaymentEntry storage pointer)" + } }, - "id": 105, - "name": "ElementaryTypeName", - "src": "1661:6:0" + "id": 145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2077:43:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } } ], - "id": 106, - "name": "VariableDeclaration", - "src": "1661:11:0" - } - ], - "id": 107, - "name": "ParameterList", - "src": "1480:198:0" - }, - { - "attributes": { - "parameters": [ - null - ] + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 139, + "name": "schedule", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 42, + "src": "2063:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + } + }, + "id": 141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2063:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_PaymentEntry_$50_storage_$returns$_t_uint256_$", + "typeString": "function (struct LoanContract.PaymentEntry storage ref) returns (uint256)" + } + }, + "id": 146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2063:58:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 147, + "nodeType": "ExpressionStatement", + "src": "2063:58:0" + } + ] + }, + "id": 149, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "LoanContract", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 94, + "name": "_borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1471:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1471:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" }, - "children": [], - "id": 108, - "name": "ParameterList", - "src": "1686:0:0" - }, - { - "children": [ - { - "children": [ + { + "constant": false, + "id": 96, + "name": "_loanAmountInEthers", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1506:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 95, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1506:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 98, + "name": "_fundRaisingDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1540:31:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 97, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1540:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 100, + "name": "_repaymentDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1581:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 99, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1581:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 102, + "name": "_ipfsHash", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1620:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + "typeName": { + "id": 101, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1620:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1461:181:0" + }, + "payable": false, + "returnParameters": { + "id": 104, + "nodeType": "ParameterList", + "parameters": [], + "src": "1650:0:0" + }, + "scope": 592, + "src": "1440:688:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 220, + "nodeType": "Block", + "src": "2238:607:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 153, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2319:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 154, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "=", - "type": "address" + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2319:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 3, - "type": "address", - "value": "borrowerAddress" - }, - "id": 109, - "name": "Identifier", - "src": "1696:15:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 96, - "type": "address", - "value": "_borrowerAddress" - }, - "id": 110, - "name": "Identifier", - "src": "1714:16:0" + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "id": 155, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "2333:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 111, - "name": "Assignment", - "src": "1696:34:0" + }, + "src": "2319:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 112, - "name": "ExpressionStatement", - "src": "1696:34:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 152, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "2311:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2311:38:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ + "id": 158, + "nodeType": "ExpressionStatement", + "src": "2311:38:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 164, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 160, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2367:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 161, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "=", - "type": "uint256" + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2367:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 113, - "name": "Identifier", - "src": "1740:10:0" + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 162, + "name": "amountLeftToFund", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 565, + "src": "2380:16:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", + "typeString": "function () view returns (uint256)" + } }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "*", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 98, - "type": "uint256", - "value": "_loanAmountInEthers" - }, - "id": 114, - "name": "Identifier", - "src": "1753:19:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "31", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": "ether", - "token": "number", - "type": "int_const 1000000000000000000", - "value": "1" - }, - "id": 115, - "name": "Literal", - "src": "1775:7:0" - } - ], - "id": 116, - "name": "BinaryOperation", - "src": "1753:29:0" + "id": 163, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2380:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 117, - "name": "Assignment", - "src": "1740:42:0" + }, + "src": "2367:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 118, - "name": "ExpressionStatement", - "src": "1740:42:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 159, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "2359:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2359:40:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ - { - "attributes": { + "id": 166, + "nodeType": "ExpressionStatement", + "src": "2359:40:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 173, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 167, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "2461:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 170, + "indexExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 168, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2476:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 169, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 7, - "type": "uint256", - "value": "repaymentDuration" - }, - "id": 119, - "name": "Identifier", - "src": "1792:17:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 102, - "type": "uint256", - "value": "_repaymentDurationInDays" - }, - "id": 120, - "name": "Identifier", - "src": "1812:24:0" + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2476:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 121, - "name": "Assignment", - "src": "1792:44:0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2461:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "id": 171, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "2461:37:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 122, - "name": "ExpressionStatement", - "src": "1792:44:0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 172, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2502:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2461:42:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": { + "id": 203, + "nodeType": "Block", + "src": "2641:75:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "id": 201, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 9, - "type": "uint256", - "value": "fundRaisingDeadline" + "baseExpression": { + "argumentTypes": null, + "id": 194, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "2655:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 197, + "indexExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 195, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2670:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2670:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2655:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } }, - "id": 123, - "name": "Identifier", - "src": "1846:19:0" + "id": 198, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "2655:37:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "id": 199, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2696:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2696:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2655:50:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 202, + "nodeType": "ExpressionStatement", + "src": "2655:50:0" + } + ] + }, + "id": 204, + "nodeType": "IfStatement", + "src": "2457:259:0", + "trueBody": { + "id": 193, + "nodeType": "Block", + "src": "2505:130:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 177, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2540:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, + "id": 178, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "+", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 773, - "type": "uint256", - "value": "now" - }, - "id": 124, - "name": "Identifier", - "src": "1868:3:0" - }, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2540:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "*", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 100, - "type": "uint256", - "value": "_fundRaisingDurationInDays" - }, - "id": 125, - "name": "Identifier", - "src": "1874:26:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "31", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": "days", - "token": "number", - "type": "int_const 86400", - "value": "1" - }, - "id": 126, - "name": "Literal", - "src": "1903:6:0" - } - ], - "id": 127, - "name": "BinaryOperation", - "src": "1874:35:0" + "typeIdentifier": "t_address", + "typeString": "address" } ], - "id": 128, - "name": "BinaryOperation", - "src": "1868:41:0" + "expression": { + "argumentTypes": null, + "id": 174, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "2519:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 176, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2519:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } + }, + "id": 179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2519:32:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 129, - "name": "Assignment", - "src": "1846:63:0" - } - ], - "id": 130, - "name": "ExpressionStatement", - "src": "1846:63:0" - }, - { - "children": [ + }, + "id": 180, + "nodeType": "ExpressionStatement", + "src": "2519:32:0" + }, { - "attributes": { + "expression": { "argumentTypes": null, + "id": 191, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 11, - "type": "uint256", - "value": "repaymentDeadline" + "id": 181, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "2565:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } }, - "id": 131, - "name": "Identifier", - "src": "1919:17:0" - }, - { - "attributes": { + "id": 184, + "indexExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "expression": { + "argumentTypes": null, + "id": 182, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2580:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, + "id": 183, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "+", - "type": "uint256" + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2580:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2565:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 9, - "type": "uint256", - "value": "fundRaisingDeadline" + "id": 186, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2608:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, - "id": 132, - "name": "Identifier", - "src": "1939:19:0" + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2608:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "*", - "type": "uint256" + "argumentTypes": null, + "hexValue": "30", + "id": 188, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2619:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 102, - "type": "uint256", - "value": "_repaymentDurationInDays" - }, - "id": 133, - "name": "Identifier", - "src": "1961:24:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "31", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": "days", - "token": "number", - "type": "int_const 86400", - "value": "1" - }, - "id": 134, - "name": "Literal", - "src": "1988:6:0" - } - ], - "id": 135, - "name": "BinaryOperation", - "src": "1961:33:0" + "value": "0" + }, + { + "argumentTypes": null, + "hexValue": "30", + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2622:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" } ], - "id": 136, - "name": "BinaryOperation", - "src": "1939:55:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 185, + "name": "LenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 39, + "src": "2594:13:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_LenderAccount_$39_storage_ptr_$", + "typeString": "type(struct LoanContract.LenderAccount storage pointer)" + } + }, + "id": 190, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2594:30:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory", + "typeString": "struct LoanContract.LenderAccount memory" + } + }, + "src": "2565:59:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" } - ], - "id": 137, - "name": "Assignment", - "src": "1919:75:0" + }, + "id": 192, + "nodeType": "ExpressionStatement", + "src": "2565:59:0" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 205, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "2734:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 206, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2750:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 207, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2750:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2734:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 209, + "nodeType": "ExpressionStatement", + "src": "2734:25:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 211, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2780:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2780:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 213, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2792:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 214, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2792:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 138, - "name": "ExpressionStatement", - "src": "1919:75:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 210, + "name": "LentToLoan", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 56, + "src": "2769:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 215, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2769:33:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 216, + "nodeType": "ExpressionStatement", + "src": "2769:33:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 217, + "name": "checkLoanFunded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 238, + "src": "2821:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 218, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2821:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 219, + "nodeType": "ExpressionStatement", + "src": "2821:17:0" + } + ] + }, + "id": 221, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "lend", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 150, + "nodeType": "ParameterList", + "parameters": [], + "src": "2220:2:0" + }, + "payable": true, + "returnParameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [], + "src": "2238:0:0" + }, + "scope": 592, + "src": "2207:638:0", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 237, + "nodeType": "Block", + "src": "2963:126:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 224, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "2977:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 225, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "2993:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2977:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": null, + "id": 236, + "nodeType": "IfStatement", + "src": "2973:110:0", + "trueBody": { + "id": 235, + "nodeType": "Block", + "src": "3005:78:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "id": 230, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 227, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3019:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", "operator": "=", - "type": "string storage ref" - }, - "children": [ - { - "attributes": { + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 13, - "type": "string storage ref", - "value": "name" + "id": 228, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3034:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } }, - "id": 139, - "name": "Identifier", - "src": "2004:4:0" + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "funded", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3034:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 104, - "type": "string memory", - "value": "_name" - }, - "id": 140, - "name": "Identifier", - "src": "2011:5:0" + "src": "3019:27:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 141, - "name": "Assignment", - "src": "2004:12:0" - } - ], - "id": 142, - "name": "ExpressionStatement", - "src": "2004:12:0" - }, - { - "children": [ + }, + "id": 231, + "nodeType": "ExpressionStatement", + "src": "3019:27:0" + }, { - "attributes": { + "expression": { "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 232, + "name": "LoanFunded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 88, + "src": "3060:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 233, "isConstant": false, "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "operator": "=", - "type": "string storage ref" + "names": [], + "nodeType": "FunctionCall", + "src": "3060:12:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 15, - "type": "string storage ref", - "value": "use" - }, - "id": 143, - "name": "Identifier", - "src": "2026:3:0" + "id": 234, + "nodeType": "ExpressionStatement", + "src": "3060:12:0" + } + ] + } + } + ] + }, + "id": 238, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "checkLoanFunded", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 222, + "nodeType": "ParameterList", + "parameters": [], + "src": "2952:2:0" + }, + "payable": false, + "returnParameters": { + "id": 223, + "nodeType": "ParameterList", + "parameters": [], + "src": "2963:0:0" + }, + "scope": 592, + "src": "2928:161:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 278, + "nodeType": "Block", + "src": "3213:377:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 242, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3301:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 106, - "type": "string memory", - "value": "_use" - }, - "id": 144, - "name": "Identifier", - "src": "2032:4:0" + "id": 243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3301:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 145, - "name": "Assignment", - "src": "2026:10:0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 244, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "3315:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3301:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 146, - "name": "ExpressionStatement", - "src": "2026:10:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 241, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3293:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 246, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3293:38:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ + "id": 247, + "nodeType": "ExpressionStatement", + "src": "3293:38:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 249, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3349:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 250, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3365:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 251, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "funded", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3365:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "3349:28:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 248, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3341:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 253, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3341:37:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 254, + "nodeType": "ExpressionStatement", + "src": "3341:37:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 257, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 255, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "3401:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 256, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3416:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3401:16:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 277, + "nodeType": "IfStatement", + "src": "3397:187:0", + "trueBody": { + "id": 276, + "nodeType": "Block", + "src": "3419:165:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "id": 261, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false + "leftHandSide": { + "argumentTypes": null, + "id": 258, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3433:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 259, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3448:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaying", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3448:14:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "3433:29:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_struct$_PaymentEntry_$52_memory", - "typeString": "struct LoanContract.PaymentEntry memory" + "id": 262, + "nodeType": "ExpressionStatement", + "src": "3433:29:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 268, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "3496:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 263, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3476:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], + }, + "id": 266, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "member_name": "push", + "memberName": "sender", + "nodeType": "MemberAccess", "referencedDeclaration": null, - "type": "function (struct LoanContract.PaymentEntry storage ref) returns (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 44, - "type": "struct LoanContract.PaymentEntry storage ref[] storage ref", - "value": "schedule" - }, - "id": 147, - "name": "Identifier", - "src": "2111:8:0" + "src": "3476:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 149, - "name": "MemberAccess", - "src": "2111:13:0" + }, + "id": 267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3476:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } }, - { - "attributes": { + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3476:33:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "3476:33:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": true, - "lValueRequested": false, - "names": [ - null - ], - "type": "struct LoanContract.PaymentEntry memory", - "type_conversion": false + "id": 272, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "3543:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 52, - "type": "type(struct LoanContract.PaymentEntry storage pointer)", - "value": "PaymentEntry" - }, - "id": 150, - "name": "Identifier", - "src": "2125:12:0" - }, + { + "argumentTypes": null, + "id": 273, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "3560:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 11, - "type": "uint256", - "value": "repaymentDeadline" - }, - "id": 151, - "name": "Identifier", - "src": "2138:17:0" + "typeIdentifier": "t_address", + "typeString": "address" }, { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 152, - "name": "Identifier", - "src": "2157:10:0" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } ], - "id": 153, - "name": "FunctionCall", - "src": "2125:43:0" + "id": 271, + "name": "DisbursedToBorrower", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "3523:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3523:50:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 154, - "name": "FunctionCall", - "src": "2111:58:0" + }, + "id": 275, + "nodeType": "ExpressionStatement", + "src": "3523:50:0" } - ], - "id": 155, - "name": "ExpressionStatement", - "src": "2111:58:0" + ] } - ], - "id": 156, - "name": "Block", - "src": "1686:490:0" - } - ], - "id": 157, - "name": "FunctionDefinition", - "src": "1459:717:0" + } + ] + }, + "id": 279, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "borrowerWithdraw", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 239, + "nodeType": "ParameterList", + "parameters": [], + "src": "3203:2:0" + }, + "payable": false, + "returnParameters": { + "id": 240, + "nodeType": "ParameterList", + "parameters": [], + "src": "3213:0:0" + }, + "scope": 592, + "src": "3178:412:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "lend", - "payable": true, - "scope": 600, - "stateMutability": "payable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 158, - "name": "ParameterList", - "src": "2268:2:0" - }, - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 159, - "name": "ParameterList", - "src": "2286:0:0" - }, - { - "children": [ - { - "children": [ + "body": { + "id": 386, + "nodeType": "Block", + "src": "3703:1089:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 283, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3800:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 284, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3800:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" - }, - "id": 160, - "name": "Identifier", - "src": "2359:7:0" + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 285, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "3814:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3800:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 282, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3792:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3792:38:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 288, + "nodeType": "ExpressionStatement", + "src": "3792:38:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 290, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3848:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 291, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3864:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "!=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 161, - "name": "Identifier", - "src": "2367:3:0" - } - ], - "id": 162, - "name": "MemberAccess", - "src": "2367:10:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 3, - "type": "address", - "value": "borrowerAddress" - }, - "id": 163, - "name": "Identifier", - "src": "2381:15:0" - } - ], - "id": 164, - "name": "BinaryOperation", - "src": "2367:29:0" + "id": 292, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaying", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3864:14:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 165, - "name": "FunctionCall", - "src": "2359:38:0" + }, + "src": "3848:30:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 166, - "name": "ExpressionStatement", - "src": "2359:38:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 289, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3840:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3840:39:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ + "id": 295, + "nodeType": "ExpressionStatement", + "src": "3840:39:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 297, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3897:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 298, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3897:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 299, + "name": "amountLeftToRepay", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 575, + "src": "3910:17:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", + "typeString": "function () view returns (uint256)" + } + }, + "id": 300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3910:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3897:32:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 296, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3889:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3889:41:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 303, + "nodeType": "ExpressionStatement", + "src": "3889:41:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 307, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 304, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3949:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 305, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3965:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3965:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3949:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 308, + "nodeType": "ExpressionStatement", + "src": "3949:25:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 310, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "4001:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 311, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "4018:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4018:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 309, + "name": "RepaidByBorrower", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 68, + "src": "3984:16:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3984:44:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 314, + "nodeType": "ExpressionStatement", + "src": "3984:44:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 319, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "4065:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 320, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "4070:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4070:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 318, + "name": "PaymentEntry", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 50, + "src": "4052:12:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_PaymentEntry_$50_storage_ptr_$", + "typeString": "type(struct LoanContract.PaymentEntry storage pointer)" + } + }, + "id": 322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4052:28:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 315, + "name": "payments", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 45, + "src": "4038:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + } + }, + "id": 317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4038:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_PaymentEntry_$50_storage_$returns$_t_uint256_$", + "typeString": "function (struct LoanContract.PaymentEntry storage ref) returns (uint256)" + } + }, + "id": 323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4038:43:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 324, + "nodeType": "ExpressionStatement", + "src": "4038:43:0" + }, + { + "assignments": [ + 326 + ], + "declarations": [ + { + "constant": false, + "id": 326, + "name": "amountToDistribute", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4196:23:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 325, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4196:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 329, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 327, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "4222:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4222:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4196:35:0" + }, + { + "assignments": [ + 331 + ], + "declarations": [ + { + "constant": false, + "id": 331, + "name": "amountDistributed", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4241:22:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 330, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4241:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 333, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4266:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4241:26:0" + }, + { + "body": { + "id": 381, + "nodeType": "Block", + "src": "4327:423:0", + "statements": [ + { + "assignments": [ + 346 + ], + "declarations": [ + { + "constant": false, + "id": 346, + "name": "currentLender", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4341:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 345, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4341:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "id": 167, - "name": "Identifier", - "src": "2407:7:0" + "value": null, + "visibility": "internal" + } + ], + "id": 350, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 347, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "4365:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 349, + "indexExpression": { + "argumentTypes": null, + "id": 348, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 335, + "src": "4381:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4365:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4341:42:0" + }, + { + "assignments": [ + 352 + ], + "declarations": [ { - "attributes": { + "constant": false, + "id": 352, + "name": "amountForLender", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4397:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 351, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4397:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 359, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "commonType": { + "id": 354, + "name": "amountToDistribute", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 326, + "src": "4439:18:0", + "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 355, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "4459:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 357, + "indexExpression": { + "argumentTypes": null, + "id": 356, + "name": "currentLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 346, + "src": "4474:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "operator": "<=", - "type": "bool" - }, - "children": [ + "nodeType": "IndexAccess", + "src": "4459:29:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 168, - "name": "Identifier", - "src": "2415:3:0" - } - ], - "id": 169, - "name": "MemberAccess", - "src": "2415:9:0" + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, { - "attributes": { - "argumentTypes": null, - "arguments": [ - null - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 573, - "type": "function () view returns (uint256)", - "value": "amountLeftToFund" - }, - "id": 170, - "name": "Identifier", - "src": "2428:16:0" - } - ], - "id": 171, - "name": "FunctionCall", - "src": "2428:18:0" + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" } ], - "id": 172, - "name": "BinaryOperation", - "src": "2415:31:0" + "id": 353, + "name": "getAmountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 417, + "src": "4420:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_struct$_LenderAccount_$39_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (uint256,struct LoanContract.LenderAccount memory) view returns (uint256)" + } + }, + "id": 358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4420:69:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 173, - "name": "FunctionCall", - "src": "2407:40:0" - } - ], - "id": 174, - "name": "ExpressionStatement", - "src": "2407:40:0" - }, - { - "children": [ + }, + "nodeType": "VariableDeclarationStatement", + "src": "4397:92:0" + }, { - "attributes": { + "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, + "id": 362, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountLent", - "referencedDeclaration": 36, - "type": "uint256" + "leftExpression": { + "argumentTypes": null, + "id": 360, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4507:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 361, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4525:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "struct LoanContract.LenderAccount storage ref" - }, - "children": [ + "value": "0" + }, + "src": "4507:19:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 380, + "nodeType": "IfStatement", + "src": "4503:237:0", + "trueBody": { + "id": 379, + "nodeType": "Block", + "src": "4528:212:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 175, - "name": "Identifier", - "src": "2509:14:0" + "argumentTypes": null, + "id": 364, + "name": "currentLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 346, + "src": "4561:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 176, - "name": "Identifier", - "src": "2524:3:0" - } - ], - "id": 177, - "name": "MemberAccess", - "src": "2524:10:0" + "argumentTypes": null, + "id": 365, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4576:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 178, - "name": "IndexAccess", - "src": "2509:26:0" - } - ], - "id": 179, - "name": "MemberAccess", - "src": "2509:37:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 180, - "name": "Literal", - "src": "2550:1:0" - } - ], - "id": 181, - "name": "BinaryOperation", - "src": "2509:42:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } ], - "type": "uint256", - "type_conversion": false + "id": 363, + "name": "RepaidToLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 74, + "src": "4546:14:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "push", - "referencedDeclaration": null, - "type": "function (address) returns (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 22, - "type": "address[] storage ref", - "value": "lenderAddresses" - }, - "id": 182, - "name": "Identifier", - "src": "2567:15:0" - } - ], - "id": 184, - "name": "MemberAccess", - "src": "2567:20:0" - }, - { - "attributes": { + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4546:46:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 367, + "nodeType": "ExpressionStatement", + "src": "4546:46:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" + "id": 368, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "4610:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 185, - "name": "Identifier", - "src": "2588:3:0" + "id": 370, + "indexExpression": { + "argumentTypes": null, + "id": 369, + "name": "currentLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 346, + "src": "4625:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 186, - "name": "MemberAccess", - "src": "2588:10:0" - } - ], - "id": 187, - "name": "FunctionCall", - "src": "2567:32:0" - } - ], - "id": 188, - "name": "ExpressionStatement", - "src": "2567:32:0" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4610:29:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "id": 371, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "struct LoanContract.LenderAccount storage ref" + "lValueRequested": true, + "memberName": "amountRepaid", + "nodeType": "MemberAccess", + "referencedDeclaration": 36, + "src": "4610:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "type": "struct LoanContract.LenderAccount storage ref" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 189, - "name": "Identifier", - "src": "2613:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 190, - "name": "Identifier", - "src": "2628:3:0" - } - ], - "id": 191, - "name": "MemberAccess", - "src": "2628:10:0" - } - ], - "id": 192, - "name": "IndexAccess", - "src": "2613:26:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": true, - "lValueRequested": false, - "names": [ - null - ], - "type": "struct LoanContract.LenderAccount memory", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 41, - "type": "type(struct LoanContract.LenderAccount storage pointer)", - "value": "LenderAccount" - }, - "id": 193, - "name": "Identifier", - "src": "2642:13:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 194, - "name": "Identifier", - "src": "2656:3:0" - } - ], - "id": 195, - "name": "MemberAccess", - "src": "2656:9:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 196, - "name": "Literal", - "src": "2667:1:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 197, - "name": "Literal", - "src": "2670:1:0" - } - ], - "id": 198, - "name": "FunctionCall", - "src": "2642:30:0" + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "id": 372, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4656:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 199, - "name": "Assignment", - "src": "2613:59:0" - } - ], - "id": 200, - "name": "ExpressionStatement", - "src": "2613:59:0" - } - ], - "id": 201, - "name": "Block", - "src": "2553:130:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { + }, + "src": "4610:61:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 374, + "nodeType": "ExpressionStatement", + "src": "4610:61:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "+=", - "type": "uint256" + "id": 375, + "name": "amountDistributed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 331, + "src": "4689:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "member_name": "amountLent", - "referencedDeclaration": 36, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "struct LoanContract.LenderAccount storage ref" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 202, - "name": "Identifier", - "src": "2703:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 203, - "name": "Identifier", - "src": "2718:3:0" - } - ], - "id": 204, - "name": "MemberAccess", - "src": "2718:10:0" - } - ], - "id": 205, - "name": "IndexAccess", - "src": "2703:26:0" - } - ], - "id": 206, - "name": "MemberAccess", - "src": "2703:37:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 207, - "name": "Identifier", - "src": "2744:3:0" - } - ], - "id": 208, - "name": "MemberAccess", - "src": "2744:9:0" + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "id": 376, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4710:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 209, - "name": "Assignment", - "src": "2703:50:0" - } - ], - "id": 210, - "name": "ExpressionStatement", - "src": "2703:50:0" + }, + "src": "4689:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 378, + "nodeType": "ExpressionStatement", + "src": "4689:36:0" + } + ] + } + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 338, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 335, + "src": "4294:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 339, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "4298:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 340, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4298:22:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4294:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 382, + "initializationExpression": { + "assignments": [ + 335 + ], + "declarations": [ + { + "constant": false, + "id": 335, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4282:6:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 334, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4282:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 211, - "name": "Block", - "src": "2689:75:0" + }, + "value": null, + "visibility": "internal" } ], - "id": 212, - "name": "IfStatement", - "src": "2505:259:0" + "id": 337, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 336, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4291:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4282:10:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "4322:3:0", + "subExpression": { + "argumentTypes": null, + "id": 342, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 335, + "src": "4322:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 344, + "nodeType": "ExpressionStatement", + "src": "4322:3:0" + }, + "nodeType": "ForStatement", + "src": "4277:473:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 383, + "name": "checkLoanRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 434, + "src": "4768:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4768:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "4768:17:0" + } + ] + }, + "id": 387, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "repay", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 280, + "nodeType": "ParameterList", + "parameters": [], + "src": "3685:2:0" + }, + "payable": true, + "returnParameters": { + "id": 281, + "nodeType": "ParameterList", + "parameters": [], + "src": "3703:0:0" + }, + "scope": 592, + "src": "3671:1121:0", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 416, + "nodeType": "Block", + "src": "4906:357:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 398, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 396, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4920:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "id": 397, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "4936:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4920:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": { + "id": 414, + "nodeType": "Block", + "src": "5116:141:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 412, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "+=", - "type": "uint256" - }, - "children": [ - { - "attributes": { + "leftExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" + "id": 408, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 391, + "src": "5205:7:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" + } }, - "id": 213, - "name": "Identifier", - "src": "2782:12:0" + "id": 409, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "5205:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 214, - "name": "Identifier", - "src": "2798:3:0" + "id": 410, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 391, + "src": "5226:7:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" } - ], - "id": 215, - "name": "MemberAccess", - "src": "2798:9:0" + }, + "id": 411, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountRepaid", + "nodeType": "MemberAccess", + "referencedDeclaration": 36, + "src": "5226:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5205:41:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 216, - "name": "Assignment", - "src": "2782:25:0" + }, + "functionReturnParameters": 395, + "id": 413, + "nodeType": "Return", + "src": "5198:48:0" } - ], - "id": 217, - "name": "ExpressionStatement", - "src": "2782:25:0" + ] }, - { - "children": [ + "id": 415, + "nodeType": "IfStatement", + "src": "4916:341:0", + "trueBody": { + "id": 407, + "nodeType": "Block", + "src": "4948:162:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 405, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 58, - "type": "function (address,uint256)", - "value": "LentToLoan" - }, - "id": 218, - "name": "Identifier", - "src": "2817:10:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { + }, + "id": 402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" + "id": 399, + "name": "amountToDistribute", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 389, + "src": "5046:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "id": 219, - "name": "Identifier", - "src": "2828:3:0" - } - ], - "id": 220, - "name": "MemberAccess", - "src": "2828:10:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" + "expression": { + "argumentTypes": null, + "id": 400, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 391, + "src": "5067:7:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" + } + }, + "id": 401, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "5067:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "id": 221, - "name": "Identifier", - "src": "2840:3:0" + "src": "5046:39:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 222, - "name": "MemberAccess", - "src": "2840:9:0" + "id": 403, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5045:41:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 404, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "5089:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5045:54:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 223, - "name": "FunctionCall", - "src": "2817:33:0" + }, + "functionReturnParameters": 395, + "id": 406, + "nodeType": "Return", + "src": "5038:61:0" } - ], - "id": 224, - "name": "ExpressionStatement", - "src": "2817:33:0" + ] + } + } + ] + }, + "id": 417, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "getAmountForLender", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 392, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 389, + "name": "amountToDistribute", + "nodeType": "VariableDeclaration", + "scope": 417, + "src": "4830:23:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 388, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4830:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 391, + "name": "account", + "nodeType": "VariableDeclaration", + "scope": 417, + "src": "4855:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" + }, + "typeName": { + "contractScope": null, + "id": 390, + "name": "LenderAccount", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 39, + "src": "4855:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4829:48:0" + }, + "payable": false, + "returnParameters": { + "id": 395, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 394, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 417, + "src": "4900:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 393, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4900:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4899:6:0" + }, + "scope": 592, + "src": "4802:461:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 433, + "nodeType": "Block", + "src": "5308:126:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 422, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 420, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "5322:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 421, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "5338:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5322:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": null, + "id": 432, + "nodeType": "IfStatement", + "src": "5318:110:0", + "trueBody": { + "id": 431, + "nodeType": "Block", + "src": "5350:78:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, - "arguments": [ - null - ], + "id": 426, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 246, - "type": "function ()", - "value": "checkLoanFunded" + "leftHandSide": { + "argumentTypes": null, + "id": 423, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "5364:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 424, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "5379:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } }, - "id": 225, - "name": "Identifier", - "src": "2869:15:0" + "id": 425, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaid", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5379:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "5364:27:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 226, - "name": "FunctionCall", - "src": "2869:17:0" + }, + "id": 427, + "nodeType": "ExpressionStatement", + "src": "5364:27:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 428, + "name": "LoanRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "5405:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 429, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5405:12:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 430, + "nodeType": "ExpressionStatement", + "src": "5405:12:0" } - ], - "id": 227, - "name": "ExpressionStatement", - "src": "2869:17:0" + ] } - ], - "id": 228, - "name": "Block", - "src": "2286:607:0" + } + ] + }, + "id": 434, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "checkLoanRepaid", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 418, + "nodeType": "ParameterList", + "parameters": [], + "src": "5297:2:0" + }, + "payable": false, + "returnParameters": { + "id": 419, + "nodeType": "ParameterList", + "parameters": [], + "src": "5308:0:0" + }, + "scope": 592, + "src": "5273:161:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 471, + "nodeType": "Block", + "src": "5568:307:0", + "statements": [ + { + "assignments": [ + 438 + ], + "declarations": [ + { + "constant": false, + "id": 438, + "name": "amountToWithdraw", + "nodeType": "VariableDeclaration", + "scope": 472, + "src": "5578:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 437, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "5578:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 443, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 440, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5626:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5626:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 439, + "name": "amountLenderCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 525, + "src": "5602:23:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) view returns (uint256)" + } + }, + "id": 442, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5602:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5578:59:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 444, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5651:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 445, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5670:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5651:20:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 470, + "nodeType": "IfStatement", + "src": "5647:222:0", + "trueBody": { + "id": 469, + "nodeType": "Block", + "src": "5673:196:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 453, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 447, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "5687:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 450, + "indexExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 448, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5702:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 449, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5702:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "5687:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "id": 451, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "amountWithdrawn", + "nodeType": "MemberAccess", + "referencedDeclaration": 38, + "src": "5687:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "id": 452, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5733:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5687:62:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 454, + "nodeType": "ExpressionStatement", + "src": "5687:62:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 460, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5783:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 455, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5763:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 458, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5763:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 459, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5763:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 461, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5763:37:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 462, + "nodeType": "ExpressionStatement", + "src": "5763:37:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 464, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5829:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 465, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5829:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 466, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5841:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 463, + "name": "LenderWithdrew", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 86, + "src": "5814:14:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5814:44:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 468, + "nodeType": "ExpressionStatement", + "src": "5814:44:0" + } + ] + } + } + ] + }, + "id": 472, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "lenderWithdraw", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 435, + "nodeType": "ParameterList", + "parameters": [], + "src": "5558:2:0" + }, + "payable": false, + "returnParameters": { + "id": 436, + "nodeType": "ParameterList", + "parameters": [], + "src": "5568:0:0" + }, + "scope": 592, + "src": "5535:340:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 524, + "nodeType": "Block", + "src": "6036:677:0", + "statements": [ + { + "assignments": [ + 480 + ], + "declarations": [ + { + "constant": false, + "id": 480, + "name": "amountCanWithdraw", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "6046:22:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 479, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "6046:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 482, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6071:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "6046:26:0" + }, + { + "assignments": [ + 484 + ], + "declarations": [ + { + "constant": false, + "id": 484, + "name": "lenderAccount", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "6082:35:0", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + }, + "typeName": { + "contractScope": null, + "id": 483, + "name": "LenderAccount", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 39, + "src": "6082:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 488, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 485, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "6120:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 487, + "indexExpression": { + "argumentTypes": null, + "id": 486, + "name": "lenderAddr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 474, + "src": "6135:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "6120:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6082:64:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 489, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6160:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 490, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6176:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "expired", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6176:13:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6160:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 510, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 502, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6386:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 503, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6402:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 504, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaying", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6402:14:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6386:30:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 509, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 506, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6420:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 507, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6436:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 508, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaid", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6436:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6420:28:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "6386:62:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 520, + "nodeType": "IfStatement", + "src": "6382:291:0", + "trueBody": { + "id": 519, + "nodeType": "Block", + "src": "6450:223:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 517, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 511, + "name": "amountCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 480, + "src": "6584:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 516, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 512, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6604:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "id": 513, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountRepaid", + "nodeType": "MemberAccess", + "referencedDeclaration": 36, + "src": "6604:26:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 514, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6633:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "id": 515, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountWithdrawn", + "nodeType": "MemberAccess", + "referencedDeclaration": 38, + "src": "6633:29:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6604:58:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6584:78:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 518, + "nodeType": "ExpressionStatement", + "src": "6584:78:0" + } + ] + } + }, + "id": 521, + "nodeType": "IfStatement", + "src": "6156:517:0", + "trueBody": { + "id": 501, + "nodeType": "Block", + "src": "6191:185:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 493, + "name": "amountCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 480, + "src": "6289:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 494, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6309:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "id": 495, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "6309:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 496, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6336:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "id": 497, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountWithdrawn", + "nodeType": "MemberAccess", + "referencedDeclaration": 38, + "src": "6336:29:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6309:56:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6289:76:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 500, + "nodeType": "ExpressionStatement", + "src": "6289:76:0" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 522, + "name": "amountCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 480, + "src": "6689:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 478, + "id": 523, + "nodeType": "Return", + "src": "6682:24:0" + } + ] + }, + "id": 525, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "amountLenderCanWithdraw", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 475, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 474, + "name": "lenderAddr", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "5989:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 473, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5989:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5988:20:0" + }, + "payable": false, + "returnParameters": { + "id": 478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 477, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "6030:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 476, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "6030:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6029:6:0" + }, + "scope": 592, + "src": "5956:757:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 545, + "nodeType": "Block", + "src": "6829:158:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 534, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 528, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "6844:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 529, + "name": "fundRaisingDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "6851:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6844:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 531, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "6874:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 532, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "6889:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6874:25:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "6844:55:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 544, + "nodeType": "IfStatement", + "src": "6840:141:0", + "trueBody": { + "id": 543, + "nodeType": "Block", + "src": "6901:80:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 538, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 535, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6915:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 536, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6930:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 537, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "expired", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6930:13:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6915:28:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "id": 539, + "nodeType": "ExpressionStatement", + "src": "6915:28:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 540, + "name": "LoanExpired", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "6957:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6957:13:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 542, + "nodeType": "ExpressionStatement", + "src": "6957:13:0" + } + ] + } + } + ] + }, + "id": 546, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "makeExpired", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 526, + "nodeType": "ParameterList", + "parameters": [], + "src": "6819:2:0" + }, + "payable": false, + "returnParameters": { + "id": 527, + "nodeType": "ParameterList", + "parameters": [], + "src": "6829:0:0" + }, + "scope": 592, + "src": "6799:188:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 554, + "nodeType": "Block", + "src": "7087:46:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 551, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "7104:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 552, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "7104:22:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 550, + "id": 553, + "nodeType": "Return", + "src": "7097:29:0" + } + ] + }, + "id": 555, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "numLenders", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 547, + "nodeType": "ParameterList", + "parameters": [], + "src": "7057:2:0" + }, + "payable": false, + "returnParameters": { + "id": 550, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 549, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 555, + "src": "7081:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 548, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7081:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7080:6:0" + }, + "scope": 592, + "src": "7038:95:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 564, + "nodeType": "Block", + "src": "7198:49:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 562, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 560, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "7215:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 561, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "7228:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7215:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 559, + "id": 563, + "nodeType": "Return", + "src": "7208:32:0" + } + ] + }, + "id": 565, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "amountLeftToFund", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 556, + "nodeType": "ParameterList", + "parameters": [], + "src": "7168:2:0" + }, + "payable": false, + "returnParameters": { + "id": 559, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 558, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 565, + "src": "7192:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 557, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7192:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7191:6:0" + }, + "scope": 592, + "src": "7143:104:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 574, + "nodeType": "Block", + "src": "7313:49:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 570, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "7330:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 571, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "7343:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7330:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 569, + "id": 573, + "nodeType": "Return", + "src": "7323:32:0" + } + ] + }, + "id": 575, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "amountLeftToRepay", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 566, + "nodeType": "ParameterList", + "parameters": [], + "src": "7283:2:0" + }, + "payable": false, + "returnParameters": { + "id": 569, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 568, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "7307:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 567, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7307:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7306:6:0" + }, + "scope": 592, + "src": "7257:105:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 590, + "nodeType": "Block", + "src": "7423:82:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 587, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 580, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "7441:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 581, + "name": "repaymentDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "7448:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7441:24:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 586, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 583, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "7469:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 584, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "7485:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 585, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaid", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "7485:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "7469:28:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "7441:56:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 588, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7440:58:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 579, + "id": 589, + "nodeType": "Return", + "src": "7433:65:0" + } + ] + }, + "id": 591, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "isDelinquent", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 576, + "nodeType": "ParameterList", + "parameters": [], + "src": "7393:2:0" + }, + "payable": false, + "returnParameters": { + "id": 579, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 578, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 591, + "src": "7417:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 577, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7417:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7416:6:0" + }, + "scope": 592, + "src": "7372:133:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 593, + "src": "110:7397:0" + } + ], + "src": "0:7508:0" + }, + "legacyAST": { + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanContract.sol", + "exportedSymbols": { + "LoanContract": [ + 592 + ] + }, + "id": 593, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".15" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 592, + "linearizedBaseContracts": [ + 592 + ], + "name": "LoanContract", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3, + "name": "borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "161:30:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "161:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 5, + "name": "loanAmount", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "197:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "197:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 7, + "name": "repaymentDuration", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "225:29:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "225:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 9, + "name": "fundRaisingDeadline", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "260:31:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "260:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 11, + "name": "repaymentDeadline", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "297:29:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 10, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "297:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 13, + "name": "ipfsHash", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "332:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + }, + "typeName": { + "id": 12, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "332:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 15, + "name": "amountRaised", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "383:24:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 14, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "383:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 17, + "name": "amountRepaid", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "413:24:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 16, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "413:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 20, + "name": "lenderAddresses", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "561:32:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + }, + "typeName": { + "baseType": { + "id": 18, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "561:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 19, + "length": null, + "nodeType": "ArrayTypeName", + "src": "561:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[] storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 24, + "name": "lenderAccounts", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "599:55:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + }, + "typeName": { + "id": 23, + "keyType": { + "id": 21, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "607:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "599:33:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + }, + "valueType": { + "contractScope": null, + "id": 22, + "name": "LenderAccount", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 39, + "src": "618:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + } + }, + "value": null, + "visibility": "public" + }, + { + "canonicalName": "LoanContract.State", + "id": 30, + "members": [ + { + "id": 25, + "name": "raising", + "nodeType": "EnumValue", + "src": "672:7:0" + }, + { + "id": 26, + "name": "funded", + "nodeType": "EnumValue", + "src": "681:6:0" + }, + { + "id": 27, + "name": "repaying", + "nodeType": "EnumValue", + "src": "689:8:0" + }, + { + "id": 28, + "name": "repaid", + "nodeType": "EnumValue", + "src": "699:6:0" + }, + { + "id": 29, + "name": "expired", + "nodeType": "EnumValue", + "src": "707:7:0" } ], - "id": 229, - "name": "FunctionDefinition", - "src": "2255:638:0" + "name": "State", + "nodeType": "EnumDefinition", + "src": "660:55:0" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "checkLoanFunded", - "payable": false, - "scope": 600, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "private" - }, - "children": [ + "constant": false, + "id": 32, + "name": "currentState", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "720:25:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "typeName": { + "contractScope": null, + "id": 31, + "name": "State", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 30, + "src": "720:5:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "value": null, + "visibility": "public" + }, + { + "canonicalName": "LoanContract.LenderAccount", + "id": 39, + "members": [ { - "attributes": { - "parameters": [ - null - ] + "constant": false, + "id": 34, + "name": "amountLent", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "782:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [], - "id": 230, - "name": "ParameterList", - "src": "3000:2:0" + "typeName": { + "id": 33, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "782:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 36, + "name": "amountRepaid", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "807:17:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 35, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "807:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 38, + "name": "amountWithdrawn", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "834:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 37, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "834:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "LenderAccount", + "nodeType": "StructDefinition", + "scope": 592, + "src": "751:110:0", + "visibility": "public" + }, + { + "constant": false, + "id": 42, + "name": "schedule", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "866:30:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 40, + "name": "PaymentEntry", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 50, + "src": "866:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage pointer" + } + }, + "id": 41, + "length": null, + "nodeType": "ArrayTypeName", + "src": "866:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 45, + "name": "payments", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "902:30:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 43, + "name": "PaymentEntry", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 50, + "src": "902:12:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage pointer" + } }, + "id": 44, + "length": null, + "nodeType": "ArrayTypeName", + "src": "902:14:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage_ptr", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "canonicalName": "LoanContract.PaymentEntry", + "id": 50, + "members": [ { - "attributes": { - "parameters": [ - null - ] + "constant": false, + "id": 47, + "name": "date", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "968:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 46, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "968:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [], - "id": 231, - "name": "ParameterList", - "src": "3011:0:0" + "value": null, + "visibility": "internal" }, { - "children": [ - { - "attributes": { - "falseBody": null + "constant": false, + "id": 49, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "987:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 48, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "987:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "PaymentEntry", + "nodeType": "StructDefinition", + "scope": 592, + "src": "938:67:0", + "visibility": "public" + }, + { + "anonymous": false, + "id": 56, + "name": "LentToLoan", + "nodeType": "EventDefinition", + "parameters": { + "id": 55, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 52, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1045:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 51, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1045:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 54, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1059:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 53, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1059:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1044:27:0" + }, + "src": "1028:44:0" + }, + { + "anonymous": false, + "id": 62, + "name": "DisbursedToBorrower", + "nodeType": "EventDefinition", + "parameters": { + "id": 61, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 58, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 62, + "src": "1103:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 57, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1103:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 60, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 62, + "src": "1117:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 59, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1117:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1102:27:0" + }, + "src": "1077:53:0" + }, + { + "anonymous": false, + "id": 68, + "name": "RepaidByBorrower", + "nodeType": "EventDefinition", + "parameters": { + "id": 67, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 64, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 68, + "src": "1158:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 63, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1158:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 66, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 68, + "src": "1172:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 65, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1172:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1157:27:0" + }, + "src": "1135:50:0" + }, + { + "anonymous": false, + "id": 74, + "name": "RepaidToLender", + "nodeType": "EventDefinition", + "parameters": { + "id": 73, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 70, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 74, + "src": "1211:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 69, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1211:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 72, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 74, + "src": "1225:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 71, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1225:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1210:27:0" + }, + "src": "1190:48:0" + }, + { + "anonymous": false, + "id": 80, + "name": "SentBack", + "nodeType": "EventDefinition", + "parameters": { + "id": 79, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 76, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 80, + "src": "1258:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 75, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1258:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 78, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 80, + "src": "1272:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 77, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1272:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1257:27:0" + }, + "src": "1243:42:0" + }, + { + "anonymous": false, + "id": 86, + "name": "LenderWithdrew", + "nodeType": "EventDefinition", + "parameters": { + "id": 85, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 82, + "indexed": false, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 86, + "src": "1311:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 81, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1311:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 84, + "indexed": false, + "name": "amount", + "nodeType": "VariableDeclaration", + "scope": 86, + "src": "1325:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 83, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1325:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1310:27:0" + }, + "src": "1290:48:0" + }, + { + "anonymous": false, + "id": 88, + "name": "LoanFunded", + "nodeType": "EventDefinition", + "parameters": { + "id": 87, + "nodeType": "ParameterList", + "parameters": [], + "src": "1359:2:0" + }, + "src": "1343:19:0" + }, + { + "anonymous": false, + "id": 90, + "name": "LoanExpired", + "nodeType": "EventDefinition", + "parameters": { + "id": 89, + "nodeType": "ParameterList", + "parameters": [], + "src": "1384:2:0" + }, + "src": "1367:20:0" + }, + { + "anonymous": false, + "id": 92, + "name": "LoanRepaid", + "nodeType": "EventDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [], + "src": "1408:2:0" + }, + "src": "1392:19:0" + }, + { + "body": { + "id": 148, + "nodeType": "Block", + "src": "1650:478:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 105, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "1660:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 106, + "name": "_borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1678:16:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1660:34:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 108, + "nodeType": "ExpressionStatement", + "src": "1660:34:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 113, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 109, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "1704:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 110, + "name": "_loanAmountInEthers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "1717:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1739:7:0", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + }, + "src": "1717:29:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1704:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 114, + "nodeType": "ExpressionStatement", + "src": "1704:42:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 115, + "name": "repaymentDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7, + "src": "1756:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 116, + "name": "_repaymentDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1776:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1756:44:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 118, + "nodeType": "ExpressionStatement", + "src": "1756:44:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 119, + "name": "fundRaisingDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "1810:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 120, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "1832:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 121, + "name": "_fundRaisingDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "1838:26:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 122, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1867:6:0", + "subdenomination": "days", + "typeDescriptions": { + "typeIdentifier": "t_rational_86400_by_1", + "typeString": "int_const 86400" + }, + "value": "1" + }, + "src": "1838:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1832:41:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1810:63:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 126, + "nodeType": "ExpressionStatement", + "src": "1810:63:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 127, + "name": "repaymentDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "1883:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 132, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 128, + "name": "fundRaisingDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "1903:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 131, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "commonType": { + "id": 129, + "name": "_repaymentDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1925:24:0", + "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 130, "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" - }, - "id": 232, - "name": "Identifier", - "src": "3025:12:0" + "nodeType": "Literal", + "src": "1952:6:0", + "subdenomination": "days", + "typeDescriptions": { + "typeIdentifier": "t_rational_86400_by_1", + "typeString": "int_const 86400" }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 233, - "name": "Identifier", - "src": "3041:10:0" - } - ], - "id": 234, - "name": "BinaryOperation", - "src": "3025:26:0" + "value": "1" + }, + "src": "1925:33:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, + "src": "1903:55:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1883:75:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 134, + "nodeType": "ExpressionStatement", + "src": "1883:75:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 137, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 135, + "name": "ipfsHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1968:8:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 136, + "name": "_ipfsHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 102, + "src": "1979:9:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "1968:20:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 138, + "nodeType": "ExpressionStatement", + "src": "1968:20:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "children": [ + "argumentTypes": null, + "arguments": [ { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 235, - "name": "Identifier", - "src": "3067:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "funded", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 236, - "name": "Identifier", - "src": "3082:5:0" - } - ], - "id": 237, - "name": "MemberAccess", - "src": "3082:12:0" - } - ], - "id": 238, - "name": "Assignment", - "src": "3067:27:0" - } - ], - "id": 239, - "name": "ExpressionStatement", - "src": "3067:27:0" + "argumentTypes": null, + "id": 143, + "name": "repaymentDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "2090:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, { - "children": [ - { - "attributes": { - "argumentTypes": null, - "arguments": [ - null - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 90, - "type": "function ()", - "value": "LoanFunded" - }, - "id": 240, - "name": "Identifier", - "src": "3108:10:0" - } - ], - "id": 241, - "name": "FunctionCall", - "src": "3108:12:0" - } - ], - "id": 242, - "name": "ExpressionStatement", - "src": "3108:12:0" + "argumentTypes": null, + "id": 144, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "2109:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 243, - "name": "Block", - "src": "3053:78:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 142, + "name": "PaymentEntry", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 50, + "src": "2077:12:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_PaymentEntry_$50_storage_ptr_$", + "typeString": "type(struct LoanContract.PaymentEntry storage pointer)" + } + }, + "id": 145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2077:43:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } } ], - "id": 244, - "name": "IfStatement", - "src": "3021:110:0" - } - ], - "id": 245, - "name": "Block", - "src": "3011:126:0" - } - ], - "id": 246, - "name": "FunctionDefinition", - "src": "2976:161:0" - }, - { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "borrowerWithdraw", - "payable": false, - "scope": 600, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 139, + "name": "schedule", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 42, + "src": "2063:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + } + }, + "id": 141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2063:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_PaymentEntry_$50_storage_$returns$_t_uint256_$", + "typeString": "function (struct LoanContract.PaymentEntry storage ref) returns (uint256)" + } + }, + "id": 146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2063:58:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 147, + "nodeType": "ExpressionStatement", + "src": "2063:58:0" + } + ] + }, + "id": 149, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "LoanContract", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 94, + "name": "_borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1471:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1471:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" }, - "children": [], - "id": 247, - "name": "ParameterList", - "src": "3251:2:0" - }, - { - "attributes": { - "parameters": [ - null - ] + { + "constant": false, + "id": 96, + "name": "_loanAmountInEthers", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1506:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 95, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1506:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" }, - "children": [], - "id": 248, - "name": "ParameterList", - "src": "3261:0:0" - }, - { - "children": [ - { - "children": [ + { + "constant": false, + "id": 98, + "name": "_fundRaisingDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1540:31:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 97, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1540:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 100, + "name": "_repaymentDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1581:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 99, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1581:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 102, + "name": "_ipfsHash", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1620:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + "typeName": { + "id": 101, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1620:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1461:181:0" + }, + "payable": false, + "returnParameters": { + "id": 104, + "nodeType": "ParameterList", + "parameters": [], + "src": "1650:0:0" + }, + "scope": 592, + "src": "1440:688:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 220, + "nodeType": "Block", + "src": "2238:607:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 153, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2319:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 154, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2319:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" - }, - "id": 249, - "name": "Identifier", - "src": "3341:7:0" - }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 250, - "name": "Identifier", - "src": "3349:3:0" - } - ], - "id": 251, - "name": "MemberAccess", - "src": "3349:10:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 3, - "type": "address", - "value": "borrowerAddress" - }, - "id": 252, - "name": "Identifier", - "src": "3363:15:0" - } - ], - "id": 253, - "name": "BinaryOperation", - "src": "3349:29:0" + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "id": 155, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "2333:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 254, - "name": "FunctionCall", - "src": "3341:38:0" + }, + "src": "2319:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 255, - "name": "ExpressionStatement", - "src": "3341:38:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 152, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "2311:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2311:38:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ + "id": 158, + "nodeType": "ExpressionStatement", + "src": "2311:38:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 164, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 160, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2367:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 161, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2367:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" - }, - "id": 256, - "name": "Identifier", - "src": "3389:7:0" + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 162, + "name": "amountLeftToFund", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 565, + "src": "2380:16:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", + "typeString": "function () view returns (uint256)" + } }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_enum$_State_$32", - "typeString": "enum LoanContract.State" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 257, - "name": "Identifier", - "src": "3397:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "funded", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 258, - "name": "Identifier", - "src": "3413:5:0" - } - ], - "id": 259, - "name": "MemberAccess", - "src": "3413:12:0" - } - ], - "id": 260, - "name": "BinaryOperation", - "src": "3397:28:0" + "id": 163, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2380:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 261, - "name": "FunctionCall", - "src": "3389:37:0" + }, + "src": "2367:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 159, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "2359:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2359:40:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 166, + "nodeType": "ExpressionStatement", + "src": "2359:40:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 173, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 167, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "2461:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 170, + "indexExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 168, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2476:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 169, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2476:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2461:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "id": 171, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "2461:37:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 262, - "name": "ExpressionStatement", - "src": "3389:37:0" - }, - { - "attributes": { - "falseBody": null }, - "children": [ + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 172, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2502:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2461:42:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 203, + "nodeType": "Block", + "src": "2641:75:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, + "id": 201, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": ">", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" - }, - "id": 263, - "name": "Identifier", - "src": "3449:12:0" - }, - { - "attributes": { + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 264, - "name": "Literal", - "src": "3464:1:0" - } - ], - "id": 265, - "name": "BinaryOperation", - "src": "3449:16:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { + "baseExpression": { + "argumentTypes": null, + "id": 194, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "2655:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 197, + "indexExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 266, - "name": "Identifier", - "src": "3481:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "repaying", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 267, - "name": "Identifier", - "src": "3496:5:0" - } - ], - "id": 268, - "name": "MemberAccess", - "src": "3496:14:0" + "id": 195, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2670:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], - "id": 269, - "name": "Assignment", - "src": "3481:29:0" - } - ], - "id": 270, - "name": "ExpressionStatement", - "src": "3481:29:0" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "transfer", - "referencedDeclaration": null, - "type": "function (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 271, - "name": "Identifier", - "src": "3524:3:0" - } - ], - "id": 274, - "name": "MemberAccess", - "src": "3524:10:0" - } - ], - "id": 275, - "name": "MemberAccess", - "src": "3524:19:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" - }, - "id": 276, - "name": "Identifier", - "src": "3544:12:0" - } - ], - "id": 277, - "name": "FunctionCall", - "src": "3524:33:0" + "id": 196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2670:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2655:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" } - ], - "id": 278, - "name": "ExpressionStatement", - "src": "3524:33:0" + }, + "id": 198, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "2655:37:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 64, - "type": "function (address,uint256)", - "value": "DisbursedToBorrower" - }, - "id": 279, - "name": "Identifier", - "src": "3571:19:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 3, - "type": "address", - "value": "borrowerAddress" - }, - "id": 280, - "name": "Identifier", - "src": "3591:15:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" - }, - "id": 281, - "name": "Identifier", - "src": "3608:12:0" - } - ], - "id": 282, - "name": "FunctionCall", - "src": "3571:50:0" + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 199, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2696:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], - "id": 283, - "name": "ExpressionStatement", - "src": "3571:50:0" + }, + "id": 200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2696:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2655:50:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 284, - "name": "Block", - "src": "3467:165:0" + }, + "id": 202, + "nodeType": "ExpressionStatement", + "src": "2655:50:0" } - ], - "id": 285, - "name": "IfStatement", - "src": "3445:187:0" - } - ], - "id": 286, - "name": "Block", - "src": "3261:377:0" - } - ], - "id": 287, - "name": "FunctionDefinition", - "src": "3226:412:0" - }, - { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "repay", - "payable": true, - "scope": 600, - "stateMutability": "payable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 288, - "name": "ParameterList", - "src": "3733:2:0" - }, - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 289, - "name": "ParameterList", - "src": "3751:0:0" - }, - { - "children": [ - { - "children": [ + ] + }, + "id": 204, + "nodeType": "IfStatement", + "src": "2457:259:0", + "trueBody": { + "id": 193, + "nodeType": "Block", + "src": "2505:130:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" - }, - "id": 290, - "name": "Identifier", - "src": "3840:7:0" - }, - { - "attributes": { + "arguments": [ + { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" + "expression": { + "argumentTypes": null, + "id": 177, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2540:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, + "id": 178, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 291, - "name": "Identifier", - "src": "3848:3:0" - } - ], - "id": 292, - "name": "MemberAccess", - "src": "3848:10:0" - }, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2540:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 3, - "type": "address", - "value": "borrowerAddress" - }, - "id": 293, - "name": "Identifier", - "src": "3862:15:0" + "typeIdentifier": "t_address", + "typeString": "address" } ], - "id": 294, - "name": "BinaryOperation", - "src": "3848:29:0" + "expression": { + "argumentTypes": null, + "id": 174, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "2519:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 176, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2519:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } + }, + "id": 179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2519:32:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 295, - "name": "FunctionCall", - "src": "3840:38:0" - } - ], - "id": 296, - "name": "ExpressionStatement", - "src": "3840:38:0" - }, - { - "children": [ + }, + "id": 180, + "nodeType": "ExpressionStatement", + "src": "2519:32:0" + }, { - "attributes": { + "expression": { "argumentTypes": null, + "id": 191, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 181, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "2565:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } }, - "id": 297, - "name": "Identifier", - "src": "3888:7:0" - }, - { - "attributes": { + "id": 184, + "indexExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_enum$_State_$32", - "typeString": "enum LoanContract.State" + "expression": { + "argumentTypes": null, + "id": 182, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2580:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, + "id": 183, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "==", - "type": "bool" + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2580:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2565:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" + "id": 186, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2608:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, - "id": 298, - "name": "Identifier", - "src": "3896:12:0" + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2608:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "repaying", - "referencedDeclaration": null, - "type": "enum LoanContract.State" + "argumentTypes": null, + "hexValue": "30", + "id": 188, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2619:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 299, - "name": "Identifier", - "src": "3912:5:0" - } - ], - "id": 300, - "name": "MemberAccess", - "src": "3912:14:0" + "value": "0" + }, + { + "argumentTypes": null, + "hexValue": "30", + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2622:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" } ], - "id": 301, - "name": "BinaryOperation", - "src": "3896:30:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 185, + "name": "LenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 39, + "src": "2594:13:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_LenderAccount_$39_storage_ptr_$", + "typeString": "type(struct LoanContract.LenderAccount storage pointer)" + } + }, + "id": 190, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2594:30:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory", + "typeString": "struct LoanContract.LenderAccount memory" + } + }, + "src": "2565:59:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" } - ], - "id": 302, - "name": "FunctionCall", - "src": "3888:39:0" + }, + "id": 192, + "nodeType": "ExpressionStatement", + "src": "2565:59:0" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 205, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "2734:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 206, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2750:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 207, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2750:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2734:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 209, + "nodeType": "ExpressionStatement", + "src": "2734:25:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 211, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2780:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2780:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 213, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "2792:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 214, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2792:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 210, + "name": "LentToLoan", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 56, + "src": "2769:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 215, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2769:33:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 216, + "nodeType": "ExpressionStatement", + "src": "2769:33:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 217, + "name": "checkLoanFunded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 238, + "src": "2821:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" } - ], - "id": 303, - "name": "ExpressionStatement", - "src": "3888:39:0" + }, + "id": 218, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2821:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 219, + "nodeType": "ExpressionStatement", + "src": "2821:17:0" + } + ] + }, + "id": 221, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "lend", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 150, + "nodeType": "ParameterList", + "parameters": [], + "src": "2220:2:0" + }, + "payable": true, + "returnParameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [], + "src": "2238:0:0" + }, + "scope": 592, + "src": "2207:638:0", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 237, + "nodeType": "Block", + "src": "2963:126:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 224, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "2977:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 225, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "2993:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2977:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": null, + "id": 236, + "nodeType": "IfStatement", + "src": "2973:110:0", + "trueBody": { + "id": 235, + "nodeType": "Block", + "src": "3005:78:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "id": 230, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 774, - "type": "function (bool) pure", - "value": "require" - }, - "id": 304, - "name": "Identifier", - "src": "3937:7:0" + "leftHandSide": { + "argumentTypes": null, + "id": 227, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3019:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - { - "attributes": { + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "<=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 305, - "name": "Identifier", - "src": "3945:3:0" - } - ], - "id": 306, - "name": "MemberAccess", - "src": "3945:9:0" - }, - { - "attributes": { - "argumentTypes": null, - "arguments": [ - null - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 583, - "type": "function () view returns (uint256)", - "value": "amountLeftToRepay" - }, - "id": 307, - "name": "Identifier", - "src": "3958:17:0" - } - ], - "id": 308, - "name": "FunctionCall", - "src": "3958:19:0" + "id": 228, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3034:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" } - ], - "id": 309, - "name": "BinaryOperation", - "src": "3945:32:0" + }, + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "funded", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3034:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "3019:27:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 310, - "name": "FunctionCall", - "src": "3937:41:0" - } - ], - "id": 311, - "name": "ExpressionStatement", - "src": "3937:41:0" - }, - { - "children": [ + }, + "id": 231, + "nodeType": "ExpressionStatement", + "src": "3019:27:0" + }, { - "attributes": { + "expression": { "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 232, + "name": "LoanFunded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 88, + "src": "3060:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 233, "isConstant": false, "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "operator": "+=", - "type": "uint256" + "names": [], + "nodeType": "FunctionCall", + "src": "3060:12:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 19, - "type": "uint256", - "value": "amountRepaid" - }, - "id": 312, - "name": "Identifier", - "src": "3997:12:0" + "id": 234, + "nodeType": "ExpressionStatement", + "src": "3060:12:0" + } + ] + } + } + ] + }, + "id": 238, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "checkLoanFunded", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 222, + "nodeType": "ParameterList", + "parameters": [], + "src": "2952:2:0" + }, + "payable": false, + "returnParameters": { + "id": 223, + "nodeType": "ParameterList", + "parameters": [], + "src": "2963:0:0" + }, + "scope": 592, + "src": "2928:161:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 278, + "nodeType": "Block", + "src": "3213:377:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 242, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3301:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 313, - "name": "Identifier", - "src": "4013:3:0" - } - ], - "id": 314, - "name": "MemberAccess", - "src": "4013:9:0" + "id": 243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3301:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 315, - "name": "Assignment", - "src": "3997:25:0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 244, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "3315:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3301:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 316, - "name": "ExpressionStatement", - "src": "3997:25:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 241, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3293:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 246, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3293:38:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ + "id": 247, + "nodeType": "ExpressionStatement", + "src": "3293:38:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "id": 249, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3349:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 250, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3365:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 251, "isConstant": false, "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, + "isPure": true, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 70, - "type": "function (address,uint256)", - "value": "RepaidByBorrower" - }, - "id": 317, - "name": "Identifier", - "src": "4032:16:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 3, - "type": "address", - "value": "borrowerAddress" - }, - "id": 318, - "name": "Identifier", - "src": "4049:15:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 319, - "name": "Identifier", - "src": "4066:3:0" - } - ], - "id": 320, - "name": "MemberAccess", - "src": "4066:9:0" + "memberName": "funded", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3365:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 321, - "name": "FunctionCall", - "src": "4032:44:0" + }, + "src": "3349:28:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 322, - "name": "ExpressionStatement", - "src": "4032:44:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 248, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3341:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 253, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3341:37:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 254, + "nodeType": "ExpressionStatement", + "src": "3341:37:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 257, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 255, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "3401:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 256, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3416:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3401:16:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": null, + "id": 277, + "nodeType": "IfStatement", + "src": "3397:187:0", + "trueBody": { + "id": 276, + "nodeType": "Block", + "src": "3419:165:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "id": 261, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false + "leftHandSide": { + "argumentTypes": null, + "id": 258, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3433:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 259, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3448:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaying", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3448:14:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "3433:29:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_struct$_PaymentEntry_$52_memory", - "typeString": "struct LoanContract.PaymentEntry memory" + "id": 262, + "nodeType": "ExpressionStatement", + "src": "3433:29:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 268, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "3496:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 263, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3476:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], + }, + "id": 266, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "member_name": "push", + "memberName": "sender", + "nodeType": "MemberAccess", "referencedDeclaration": null, - "type": "function (struct LoanContract.PaymentEntry storage ref) returns (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 47, - "type": "struct LoanContract.PaymentEntry storage ref[] storage ref", - "value": "payments" - }, - "id": 323, - "name": "Identifier", - "src": "4086:8:0" + "src": "3476:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 325, - "name": "MemberAccess", - "src": "4086:13:0" + }, + "id": 267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3476:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } }, - { - "attributes": { + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3476:33:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "3476:33:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": true, - "lValueRequested": false, - "names": [ - null - ], - "type": "struct LoanContract.PaymentEntry memory", - "type_conversion": false + "id": 272, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "3543:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 52, - "type": "type(struct LoanContract.PaymentEntry storage pointer)", - "value": "PaymentEntry" - }, - "id": 326, - "name": "Identifier", - "src": "4100:12:0" - }, + { + "argumentTypes": null, + "id": 273, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "3560:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 773, - "type": "uint256", - "value": "now" - }, - "id": 327, - "name": "Identifier", - "src": "4113:3:0" + "typeIdentifier": "t_address", + "typeString": "address" }, { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "value", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 328, - "name": "Identifier", - "src": "4118:3:0" - } - ], - "id": 329, - "name": "MemberAccess", - "src": "4118:9:0" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } ], - "id": 330, - "name": "FunctionCall", - "src": "4100:28:0" + "id": 271, + "name": "DisbursedToBorrower", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "3523:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3523:50:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 331, - "name": "FunctionCall", - "src": "4086:43:0" + }, + "id": 275, + "nodeType": "ExpressionStatement", + "src": "3523:50:0" } - ], - "id": 332, - "name": "ExpressionStatement", - "src": "4086:43:0" - }, - { - "attributes": { - "assignments": [ - 334 - ] - }, - "children": [ - { - "attributes": { - "constant": false, - "name": "amountToDistribute", - "scope": 395, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 333, - "name": "ElementaryTypeName", - "src": "4244:4:0" - } - ], - "id": 334, - "name": "VariableDeclaration", - "src": "4244:23:0" - }, + ] + } + } + ] + }, + "id": 279, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "borrowerWithdraw", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 239, + "nodeType": "ParameterList", + "parameters": [], + "src": "3203:2:0" + }, + "payable": false, + "returnParameters": { + "id": 240, + "nodeType": "ParameterList", + "parameters": [], + "src": "3213:0:0" + }, + "scope": 592, + "src": "3178:412:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 386, + "nodeType": "Block", + "src": "3703:1089:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 283, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3800:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 284, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "member_name": "value", + "memberName": "sender", + "nodeType": "MemberAccess", "referencedDeclaration": null, - "type": "uint256" + "src": "3800:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 335, - "name": "Identifier", - "src": "4270:3:0" + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 285, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "3814:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 336, - "name": "MemberAccess", - "src": "4270:9:0" + }, + "src": "3800:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 337, - "name": "VariableDeclarationStatement", - "src": "4244:35:0" - }, - { - "attributes": { - "assignments": [ - 339 - ] + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 282, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3792:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } }, - "children": [ + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3792:38:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 288, + "nodeType": "ExpressionStatement", + "src": "3792:38:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "constant": false, - "name": "amountDistributed", - "scope": 395, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 338, - "name": "ElementaryTypeName", - "src": "4289:4:0" + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 290, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3848:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 339, - "name": "VariableDeclaration", - "src": "4289:22:0" - }, - { - "attributes": { + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { "argumentTypes": null, - "hexvalue": "30", + "expression": { + "argumentTypes": null, + "id": 291, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3864:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 292, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" + "memberName": "repaying", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3864:14:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - "id": 340, - "name": "Literal", - "src": "4314:1:0" + "src": "3848:30:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 341, - "name": "VariableDeclarationStatement", - "src": "4289:26:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 289, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3840:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3840:39:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "children": [ + "id": 295, + "nodeType": "ExpressionStatement", + "src": "3840:39:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "assignments": [ - 343 - ] + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "constant": false, - "name": "i", - "scope": 395, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 342, - "name": "ElementaryTypeName", - "src": "4330:4:0" - } - ], - "id": 343, - "name": "VariableDeclaration", - "src": "4330:6:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 344, - "name": "Literal", - "src": "4339:1:0" - } - ], - "id": 345, - "name": "VariableDeclarationStatement", - "src": "4330:10:0" - }, - { - "attributes": { + "id": 301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "expression": { + "argumentTypes": null, + "id": 297, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3897:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, + "id": 298, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "<", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 343, - "type": "uint256", - "value": "i" - }, - "id": 346, - "name": "Identifier", - "src": "4342:1:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "length", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 22, - "type": "address[] storage ref", - "value": "lenderAddresses" - }, - "id": 347, - "name": "Identifier", - "src": "4346:15:0" - } - ], - "id": 348, - "name": "MemberAccess", - "src": "4346:22:0" - } - ], - "id": 349, - "name": "BinaryOperation", - "src": "4342:26:0" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "++", - "prefix": false, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 343, - "type": "uint256", - "value": "i" - }, - "id": 350, - "name": "Identifier", - "src": "4370:1:0" - } - ], - "id": 351, - "name": "UnaryOperation", - "src": "4370:3:0" + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3897:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 352, - "name": "ExpressionStatement", - "src": "4370:3:0" - }, - { - "children": [ - { - "attributes": { - "assignments": [ - 354 - ] - }, - "children": [ - { - "attributes": { - "constant": false, - "name": "currentLender", - "scope": 395, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 353, - "name": "ElementaryTypeName", - "src": "4389:7:0" - } - ], - "id": 354, - "name": "VariableDeclaration", - "src": "4389:21:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 22, - "type": "address[] storage ref", - "value": "lenderAddresses" - }, - "id": 355, - "name": "Identifier", - "src": "4413:15:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 343, - "type": "uint256", - "value": "i" - }, - "id": 356, - "name": "Identifier", - "src": "4429:1:0" - } - ], - "id": 357, - "name": "IndexAccess", - "src": "4413:18:0" - } - ], - "id": 358, - "name": "VariableDeclarationStatement", - "src": "4389:42:0" - }, - { - "attributes": { - "assignments": [ - 360 - ] - }, - "children": [ - { - "attributes": { - "constant": false, - "name": "amountForLender", - "scope": 395, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 359, - "name": "ElementaryTypeName", - "src": "4445:4:0" - } - ], - "id": 360, - "name": "VariableDeclaration", - "src": "4445:20:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_struct$_LenderAccount_$41_storage", - "typeString": "struct LoanContract.LenderAccount storage ref" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 425, - "type": "function (uint256,struct LoanContract.LenderAccount memory) view returns (uint256)", - "value": "getAmountForLender" - }, - "id": 361, - "name": "Identifier", - "src": "4468:18:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 334, - "type": "uint256", - "value": "amountToDistribute" - }, - "id": 362, - "name": "Identifier", - "src": "4487:18:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "struct LoanContract.LenderAccount storage ref" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 363, - "name": "Identifier", - "src": "4507:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 354, - "type": "address", - "value": "currentLender" - }, - "id": 364, - "name": "Identifier", - "src": "4522:13:0" - } - ], - "id": 365, - "name": "IndexAccess", - "src": "4507:29:0" - } - ], - "id": 366, - "name": "FunctionCall", - "src": "4468:69:0" - } - ], - "id": 367, - "name": "VariableDeclarationStatement", - "src": "4445:92:0" + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 299, + "name": "amountLeftToRepay", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 575, + "src": "3910:17:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", + "typeString": "function () view returns (uint256)" + } }, - { - "attributes": { - "falseBody": null - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": ">", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 360, - "type": "uint256", - "value": "amountForLender" - }, - "id": 368, - "name": "Identifier", - "src": "4555:15:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 369, - "name": "Literal", - "src": "4573:1:0" - } - ], - "id": 370, - "name": "BinaryOperation", - "src": "4555:19:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 76, - "type": "function (address,uint256)", - "value": "RepaidToLender" - }, - "id": 371, - "name": "Identifier", - "src": "4594:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 354, - "type": "address", - "value": "currentLender" - }, - "id": 372, - "name": "Identifier", - "src": "4609:13:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 360, - "type": "uint256", - "value": "amountForLender" - }, - "id": 373, - "name": "Identifier", - "src": "4624:15:0" - } - ], - "id": 374, - "name": "FunctionCall", - "src": "4594:46:0" - } - ], - "id": 375, - "name": "ExpressionStatement", - "src": "4594:46:0" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "+=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "member_name": "amountRepaid", - "referencedDeclaration": 38, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "struct LoanContract.LenderAccount storage ref" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 376, - "name": "Identifier", - "src": "4658:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 354, - "type": "address", - "value": "currentLender" - }, - "id": 377, - "name": "Identifier", - "src": "4673:13:0" - } - ], - "id": 378, - "name": "IndexAccess", - "src": "4658:29:0" - } - ], - "id": 379, - "name": "MemberAccess", - "src": "4658:42:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 360, - "type": "uint256", - "value": "amountForLender" - }, - "id": 380, - "name": "Identifier", - "src": "4704:15:0" - } - ], - "id": 381, - "name": "Assignment", - "src": "4658:61:0" - } - ], - "id": 382, - "name": "ExpressionStatement", - "src": "4658:61:0" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "+=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 339, - "type": "uint256", - "value": "amountDistributed" - }, - "id": 383, - "name": "Identifier", - "src": "4737:17:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 360, - "type": "uint256", - "value": "amountForLender" - }, - "id": 384, - "name": "Identifier", - "src": "4758:15:0" - } - ], - "id": 385, - "name": "Assignment", - "src": "4737:36:0" - } - ], - "id": 386, - "name": "ExpressionStatement", - "src": "4737:36:0" - } - ], - "id": 387, - "name": "Block", - "src": "4576:212:0" - } - ], - "id": 388, - "name": "IfStatement", - "src": "4551:237:0" + "id": 300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3910:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 389, - "name": "Block", - "src": "4375:423:0" + }, + "src": "3897:32:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 296, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "3889:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3889:41:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 303, + "nodeType": "ExpressionStatement", + "src": "3889:41:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 307, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 304, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3949:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 390, - "name": "ForStatement", - "src": "4325:473:0" + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 305, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "3965:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3965:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3949:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "children": [ + "id": 308, + "nodeType": "ExpressionStatement", + "src": "3949:25:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { + "argumentTypes": null, + "id": 310, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "4001:15:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "arguments": [ - null - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 442, - "type": "function ()", - "value": "checkLoanRepaid" - }, - "id": 391, - "name": "Identifier", - "src": "4816:15:0" + "id": 311, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "4018:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], - "id": 392, - "name": "FunctionCall", - "src": "4816:17:0" + }, + "id": 312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4018:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 393, - "name": "ExpressionStatement", - "src": "4816:17:0" - } - ], - "id": 394, - "name": "Block", - "src": "3751:1089:0" - } - ], - "id": 395, - "name": "FunctionDefinition", - "src": "3719:1121:0" - }, - { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "getAmountForLender", - "payable": false, - "scope": 600, - "stateMutability": "view", - "superFunction": null, - "visibility": "private" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "amountToDistribute", - "scope": 425, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 309, + "name": "RepaidByBorrower", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 68, + "src": "3984:16:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } }, - "children": [ + "id": 313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3984:44:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 314, + "nodeType": "ExpressionStatement", + "src": "3984:44:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "uint", - "type": "uint256" + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 319, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "4065:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 320, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "4070:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4070:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 318, + "name": "PaymentEntry", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 50, + "src": "4052:12:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_PaymentEntry_$50_storage_ptr_$", + "typeString": "type(struct LoanContract.PaymentEntry storage pointer)" + } }, - "id": 396, - "name": "ElementaryTypeName", - "src": "4878:4:0" + "id": 322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4052:28:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } } ], - "id": 397, - "name": "VariableDeclaration", - "src": "4878:23:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_PaymentEntry_$50_memory", + "typeString": "struct LoanContract.PaymentEntry memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 315, + "name": "payments", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 45, + "src": "4038:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_PaymentEntry_$50_storage_$dyn_storage", + "typeString": "struct LoanContract.PaymentEntry storage ref[] storage ref" + } + }, + "id": 317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4038:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_PaymentEntry_$50_storage_$returns$_t_uint256_$", + "typeString": "function (struct LoanContract.PaymentEntry storage ref) returns (uint256)" + } + }, + "id": 323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4038:43:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { + "id": 324, + "nodeType": "ExpressionStatement", + "src": "4038:43:0" + }, + { + "assignments": [ + 326 + ], + "declarations": [ + { "constant": false, - "name": "account", - "scope": 425, + "id": 326, + "name": "amountToDistribute", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4196:23:0", "stateVariable": false, "storageLocation": "default", - "type": "struct LoanContract.LenderAccount memory", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 325, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4196:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "value": null, "visibility": "internal" - }, - "children": [ - { - "attributes": { - "contractScope": null, - "name": "LenderAccount", - "referencedDeclaration": 41, - "type": "struct LoanContract.LenderAccount storage pointer" - }, - "id": 398, - "name": "UserDefinedTypeName", - "src": "4903:13:0" + } + ], + "id": 329, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 327, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "4222:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], - "id": 399, - "name": "VariableDeclaration", - "src": "4903:21:0" - } - ], - "id": 400, - "name": "ParameterList", - "src": "4877:48:0" - }, - { - "children": [ - { - "attributes": { + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4222:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4196:35:0" + }, + { + "assignments": [ + 331 + ], + "declarations": [ + { "constant": false, - "name": "", - "scope": 425, + "id": 331, + "name": "amountDistributed", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4241:22:0", "stateVariable": false, "storageLocation": "default", - "type": "uint256", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 330, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4241:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "value": null, "visibility": "internal" + } + ], + "id": 333, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4266:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 401, - "name": "ElementaryTypeName", - "src": "4948:4:0" - } - ], - "id": 402, - "name": "VariableDeclaration", - "src": "4948:4:0" - } - ], - "id": 403, - "name": "ParameterList", - "src": "4947:6:0" - }, - { - "children": [ - { - "children": [ + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4241:26:0" + }, + { + "body": { + "id": 381, + "nodeType": "Block", + "src": "4327:423:0", + "statements": [ { - "attributes": { + "assignments": [ + 346 + ], + "declarations": [ + { + "constant": false, + "id": 346, + "name": "currentLender", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4341:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 345, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4341:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 350, + "initialValue": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "baseExpression": { + "argumentTypes": null, + "id": 347, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "4365:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 349, + "indexExpression": { + "argumentTypes": null, + "id": 348, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 335, + "src": "4381:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "operator": "!=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 19, - "type": "uint256", - "value": "amountRepaid" - }, - "id": 404, - "name": "Identifier", - "src": "4968:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 405, - "name": "Identifier", - "src": "4984:10:0" + "nodeType": "IndexAccess", + "src": "4365:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 406, - "name": "BinaryOperation", - "src": "4968:26:0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4341:42:0" }, { - "children": [ + "assignments": [ + 352 + ], + "declarations": [ { - "attributes": { - "functionReturnParameters": 403 + "constant": false, + "id": 352, + "name": "amountForLender", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4397:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "/", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "*", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 397, - "type": "uint256", - "value": "amountToDistribute" - }, - "id": 407, - "name": "Identifier", - "src": "5094:18:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountLent", - "referencedDeclaration": 36, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 399, - "type": "struct LoanContract.LenderAccount memory", - "value": "account" - }, - "id": 408, - "name": "Identifier", - "src": "5115:7:0" - } - ], - "id": 409, - "name": "MemberAccess", - "src": "5115:18:0" - } - ], - "id": 410, - "name": "BinaryOperation", - "src": "5094:39:0" - } - ], - "id": 411, - "name": "TupleExpression", - "src": "5093:41:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 412, - "name": "Identifier", - "src": "5137:10:0" - } - ], - "id": 413, - "name": "BinaryOperation", - "src": "5093:54:0" + "typeName": { + "id": 351, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4397:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 414, - "name": "Return", - "src": "5086:61:0" + }, + "value": null, + "visibility": "internal" } ], - "id": 415, - "name": "Block", - "src": "4996:162:0" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 403 + "id": 359, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 354, + "name": "amountToDistribute", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 326, + "src": "4439:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 355, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "4459:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 357, + "indexExpression": { + "argumentTypes": null, + "id": 356, + "name": "currentLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 346, + "src": "4474:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4459:29:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "-", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountLent", - "referencedDeclaration": 36, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 399, - "type": "struct LoanContract.LenderAccount memory", - "value": "account" - }, - "id": 416, - "name": "Identifier", - "src": "5253:7:0" - } - ], - "id": 417, - "name": "MemberAccess", - "src": "5253:18:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountRepaid", - "referencedDeclaration": 38, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 399, - "type": "struct LoanContract.LenderAccount memory", - "value": "account" - }, - "id": 418, - "name": "Identifier", - "src": "5274:7:0" - } - ], - "id": 419, - "name": "MemberAccess", - "src": "5274:20:0" - } - ], - "id": 420, - "name": "BinaryOperation", - "src": "5253:41:0" + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" } ], - "id": 421, - "name": "Return", - "src": "5246:48:0" + "id": 353, + "name": "getAmountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 417, + "src": "4420:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_struct$_LenderAccount_$39_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (uint256,struct LoanContract.LenderAccount memory) view returns (uint256)" + } + }, + "id": 358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4420:69:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 422, - "name": "Block", - "src": "5164:141:0" - } - ], - "id": 423, - "name": "IfStatement", - "src": "4964:341:0" - } - ], - "id": 424, - "name": "Block", - "src": "4954:357:0" - } - ], - "id": 425, - "name": "FunctionDefinition", - "src": "4850:461:0" - }, - { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "checkLoanRepaid", - "payable": false, - "scope": 600, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "private" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 426, - "name": "ParameterList", - "src": "5345:2:0" - }, - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 427, - "name": "ParameterList", - "src": "5356:0:0" - }, - { - "children": [ - { - "attributes": { - "falseBody": null - }, - "children": [ + }, + "nodeType": "VariableDeclarationStatement", + "src": "4397:92:0" + }, { - "attributes": { + "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, + "id": 362, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 19, - "type": "uint256", - "value": "amountRepaid" - }, - "id": 428, - "name": "Identifier", - "src": "5370:12:0" + "leftExpression": { + "argumentTypes": null, + "id": 360, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4507:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 361, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4525:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" }, - "id": 429, - "name": "Identifier", - "src": "5386:10:0" + "value": "0" + }, + "src": "4507:19:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } - ], - "id": 430, - "name": "BinaryOperation", - "src": "5370:26:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "enum LoanContract.State" + }, + "falseBody": null, + "id": 380, + "nodeType": "IfStatement", + "src": "4503:237:0", + "trueBody": { + "id": 379, + "nodeType": "Block", + "src": "4528:212:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 364, + "name": "currentLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 346, + "src": "4561:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 365, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4576:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 363, + "name": "RepaidToLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 74, + "src": "4546:14:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } }, - "children": [ - { - "attributes": { + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4546:46:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 367, + "nodeType": "ExpressionStatement", + "src": "4546:46:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" + "id": 368, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "4610:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } }, - "id": 431, - "name": "Identifier", - "src": "5412:12:0" - }, - { - "attributes": { + "id": 370, + "indexExpression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "repaid", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 432, - "name": "Identifier", - "src": "5427:5:0" + "id": 369, + "name": "currentLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 346, + "src": "4625:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 433, - "name": "MemberAccess", - "src": "5427:12:0" - } - ], - "id": 434, - "name": "Assignment", - "src": "5412:27:0" - } - ], - "id": 435, - "name": "ExpressionStatement", - "src": "5412:27:0" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "arguments": [ - null - ], + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4610:29:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "id": 371, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false + "lValueRequested": true, + "memberName": "amountRepaid", + "nodeType": "MemberAccess", + "referencedDeclaration": 36, + "src": "4610:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 94, - "type": "function ()", - "value": "LoanRepaid" - }, - "id": 436, - "name": "Identifier", - "src": "5453:10:0" + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "id": 372, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4656:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 437, - "name": "FunctionCall", - "src": "5453:12:0" - } - ], - "id": 438, - "name": "ExpressionStatement", - "src": "5453:12:0" + }, + "src": "4610:61:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 374, + "nodeType": "ExpressionStatement", + "src": "4610:61:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 375, + "name": "amountDistributed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 331, + "src": "4689:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "id": 376, + "name": "amountForLender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 352, + "src": "4710:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4689:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 378, + "nodeType": "ExpressionStatement", + "src": "4689:36:0" + } + ] + } + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 338, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 335, + "src": "4294:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 339, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "4298:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 340, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4298:22:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4294:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 382, + "initializationExpression": { + "assignments": [ + 335 + ], + "declarations": [ + { + "constant": false, + "id": 335, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 387, + "src": "4282:6:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 334, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4282:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 439, - "name": "Block", - "src": "5398:78:0" + }, + "value": null, + "visibility": "internal" } ], - "id": 440, - "name": "IfStatement", - "src": "5366:110:0" - } - ], - "id": 441, - "name": "Block", - "src": "5356:126:0" - } - ], - "id": 442, - "name": "FunctionDefinition", - "src": "5321:161:0" + "id": 337, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 336, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4291:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4282:10:0" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "4322:3:0", + "subExpression": { + "argumentTypes": null, + "id": 342, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 335, + "src": "4322:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 344, + "nodeType": "ExpressionStatement", + "src": "4322:3:0" + }, + "nodeType": "ForStatement", + "src": "4277:473:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 383, + "name": "checkLoanRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 434, + "src": "4768:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4768:17:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "4768:17:0" + } + ] + }, + "id": 387, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "repay", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 280, + "nodeType": "ParameterList", + "parameters": [], + "src": "3685:2:0" + }, + "payable": true, + "returnParameters": { + "id": 281, + "nodeType": "ParameterList", + "parameters": [], + "src": "3703:0:0" + }, + "scope": 592, + "src": "3671:1121:0", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "lenderWithdraw", - "payable": false, - "scope": 600, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 443, - "name": "ParameterList", - "src": "5606:2:0" - }, - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 444, - "name": "ParameterList", - "src": "5616:0:0" - }, - { - "children": [ - { - "attributes": { - "assignments": [ - 446 - ] + "body": { + "id": 416, + "nodeType": "Block", + "src": "4906:357:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "constant": false, - "name": "amountToWithdraw", - "scope": 480, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 445, - "name": "ElementaryTypeName", - "src": "5626:4:0" - } - ], - "id": 446, - "name": "VariableDeclaration", - "src": "5626:21:0" - }, + "id": 398, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 396, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4920:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "id": 397, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "4936:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4920:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 414, + "nodeType": "Block", + "src": "5116:141:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 412, "isConstant": false, "isLValue": false, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 533, - "type": "function (address) view returns (uint256)", - "value": "amountLenderCanWithdraw" + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 408, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 391, + "src": "5205:7:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" + } }, - "id": 447, - "name": "Identifier", - "src": "5650:23:0" + "id": 409, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "5205:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 448, - "name": "Identifier", - "src": "5674:3:0" + "id": 410, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 391, + "src": "5226:7:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" } - ], - "id": 449, - "name": "MemberAccess", - "src": "5674:10:0" + }, + "id": 411, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountRepaid", + "nodeType": "MemberAccess", + "referencedDeclaration": 36, + "src": "5226:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5205:41:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 450, - "name": "FunctionCall", - "src": "5650:35:0" + }, + "functionReturnParameters": 395, + "id": 413, + "nodeType": "Return", + "src": "5198:48:0" } - ], - "id": 451, - "name": "VariableDeclarationStatement", - "src": "5626:59:0" + ] }, - { - "attributes": { - "falseBody": null - }, - "children": [ + "id": 415, + "nodeType": "IfStatement", + "src": "4916:341:0", + "trueBody": { + "id": 407, + "nodeType": "Block", + "src": "4948:162:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, + "id": 405, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": ">", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 446, - "type": "uint256", - "value": "amountToWithdraw" - }, - "id": 452, - "name": "Identifier", - "src": "5699:16:0" - }, - { - "attributes": { - "argumentTypes": null, - "hexvalue": "30", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 453, - "name": "Literal", - "src": "5718:1:0" - } - ], - "id": 454, - "name": "BinaryOperation", - "src": "5699:20:0" - }, - { - "children": [ - { - "children": [ + "leftExpression": { + "argumentTypes": null, + "components": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "+=", - "type": "uint256" + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "member_name": "amountWithdrawn", - "referencedDeclaration": 40, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "struct LoanContract.LenderAccount storage ref" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 455, - "name": "Identifier", - "src": "5735:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 456, - "name": "Identifier", - "src": "5750:3:0" - } - ], - "id": 457, - "name": "MemberAccess", - "src": "5750:10:0" - } - ], - "id": 458, - "name": "IndexAccess", - "src": "5735:26:0" - } - ], - "id": 459, - "name": "MemberAccess", - "src": "5735:42:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 446, - "type": "uint256", - "value": "amountToWithdraw" - }, - "id": 460, - "name": "Identifier", - "src": "5781:16:0" - } - ], - "id": 461, - "name": "Assignment", - "src": "5735:62:0" - } - ], - "id": 462, - "name": "ExpressionStatement", - "src": "5735:62:0" - }, - { - "children": [ - { - "attributes": { + "id": 402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "transfer", - "referencedDeclaration": null, - "type": "function (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 463, - "name": "Identifier", - "src": "5811:3:0" - } - ], - "id": 466, - "name": "MemberAccess", - "src": "5811:10:0" - } - ], - "id": 467, - "name": "MemberAccess", - "src": "5811:19:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 446, - "type": "uint256", - "value": "amountToWithdraw" - }, - "id": 468, - "name": "Identifier", - "src": "5831:16:0" + "id": 399, + "name": "amountToDistribute", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 389, + "src": "5046:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 469, - "name": "FunctionCall", - "src": "5811:37:0" - } - ], - "id": 470, - "name": "ExpressionStatement", - "src": "5811:37:0" - }, - { - "children": [ - { - "attributes": { + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 400, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 391, + "src": "5067:7:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" + } + }, + "id": 401, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, - "isStructConstructorCall": false, "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 88, - "type": "function (address,uint256)", - "value": "LenderWithdrew" - }, - "id": 471, - "name": "Identifier", - "src": "5862:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 472, - "name": "Identifier", - "src": "5877:3:0" - } - ], - "id": 473, - "name": "MemberAccess", - "src": "5877:10:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 446, - "type": "uint256", - "value": "amountToWithdraw" - }, - "id": 474, - "name": "Identifier", - "src": "5889:16:0" + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "5067:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 475, - "name": "FunctionCall", - "src": "5862:44:0" + }, + "src": "5046:39:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 476, - "name": "ExpressionStatement", - "src": "5862:44:0" + "id": 403, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5045:41:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 404, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "5089:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5045:54:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 477, - "name": "Block", - "src": "5721:196:0" + }, + "functionReturnParameters": 395, + "id": 406, + "nodeType": "Return", + "src": "5038:61:0" } - ], - "id": 478, - "name": "IfStatement", - "src": "5695:222:0" + ] } - ], - "id": 479, - "name": "Block", - "src": "5616:307:0" - } - ], - "id": 480, - "name": "FunctionDefinition", - "src": "5583:340:0" + } + ] + }, + "id": 417, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "getAmountForLender", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 392, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 389, + "name": "amountToDistribute", + "nodeType": "VariableDeclaration", + "scope": 417, + "src": "4830:23:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 388, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4830:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 391, + "name": "account", + "nodeType": "VariableDeclaration", + "scope": 417, + "src": "4855:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_memory_ptr", + "typeString": "struct LoanContract.LenderAccount memory" + }, + "typeName": { + "contractScope": null, + "id": 390, + "name": "LenderAccount", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 39, + "src": "4855:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4829:48:0" + }, + "payable": false, + "returnParameters": { + "id": 395, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 394, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 417, + "src": "4900:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 393, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4900:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4899:6:0" + }, + "scope": 592, + "src": "4802:461:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "private" }, { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "amountLenderCanWithdraw", - "payable": false, - "scope": 600, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "lenderAddr", - "scope": 533, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" + "body": { + "id": 433, + "nodeType": "Block", + "src": "5308:126:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 481, - "name": "ElementaryTypeName", - "src": "6037:7:0" + "id": 422, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 420, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "5322:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 482, - "name": "VariableDeclaration", - "src": "6037:18:0" - } - ], - "id": 483, - "name": "ParameterList", - "src": "6036:20:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "scope": 533, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 484, - "name": "ElementaryTypeName", - "src": "6078:4:0" + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 421, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "5338:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 485, - "name": "VariableDeclaration", - "src": "6078:4:0" - } - ], - "id": 486, - "name": "ParameterList", - "src": "6077:6:0" - }, - { - "children": [ - { - "attributes": { - "assignments": [ - 488 - ] }, - "children": [ - { - "attributes": { - "constant": false, - "name": "amountCanWithdraw", - "scope": 533, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 487, - "name": "ElementaryTypeName", - "src": "6094:4:0" - } - ], - "id": 488, - "name": "VariableDeclaration", - "src": "6094:22:0" - }, + "src": "5322:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 432, + "nodeType": "IfStatement", + "src": "5318:110:0", + "trueBody": { + "id": 431, + "nodeType": "Block", + "src": "5350:78:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, - "hexvalue": "30", + "id": 426, "isConstant": false, "isLValue": false, - "isPure": true, + "isPure": false, "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 0", - "value": "0" - }, - "id": 489, - "name": "Literal", - "src": "6119:1:0" - } - ], - "id": 490, - "name": "VariableDeclarationStatement", - "src": "6094:26:0" - }, - { - "attributes": { - "assignments": [ - 492 - ] - }, - "children": [ - { - "attributes": { - "constant": false, - "name": "lenderAccount", - "scope": 533, - "stateVariable": false, - "storageLocation": "storage", - "type": "struct LoanContract.LenderAccount storage pointer", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "contractScope": null, - "name": "LenderAccount", - "referencedDeclaration": 41, - "type": "struct LoanContract.LenderAccount storage pointer" + "leftHandSide": { + "argumentTypes": null, + "id": 423, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "5364:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 424, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "5379:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } }, - "id": 491, - "name": "UserDefinedTypeName", - "src": "6130:13:0" + "id": 425, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaid", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5379:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "5364:27:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 492, - "name": "VariableDeclaration", - "src": "6130:35:0" + }, + "id": 427, + "nodeType": "ExpressionStatement", + "src": "5364:27:0" }, { - "attributes": { + "expression": { "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 428, + "name": "LoanRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "5405:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 429, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "type": "struct LoanContract.LenderAccount storage ref" + "names": [], + "nodeType": "FunctionCall", + "src": "5405:12:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 26, - "type": "mapping(address => struct LoanContract.LenderAccount storage ref)", - "value": "lenderAccounts" - }, - "id": 493, - "name": "Identifier", - "src": "6168:14:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 482, - "type": "address", - "value": "lenderAddr" - }, - "id": 494, - "name": "Identifier", - "src": "6183:10:0" + "id": 430, + "nodeType": "ExpressionStatement", + "src": "5405:12:0" + } + ] + } + } + ] + }, + "id": 434, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "checkLoanRepaid", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 418, + "nodeType": "ParameterList", + "parameters": [], + "src": "5297:2:0" + }, + "payable": false, + "returnParameters": { + "id": 419, + "nodeType": "ParameterList", + "parameters": [], + "src": "5308:0:0" + }, + "scope": 592, + "src": "5273:161:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 471, + "nodeType": "Block", + "src": "5568:307:0", + "statements": [ + { + "assignments": [ + 438 + ], + "declarations": [ + { + "constant": false, + "id": 438, + "name": "amountToWithdraw", + "nodeType": "VariableDeclaration", + "scope": 472, + "src": "5578:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 437, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "5578:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 443, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 440, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5626:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], - "id": 495, - "name": "IndexAccess", - "src": "6168:26:0" + }, + "id": 441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5626:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 496, - "name": "VariableDeclarationStatement", - "src": "6130:64:0" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 439, + "name": "amountLenderCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 525, + "src": "5602:23:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) view returns (uint256)" + } + }, + "id": 442, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5602:35:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5578:59:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 444, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5651:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 445, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5670:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5651:20:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - { - "children": [ + "falseBody": null, + "id": 470, + "nodeType": "IfStatement", + "src": "5647:222:0", + "trueBody": { + "id": 469, + "nodeType": "Block", + "src": "5673:196:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_enum$_State_$32", - "typeString": "enum LoanContract.State" - }, + "id": 453, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 497, - "name": "Identifier", - "src": "6208:12:0" - }, - { - "attributes": { + "leftHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "expired", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { + "baseExpression": { + "argumentTypes": null, + "id": 447, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "5687:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 450, + "indexExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" + "id": 448, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5702:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, - "id": 498, - "name": "Identifier", - "src": "6224:5:0" + "id": 449, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5702:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "5687:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" } - ], - "id": 499, - "name": "MemberAccess", - "src": "6224:13:0" + }, + "id": 451, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "amountWithdrawn", + "nodeType": "MemberAccess", + "referencedDeclaration": 38, + "src": "5687:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "id": 452, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5733:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5687:62:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 500, - "name": "BinaryOperation", - "src": "6208:29:0" + }, + "id": 454, + "nodeType": "ExpressionStatement", + "src": "5687:62:0" }, { - "children": [ - { - "children": [ + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 460, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5783:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 488, - "type": "uint256", - "value": "amountCanWithdraw" - }, - "id": 501, - "name": "Identifier", - "src": "6337:17:0" - }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "-", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountLent", - "referencedDeclaration": 36, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 492, - "type": "struct LoanContract.LenderAccount storage pointer", - "value": "lenderAccount" - }, - "id": 502, - "name": "Identifier", - "src": "6357:13:0" - } - ], - "id": 503, - "name": "MemberAccess", - "src": "6357:24:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountWithdrawn", - "referencedDeclaration": 40, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 492, - "type": "struct LoanContract.LenderAccount storage pointer", - "value": "lenderAccount" - }, - "id": 504, - "name": "Identifier", - "src": "6384:13:0" - } - ], - "id": 505, - "name": "MemberAccess", - "src": "6384:29:0" - } - ], - "id": 506, - "name": "BinaryOperation", - "src": "6357:56:0" - } - ], - "id": 507, - "name": "Assignment", - "src": "6337:76:0" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } ], - "id": 508, - "name": "ExpressionStatement", - "src": "6337:76:0" + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 455, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5763:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 458, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5763:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 459, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5763:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 461, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5763:37:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 509, - "name": "Block", - "src": "6239:185:0" + }, + "id": 462, + "nodeType": "ExpressionStatement", + "src": "5763:37:0" }, { - "attributes": { - "falseBody": null - }, - "children": [ - { - "attributes": { + "expression": { + "argumentTypes": null, + "arguments": [ + { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "expression": { + "argumentTypes": null, + "id": 464, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5829:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, + "id": 465, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "||", - "type": "bool" + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5829:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_enum$_State_$32", - "typeString": "enum LoanContract.State" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 510, - "name": "Identifier", - "src": "6434:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "repaying", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 511, - "name": "Identifier", - "src": "6450:5:0" - } - ], - "id": 512, - "name": "MemberAccess", - "src": "6450:14:0" - } - ], - "id": 513, - "name": "BinaryOperation", - "src": "6434:30:0" - }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_enum$_State_$32", - "typeString": "enum LoanContract.State" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 514, - "name": "Identifier", - "src": "6468:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "repaid", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 515, - "name": "Identifier", - "src": "6484:5:0" - } - ], - "id": 516, - "name": "MemberAccess", - "src": "6484:12:0" - } - ], - "id": 517, - "name": "BinaryOperation", - "src": "6468:28:0" + { + "argumentTypes": null, + "id": 466, + "name": "amountToWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "5841:16:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 518, - "name": "BinaryOperation", - "src": "6434:62:0" - }, - { - "children": [ + } + ], + "expression": { + "argumentTypes": [ { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 488, - "type": "uint256", - "value": "amountCanWithdraw" - }, - "id": 519, - "name": "Identifier", - "src": "6632:17:0" - }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "-", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountRepaid", - "referencedDeclaration": 38, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 492, - "type": "struct LoanContract.LenderAccount storage pointer", - "value": "lenderAccount" - }, - "id": 520, - "name": "Identifier", - "src": "6652:13:0" - } - ], - "id": 521, - "name": "MemberAccess", - "src": "6652:26:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "amountWithdrawn", - "referencedDeclaration": 40, - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 492, - "type": "struct LoanContract.LenderAccount storage pointer", - "value": "lenderAccount" - }, - "id": 522, - "name": "Identifier", - "src": "6681:13:0" - } - ], - "id": 523, - "name": "MemberAccess", - "src": "6681:29:0" - } - ], - "id": 524, - "name": "BinaryOperation", - "src": "6652:58:0" - } - ], - "id": 525, - "name": "Assignment", - "src": "6632:78:0" - } - ], - "id": 526, - "name": "ExpressionStatement", - "src": "6632:78:0" + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } ], - "id": 527, - "name": "Block", - "src": "6498:223:0" + "id": 463, + "name": "LenderWithdrew", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 86, + "src": "5814:14:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,uint256)" + } + }, + "id": 467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5814:44:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 528, - "name": "IfStatement", - "src": "6430:291:0" - } - ], - "id": 529, - "name": "IfStatement", - "src": "6204:517:0" - }, - { - "attributes": { - "functionReturnParameters": 486 - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 488, - "type": "uint256", - "value": "amountCanWithdraw" }, - "id": 530, - "name": "Identifier", - "src": "6737:17:0" + "id": 468, + "nodeType": "ExpressionStatement", + "src": "5814:44:0" } - ], - "id": 531, - "name": "Return", - "src": "6730:24:0" + ] } - ], - "id": 532, - "name": "Block", - "src": "6084:677:0" - } - ], - "id": 533, - "name": "FunctionDefinition", - "src": "6004:757:0" + } + ] + }, + "id": 472, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "lenderWithdraw", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 435, + "nodeType": "ParameterList", + "parameters": [], + "src": "5558:2:0" + }, + "payable": false, + "returnParameters": { + "id": 436, + "nodeType": "ParameterList", + "parameters": [], + "src": "5568:0:0" + }, + "scope": 592, + "src": "5535:340:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "makeExpired", - "payable": false, - "scope": 600, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] + "body": { + "id": 524, + "nodeType": "Block", + "src": "6036:677:0", + "statements": [ + { + "assignments": [ + 480 + ], + "declarations": [ + { + "constant": false, + "id": 480, + "name": "amountCanWithdraw", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "6046:22:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 479, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "6046:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 482, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6071:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "6046:26:0" }, - "children": [], - "id": 534, - "name": "ParameterList", - "src": "6867:2:0" - }, - { - "attributes": { - "parameters": [ - null - ] + { + "assignments": [ + 484 + ], + "declarations": [ + { + "constant": false, + "id": 484, + "name": "lenderAccount", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "6082:35:0", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + }, + "typeName": { + "contractScope": null, + "id": 483, + "name": "LenderAccount", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 39, + "src": "6082:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 488, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 485, + "name": "lenderAccounts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "6120:14:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_LenderAccount_$39_storage_$", + "typeString": "mapping(address => struct LoanContract.LenderAccount storage ref)" + } + }, + "id": 487, + "indexExpression": { + "argumentTypes": null, + "id": 486, + "name": "lenderAddr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 474, + "src": "6135:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "6120:26:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage", + "typeString": "struct LoanContract.LenderAccount storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6082:64:0" }, - "children": [], - "id": 535, - "name": "ParameterList", - "src": "6877:0:0" - }, - { - "children": [ - { - "attributes": { - "falseBody": null + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" }, - "children": [ - { - "attributes": { + "id": 492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 489, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6160:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 490, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6176:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "expired", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6176:13:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6160:29:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 510, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "id": 502, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6386:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 503, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6402:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } }, + "id": 504, "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, "lValueRequested": false, - "operator": "&&", - "type": "bool" + "memberName": "repaying", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6402:14:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } }, - "children": [ - { - "attributes": { + "src": "6386:30:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 509, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 506, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6420:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 507, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6436:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } + }, + "id": 508, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaid", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6436:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6420:28:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "6386:62:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 520, + "nodeType": "IfStatement", + "src": "6382:291:0", + "trueBody": { + "id": 519, + "nodeType": "Block", + "src": "6450:223:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 517, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 511, + "name": "amountCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 480, + "src": "6584:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, + "id": 516, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { + "leftExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 773, - "type": "uint256", - "value": "now" + "id": 512, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6604:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } }, - "id": 536, - "name": "Identifier", - "src": "6892:3:0" + "id": 513, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountRepaid", + "nodeType": "MemberAccess", + "referencedDeclaration": 36, + "src": "6604:26:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 9, - "type": "uint256", - "value": "fundRaisingDeadline" + "id": 514, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6633:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } }, - "id": 537, - "name": "Identifier", - "src": "6899:19:0" + "id": 515, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountWithdrawn", + "nodeType": "MemberAccess", + "referencedDeclaration": 38, + "src": "6633:29:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6604:58:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 538, - "name": "BinaryOperation", - "src": "6892:26:0" + }, + "src": "6584:78:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { + "id": 518, + "nodeType": "ExpressionStatement", + "src": "6584:78:0" + } + ] + } + }, + "id": 521, + "nodeType": "IfStatement", + "src": "6156:517:0", + "trueBody": { + "id": 501, + "nodeType": "Block", + "src": "6191:185:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 493, + "name": "amountCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 480, + "src": "6289:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "expression": { + "argumentTypes": null, + "id": 494, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6309:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } }, + "id": 495, "isConstant": false, - "isLValue": false, + "isLValue": true, "isPure": false, "lValueRequested": false, - "operator": "<", - "type": "bool" + "memberName": "amountLent", + "nodeType": "MemberAccess", + "referencedDeclaration": 34, + "src": "6309:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" - }, - "id": 539, - "name": "Identifier", - "src": "6922:12:0" + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 496, + "name": "lenderAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 484, + "src": "6336:13:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_LenderAccount_$39_storage_ptr", + "typeString": "struct LoanContract.LenderAccount storage pointer" + } }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 540, - "name": "Identifier", - "src": "6937:10:0" - } - ], - "id": 541, - "name": "BinaryOperation", - "src": "6922:25:0" - } - ], - "id": 542, - "name": "BinaryOperation", - "src": "6892:55:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 543, - "name": "Identifier", - "src": "6963:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "expired", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 544, - "name": "Identifier", - "src": "6978:5:0" - } - ], - "id": 545, - "name": "MemberAccess", - "src": "6978:13:0" - } - ], - "id": 546, - "name": "Assignment", - "src": "6963:28:0" + "id": 497, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "amountWithdrawn", + "nodeType": "MemberAccess", + "referencedDeclaration": 38, + "src": "6336:29:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 547, - "name": "ExpressionStatement", - "src": "6963:28:0" + }, + "src": "6309:56:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "arguments": [ - null - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - null - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 92, - "type": "function ()", - "value": "LoanExpired" - }, - "id": 548, - "name": "Identifier", - "src": "7005:11:0" - } - ], - "id": 549, - "name": "FunctionCall", - "src": "7005:13:0" - } - ], - "id": 550, - "name": "ExpressionStatement", - "src": "7005:13:0" + "src": "6289:76:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 551, - "name": "Block", - "src": "6949:80:0" + }, + "id": 500, + "nodeType": "ExpressionStatement", + "src": "6289:76:0" } - ], - "id": 552, - "name": "IfStatement", - "src": "6888:141:0" + ] } - ], - "id": 553, - "name": "Block", - "src": "6877:158:0" - } - ], - "id": 554, - "name": "FunctionDefinition", - "src": "6847:188:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 522, + "name": "amountCanWithdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 480, + "src": "6689:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 478, + "id": 523, + "nodeType": "Return", + "src": "6682:24:0" + } + ] + }, + "id": 525, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "amountLenderCanWithdraw", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 475, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 474, + "name": "lenderAddr", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "5989:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 473, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5989:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5988:20:0" + }, + "payable": false, + "returnParameters": { + "id": 478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 477, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 525, + "src": "6030:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 476, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "6030:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6029:6:0" + }, + "scope": 592, + "src": "5956:757:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "numLenders", - "payable": false, - "scope": 600, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 555, - "name": "ParameterList", - "src": "7105:2:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "scope": 563, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "body": { + "id": 545, + "nodeType": "Block", + "src": "6829:158:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 534, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 528, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "6844:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 529, + "name": "fundRaisingDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "6851:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6844:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 556, - "name": "ElementaryTypeName", - "src": "7129:4:0" + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 531, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "6874:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 532, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "6889:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6874:25:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } - ], - "id": 557, - "name": "VariableDeclaration", - "src": "7129:4:0" - } - ], - "id": 558, - "name": "ParameterList", - "src": "7128:6:0" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 558 }, - "children": [ + "src": "6844:55:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 544, + "nodeType": "IfStatement", + "src": "6840:141:0", + "trueBody": { + "id": 543, + "nodeType": "Block", + "src": "6901:80:0", + "statements": [ { - "attributes": { + "expression": { "argumentTypes": null, + "id": 538, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "member_name": "length", - "referencedDeclaration": null, - "type": "uint256" - }, - "children": [ - { - "attributes": { + "leftHandSide": { + "argumentTypes": null, + "id": 535, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "6915:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 22, - "type": "address[] storage ref", - "value": "lenderAddresses" + "id": 536, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "6930:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" + } }, - "id": 559, - "name": "Identifier", - "src": "7152:15:0" + "id": 537, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "expired", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6930:13:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "6915:28:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" } - ], - "id": 560, - "name": "MemberAccess", - "src": "7152:22:0" - } - ], - "id": 561, - "name": "Return", - "src": "7145:29:0" - } - ], - "id": 562, - "name": "Block", - "src": "7135:46:0" - } - ], - "id": 563, - "name": "FunctionDefinition", - "src": "7086:95:0" - }, - { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "amountLeftToFund", - "payable": false, - "scope": 600, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 564, - "name": "ParameterList", - "src": "7216:2:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "scope": 573, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" }, - "id": 565, - "name": "ElementaryTypeName", - "src": "7240:4:0" - } - ], - "id": 566, - "name": "VariableDeclaration", - "src": "7240:4:0" - } - ], - "id": 567, - "name": "ParameterList", - "src": "7239:6:0" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 567 - }, - "children": [ + "id": 539, + "nodeType": "ExpressionStatement", + "src": "6915:28:0" + }, { - "attributes": { + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 540, + "name": "LoanExpired", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "6957:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$__$returns$__$", + "typeString": "function ()" + } }, + "id": 541, "isConstant": false, "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "operator": "-", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 568, - "name": "Identifier", - "src": "7263:10:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 17, - "type": "uint256", - "value": "amountRaised" - }, - "id": 569, - "name": "Identifier", - "src": "7276:12:0" + "names": [], + "nodeType": "FunctionCall", + "src": "6957:13:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 570, - "name": "BinaryOperation", - "src": "7263:25:0" + }, + "id": 542, + "nodeType": "ExpressionStatement", + "src": "6957:13:0" } - ], - "id": 571, - "name": "Return", - "src": "7256:32:0" + ] } - ], - "id": 572, - "name": "Block", - "src": "7246:49:0" - } - ], - "id": 573, - "name": "FunctionDefinition", - "src": "7191:104:0" + } + ] + }, + "id": 546, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "makeExpired", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 526, + "nodeType": "ParameterList", + "parameters": [], + "src": "6819:2:0" + }, + "payable": false, + "returnParameters": { + "id": 527, + "nodeType": "ParameterList", + "parameters": [], + "src": "6829:0:0" + }, + "scope": 592, + "src": "6799:188:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null + "body": { + "id": 554, + "nodeType": "Block", + "src": "7087:46:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 551, + "name": "lenderAddresses", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "7104:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 552, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "7104:22:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 550, + "id": 553, + "nodeType": "Return", + "src": "7097:29:0" + } + ] + }, + "id": 555, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "numLenders", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 547, + "nodeType": "ParameterList", + "parameters": [], + "src": "7057:2:0" + }, + "payable": false, + "returnParameters": { + "id": 550, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 549, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 555, + "src": "7081:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 548, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7081:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } ], - "name": "amountLeftToRepay", - "payable": false, - "scope": 600, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 574, - "name": "ParameterList", - "src": "7331:2:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "scope": 583, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" + "src": "7080:6:0" + }, + "scope": 592, + "src": "7038:95:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 564, + "nodeType": "Block", + "src": "7198:49:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 575, - "name": "ElementaryTypeName", - "src": "7355:4:0" + "id": 562, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 560, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "7215:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 561, + "name": "amountRaised", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "7228:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7215:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 559, + "id": 563, + "nodeType": "Return", + "src": "7208:32:0" + } + ] + }, + "id": 565, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "amountLeftToFund", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 556, + "nodeType": "ParameterList", + "parameters": [], + "src": "7168:2:0" + }, + "payable": false, + "returnParameters": { + "id": 559, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 558, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 565, + "src": "7192:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 557, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7192:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7191:6:0" + }, + "scope": 592, + "src": "7143:104:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 574, + "nodeType": "Block", + "src": "7313:49:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 570, + "name": "loanAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "7330:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 571, + "name": "amountRepaid", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "7343:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 576, - "name": "VariableDeclaration", - "src": "7355:4:0" - } - ], - "id": 577, - "name": "ParameterList", - "src": "7354:6:0" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 577 }, - "children": [ + "src": "7330:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 569, + "id": 573, + "nodeType": "Return", + "src": "7323:32:0" + } + ] + }, + "id": 575, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "amountLeftToRepay", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 566, + "nodeType": "ParameterList", + "parameters": [], + "src": "7283:2:0" + }, + "payable": false, + "returnParameters": { + "id": 569, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 568, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "7307:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 567, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7307:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7306:6:0" + }, + "scope": 592, + "src": "7257:105:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 590, + "nodeType": "Block", + "src": "7423:82:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ { - "attributes": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 587, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, + "id": 582, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "operator": "-", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 5, - "type": "uint256", - "value": "loanAmount" - }, - "id": 578, - "name": "Identifier", - "src": "7378:10:0" + "leftExpression": { + "argumentTypes": null, + "id": 580, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "7441:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 19, - "type": "uint256", - "value": "amountRepaid" - }, - "id": 579, - "name": "Identifier", - "src": "7391:12:0" + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 581, + "name": "repaymentDeadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "7448:17:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7441:24:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } - ], - "id": 580, - "name": "BinaryOperation", - "src": "7378:25:0" - } - ], - "id": 581, - "name": "Return", - "src": "7371:32:0" - } - ], - "id": 582, - "name": "Block", - "src": "7361:49:0" - } - ], - "id": 583, - "name": "FunctionDefinition", - "src": "7305:105:0" - }, - { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "isDelinquent", - "payable": false, - "scope": 600, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 584, - "name": "ParameterList", - "src": "7441:2:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "scope": 599, - "stateVariable": false, - "storageLocation": "default", - "type": "bool", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool", - "type": "bool" }, - "id": 585, - "name": "ElementaryTypeName", - "src": "7465:4:0" - } - ], - "id": 586, - "name": "VariableDeclaration", - "src": "7465:4:0" - } - ], - "id": 587, - "name": "ParameterList", - "src": "7464:6:0" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 587 - }, - "children": [ - { - "attributes": { + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + }, + "id": 586, "isConstant": false, - "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "type": "bool" - }, - "children": [ - { - "attributes": { + "leftExpression": { + "argumentTypes": null, + "id": 583, + "name": "currentState", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "7469:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "expression": { "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "&&", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 773, - "type": "uint256", - "value": "now" - }, - "id": 588, - "name": "Identifier", - "src": "7489:3:0" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 11, - "type": "uint256", - "value": "repaymentDeadline" - }, - "id": 589, - "name": "Identifier", - "src": "7496:17:0" - } - ], - "id": 590, - "name": "BinaryOperation", - "src": "7489:24:0" - }, - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_enum$_State_$32", - "typeString": "enum LoanContract.State" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "!=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 34, - "type": "enum LoanContract.State", - "value": "currentState" - }, - "id": 591, - "name": "Identifier", - "src": "7517:12:0" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "member_name": "repaid", - "referencedDeclaration": null, - "type": "enum LoanContract.State" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 32, - "type": "type(enum LoanContract.State)", - "value": "State" - }, - "id": 592, - "name": "Identifier", - "src": "7533:5:0" - } - ], - "id": 593, - "name": "MemberAccess", - "src": "7533:12:0" - } - ], - "id": 594, - "name": "BinaryOperation", - "src": "7517:28:0" + "id": 584, + "name": "State", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "7485:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_State_$30_$", + "typeString": "type(enum LoanContract.State)" } - ], - "id": 595, - "name": "BinaryOperation", - "src": "7489:56:0" + }, + "id": 585, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "repaid", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "7485:12:0", + "typeDescriptions": { + "typeIdentifier": "t_enum$_State_$30", + "typeString": "enum LoanContract.State" + } + }, + "src": "7469:28:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" } - ], - "id": 596, - "name": "TupleExpression", - "src": "7488:58:0" + }, + "src": "7441:56:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } } ], - "id": 597, - "name": "Return", - "src": "7481:65:0" - } - ], - "id": 598, - "name": "Block", - "src": "7471:82:0" - } - ], - "id": 599, - "name": "FunctionDefinition", - "src": "7420:133:0" + "id": 588, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7440:58:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 579, + "id": 589, + "nodeType": "Return", + "src": "7433:65:0" + } + ] + }, + "id": 591, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "isDelinquent", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 576, + "nodeType": "ParameterList", + "parameters": [], + "src": "7393:2:0" + }, + "payable": false, + "returnParameters": { + "id": 579, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 578, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 591, + "src": "7417:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 577, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7417:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7416:6:0" + }, + "scope": 592, + "src": "7372:133:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" } ], - "id": 600, - "name": "ContractDefinition", - "src": "110:7445:0" + "scope": 593, + "src": "110:7397:0" } ], - "id": 601, - "name": "SourceUnit", - "src": "0:7555:0" + "src": "0:7508:0" }, "compiler": { "name": "solc", - "version": "0.4.18+commit.9cf6e910.Emscripten.clang" + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" }, "networks": {}, - "schemaVersion": "1.0.1", - "updatedAt": "2017-11-13T08:15:12.824Z" + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-13T18:29:09.247Z" } \ No newline at end of file diff --git a/build/contracts/LoanFactory.json b/build/contracts/LoanFactory.json index da33e0ab..fc110961 100644 --- a/build/contracts/LoanFactory.json +++ b/build/contracts/LoanFactory.json @@ -24,14 +24,14 @@ "constant": true, "inputs": [ { - "name": "_borrowerAddress", + "name": "", "type": "address" } ], - "name": "getLoanForBorrower", + "name": "borrowerLoanIndex", "outputs": [ { - "name": "_loanAddress", + "name": "", "type": "address" } ], @@ -40,54 +40,40 @@ "type": "function" }, { - "constant": false, + "constant": true, "inputs": [ { - "name": "_loanAmountInEthers", - "type": "uint256" - }, - { - "name": "_repaymentDurationInDays", + "name": "", "type": "uint256" - }, - { - "name": "_name", - "type": "string" - }, - { - "name": "_use", - "type": "string" } ], - "name": "create", + "name": "loans", "outputs": [ { - "name": "_loanAddress", + "name": "", "type": "address" } ], "payable": false, - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "constant": true, + "anonymous": false, "inputs": [ { - "name": "", + "indexed": false, + "name": "loanAddress", "type": "address" - } - ], - "name": "borrowerLoanIndex", - "outputs": [ + }, { - "name": "", + "indexed": false, + "name": "borrowerAddress", "type": "address" } ], - "payable": false, - "stateMutability": "view", - "type": "function" + "name": "LoanCreated", + "type": "event" }, { "constant": true, @@ -107,14 +93,14 @@ "constant": true, "inputs": [ { - "name": "", - "type": "uint256" + "name": "_borrowerAddress", + "type": "address" } ], - "name": "loans", + "name": "getLoanForBorrower", "outputs": [ { - "name": "", + "name": "_loanAddress", "type": "address" } ], @@ -123,1392 +109,2478 @@ "type": "function" }, { - "anonymous": false, + "constant": false, "inputs": [ { - "indexed": false, - "name": "loanAddress", - "type": "address" + "name": "_loanAmountInEthers", + "type": "uint256" }, { - "indexed": false, - "name": "borrowerAddress", + "name": "_repaymentDurationInDays", + "type": "uint256" + }, + { + "name": "_ipfsHash", + "type": "string" + } + ], + "name": "create", + "outputs": [ + { + "name": "_loanAddress", "type": "address" } ], - "name": "LoanCreated", - "type": "event" + "payable": false, + "stateMutability": "nonpayable", + "type": "function" } ], - "bytecode": "0x6060604052341561000f57600080fd5b611fb88061001e6000396000f300606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680637924d93f1461007d5780637c58a97a146100e05780638a175ff614610159578063b521ead71461024b578063ce63094d146102c4578063e1ec3c68146102ed575b600080fd5b341561008857600080fd5b61009e6004808035906020019091905050610350565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100eb57600080fd5b610117600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061038f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561016457600080fd5b610209600480803590602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506103f8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561025657600080fd5b610282600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610737565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102cf57600080fd5b6102d761076a565b6040518082815260200191505060405180910390f35b34156102f857600080fd5b61030e6004808035906020019091905050610776565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60018181548110151561035f57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600080600080339250601e91508288838989896104136107b5565b808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561049857808201518184015260208101905061047d565b50505050905090810190601f1680156104c55780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156104fe5780820151818401526020810190506104e3565b50505050905090810190601f16801561052b5780820380516001836020036101000a031916815260200191505b5098505050505050505050604051809103906000f080151561054c57600080fd5b90506000805480600101828161056291906107c5565b9160005260206000209001600083909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600180548060010182816105c591906107c5565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f89ccfc5e75642b3e017aea5b211bdfbb93e3a3d488f86df28801c48f3771a1d58184604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1809350505050949350505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008080549050905090565b60008181548110151561078557fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040516117768061081783390190565b8154818355818115116107ec578183600052602060002091820191016107eb91906107f1565b5b505050565b61081391905b8082111561080f5760008160009055506001016107f7565b5090565b905600606060405234156200001057600080fd5b604051620017763803806200177683398101604052808051906020019091908051906020019091908051906020019091908051906020019091908051820191906020018051820191905050856000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550670de0b6b3a76400008502600181905550826002819055506201518084024201600381905550620151808302600354016004819055508160059080519060200190620000e99291906200016a565b508060069080519060200190620001029291906200016a565b50600c8054806001018281620001199190620001f1565b91600052602060002090600202016000604080519081016040528060045481526020016001548152509091909150600082015181600001556020820151816001015550505050505050505062000280565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620001ad57805160ff1916838001178555620001de565b82800160010185558215620001de579182015b82811115620001dd578251825591602001919060010190620001c0565b5b509050620001ed919062000226565b5090565b81548183558181151162000221576002028160020283600052602060002091820191016200022091906200024e565b5b505050565b6200024b91905b80821115620002475760008160009055506001016200022d565b5090565b90565b6200027d91905b80821115620002795760008082016000905560018201600090555060020162000255565b5090565b90565b6114e680620002906000396000f30060606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101435780630c3f6acf146101d157806319cc3aaa14610208578063281380e81461023157806328b4e8561461025a5780632d6963ce1461026f578063402d8883146102d25780634c97d71a146102dc5780635cdb98291461036a5780635edf0c9e1461037f5780635f97a7d8146103a85780636fbfd409146104035780637b3e5e7b146104415780637ba61ea51461046a57806387d81789146104bf5780638e362394146104fd57806395e723141461052657806397dffc61146105735780639d585f7f1461057d578063bb927c46146105a6578063cbc9130e146105cf578063d0bf4de6146105f8578063ee86afd814610625578063f14f6e171461064e575b600080fd5b341561014e57600080fd5b610156610663565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b6101e4610701565b604051808260048111156101f457fe5b60ff16815260200191505060405180910390f35b341561021357600080fd5b61021b610714565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b61024461071a565b6040518082815260200191505060405180910390f35b341561026557600080fd5b61026d610728565b005b341561027a57600080fd5b6102906004808035906020019091905050610795565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da6107d4565b005b34156102e757600080fd5b6102ef610b22565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032f578082015181840152602081019050610314565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561037557600080fd5b61037d610bc0565b005b341561038a57600080fd5b610392610d51565b6040518082815260200191505060405180910390f35b34156103b357600080fd5b6103df600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d5f565b60405180848152602001838152602001828152602001935050505060405180910390f35b341561040e57600080fd5b6104246004808035906020019091905050610d89565b604051808381526020018281526020019250505060405180910390f35b341561044c57600080fd5b610454610dbc565b6040518082815260200191505060405180910390f35b341561047557600080fd5b61047d610dc2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ca57600080fd5b6104e06004808035906020019091905050610de7565b604051808381526020018281526020019250505060405180910390f35b341561050857600080fd5b610510610e1a565b6040518082815260200191505060405180910390f35b341561053157600080fd5b61055d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e20565b6040518082815260200191505060405180910390f35b61057b610f1f565b005b341561058857600080fd5b610590611198565b6040518082815260200191505060405180910390f35b34156105b157600080fd5b6105b961119e565b6040518082815260200191505060405180910390f35b34156105da57600080fd5b6105e26111ab565b6040518082815260200191505060405180910390f35b341561060357600080fd5b61060b6111b1565b604051808215151515815260200191505060405180910390f35b341561063057600080fd5b6106386111f0565b6040518082815260200191505060405180910390f35b341561065957600080fd5b6106616111f6565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106f95780601f106106ce576101008083540402835291602001916106f9565b820191906000526020600020905b8154815290600101906020018083116106dc57829003601f168201915b505050505081565b600b60009054906101000a900460ff1681565b60045481565b600060075460015403905090565b600354421015801561073d5750600154600754105b15610793576004600b60006101000a81548160ff0219169083600481111561076157fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b6009818154811015156107a457fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561083757600080fd5b6002600481111561084457fe5b600b60009054906101000a900460ff16600481111561085f57fe5b14151561086b57600080fd5b610873610d51565b341115151561088157600080fd5b346008600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600d80548060010182816109319190611408565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b600980549050831015610b135760098381548110151561099a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150610a3a85600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060606040519081016040529081600082015481526020016001820154815260200160028201548152505061130b565b90506000811115610b06577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b828060010193505061097e565b610b1b611349565b5050505050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb85780601f10610b8d57610100808354040283529160200191610bb8565b820191906000526020600020905b815481529060010190602001808311610b9b57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1b57600080fd5b60016004811115610c2857fe5b600b60009054906101000a900460ff166004811115610c4357fe5b141515610c4f57600080fd5b60006007541115610d4f576002600b60006101000a81548160ff02191690836004811115610c7957fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6007549081150290604051600060405180830381858888f193505050501515610cc057600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600754604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060085460015403905090565b600a6020528060005260406000206000915090508060000154908060010154908060020154905083565b600c81815481101515610d9857fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d81815481101515610df657fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610e7557fe5b600b60009054906101000a900460ff166004811115610e9057fe5b1415610ea85780600201548160000154039150610f15565b60026004811115610eb557fe5b600b60009054906101000a900460ff166004811115610ed057fe5b1480610f01575060036004811115610ee457fe5b600b60009054906101000a900460ff166004811115610eff57fe5b145b15610f1457806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610f7b57600080fd5b610f8361071a565b3411151515610f9157600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156110c25760098054806001018281610ff0919061143a565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050611113565b34600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346007600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16111966113a8565b565b60015481565b6000600980549050905090565b60035481565b600060045442101580156111eb5750600360048111156111cd57fe5b600b60009054906101000a900460ff1660048111156111e857fe5b14155b905090565b60085481565b600061120133610e20565b905060008111156113085780600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561129c57600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b6000600154600854141515611335576001548260000151840281151561132d57fe5b049050611343565b816020015182600001510390505b92915050565b60015460085414156113a6576003600b60006101000a81548160ff0219169083600481111561137457fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b600154600754101515611406576001600b60006101000a81548160ff021916908360048111156113d457fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b815481835581811511611435576002028160020283600052602060002091820191016114349190611466565b5b505050565b815481835581811511611461578183600052602060002091820191016114609190611495565b5b505050565b61149291905b8082111561148e5760008082016000905560018201600090555060020161146c565b5090565b90565b6114b791905b808211156114b357600081600090555060010161149b565b5090565b905600a165627a7a7230582050dd2c8af2fd968e86ac93ddd745c85ebde3789d75900b041da51405192706230029a165627a7a723058201d0f07a7754abfcf9868a8b31cfa09b8cf4f12de0a486dc089e976a0bcc6f16e0029", - "deployedBytecode": "0x606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680637924d93f1461007d5780637c58a97a146100e05780638a175ff614610159578063b521ead71461024b578063ce63094d146102c4578063e1ec3c68146102ed575b600080fd5b341561008857600080fd5b61009e6004808035906020019091905050610350565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100eb57600080fd5b610117600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061038f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561016457600080fd5b610209600480803590602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506103f8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561025657600080fd5b610282600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610737565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102cf57600080fd5b6102d761076a565b6040518082815260200191505060405180910390f35b34156102f857600080fd5b61030e6004808035906020019091905050610776565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60018181548110151561035f57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600080600080339250601e91508288838989896104136107b5565b808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561049857808201518184015260208101905061047d565b50505050905090810190601f1680156104c55780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156104fe5780820151818401526020810190506104e3565b50505050905090810190601f16801561052b5780820380516001836020036101000a031916815260200191505b5098505050505050505050604051809103906000f080151561054c57600080fd5b90506000805480600101828161056291906107c5565b9160005260206000209001600083909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600180548060010182816105c591906107c5565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f89ccfc5e75642b3e017aea5b211bdfbb93e3a3d488f86df28801c48f3771a1d58184604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1809350505050949350505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008080549050905090565b60008181548110151561078557fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040516117768061081783390190565b8154818355818115116107ec578183600052602060002091820191016107eb91906107f1565b5b505050565b61081391905b8082111561080f5760008160009055506001016107f7565b5090565b905600606060405234156200001057600080fd5b604051620017763803806200177683398101604052808051906020019091908051906020019091908051906020019091908051906020019091908051820191906020018051820191905050856000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550670de0b6b3a76400008502600181905550826002819055506201518084024201600381905550620151808302600354016004819055508160059080519060200190620000e99291906200016a565b508060069080519060200190620001029291906200016a565b50600c8054806001018281620001199190620001f1565b91600052602060002090600202016000604080519081016040528060045481526020016001548152509091909150600082015181600001556020820151816001015550505050505050505062000280565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620001ad57805160ff1916838001178555620001de565b82800160010185558215620001de579182015b82811115620001dd578251825591602001919060010190620001c0565b5b509050620001ed919062000226565b5090565b81548183558181151162000221576002028160020283600052602060002091820191016200022091906200024e565b5b505050565b6200024b91905b80821115620002475760008160009055506001016200022d565b5090565b90565b6200027d91905b80821115620002795760008082016000905560018201600090555060020162000255565b5090565b90565b6114e680620002906000396000f30060606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101435780630c3f6acf146101d157806319cc3aaa14610208578063281380e81461023157806328b4e8561461025a5780632d6963ce1461026f578063402d8883146102d25780634c97d71a146102dc5780635cdb98291461036a5780635edf0c9e1461037f5780635f97a7d8146103a85780636fbfd409146104035780637b3e5e7b146104415780637ba61ea51461046a57806387d81789146104bf5780638e362394146104fd57806395e723141461052657806397dffc61146105735780639d585f7f1461057d578063bb927c46146105a6578063cbc9130e146105cf578063d0bf4de6146105f8578063ee86afd814610625578063f14f6e171461064e575b600080fd5b341561014e57600080fd5b610156610663565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b6101e4610701565b604051808260048111156101f457fe5b60ff16815260200191505060405180910390f35b341561021357600080fd5b61021b610714565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b61024461071a565b6040518082815260200191505060405180910390f35b341561026557600080fd5b61026d610728565b005b341561027a57600080fd5b6102906004808035906020019091905050610795565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da6107d4565b005b34156102e757600080fd5b6102ef610b22565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032f578082015181840152602081019050610314565b50505050905090810190601f16801561035c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561037557600080fd5b61037d610bc0565b005b341561038a57600080fd5b610392610d51565b6040518082815260200191505060405180910390f35b34156103b357600080fd5b6103df600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d5f565b60405180848152602001838152602001828152602001935050505060405180910390f35b341561040e57600080fd5b6104246004808035906020019091905050610d89565b604051808381526020018281526020019250505060405180910390f35b341561044c57600080fd5b610454610dbc565b6040518082815260200191505060405180910390f35b341561047557600080fd5b61047d610dc2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ca57600080fd5b6104e06004808035906020019091905050610de7565b604051808381526020018281526020019250505060405180910390f35b341561050857600080fd5b610510610e1a565b6040518082815260200191505060405180910390f35b341561053157600080fd5b61055d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e20565b6040518082815260200191505060405180910390f35b61057b610f1f565b005b341561058857600080fd5b610590611198565b6040518082815260200191505060405180910390f35b34156105b157600080fd5b6105b961119e565b6040518082815260200191505060405180910390f35b34156105da57600080fd5b6105e26111ab565b6040518082815260200191505060405180910390f35b341561060357600080fd5b61060b6111b1565b604051808215151515815260200191505060405180910390f35b341561063057600080fd5b6106386111f0565b6040518082815260200191505060405180910390f35b341561065957600080fd5b6106616111f6565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106f95780601f106106ce576101008083540402835291602001916106f9565b820191906000526020600020905b8154815290600101906020018083116106dc57829003601f168201915b505050505081565b600b60009054906101000a900460ff1681565b60045481565b600060075460015403905090565b600354421015801561073d5750600154600754105b15610793576004600b60006101000a81548160ff0219169083600481111561076157fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b6009818154811015156107a457fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561083757600080fd5b6002600481111561084457fe5b600b60009054906101000a900460ff16600481111561085f57fe5b14151561086b57600080fd5b610873610d51565b341115151561088157600080fd5b346008600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600d80548060010182816109319190611408565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b600980549050831015610b135760098381548110151561099a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150610a3a85600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060606040519081016040529081600082015481526020016001820154815260200160028201548152505061130b565b90506000811115610b06577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b828060010193505061097e565b610b1b611349565b5050505050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb85780601f10610b8d57610100808354040283529160200191610bb8565b820191906000526020600020905b815481529060010190602001808311610b9b57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1b57600080fd5b60016004811115610c2857fe5b600b60009054906101000a900460ff166004811115610c4357fe5b141515610c4f57600080fd5b60006007541115610d4f576002600b60006101000a81548160ff02191690836004811115610c7957fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6007549081150290604051600060405180830381858888f193505050501515610cc057600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600754604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060085460015403905090565b600a6020528060005260406000206000915090508060000154908060010154908060020154905083565b600c81815481101515610d9857fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d81815481101515610df657fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610e7557fe5b600b60009054906101000a900460ff166004811115610e9057fe5b1415610ea85780600201548160000154039150610f15565b60026004811115610eb557fe5b600b60009054906101000a900460ff166004811115610ed057fe5b1480610f01575060036004811115610ee457fe5b600b60009054906101000a900460ff166004811115610eff57fe5b145b15610f1457806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610f7b57600080fd5b610f8361071a565b3411151515610f9157600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156110c25760098054806001018281610ff0919061143a565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050611113565b34600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346007600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16111966113a8565b565b60015481565b6000600980549050905090565b60035481565b600060045442101580156111eb5750600360048111156111cd57fe5b600b60009054906101000a900460ff1660048111156111e857fe5b14155b905090565b60085481565b600061120133610e20565b905060008111156113085780600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561129c57600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b6000600154600854141515611335576001548260000151840281151561132d57fe5b049050611343565b816020015182600001510390505b92915050565b60015460085414156113a6576003600b60006101000a81548160ff0219169083600481111561137457fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b600154600754101515611406576001600b60006101000a81548160ff021916908360048111156113d457fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b815481835581811511611435576002028160020283600052602060002091820191016114349190611466565b5b505050565b815481835581811511611461578183600052602060002091820191016114609190611495565b5b505050565b61149291905b8082111561148e5760008082016000905560018201600090555060020161146c565b5090565b90565b6114b791905b808211156114b357600081600090555060010161149b565b5090565b905600a165627a7a7230582050dd2c8af2fd968e86ac93ddd745c85ebde3789d75900b041da51405192706230029a165627a7a723058201d0f07a7754abfcf9868a8b31cfa09b8cf4f12de0a486dc089e976a0bcc6f16e0029", - "sourceMap": "55:1447:1:-;;;;;;;;;;;;;;;;;", - "deployedSourceMap": "55:1447:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;470:158;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;734:766;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;163:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;296:97;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;470:158::-;545:20;585:17;:35;603:16;585:35;;;;;;;;;;;;;;;;;;;;;;;;;577:44;;470:158;;;:::o;734:766::-;888:20;920:23;966:30;1035:23;946:10;920:36;;999:2;966:35;;1091:15;1121:19;1155:25;1195:24;1233:5;1252:4;1061:205;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1035:231:1;;1276:5;:27;;;;;;;;;;;:::i;:::-;;;;;;;;;;1287:15;1276:27;;;;;;;;;;;;;;;;;;;;;;;1313:9;:31;;;;;;;;;;;:::i;:::-;;;;;;;;;;1328:15;1313:31;;;;;;;;;;;;;;;;;;;;;;;1391:15;1354:17;:34;1372:15;1354:34;;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;;;;1416:45;1428:15;1445;1416:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1478:15;1471:22;;734:766;;;;;;;;;:::o;163:52::-;;;;;;;;;;;;;;;;;;;;;;:::o;296:97::-;337:18;374:5;:12;;;;367:19;;296:97;:::o;83:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;55:1447::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.4.15;\nimport \"./LoanContract.sol\";\n\ncontract LoanFactory {\n\n address[] public loans;\n address[] public borrowers; //may not be needed\n mapping(address => address) public borrowerLoanIndex;\n\n event LoanCreated(address loanAddress, address borrowerAddress);\n \n function loanCount() public view returns(uint256 _loanCount) {\n return loans.length;\n }\n \n // Gets the loan contract address for the given borrower address\n function getLoanForBorrower (address _borrowerAddress) public view returns(address _loanAddress) {\n return (borrowerLoanIndex[_borrowerAddress]);\n }\n\n // Creates a new loan contract with the data specified and adds it to the centralized loan repo\n function create (\n uint _loanAmountInEthers,\n uint _repaymentDurationInDays,\n string _name,\n string _use\n ) public returns(address _loanAddress) {\n address borrowerAddress = msg.sender;\n uint fundRaisingDurationInDays = 30; //default to 30 for now\n address newLoanContract = new LoanContract(\n borrowerAddress, \n _loanAmountInEthers, \n fundRaisingDurationInDays, \n _repaymentDurationInDays,\n _name,\n _use\n );\n loans.push(newLoanContract);\n borrowers.push(borrowerAddress);\n borrowerLoanIndex[borrowerAddress] = newLoanContract;\n LoanCreated(newLoanContract, borrowerAddress);\n return newLoanContract;\n }\n}", - "sourcePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/LoanFactory.sol", + "bytecode": "0x6060604052341561000f57600080fd5b611dad8061001e6000396000f300606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b068c781461007d5780637924d93f1461012c5780637c58a97a1461018f578063b521ead714610208578063ce63094d14610281578063e1ec3c68146102aa575b600080fd5b341561008857600080fd5b6100ea600480803590602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061030d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561013757600080fd5b61014d60048080359060200190919050506105de565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561019a57600080fd5b6101c6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061061d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021357600080fd5b61023f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610686565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561028c57600080fd5b6102946106b9565b6040518082815260200191505060405180910390f35b34156102b557600080fd5b6102cb60048080359060200190919050506106c5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600080339250601e91508287838888610327610704565b808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509650505050505050604051809103906000f08015156103f457600080fd5b90506000805480600101828161040a9190610714565b9160005260206000209001600083909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001805480600101828161046d9190610714565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f89ccfc5e75642b3e017aea5b211bdfbb93e3a3d488f86df28801c48f3771a1d58184604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a18093505050509392505050565b6001818154811015156105ed57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008080549050905090565b6000818154811015156106d457fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60405161161c8061076683390190565b81548183558181151161073b5781836000526020600020918201910161073a9190610740565b5b505050565b61076291905b8082111561075e576000816000905550600101610746565b5090565b905600606060405234156200001057600080fd5b6040516200161c3803806200161c83398101604052808051906020019091908051906020019091908051906020019091908051906020019091908051820191905050846000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550670de0b6b3a76400008402600181905550816002819055506201518083024201600381905550620151808202600354016004819055508060059080519060200190620000e092919062000147565b50600b8054806001018281620000f79190620001ce565b91600052602060002090600202016000604080519081016040528060045481526020016001548152509091909150600082015181600001556020820151816001015550505050505050506200025d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018a57805160ff1916838001178555620001bb565b82800160010185558215620001bb579182015b82811115620001ba5782518255916020019190600101906200019d565b5b509050620001ca919062000203565b5090565b815481835581811511620001fe57600202816002028360005260206000209182019101620001fd91906200022b565b5b505050565b6200022891905b80821115620002245760008160009055506001016200020a565b5090565b90565b6200025a91905b80821115620002565760008082016000905560018201600090555060020162000232565b5090565b90565b6113af806200026d6000396000f300606060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c3f6acf1461013857806319cc3aaa1461016f578063281380e81461019857806328b4e856146101c15780632d6963ce146101d6578063402d8883146102395780635cdb9829146102435780635edf0c9e146102585780635f97a7d8146102815780636fbfd409146102dc5780637b3e5e7b1461031a5780637ba61ea51461034357806387d81789146103985780638e362394146103d657806395e72314146103ff57806397dffc611461044c5780639d585f7f14610456578063bb927c461461047f578063c623674f146104a8578063cbc9130e14610536578063d0bf4de61461055f578063ee86afd81461058c578063f14f6e17146105b5575b600080fd5b341561014357600080fd5b61014b6105ca565b6040518082600481111561015b57fe5b60ff16815260200191505060405180910390f35b341561017a57600080fd5b6101826105dd565b6040518082815260200191505060405180910390f35b34156101a357600080fd5b6101ab6105e3565b6040518082815260200191505060405180910390f35b34156101cc57600080fd5b6101d46105f1565b005b34156101e157600080fd5b6101f7600480803590602001909190505061065e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024161069d565b005b341561024e57600080fd5b6102566109eb565b005b341561026357600080fd5b61026b610b7c565b6040518082815260200191505060405180910390f35b341561028c57600080fd5b6102b8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b8a565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156102e757600080fd5b6102fd6004808035906020019091905050610bb4565b604051808381526020018281526020019250505060405180910390f35b341561032557600080fd5b61032d610be7565b6040518082815260200191505060405180910390f35b341561034e57600080fd5b610356610bed565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103a357600080fd5b6103b96004808035906020019091905050610c12565b604051808381526020018281526020019250505060405180910390f35b34156103e157600080fd5b6103e9610c45565b6040518082815260200191505060405180910390f35b341561040a57600080fd5b610436600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c4b565b6040518082815260200191505060405180910390f35b610454610d4a565b005b341561046157600080fd5b610469610fc3565b6040518082815260200191505060405180910390f35b341561048a57600080fd5b610492610fc9565b6040518082815260200191505060405180910390f35b34156104b357600080fd5b6104bb610fd6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104fb5780820151818401526020810190506104e0565b50505050905090810190601f1680156105285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054157600080fd5b610549611074565b6040518082815260200191505060405180910390f35b341561056a57600080fd5b61057261107a565b604051808215151515815260200191505060405180910390f35b341561059757600080fd5b61059f6110b9565b6040518082815260200191505060405180910390f35b34156105c057600080fd5b6105c86110bf565b005b600a60009054906101000a900460ff1681565b60045481565b600060065460015403905090565b60035442101580156106065750600154600654105b1561065c576004600a60006101000a81548160ff0219169083600481111561062a57fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b60088181548110151561066d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070057600080fd5b6002600481111561070d57fe5b600a60009054906101000a900460ff16600481111561072857fe5b14151561073457600080fd5b61073c610b7c565b341115151561074a57600080fd5b346007600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600c80548060010182816107fa91906112d1565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b6008805490508310156109dc5760088381548110151561086357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915061090385600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206060604051908101604052908160008201548152602001600182015481526020016002820154815250506111d4565b905060008111156109cf577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b8280600101935050610847565b6109e4611212565b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4657600080fd5b60016004811115610a5357fe5b600a60009054906101000a900460ff166004811115610a6e57fe5b141515610a7a57600080fd5b60006006541115610b7a576002600a60006101000a81548160ff02191690836004811115610aa457fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6006549081150290604051600060405180830381858888f193505050501515610aeb57600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060075460015403905090565b60096020528060005260406000206000915090508060000154908060010154908060020154905083565b600b81815481101515610bc357fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c81815481101515610c2157fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610ca057fe5b600a60009054906101000a900460ff166004811115610cbb57fe5b1415610cd35780600201548160000154039150610d40565b60026004811115610ce057fe5b600a60009054906101000a900460ff166004811115610cfb57fe5b1480610d2c575060036004811115610d0f57fe5b600a60009054906101000a900460ff166004811115610d2a57fe5b145b15610d3f57806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610da657600080fd5b610dae6105e3565b3411151515610dbc57600080fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610eed5760088054806001018281610e1b9190611303565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050610f3e565b34600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346006600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1610fc1611271565b565b60015481565b6000600880549050905090565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561106c5780601f106110415761010080835404028352916020019161106c565b820191906000526020600020905b81548152906001019060200180831161104f57829003601f168201915b505050505081565b60035481565b600060045442101580156110b457506003600481111561109657fe5b600a60009054906101000a900460ff1660048111156110b157fe5b14155b905090565b60075481565b60006110ca33610c4b565b905060008111156111d15780600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561116557600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60006001546007541415156111fe57600154826000015184028115156111f657fe5b04905061120c565b816020015182600001510390505b92915050565b600154600754141561126f576003600a60006101000a81548160ff0219169083600481111561123d57fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b6001546006541015156112cf576001600a60006101000a81548160ff0219169083600481111561129d57fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b8154818355818115116112fe576002028160020283600052602060002091820191016112fd919061132f565b5b505050565b81548183558181151161132a57818360005260206000209182019101611329919061135e565b5b505050565b61135b91905b8082111561135757600080820160009055600182016000905550600201611335565b5090565b90565b61138091905b8082111561137c576000816000905550600101611364565b5090565b905600a165627a7a72305820dd36fb267f9b7e36e90fc74ddb485c0c7f4fb92d6c293f494e942c215b1da3d50029a165627a7a723058207eb68c94764f32046b9839083e5026cb9e8690a977faa84a80b0c5df099069e60029", + "deployedBytecode": "0x606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b068c781461007d5780637924d93f1461012c5780637c58a97a1461018f578063b521ead714610208578063ce63094d14610281578063e1ec3c68146102aa575b600080fd5b341561008857600080fd5b6100ea600480803590602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061030d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561013757600080fd5b61014d60048080359060200190919050506105de565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561019a57600080fd5b6101c6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061061d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021357600080fd5b61023f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610686565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561028c57600080fd5b6102946106b9565b6040518082815260200191505060405180910390f35b34156102b557600080fd5b6102cb60048080359060200190919050506106c5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600080339250601e91508287838888610327610704565b808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509650505050505050604051809103906000f08015156103f457600080fd5b90506000805480600101828161040a9190610714565b9160005260206000209001600083909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001805480600101828161046d9190610714565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f89ccfc5e75642b3e017aea5b211bdfbb93e3a3d488f86df28801c48f3771a1d58184604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a18093505050509392505050565b6001818154811015156105ed57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008080549050905090565b6000818154811015156106d457fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60405161161c8061076683390190565b81548183558181151161073b5781836000526020600020918201910161073a9190610740565b5b505050565b61076291905b8082111561075e576000816000905550600101610746565b5090565b905600606060405234156200001057600080fd5b6040516200161c3803806200161c83398101604052808051906020019091908051906020019091908051906020019091908051906020019091908051820191905050846000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550670de0b6b3a76400008402600181905550816002819055506201518083024201600381905550620151808202600354016004819055508060059080519060200190620000e092919062000147565b50600b8054806001018281620000f79190620001ce565b91600052602060002090600202016000604080519081016040528060045481526020016001548152509091909150600082015181600001556020820151816001015550505050505050506200025d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200018a57805160ff1916838001178555620001bb565b82800160010185558215620001bb579182015b82811115620001ba5782518255916020019190600101906200019d565b5b509050620001ca919062000203565b5090565b815481835581811511620001fe57600202816002028360005260206000209182019101620001fd91906200022b565b5b505050565b6200022891905b80821115620002245760008160009055506001016200020a565b5090565b90565b6200025a91905b80821115620002565760008082016000905560018201600090555060020162000232565b5090565b90565b6113af806200026d6000396000f300606060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c3f6acf1461013857806319cc3aaa1461016f578063281380e81461019857806328b4e856146101c15780632d6963ce146101d6578063402d8883146102395780635cdb9829146102435780635edf0c9e146102585780635f97a7d8146102815780636fbfd409146102dc5780637b3e5e7b1461031a5780637ba61ea51461034357806387d81789146103985780638e362394146103d657806395e72314146103ff57806397dffc611461044c5780639d585f7f14610456578063bb927c461461047f578063c623674f146104a8578063cbc9130e14610536578063d0bf4de61461055f578063ee86afd81461058c578063f14f6e17146105b5575b600080fd5b341561014357600080fd5b61014b6105ca565b6040518082600481111561015b57fe5b60ff16815260200191505060405180910390f35b341561017a57600080fd5b6101826105dd565b6040518082815260200191505060405180910390f35b34156101a357600080fd5b6101ab6105e3565b6040518082815260200191505060405180910390f35b34156101cc57600080fd5b6101d46105f1565b005b34156101e157600080fd5b6101f7600480803590602001909190505061065e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024161069d565b005b341561024e57600080fd5b6102566109eb565b005b341561026357600080fd5b61026b610b7c565b6040518082815260200191505060405180910390f35b341561028c57600080fd5b6102b8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b8a565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156102e757600080fd5b6102fd6004808035906020019091905050610bb4565b604051808381526020018281526020019250505060405180910390f35b341561032557600080fd5b61032d610be7565b6040518082815260200191505060405180910390f35b341561034e57600080fd5b610356610bed565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103a357600080fd5b6103b96004808035906020019091905050610c12565b604051808381526020018281526020019250505060405180910390f35b34156103e157600080fd5b6103e9610c45565b6040518082815260200191505060405180910390f35b341561040a57600080fd5b610436600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c4b565b6040518082815260200191505060405180910390f35b610454610d4a565b005b341561046157600080fd5b610469610fc3565b6040518082815260200191505060405180910390f35b341561048a57600080fd5b610492610fc9565b6040518082815260200191505060405180910390f35b34156104b357600080fd5b6104bb610fd6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104fb5780820151818401526020810190506104e0565b50505050905090810190601f1680156105285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561054157600080fd5b610549611074565b6040518082815260200191505060405180910390f35b341561056a57600080fd5b61057261107a565b604051808215151515815260200191505060405180910390f35b341561059757600080fd5b61059f6110b9565b6040518082815260200191505060405180910390f35b34156105c057600080fd5b6105c86110bf565b005b600a60009054906101000a900460ff1681565b60045481565b600060065460015403905090565b60035442101580156106065750600154600654105b1561065c576004600a60006101000a81548160ff0219169083600481111561062a57fe5b02179055507f5dc919cafc7dd3f912b1ba505941b4eb1c8f4fd4bea581b22982d7d0feef549c60405160405180910390a15b565b60088181548110151561066d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070057600080fd5b6002600481111561070d57fe5b600a60009054906101000a900460ff16600481111561072857fe5b14151561073457600080fd5b61073c610b7c565b341115151561074a57600080fd5b346007600082825401925050819055507f9540628bcc956d1875c390fc9c9937464c5d6a3bcef396c4c48c262c25f89e796000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600c80548060010182816107fa91906112d1565b916000526020600020906002020160006040805190810160405280428152602001348152509091909150600082015181600001556020820151816001015550505034945060009350600092505b6008805490508310156109dc5760088381548110151561086357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915061090385600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206060604051908101604052908160008201548152602001600182015481526020016002820154815250506111d4565b905060008111156109cf577f5f1d3e8a00979c6a9305039148c35f8fa408d3292c93f865cad76e32ae6ce0bb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555080840193505b8280600101935050610847565b6109e4611212565b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4657600080fd5b60016004811115610a5357fe5b600a60009054906101000a900460ff166004811115610a6e57fe5b141515610a7a57600080fd5b60006006541115610b7a576002600a60006101000a81548160ff02191690836004811115610aa457fe5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc6006549081150290604051600060405180830381858888f193505050501515610aeb57600080fd5b7f578e21d0b157d96ca63ed68a4b14ae51e6eee5a6fc77905ede446749fa5a1ab56000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b565b600060075460015403905090565b60096020528060005260406000206000915090508060000154908060010154908060020154905083565b600b81815481101515610bc357fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c81815481101515610c2157fe5b90600052602060002090600202016000915090508060000154908060010154905082565b60025481565b6000806000809150600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600480811115610ca057fe5b600a60009054906101000a900460ff166004811115610cbb57fe5b1415610cd35780600201548160000154039150610d40565b60026004811115610ce057fe5b600a60009054906101000a900460ff166004811115610cfb57fe5b1480610d2c575060036004811115610d0f57fe5b600a60009054906101000a900460ff166004811115610d2a57fe5b145b15610d3f57806002015481600101540391505b5b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610da657600080fd5b610dae6105e3565b3411151515610dbc57600080fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610eed5760088054806001018281610e1b9190611303565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050606060405190810160405280348152602001600081526020016000815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050610f3e565b34600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055505b346006600082825401925050819055507f47047d86227821f4ba4162b47a4e21f3751a6898df27767881baae61a5df54b93334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1610fc1611271565b565b60015481565b6000600880549050905090565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561106c5780601f106110415761010080835404028352916020019161106c565b820191906000526020600020905b81548152906001019060200180831161104f57829003601f168201915b505050505081565b60035481565b600060045442101580156110b457506003600481111561109657fe5b600a60009054906101000a900460ff1660048111156110b157fe5b14155b905090565b60075481565b60006110ca33610c4b565b905060008111156111d15780600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561116557600080fd5b7f5eb46cc574ef1abdbd52310ce761acbb5cbd48af34b53e4f32083f205c8a977e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60006001546007541415156111fe57600154826000015184028115156111f657fe5b04905061120c565b816020015182600001510390505b92915050565b600154600754141561126f576003600a60006101000a81548160ff0219169083600481111561123d57fe5b02179055507f1062e18f9d21decf38f145fc9b437cd2c70e09252a729f9830b75ffdaaf3789460405160405180910390a15b565b6001546006541015156112cf576001600a60006101000a81548160ff0219169083600481111561129d57fe5b02179055507f3351ae6756a83898700959ab1a672004e55a70dd6e74a45a80835316af9c76a460405160405180910390a15b565b8154818355818115116112fe576002028160020283600052602060002091820191016112fd919061132f565b5b505050565b81548183558181151161132a57818360005260206000209182019101611329919061135e565b5b505050565b61135b91905b8082111561135757600080820160009055600182016000905550600201611335565b5090565b90565b61138091905b8082111561137c576000816000905550600101611364565b5090565b905600a165627a7a72305820dd36fb267f9b7e36e90fc74ddb485c0c7f4fb92d6c293f494e942c215b1da3d50029a165627a7a723058207eb68c94764f32046b9839083e5026cb9e8690a977faa84a80b0c5df099069e60029", + "sourceMap": "55:1416:1:-;;;;;;;;;;;;;;;;;", + "deployedSourceMap": "55:1416:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;734:735;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;470:158;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;163:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;296:97;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;734:735;871:20;903:23;949:30;1018:23;929:10;903:36;;982:2;949:35;;1074:15;1104:19;1138:25;1178:24;1216:9;1044:191;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1018:217:1;;1245:5;:27;;;;;;;;;;;:::i;:::-;;;;;;;;;;1256:15;1245:27;;;;;;;;;;;;;;;;;;;;;;;1282:9;:31;;;;;;;;;;;:::i;:::-;;;;;;;;;;1297:15;1282:31;;;;;;;;;;;;;;;;;;;;;;;1360:15;1323:17;:34;1341:15;1323:34;;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;;;;1385:45;1397:15;1414;1385:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1447:15;1440:22;;734:735;;;;;;;;:::o;111:26::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;470:158::-;545:20;585:17;:35;603:16;585:35;;;;;;;;;;;;;;;;;;;;;;;;;577:44;;470:158;;;:::o;163:52::-;;;;;;;;;;;;;;;;;;;;;;:::o;296:97::-;337:18;374:5;:12;;;;367:19;;296:97;:::o;83:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;55:1416::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "source": "pragma solidity ^0.4.15;\nimport \"./LoanContract.sol\";\n\ncontract LoanFactory {\n\n address[] public loans;\n address[] public borrowers; //may not be needed\n mapping(address => address) public borrowerLoanIndex;\n\n event LoanCreated(address loanAddress, address borrowerAddress);\n \n function loanCount() public view returns(uint256 _loanCount) {\n return loans.length;\n }\n \n // Gets the loan contract address for the given borrower address\n function getLoanForBorrower (address _borrowerAddress) public view returns(address _loanAddress) {\n return (borrowerLoanIndex[_borrowerAddress]);\n }\n\n // Creates a new loan contract with the data specified and adds it to the centralized loan repo\n function create (\n uint _loanAmountInEthers,\n uint _repaymentDurationInDays,\n string _ipfsHash\n ) public returns(address _loanAddress) {\n address borrowerAddress = msg.sender;\n uint fundRaisingDurationInDays = 30; //default to 30 for now\n address newLoanContract = new LoanContract(\n borrowerAddress, \n _loanAmountInEthers, \n fundRaisingDurationInDays, \n _repaymentDurationInDays,\n _ipfsHash\n );\n loans.push(newLoanContract);\n borrowers.push(borrowerAddress);\n borrowerLoanIndex[borrowerAddress] = newLoanContract;\n LoanCreated(newLoanContract, borrowerAddress);\n return newLoanContract;\n }\n}\n", + "sourcePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanFactory.sol", "ast": { - "attributes": { - "absolutePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/LoanFactory.sol", - "exportedSymbols": { - "LoanFactory": [ - 702 - ] - } + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanFactory.sol", + "exportedSymbols": { + "LoanFactory": [ + 691 + ] }, - "children": [ + "id": 692, + "nodeType": "SourceUnit", + "nodes": [ { - "attributes": { - "literals": [ - "solidity", - "^", - "0.4", - ".15" - ] - }, - "id": 602, - "name": "PragmaDirective", + "id": 594, + "literals": [ + "solidity", + "^", + "0.4", + ".15" + ], + "nodeType": "PragmaDirective", "src": "0:24:1" }, { - "attributes": { - "SourceUnit": 601, - "absolutePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/LoanContract.sol", - "file": "./LoanContract.sol", - "scope": 703, - "symbolAliases": [ - null - ], - "unitAlias": "" - }, - "id": 603, - "name": "ImportDirective", - "src": "25:28:1" + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanContract.sol", + "file": "./LoanContract.sol", + "id": 595, + "nodeType": "ImportDirective", + "scope": 692, + "sourceUnit": 593, + "src": "25:28:1", + "symbolAliases": [], + "unitAlias": "" }, { - "attributes": { - "baseContracts": [ - null - ], - "contractDependencies": [ - 600 - ], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "linearizedBaseContracts": [ - 702 - ], - "name": "LoanFactory", - "scope": 703 - }, - "children": [ + "baseContracts": [], + "contractDependencies": [ + 592 + ], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 691, + "linearizedBaseContracts": [ + 691 + ], + "name": "LoanFactory", + "nodeType": "ContractDefinition", + "nodes": [ { - "attributes": { - "constant": false, - "name": "loans", - "scope": 702, - "stateVariable": true, - "storageLocation": "default", - "type": "address[] storage ref", - "value": null, - "visibility": "public" + "constant": false, + "id": 598, + "name": "loans", + "nodeType": "VariableDeclaration", + "scope": 691, + "src": "83:22:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" }, - "children": [ - { - "attributes": { - "length": null, - "type": "address[] storage pointer" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 604, - "name": "ElementaryTypeName", - "src": "83:7:1" - } - ], - "id": 605, - "name": "ArrayTypeName", - "src": "83:9:1" + "typeName": { + "baseType": { + "id": 596, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "83:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 597, + "length": null, + "nodeType": "ArrayTypeName", + "src": "83:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[] storage pointer" } - ], - "id": 606, - "name": "VariableDeclaration", - "src": "83:22:1" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "name": "borrowers", - "scope": 702, - "stateVariable": true, - "storageLocation": "default", - "type": "address[] storage ref", - "value": null, - "visibility": "public" + "constant": false, + "id": 601, + "name": "borrowers", + "nodeType": "VariableDeclaration", + "scope": 691, + "src": "111:26:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" }, - "children": [ - { - "attributes": { - "length": null, - "type": "address[] storage pointer" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 607, - "name": "ElementaryTypeName", - "src": "111:7:1" - } - ], - "id": 608, - "name": "ArrayTypeName", - "src": "111:9:1" + "typeName": { + "baseType": { + "id": 599, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "111:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 600, + "length": null, + "nodeType": "ArrayTypeName", + "src": "111:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[] storage pointer" } - ], - "id": 609, - "name": "VariableDeclaration", - "src": "111:26:1" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "name": "borrowerLoanIndex", - "scope": 702, - "stateVariable": true, - "storageLocation": "default", - "type": "mapping(address => address)", - "value": null, - "visibility": "public" + "constant": false, + "id": 605, + "name": "borrowerLoanIndex", + "nodeType": "VariableDeclaration", + "scope": 691, + "src": "163:52:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + }, + "typeName": { + "id": 604, + "keyType": { + "id": 602, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "171:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "163:27:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + }, + "valueType": { + "id": 603, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "182:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } }, - "children": [ - { - "attributes": { - "type": "mapping(address => address)" + "value": null, + "visibility": "public" + }, + { + "anonymous": false, + "id": 611, + "name": "LoanCreated", + "nodeType": "EventDefinition", + "parameters": { + "id": 610, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 607, + "indexed": false, + "name": "loanAddress", + "nodeType": "VariableDeclaration", + "scope": 611, + "src": "240:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 606, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "240:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 610, - "name": "ElementaryTypeName", - "src": "171:7:1" + { + "constant": false, + "id": 609, + "indexed": false, + "name": "borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 611, + "src": "261:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 608, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "261:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - { - "attributes": { - "name": "address", - "type": "address" + "value": null, + "visibility": "internal" + } + ], + "src": "239:46:1" + }, + "src": "222:64:1" + }, + { + "body": { + "id": 619, + "nodeType": "Block", + "src": "357:36:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 616, + "name": "loans", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 598, + "src": "374:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } }, - "id": 611, - "name": "ElementaryTypeName", - "src": "182:7:1" - } - ], - "id": 612, - "name": "Mapping", - "src": "163:27:1" - } - ], - "id": 613, - "name": "VariableDeclaration", - "src": "163:52:1" + "id": 617, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "374:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 615, + "id": 618, + "nodeType": "Return", + "src": "367:19:1" + } + ] + }, + "id": 620, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "loanCount", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 612, + "nodeType": "ParameterList", + "parameters": [], + "src": "314:2:1" + }, + "payable": false, + "returnParameters": { + "id": 615, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 614, + "name": "_loanCount", + "nodeType": "VariableDeclaration", + "scope": 620, + "src": "337:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 613, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "337:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "336:20:1" + }, + "scope": 691, + "src": "296:97:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "anonymous": false, - "name": "LoanCreated" + "body": { + "id": 632, + "nodeType": "Block", + "src": "567:61:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 627, + "name": "borrowerLoanIndex", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "585:17:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + } + }, + "id": 629, + "indexExpression": { + "argumentTypes": null, + "id": 628, + "name": "_borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 622, + "src": "603:16:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "585:35:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 630, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "584:37:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 626, + "id": 631, + "nodeType": "Return", + "src": "577:44:1" + } + ] + }, + "id": 633, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "getLoanForBorrower", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 623, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 622, + "name": "_borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 633, + "src": "499:24:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 621, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "499:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "498:26:1" + }, + "payable": false, + "returnParameters": { + "id": 626, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 625, + "name": "_loanAddress", + "nodeType": "VariableDeclaration", + "scope": 633, + "src": "545:20:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 624, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "545:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "544:22:1" }, - "children": [ - { - "children": [ - { - "attributes": { + "scope": 691, + "src": "470:158:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 689, + "nodeType": "Block", + "src": "893:576:1", + "statements": [ + { + "assignments": [ + 645 + ], + "declarations": [ + { "constant": false, - "indexed": false, - "name": "loanAddress", - "scope": 619, + "id": 645, + "name": "borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "903:23:1", "stateVariable": false, "storageLocation": "default", - "type": "address", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 644, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "903:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, "value": null, "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 614, - "name": "ElementaryTypeName", - "src": "240:7:1" + } + ], + "id": 648, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 646, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "929:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], - "id": 615, - "name": "VariableDeclaration", - "src": "240:19:1" + }, + "id": 647, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "929:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - { - "attributes": { + "nodeType": "VariableDeclarationStatement", + "src": "903:36:1" + }, + { + "assignments": [ + 650 + ], + "declarations": [ + { "constant": false, - "indexed": false, - "name": "borrowerAddress", - "scope": 619, + "id": 650, + "name": "fundRaisingDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "949:30:1", "stateVariable": false, "storageLocation": "default", - "type": "address", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 649, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "949:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "value": null, "visibility": "internal" + } + ], + "id": 652, + "initialValue": { + "argumentTypes": null, + "hexValue": "3330", + "id": 651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "982:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_30_by_1", + "typeString": "int_const 30" }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 616, - "name": "ElementaryTypeName", - "src": "261:7:1" - } - ], - "id": 617, - "name": "VariableDeclaration", - "src": "261:23:1" - } - ], - "id": 618, - "name": "ParameterList", - "src": "239:46:1" - } - ], - "id": 619, - "name": "EventDefinition", - "src": "222:64:1" - }, - { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "loanCount", - "payable": false, - "scope": 702, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] + "value": "30" + }, + "nodeType": "VariableDeclarationStatement", + "src": "949:35:1" }, - "children": [], - "id": 620, - "name": "ParameterList", - "src": "314:2:1" - }, - { - "children": [ - { - "attributes": { + { + "assignments": [ + 654 + ], + "declarations": [ + { "constant": false, - "name": "_loanCount", - "scope": 628, + "id": 654, + "name": "newLoanContract", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "1018:23:1", "stateVariable": false, "storageLocation": "default", - "type": "uint256", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 653, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1018:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, "value": null, "visibility": "internal" - }, - "children": [ + } + ], + "id": 663, + "initialValue": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "uint256", - "type": "uint256" - }, - "id": 621, - "name": "ElementaryTypeName", - "src": "337:7:1" + "argumentTypes": null, + "id": 657, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1074:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 658, + "name": "_loanAmountInEthers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 635, + "src": "1104:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 659, + "name": "fundRaisingDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "1138:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 660, + "name": "_repaymentDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 637, + "src": "1178:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 661, + "name": "_ipfsHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 639, + "src": "1216:9:1", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } } ], - "id": 622, - "name": "VariableDeclaration", - "src": "337:18:1" - } - ], - "id": 623, - "name": "ParameterList", - "src": "336:20:1" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 623 - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "member_name": "length", - "referencedDeclaration": null, - "type": "uint256" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 606, - "type": "address[] storage ref", - "value": "loans" - }, - "id": 624, - "name": "Identifier", - "src": "374:5:1" - } - ], - "id": 625, - "name": "MemberAccess", - "src": "374:12:1" + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1044:16:1", + "typeDescriptions": { + "typeIdentifier": "t_function_creation_nonpayable$_t_address_$_t_uint256_$_t_uint256_$_t_uint256_$_t_string_memory_ptr_$returns$_t_contract$_LoanContract_$592_$", + "typeString": "function (address,uint256,uint256,uint256,string memory) returns (contract LoanContract)" + }, + "typeName": { + "contractScope": null, + "id": 655, + "name": "LoanContract", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 592, + "src": "1048:12:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_LoanContract_$592", + "typeString": "contract LoanContract" + } } - ], - "id": 626, - "name": "Return", - "src": "367:19:1" - } - ], - "id": 627, - "name": "Block", - "src": "357:36:1" - } - ], - "id": 628, - "name": "FunctionDefinition", - "src": "296:97:1" - }, - { - "attributes": { - "constant": true, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null - ], - "name": "getLoanForBorrower", - "payable": false, - "scope": 702, - "stateMutability": "view", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_borrowerAddress", - "scope": 641, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" }, - "children": [ + "id": 662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1044:191:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_LoanContract_$592", + "typeString": "contract LoanContract" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1018:217:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 629, - "name": "ElementaryTypeName", - "src": "499:7:1" + "argumentTypes": null, + "id": 667, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1256:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 630, - "name": "VariableDeclaration", - "src": "499:24:1" - } - ], - "id": 631, - "name": "ParameterList", - "src": "498:26:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_loanAddress", - "scope": 641, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "argumentTypes": null, + "id": 664, + "name": "loans", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 598, + "src": "1245:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 666, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1245:10:1", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } }, - "children": [ + "id": 668, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1245:27:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 669, + "nodeType": "ExpressionStatement", + "src": "1245:27:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 632, - "name": "ElementaryTypeName", - "src": "545:7:1" + "argumentTypes": null, + "id": 673, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1297:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 633, - "name": "VariableDeclaration", - "src": "545:20:1" - } - ], - "id": 634, - "name": "ParameterList", - "src": "544:22:1" - }, - { - "children": [ - { - "attributes": { - "functionReturnParameters": 634 + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "argumentTypes": null, + "id": 670, + "name": "borrowers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 601, + "src": "1282:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 672, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1282:14:1", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } }, - "children": [ + "id": 674, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1282:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 675, + "nodeType": "ExpressionStatement", + "src": "1282:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 680, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 676, + "name": "borrowerLoanIndex", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "1323:17:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + } + }, + "id": 678, + "indexExpression": { + "argumentTypes": null, + "id": 677, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1341:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1323:34:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 679, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1360:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1323:52:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 681, + "nodeType": "ExpressionStatement", + "src": "1323:52:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 613, - "type": "mapping(address => address)", - "value": "borrowerLoanIndex" - }, - "id": 635, - "name": "Identifier", - "src": "585:17:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 630, - "type": "address", - "value": "_borrowerAddress" - }, - "id": 636, - "name": "Identifier", - "src": "603:16:1" - } - ], - "id": 637, - "name": "IndexAccess", - "src": "585:35:1" - } - ], - "id": 638, - "name": "TupleExpression", - "src": "584:37:1" + "argumentTypes": null, + "id": 683, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1397:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 684, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1414:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 639, - "name": "Return", - "src": "577:44:1" - } - ], - "id": 640, - "name": "Block", - "src": "567:61:1" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 682, + "name": "LoanCreated", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 611, + "src": "1385:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" + } + }, + "id": 685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1385:45:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 686, + "nodeType": "ExpressionStatement", + "src": "1385:45:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 687, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1447:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 643, + "id": 688, + "nodeType": "Return", + "src": "1440:22:1" + } + ] + }, + "id": 690, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "create", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 640, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 635, + "name": "_loanAmountInEthers", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "760:24:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 634, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "760:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 637, + "name": "_repaymentDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "794:29:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 636, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "794:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 639, + "name": "_ipfsHash", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "833:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + "typeName": { + "id": 638, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "833:6:1", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "750:105:1" + }, + "payable": false, + "returnParameters": { + "id": 643, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 642, + "name": "_loanAddress", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "871:20:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 641, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "871:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "870:22:1" + }, + "scope": 691, + "src": "734:735:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 692, + "src": "55:1416:1" + } + ], + "src": "0:1472:1" + }, + "legacyAST": { + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanFactory.sol", + "exportedSymbols": { + "LoanFactory": [ + 691 + ] + }, + "id": 692, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 594, + "literals": [ + "solidity", + "^", + "0.4", + ".15" + ], + "nodeType": "PragmaDirective", + "src": "0:24:1" + }, + { + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/LoanContract.sol", + "file": "./LoanContract.sol", + "id": 595, + "nodeType": "ImportDirective", + "scope": 692, + "sourceUnit": 593, + "src": "25:28:1", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [ + 592 + ], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 691, + "linearizedBaseContracts": [ + 691 + ], + "name": "LoanFactory", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 598, + "name": "loans", + "nodeType": "VariableDeclaration", + "scope": 691, + "src": "83:22:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + }, + "typeName": { + "baseType": { + "id": 596, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "83:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 597, + "length": null, + "nodeType": "ArrayTypeName", + "src": "83:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[] storage pointer" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 601, + "name": "borrowers", + "nodeType": "VariableDeclaration", + "scope": 691, + "src": "111:26:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + }, + "typeName": { + "baseType": { + "id": 599, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "111:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 600, + "length": null, + "nodeType": "ArrayTypeName", + "src": "111:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[] storage pointer" } - ], - "id": 641, - "name": "FunctionDefinition", - "src": "470:158:1" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "modifiers": [ - null + "constant": false, + "id": 605, + "name": "borrowerLoanIndex", + "nodeType": "VariableDeclaration", + "scope": 691, + "src": "163:52:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + }, + "typeName": { + "id": 604, + "keyType": { + "id": 602, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "171:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "163:27:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + }, + "valueType": { + "id": 603, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "182:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + }, + "value": null, + "visibility": "public" + }, + { + "anonymous": false, + "id": 611, + "name": "LoanCreated", + "nodeType": "EventDefinition", + "parameters": { + "id": 610, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 607, + "indexed": false, + "name": "loanAddress", + "nodeType": "VariableDeclaration", + "scope": 611, + "src": "240:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 606, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "240:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 609, + "indexed": false, + "name": "borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 611, + "src": "261:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 608, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "261:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } ], - "name": "create", - "payable": false, - "scope": 702, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" + "src": "239:46:1" }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_loanAmountInEthers", - "scope": 701, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 642, - "name": "ElementaryTypeName", - "src": "760:4:1" + "src": "222:64:1" + }, + { + "body": { + "id": 619, + "nodeType": "Block", + "src": "357:36:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 616, + "name": "loans", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 598, + "src": "374:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" } - ], - "id": 643, - "name": "VariableDeclaration", - "src": "760:24:1" - }, - { - "attributes": { - "constant": false, - "name": "_repaymentDurationInDays", - "scope": 701, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" }, - "children": [ + "id": 617, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "374:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 615, + "id": 618, + "nodeType": "Return", + "src": "367:19:1" + } + ] + }, + "id": 620, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "loanCount", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 612, + "nodeType": "ParameterList", + "parameters": [], + "src": "314:2:1" + }, + "payable": false, + "returnParameters": { + "id": 615, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 614, + "name": "_loanCount", + "nodeType": "VariableDeclaration", + "scope": 620, + "src": "337:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 613, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "337:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "336:20:1" + }, + "scope": 691, + "src": "296:97:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 632, + "nodeType": "Block", + "src": "567:61:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ { - "attributes": { - "name": "uint", - "type": "uint256" + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 627, + "name": "borrowerLoanIndex", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "585:17:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + } }, - "id": 644, - "name": "ElementaryTypeName", - "src": "794:4:1" + "id": 629, + "indexExpression": { + "argumentTypes": null, + "id": 628, + "name": "_borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 622, + "src": "603:16:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "585:35:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 645, - "name": "VariableDeclaration", - "src": "794:29:1" + "id": 630, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "584:37:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - { - "attributes": { + "functionReturnParameters": 626, + "id": 631, + "nodeType": "Return", + "src": "577:44:1" + } + ] + }, + "id": 633, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "getLoanForBorrower", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 623, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 622, + "name": "_borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 633, + "src": "499:24:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 621, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "499:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "498:26:1" + }, + "payable": false, + "returnParameters": { + "id": 626, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 625, + "name": "_loanAddress", + "nodeType": "VariableDeclaration", + "scope": 633, + "src": "545:20:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 624, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "545:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "544:22:1" + }, + "scope": 691, + "src": "470:158:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 689, + "nodeType": "Block", + "src": "893:576:1", + "statements": [ + { + "assignments": [ + 645 + ], + "declarations": [ + { "constant": false, - "name": "_name", - "scope": 701, + "id": 645, + "name": "borrowerAddress", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "903:23:1", "stateVariable": false, "storageLocation": "default", - "type": "string memory", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 644, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "903:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, "value": null, "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "string", - "type": "string storage pointer" - }, - "id": 646, - "name": "ElementaryTypeName", - "src": "833:6:1" + } + ], + "id": 648, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 646, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "929:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" } - ], + }, "id": 647, - "name": "VariableDeclaration", - "src": "833:12:1" + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "929:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - { - "attributes": { + "nodeType": "VariableDeclarationStatement", + "src": "903:36:1" + }, + { + "assignments": [ + 650 + ], + "declarations": [ + { "constant": false, - "name": "_use", - "scope": 701, + "id": 650, + "name": "fundRaisingDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "949:30:1", "stateVariable": false, "storageLocation": "default", - "type": "string memory", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 649, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "949:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "value": null, "visibility": "internal" + } + ], + "id": 652, + "initialValue": { + "argumentTypes": null, + "hexValue": "3330", + "id": 651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "982:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_30_by_1", + "typeString": "int_const 30" }, - "children": [ - { - "attributes": { - "name": "string", - "type": "string storage pointer" - }, - "id": 648, - "name": "ElementaryTypeName", - "src": "855:6:1" - } - ], - "id": 649, - "name": "VariableDeclaration", - "src": "855:11:1" - } - ], - "id": 650, - "name": "ParameterList", - "src": "750:122:1" - }, - { - "children": [ - { - "attributes": { + "value": "30" + }, + "nodeType": "VariableDeclarationStatement", + "src": "949:35:1" + }, + { + "assignments": [ + 654 + ], + "declarations": [ + { "constant": false, - "name": "_loanAddress", - "scope": 701, + "id": 654, + "name": "newLoanContract", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "1018:23:1", "stateVariable": false, "storageLocation": "default", - "type": "address", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 653, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1018:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, "value": null, "visibility": "internal" - }, - "children": [ + } + ], + "id": 663, + "initialValue": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 651, - "name": "ElementaryTypeName", - "src": "888:7:1" - } - ], - "id": 652, - "name": "VariableDeclaration", - "src": "888:20:1" - } - ], - "id": 653, - "name": "ParameterList", - "src": "887:22:1" - }, - { - "children": [ - { - "attributes": { - "assignments": [ - 655 - ] - }, - "children": [ + "argumentTypes": null, + "id": 657, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1074:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, { - "attributes": { - "constant": false, - "name": "borrowerAddress", - "scope": 701, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 654, - "name": "ElementaryTypeName", - "src": "920:7:1" - } - ], - "id": 655, - "name": "VariableDeclaration", - "src": "920:23:1" + "argumentTypes": null, + "id": 658, + "name": "_loanAmountInEthers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 635, + "src": "1104:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 656, - "name": "Identifier", - "src": "946:3:1" - } - ], - "id": 657, - "name": "MemberAccess", - "src": "946:10:1" - } - ], - "id": 658, - "name": "VariableDeclarationStatement", - "src": "920:36:1" - }, - { - "attributes": { - "assignments": [ - 660 - ] - }, - "children": [ + "argumentTypes": null, + "id": 659, + "name": "fundRaisingDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "1138:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, { - "attributes": { - "constant": false, - "name": "fundRaisingDurationInDays", - "scope": 701, - "stateVariable": false, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 659, - "name": "ElementaryTypeName", - "src": "966:4:1" - } - ], + "argumentTypes": null, "id": 660, - "name": "VariableDeclaration", - "src": "966:30:1" + "name": "_repaymentDurationInDays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 637, + "src": "1178:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, { - "attributes": { - "argumentTypes": null, - "hexvalue": "3330", - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "subdenomination": null, - "token": "number", - "type": "int_const 30", - "value": "30" - }, + "argumentTypes": null, "id": 661, - "name": "Literal", - "src": "999:2:1" + "name": "_ipfsHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 639, + "src": "1216:9:1", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } } ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1044:16:1", + "typeDescriptions": { + "typeIdentifier": "t_function_creation_nonpayable$_t_address_$_t_uint256_$_t_uint256_$_t_uint256_$_t_string_memory_ptr_$returns$_t_contract$_LoanContract_$592_$", + "typeString": "function (address,uint256,uint256,uint256,string memory) returns (contract LoanContract)" + }, + "typeName": { + "contractScope": null, + "id": 655, + "name": "LoanContract", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 592, + "src": "1048:12:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_LoanContract_$592", + "typeString": "contract LoanContract" + } + } + }, "id": 662, - "name": "VariableDeclarationStatement", - "src": "966:35:1" + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1044:191:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_LoanContract_$592", + "typeString": "contract LoanContract" + } }, - { - "attributes": { - "assignments": [ - 664 - ] - }, - "children": [ + "nodeType": "VariableDeclarationStatement", + "src": "1018:217:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "constant": false, - "name": "newLoanContract", - "scope": 701, - "stateVariable": false, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 663, - "name": "ElementaryTypeName", - "src": "1035:7:1" - } - ], + "argumentTypes": null, + "id": 667, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1256:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "argumentTypes": null, "id": 664, - "name": "VariableDeclaration", - "src": "1035:23:1" + "name": "loans", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 598, + "src": "1245:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } }, + "id": 666, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1245:10:1", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } + }, + "id": 668, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1245:27:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 669, + "nodeType": "ExpressionStatement", + "src": "1245:27:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "contract LoanContract", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - }, - { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "type": "function (address,uint256,uint256,uint256,string memory,string memory) returns (contract LoanContract)" - }, - "children": [ - { - "attributes": { - "contractScope": null, - "name": "LoanContract", - "referencedDeclaration": 600, - "type": "contract LoanContract" - }, - "id": 665, - "name": "UserDefinedTypeName", - "src": "1065:12:1" - } - ], - "id": 666, - "name": "NewExpression", - "src": "1061:16:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 655, - "type": "address", - "value": "borrowerAddress" - }, - "id": 667, - "name": "Identifier", - "src": "1091:15:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 643, - "type": "uint256", - "value": "_loanAmountInEthers" - }, - "id": 668, - "name": "Identifier", - "src": "1121:19:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 660, - "type": "uint256", - "value": "fundRaisingDurationInDays" - }, - "id": 669, - "name": "Identifier", - "src": "1155:25:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 645, - "type": "uint256", - "value": "_repaymentDurationInDays" - }, - "id": 670, - "name": "Identifier", - "src": "1195:24:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 647, - "type": "string memory", - "value": "_name" - }, - "id": 671, - "name": "Identifier", - "src": "1233:5:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 649, - "type": "string memory", - "value": "_use" - }, - "id": 672, - "name": "Identifier", - "src": "1252:4:1" - } - ], + "argumentTypes": null, "id": 673, - "name": "FunctionCall", - "src": "1061:205:1" + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1297:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "argumentTypes": null, + "id": 670, + "name": "borrowers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 601, + "src": "1282:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 672, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1282:14:1", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } + }, "id": 674, - "name": "VariableDeclarationStatement", - "src": "1035:231:1" + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1282:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "push", - "referencedDeclaration": null, - "type": "function (address) returns (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 606, - "type": "address[] storage ref", - "value": "loans" - }, - "id": 675, - "name": "Identifier", - "src": "1276:5:1" - } - ], - "id": 677, - "name": "MemberAccess", - "src": "1276:10:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 664, - "type": "address", - "value": "newLoanContract" - }, - "id": 678, - "name": "Identifier", - "src": "1287:15:1" - } - ], - "id": 679, - "name": "FunctionCall", - "src": "1276:27:1" - } - ], + "id": 675, + "nodeType": "ExpressionStatement", + "src": "1282:31:1" + }, + { + "expression": { + "argumentTypes": null, "id": 680, - "name": "ExpressionStatement", - "src": "1276:27:1" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "uint256", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "push", - "referencedDeclaration": null, - "type": "function (address) returns (uint256)" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 609, - "type": "address[] storage ref", - "value": "borrowers" - }, - "id": 681, - "name": "Identifier", - "src": "1313:9:1" - } - ], - "id": 683, - "name": "MemberAccess", - "src": "1313:14:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 655, - "type": "address", - "value": "borrowerAddress" - }, - "id": 684, - "name": "Identifier", - "src": "1328:15:1" - } - ], - "id": 685, - "name": "FunctionCall", - "src": "1313:31:1" + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 676, + "name": "borrowerLoanIndex", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "1323:17:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_address_$", + "typeString": "mapping(address => address)" + } + }, + "id": 678, + "indexExpression": { + "argumentTypes": null, + "id": 677, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1341:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1323:34:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 686, - "name": "ExpressionStatement", - "src": "1313:31:1" - }, - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 613, - "type": "mapping(address => address)", - "value": "borrowerLoanIndex" - }, - "id": 687, - "name": "Identifier", - "src": "1354:17:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 655, - "type": "address", - "value": "borrowerAddress" - }, - "id": 688, - "name": "Identifier", - "src": "1372:15:1" - } - ], - "id": 689, - "name": "IndexAccess", - "src": "1354:34:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 664, - "type": "address", - "value": "newLoanContract" - }, - "id": 690, - "name": "Identifier", - "src": "1391:15:1" - } - ], - "id": 691, - "name": "Assignment", - "src": "1354:52:1" + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 679, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1360:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 692, - "name": "ExpressionStatement", - "src": "1354:52:1" + }, + "src": "1323:52:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - { - "children": [ + "id": 681, + "nodeType": "ExpressionStatement", + "src": "1323:52:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 619, - "type": "function (address,address)", - "value": "LoanCreated" - }, - "id": 693, - "name": "Identifier", - "src": "1416:11:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 664, - "type": "address", - "value": "newLoanContract" - }, - "id": 694, - "name": "Identifier", - "src": "1428:15:1" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 655, - "type": "address", - "value": "borrowerAddress" - }, - "id": 695, - "name": "Identifier", - "src": "1445:15:1" - } - ], - "id": 696, - "name": "FunctionCall", - "src": "1416:45:1" + "argumentTypes": null, + "id": 683, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1397:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 684, + "name": "borrowerAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 645, + "src": "1414:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 697, - "name": "ExpressionStatement", - "src": "1416:45:1" - }, - { - "attributes": { - "functionReturnParameters": 653 - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 664, - "type": "address", - "value": "newLoanContract" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" }, - "id": 698, - "name": "Identifier", - "src": "1478:15:1" + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 682, + "name": "LoanCreated", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 611, + "src": "1385:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" } - ], - "id": 699, - "name": "Return", - "src": "1471:22:1" - } - ], - "id": 700, - "name": "Block", - "src": "910:590:1" - } - ], - "id": 701, - "name": "FunctionDefinition", - "src": "734:766:1" + }, + "id": 685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1385:45:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 686, + "nodeType": "ExpressionStatement", + "src": "1385:45:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 687, + "name": "newLoanContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 654, + "src": "1447:15:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 643, + "id": 688, + "nodeType": "Return", + "src": "1440:22:1" + } + ] + }, + "id": 690, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "create", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 640, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 635, + "name": "_loanAmountInEthers", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "760:24:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 634, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "760:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 637, + "name": "_repaymentDurationInDays", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "794:29:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 636, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "794:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 639, + "name": "_ipfsHash", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "833:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + "typeName": { + "id": 638, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "833:6:1", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "750:105:1" + }, + "payable": false, + "returnParameters": { + "id": 643, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 642, + "name": "_loanAddress", + "nodeType": "VariableDeclaration", + "scope": 690, + "src": "871:20:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 641, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "871:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "870:22:1" + }, + "scope": 691, + "src": "734:735:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" } ], - "id": 702, - "name": "ContractDefinition", - "src": "55:1447:1" + "scope": 692, + "src": "55:1416:1" } ], - "id": 703, - "name": "SourceUnit", - "src": "0:1502:1" + "src": "0:1472:1" }, "compiler": { "name": "solc", - "version": "0.4.18+commit.9cf6e910.Emscripten.clang" + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" }, "networks": { + "5777": { + "events": {}, + "links": {}, + "address": "0xf12b5dd4ead5f743c6baa640b0216200e89b60da", + "transactionHash": "0xe35b19e0d963e95172be00bf6fd132a91411d0e6da7b864387fd1a755d82fe40" + }, "1510032569593": { "events": {}, "links": {}, @@ -1518,8 +2590,14 @@ "events": {}, "links": {}, "address": "0x9ed27991baf9cb14da00be6a43814ad6cd796090" + }, + "1520965760294": { + "events": {}, + "links": {}, + "address": "0xb5eca87a2f49cd83588bf9f04c23ae564b757d7a", + "transactionHash": "0x35098613b609b22f8a5e5156c1b3ed97b94a4931408c55dbc9b7739600e88375" } }, - "schemaVersion": "1.0.1", - "updatedAt": "2017-11-13T08:15:13.103Z" + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-13T18:29:27.483Z" } \ No newline at end of file diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json index 03422d5b..736ad881 100644 --- a/build/contracts/Migrations.json +++ b/build/contracts/Migrations.json @@ -1,20 +1,6 @@ { "contractName": "Migrations", "abi": [ - { - "constant": false, - "inputs": [ - { - "name": "new_address", - "type": "address" - } - ], - "name": "upgrade", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, { "constant": true, "inputs": [], @@ -43,6 +29,12 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, { "constant": false, "inputs": [ @@ -58,764 +50,1329 @@ "type": "function" }, { - "inputs": [], + "constant": false, + "inputs": [ + { + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], "payable": false, "stateMutability": "nonpayable", - "type": "constructor" + "type": "function" } ], - "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582065d76fc1a0d977fcdb7e3d0a6af1ad21844454171b4527369ea055b5ebafd66f0029", - "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582065d76fc1a0d977fcdb7e3d0a6af1ad21844454171b4527369ea055b5ebafd66f0029", + "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820b80714d1f6590f791f4bebdad43b8f9746fd871983e774f095c5f7c01a47149c0029", + "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820b80714d1f6590f791f4bebdad43b8f9746fd871983e774f095c5f7c01a47149c0029", "sourceMap": "26:488:2:-;;;178:58;;;;;;;;221:10;213:5;;:18;;;;;;;;;;;;;;;;;;26:488;;;;;;", "deployedSourceMap": "26:488:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;409:19;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;143:26;347:165;;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;240:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;329:9;302:24;:36;;;;143:26;240:103;:::o", "source": "pragma solidity ^0.4.15;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}", - "sourcePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/Migrations.sol", + "sourcePath": "/Users/jkb/Kiva/lending-dapp/contracts/Migrations.sol", "ast": { - "attributes": { - "absolutePath": "/Users/jsaur/VMs/projects/truffle/lending-dapp/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 759 - ] - } + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 748 + ] }, - "children": [ + "id": 749, + "nodeType": "SourceUnit", + "nodes": [ { - "attributes": { - "literals": [ - "solidity", - "^", - "0.4", - ".15" - ] - }, - "id": 704, - "name": "PragmaDirective", + "id": 693, + "literals": [ + "solidity", + "^", + "0.4", + ".15" + ], + "nodeType": "PragmaDirective", "src": "0:24:2" }, { - "attributes": { - "baseContracts": [ - null - ], - "contractDependencies": [ - null - ], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "linearizedBaseContracts": [ - 759 - ], - "name": "Migrations", - "scope": 760 - }, - "children": [ + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 748, + "linearizedBaseContracts": [ + 748 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ { - "attributes": { - "constant": false, - "name": "owner", - "scope": 759, - "stateVariable": true, - "storageLocation": "default", - "type": "address", - "value": null, - "visibility": "public" + "constant": false, + "id": 695, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 748, + "src": "50:20:2", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" }, - "children": [ - { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 705, - "name": "ElementaryTypeName", - "src": "50:7:2" + "typeName": { + "id": 694, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "50:7:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 706, - "name": "VariableDeclaration", - "src": "50:20:2" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "name": "last_completed_migration", - "scope": 759, - "stateVariable": true, - "storageLocation": "default", - "type": "uint256", - "value": null, - "visibility": "public" + "constant": false, + "id": 697, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 748, + "src": "74:36:2", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - "children": [ - { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 707, - "name": "ElementaryTypeName", - "src": "74:4:2" + "typeName": { + "id": 696, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "74:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" } - ], - "id": 708, - "name": "VariableDeclaration", - "src": "74:36:2" + }, + "value": null, + "visibility": "public" }, { - "attributes": { - "name": "restricted", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 709, - "name": "ParameterList", - "src": "134:2:2" - }, - { - "children": [ - { - "attributes": { - "falseBody": null + "body": { + "id": 705, + "nodeType": "Block", + "src": "137:37:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "==", - "type": "bool" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 710, - "name": "Identifier", - "src": "147:3:2" - } - ], - "id": 711, - "name": "MemberAccess", - "src": "147:10:2" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 706, - "type": "address", - "value": "owner" - }, - "id": 712, - "name": "Identifier", - "src": "161:5:2" - } - ], - "id": 713, - "name": "BinaryOperation", - "src": "147:19:2" + "id": 702, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 699, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 760, + "src": "147:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } }, - { - "id": 714, - "name": "PlaceholderStatement", - "src": "168:1:2" + "id": 700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "147:10:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 715, - "name": "IfStatement", - "src": "143:26:2" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 701, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 695, + "src": "161:5:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "147:19:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 704, + "nodeType": "IfStatement", + "src": "143:26:2", + "trueBody": { + "id": 703, + "nodeType": "PlaceholderStatement", + "src": "168:1:2" } - ], - "id": 716, - "name": "Block", - "src": "137:37:2" - } - ], - "id": 717, - "name": "ModifierDefinition", - "src": "115:59:2" + } + ] + }, + "id": 706, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 698, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:2" + }, + "src": "115:59:2", + "visibility": "internal" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": true, - "modifiers": [ - null - ], - "name": "Migrations", - "payable": false, - "scope": 759, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 718, - "name": "ParameterList", - "src": "197:2:2" - }, - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 719, - "name": "ParameterList", - "src": "207:0:2" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 706, - "type": "address", - "value": "owner" - }, - "id": 720, - "name": "Identifier", - "src": "213:5:2" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "sender", - "referencedDeclaration": null, - "type": "address" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 771, - "type": "msg", - "value": "msg" - }, - "id": 721, - "name": "Identifier", - "src": "221:3:2" - } - ], - "id": 722, - "name": "MemberAccess", - "src": "221:10:2" - } - ], - "id": 723, - "name": "Assignment", - "src": "213:18:2" + "body": { + "id": 714, + "nodeType": "Block", + "src": "207:29:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 712, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 709, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 695, + "src": "213:5:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 710, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 760, + "src": "221:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "221:10:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "213:18:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 713, + "nodeType": "ExpressionStatement", + "src": "213:18:2" + } + ] + }, + "id": 715, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "Migrations", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 707, + "nodeType": "ParameterList", + "parameters": [], + "src": "197:2:2" + }, + "payable": false, + "returnParameters": { + "id": 708, + "nodeType": "ParameterList", + "parameters": [], + "src": "207:0:2" + }, + "scope": 748, + "src": "178:58:2", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 726, + "nodeType": "Block", + "src": "296:47:2", + "statements": [ + { + "expression": { + "argumentTypes": null, "id": 724, - "name": "ExpressionStatement", - "src": "213:18:2" + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 722, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 697, + "src": "302:24:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 723, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 717, + "src": "329:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "302:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 725, + "nodeType": "ExpressionStatement", + "src": "302:36:2" + } + ] + }, + "id": 727, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 720, + "modifierName": { + "argumentTypes": null, + "id": 719, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "285:10:2", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" } - ], - "id": 725, - "name": "Block", - "src": "207:29:2" + }, + "nodeType": "ModifierInvocation", + "src": "285:10:2" } ], - "id": 726, - "name": "FunctionDefinition", - "src": "178:58:2" + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 718, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 717, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 727, + "src": "262:14:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 716, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "262:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "261:16:2" + }, + "payable": false, + "returnParameters": { + "id": 721, + "nodeType": "ParameterList", + "parameters": [], + "src": "296:0:2" + }, + "scope": 748, + "src": "240:103:2", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "name": "setCompleted", - "payable": false, - "scope": 759, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { + "body": { + "id": 746, + "nodeType": "Block", + "src": "403:109:2", + "statements": [ + { + "assignments": [ + 735 + ], + "declarations": [ + { "constant": false, - "name": "completed", - "scope": 738, + "id": 735, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 747, + "src": "409:19:2", "stateVariable": false, "storageLocation": "default", - "type": "uint256", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 734, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 748, + "src": "409:10:2", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + } + }, "value": null, "visibility": "internal" + } + ], + "id": 739, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 737, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 729, + "src": "442:11:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 736, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 748, + "src": "431:10:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$748_$", + "typeString": "type(contract Migrations)" + } }, - "children": [ + "id": 738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "431:23:2", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "409:45:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "uint", - "type": "uint256" - }, - "id": 727, - "name": "ElementaryTypeName", - "src": "262:4:2" + "argumentTypes": null, + "id": 743, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 697, + "src": "482:24:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 728, - "name": "VariableDeclaration", - "src": "262:14:2" - } - ], - "id": 729, - "name": "ParameterList", - "src": "261:16:2" - }, + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 740, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 735, + "src": "460:8:2", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + } + }, + "id": 742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 727, + "src": "460:21:2", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "460:47:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 745, + "nodeType": "ExpressionStatement", + "src": "460:47:2" + } + ] + }, + "id": 747, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], + "arguments": [], "id": 732, - "name": "ParameterList", - "src": "296:0:2" - }, - { - "attributes": { - "arguments": [ - null - ] + "modifierName": { + "argumentTypes": null, + "id": 731, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "392:10:2", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } }, - "children": [ - { - "attributes": { + "nodeType": "ModifierInvocation", + "src": "392:10:2" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 730, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 729, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 747, + "src": "364:19:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 728, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "364:7:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "363:21:2" + }, + "payable": false, + "returnParameters": { + "id": 733, + "nodeType": "ParameterList", + "parameters": [], + "src": "403:0:2" + }, + "scope": 748, + "src": "347:165:2", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 749, + "src": "26:488:2" + } + ], + "src": "0:514:2" + }, + "legacyAST": { + "absolutePath": "/Users/jkb/Kiva/lending-dapp/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 748 + ] + }, + "id": 749, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 693, + "literals": [ + "solidity", + "^", + "0.4", + ".15" + ], + "nodeType": "PragmaDirective", + "src": "0:24:2" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 748, + "linearizedBaseContracts": [ + 748 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 695, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 748, + "src": "50:20:2", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 694, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "50:7:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 697, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 748, + "src": "74:36:2", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 696, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "74:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 705, + "nodeType": "Block", + "src": "137:37:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 702, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 717, - "type": "modifier ()", - "value": "restricted" + "expression": { + "argumentTypes": null, + "id": 699, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 760, + "src": "147:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "147:10:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 701, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 695, + "src": "161:5:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } }, - "id": 730, - "name": "Identifier", - "src": "285:10:2" + "src": "147:19:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 704, + "nodeType": "IfStatement", + "src": "143:26:2", + "trueBody": { + "id": 703, + "nodeType": "PlaceholderStatement", + "src": "168:1:2" } - ], - "id": 731, - "name": "ModifierInvocation", - "src": "285:10:2" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 708, - "type": "uint256", - "value": "last_completed_migration" - }, - "id": 733, - "name": "Identifier", - "src": "302:24:2" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 728, - "type": "uint256", - "value": "completed" - }, - "id": 734, - "name": "Identifier", - "src": "329:9:2" - } - ], - "id": 735, - "name": "Assignment", - "src": "302:36:2" + } + ] + }, + "id": 706, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 698, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:2" + }, + "src": "115:59:2", + "visibility": "internal" + }, + { + "body": { + "id": 714, + "nodeType": "Block", + "src": "207:29:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 712, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 709, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 695, + "src": "213:5:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" } - ], - "id": 736, - "name": "ExpressionStatement", - "src": "302:36:2" + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 710, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 760, + "src": "221:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "221:10:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "213:18:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 713, + "nodeType": "ExpressionStatement", + "src": "213:18:2" + } + ] + }, + "id": 715, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "Migrations", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 707, + "nodeType": "ParameterList", + "parameters": [], + "src": "197:2:2" + }, + "payable": false, + "returnParameters": { + "id": 708, + "nodeType": "ParameterList", + "parameters": [], + "src": "207:0:2" + }, + "scope": 748, + "src": "178:58:2", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 726, + "nodeType": "Block", + "src": "296:47:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 724, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 722, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 697, + "src": "302:24:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 723, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 717, + "src": "329:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "302:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 725, + "nodeType": "ExpressionStatement", + "src": "302:36:2" + } + ] + }, + "id": 727, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 720, + "modifierName": { + "argumentTypes": null, + "id": 719, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "285:10:2", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" } - ], - "id": 737, - "name": "Block", - "src": "296:47:2" + }, + "nodeType": "ModifierInvocation", + "src": "285:10:2" } ], - "id": 738, - "name": "FunctionDefinition", - "src": "240:103:2" + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 718, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 717, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 727, + "src": "262:14:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 716, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "262:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "261:16:2" + }, + "payable": false, + "returnParameters": { + "id": 721, + "nodeType": "ParameterList", + "parameters": [], + "src": "296:0:2" + }, + "scope": 748, + "src": "240:103:2", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" }, { - "attributes": { - "constant": false, - "implemented": true, - "isConstructor": false, - "name": "upgrade", - "payable": false, - "scope": 759, - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { + "body": { + "id": 746, + "nodeType": "Block", + "src": "403:109:2", + "statements": [ + { + "assignments": [ + 735 + ], + "declarations": [ + { "constant": false, - "name": "new_address", - "scope": 758, + "id": 735, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 747, + "src": "409:19:2", "stateVariable": false, "storageLocation": "default", - "type": "address", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 734, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 748, + "src": "409:10:2", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + } + }, "value": null, "visibility": "internal" - }, - "children": [ + } + ], + "id": 739, + "initialValue": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "name": "address", - "type": "address" - }, - "id": 739, - "name": "ElementaryTypeName", - "src": "364:7:2" + "argumentTypes": null, + "id": 737, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 729, + "src": "442:11:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } } ], - "id": 740, - "name": "VariableDeclaration", - "src": "364:19:2" - } - ], - "id": 741, - "name": "ParameterList", - "src": "363:21:2" - }, - { - "attributes": { - "parameters": [ - null - ] - }, - "children": [], - "id": 744, - "name": "ParameterList", - "src": "403:0:2" - }, - { - "attributes": { - "arguments": [ - null - ] - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } ], - "referencedDeclaration": 717, - "type": "modifier ()", - "value": "restricted" - }, - "id": 742, - "name": "Identifier", - "src": "392:10:2" - } - ], - "id": 743, - "name": "ModifierInvocation", - "src": "392:10:2" - }, - { - "children": [ - { - "attributes": { - "assignments": [ - 746 - ] - }, - "children": [ - { - "attributes": { - "constant": false, - "name": "upgraded", - "scope": 758, - "stateVariable": false, - "storageLocation": "default", - "type": "contract Migrations", - "value": null, - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "contractScope": null, - "name": "Migrations", - "referencedDeclaration": 759, - "type": "contract Migrations" - }, - "id": 745, - "name": "UserDefinedTypeName", - "src": "409:10:2" - } - ], - "id": 746, - "name": "VariableDeclaration", - "src": "409:19:2" - }, - { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "contract Migrations", - "type_conversion": true - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 759, - "type": "type(contract Migrations)", - "value": "Migrations" - }, - "id": 747, - "name": "Identifier", - "src": "431:10:2" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 740, - "type": "address", - "value": "new_address" - }, - "id": 748, - "name": "Identifier", - "src": "442:11:2" - } - ], - "id": 749, - "name": "FunctionCall", - "src": "431:23:2" + "id": 736, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 748, + "src": "431:10:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$748_$", + "typeString": "type(contract Migrations)" } - ], - "id": 750, - "name": "VariableDeclarationStatement", - "src": "409:45:2" + }, + "id": 738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "431:23:2", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + } }, - { - "children": [ + "nodeType": "VariableDeclarationStatement", + "src": "409:45:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ { - "attributes": { - "argumentTypes": null, - "isConstant": false, - "isLValue": false, - "isPure": false, - "isStructConstructorCall": false, - "lValueRequested": false, - "names": [ - null - ], - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "member_name": "setCompleted", - "referencedDeclaration": 738, - "type": "function (uint256) external" - }, - "children": [ - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 746, - "type": "contract Migrations", - "value": "upgraded" - }, - "id": 751, - "name": "Identifier", - "src": "460:8:2" - } - ], - "id": 753, - "name": "MemberAccess", - "src": "460:21:2" - }, - { - "attributes": { - "argumentTypes": null, - "overloadedDeclarations": [ - null - ], - "referencedDeclaration": 708, - "type": "uint256", - "value": "last_completed_migration" - }, - "id": 754, - "name": "Identifier", - "src": "482:24:2" - } - ], - "id": 755, - "name": "FunctionCall", - "src": "460:47:2" + "argumentTypes": null, + "id": 743, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 697, + "src": "482:24:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } ], - "id": 756, - "name": "ExpressionStatement", - "src": "460:47:2" + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 740, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 735, + "src": "460:8:2", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$748", + "typeString": "contract Migrations" + } + }, + "id": 742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 727, + "src": "460:21:2", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "460:47:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 745, + "nodeType": "ExpressionStatement", + "src": "460:47:2" + } + ] + }, + "id": 747, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 732, + "modifierName": { + "argumentTypes": null, + "id": 731, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 706, + "src": "392:10:2", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" } - ], - "id": 757, - "name": "Block", - "src": "403:109:2" + }, + "nodeType": "ModifierInvocation", + "src": "392:10:2" } ], - "id": 758, - "name": "FunctionDefinition", - "src": "347:165:2" + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 730, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 729, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 747, + "src": "364:19:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 728, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "364:7:2", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "363:21:2" + }, + "payable": false, + "returnParameters": { + "id": 733, + "nodeType": "ParameterList", + "parameters": [], + "src": "403:0:2" + }, + "scope": 748, + "src": "347:165:2", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" } ], - "id": 759, - "name": "ContractDefinition", + "scope": 749, "src": "26:488:2" } ], - "id": 760, - "name": "SourceUnit", "src": "0:514:2" }, "compiler": { "name": "solc", - "version": "0.4.18+commit.9cf6e910.Emscripten.clang" + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" }, "networks": { + "5777": { + "events": {}, + "links": {}, + "address": "0x8cdaf0cd259887258bc13a92c0a6da92698644c0", + "transactionHash": "0xf6a5de91032290c21a8d6944c8c394f91f0a7515790ce457911dcc80006d6919" + }, "1510032569593": { "events": {}, "links": {}, @@ -825,8 +1382,14 @@ "events": {}, "links": {}, "address": "0x61196b6e990938a155947c64261b7e6bf810b64c" + }, + "1520965760294": { + "events": {}, + "links": {}, + "address": "0x0e977fe231ac7d7905d7f051e1eb19095adfd4aa", + "transactionHash": "0xf6a5de91032290c21a8d6944c8c394f91f0a7515790ce457911dcc80006d6919" } }, - "schemaVersion": "1.0.1", - "updatedAt": "2017-11-13T08:15:13.102Z" + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-13T18:29:27.481Z" } \ No newline at end of file diff --git a/contracts/LoanContract.sol b/contracts/LoanContract.sol index 973a866e..6b13b478 100644 --- a/contracts/LoanContract.sol +++ b/contracts/LoanContract.sol @@ -9,8 +9,7 @@ contract LoanContract { uint public repaymentDuration; uint public fundRaisingDeadline; uint public repaymentDeadline; - string public name; - string public use; + string public ipfsHash; //Useful vars uint public amountRaised; @@ -49,16 +48,14 @@ contract LoanContract { uint _loanAmountInEthers, uint _fundRaisingDurationInDays, uint _repaymentDurationInDays, - string _name, - string _use + string _ipfsHash ) public { borrowerAddress = _borrowerAddress; loanAmount = _loanAmountInEthers * 1 ether; repaymentDuration = _repaymentDurationInDays; fundRaisingDeadline = now + _fundRaisingDurationInDays * 1 days; repaymentDeadline = fundRaisingDeadline + _repaymentDurationInDays * 1 days; - name = _name; - use = _use; + ipfsHash = _ipfsHash; // For now just do a single scheduled payment at the end schedule.push(PaymentEntry(repaymentDeadline, loanAmount)); } @@ -197,4 +194,4 @@ contract LoanContract { function isDelinquent() public view returns (bool) { return (now >= repaymentDeadline && currentState != State.repaid); } -} \ No newline at end of file +} diff --git a/contracts/LoanFactory.sol b/contracts/LoanFactory.sol index 4b93860c..954c31c8 100644 --- a/contracts/LoanFactory.sol +++ b/contracts/LoanFactory.sol @@ -22,8 +22,7 @@ contract LoanFactory { function create ( uint _loanAmountInEthers, uint _repaymentDurationInDays, - string _name, - string _use + string _ipfsHash ) public returns(address _loanAddress) { address borrowerAddress = msg.sender; uint fundRaisingDurationInDays = 30; //default to 30 for now @@ -32,8 +31,7 @@ contract LoanFactory { _loanAmountInEthers, fundRaisingDurationInDays, _repaymentDurationInDays, - _name, - _use + _ipfsHash ); loans.push(newLoanContract); borrowers.push(borrowerAddress); @@ -41,4 +39,4 @@ contract LoanFactory { LoanCreated(newLoanContract, borrowerAddress); return newLoanContract; } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index e06abd38..bb86b9f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1179,6 +1179,14 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, + "base-x": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz", + "integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==", + "requires": { + "safe-buffer": "5.1.1" + } + }, "base64-arraybuffer": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", @@ -1225,6 +1233,32 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz", "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=" }, + "bindings": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", + "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" + }, + "bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "bl": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.1.tgz", + "integrity": "sha1-ysMo977kVzDUBLaSID/LWQ4XLV4=", + "requires": { + "readable-stream": "2.3.3" + } + }, + "blakejs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", + "integrity": "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" + }, "blob": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", @@ -1396,6 +1430,14 @@ } } }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "3.0.4" + } + }, "buffer": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", @@ -1406,6 +1448,11 @@ "isarray": "1.0.0" } }, + "buffer-loader": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-loader/-/buffer-loader-0.0.1.tgz", + "integrity": "sha1-TWd8qS3YiTEIeLAqL7z6txICTPI=" + }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -1637,6 +1684,16 @@ } } }, + "cids": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.5.3.tgz", + "integrity": "sha512-ujWbNP8SeLKg5KmGrxYZM4c+ttd+wwvegrdtgmbi2KNFUbQN4pqsGZaGQE3rhjayXTbKFq36bYDbKhsnD0eMsg==", + "requires": { + "multibase": "0.4.0", + "multicodec": "0.2.6", + "multihashes": "0.4.13" + } + }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -2651,6 +2708,11 @@ "repeating": "2.0.1" } }, + "detect-node": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", + "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=" + }, "di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", @@ -2674,13 +2736,12 @@ } }, "doctrine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", - "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" + "esutils": "2.0.2" } }, "dom-converter": { @@ -2760,6 +2821,16 @@ "domelementtype": "1.3.0" } }, + "drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", + "requires": { + "browserify-aes": "1.0.8", + "create-hash": "1.1.3", + "create-hmac": "1.1.6" + } + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -2819,6 +2890,14 @@ "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=", "dev": true }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "requires": { + "once": "1.4.0" + } + }, "engine.io": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.3.tgz", @@ -3099,20 +3178,20 @@ "chalk": "1.1.3", "concat-stream": "1.6.0", "debug": "2.6.9", - "doctrine": "2.0.0", + "doctrine": "2.1.0", "escope": "3.6.0", - "espree": "3.5.1", + "espree": "3.5.4", "esquery": "1.0.0", "estraverse": "4.2.0", "esutils": "2.0.2", "file-entry-cache": "2.0.0", "glob": "7.1.2", "globals": "9.18.0", - "ignore": "3.3.5", + "ignore": "3.3.7", "imurmurhash": "0.1.4", "inquirer": "0.12.0", - "is-my-json-valid": "2.16.1", - "is-resolvable": "1.0.0", + "is-my-json-valid": "2.17.2", + "is-resolvable": "1.1.0", "js-yaml": "3.7.0", "json-stable-stringify": "1.0.1", "levn": "0.3.0", @@ -3241,9 +3320,9 @@ } }, "eslint-plugin-promise": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.6.0.tgz", - "integrity": "sha512-YQzM6TLTlApAr7Li8vWKR+K3WghjwKcYzY0d2roWap4SLK+kzuagJX/leTetIDWsFcTFnKNJXWupDCD6aZkP2Q==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.7.0.tgz", + "integrity": "sha512-2WO+ZFh7vxUKRfR0cOIMrWgYKdR6S1AlOezw6pC52B6oYpd5WFghN+QHxvrRdZMtbo8h3dfUZ2o1rWb0UPbKtg==", "dev": true }, "eslint-plugin-standard": { @@ -3253,13 +3332,21 @@ "dev": true }, "espree": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", - "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", "dev": true, "requires": { - "acorn": "5.1.2", + "acorn": "5.5.3", "acorn-jsx": "3.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "dev": true + } } }, "esprima": { @@ -3849,6 +3936,11 @@ "write": "0.2.1" } }, + "flatmap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/flatmap/-/flatmap-0.0.3.tgz", + "integrity": "sha1-Hxik2TgVLUlZZfnJWNkjqy3WabQ=" + }, "flatten": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", @@ -3966,8 +4058,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "1.1.2", @@ -4891,7 +4982,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -5369,9 +5459,9 @@ "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=" }, "ignore": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", - "integrity": "sha512-JLH93mL8amZQhh/p6mfQgVBH3M6epNq3DfsXsTSuSrInVjwyYlFE1nv2AgfRCC8PoOhM0jwQ5v8s9LgbK7yGDw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", "dev": true }, "imurmurhash": { @@ -5410,7 +5500,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -5509,6 +5598,153 @@ "integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=", "dev": true }, + "ipfs-api": { + "version": "18.1.2", + "resolved": "https://registry.npmjs.org/ipfs-api/-/ipfs-api-18.1.2.tgz", + "integrity": "sha512-MZMTBA9xg2ObktT5YYrN/FdgTAX4VoJJjwmtmvM7azIcQnI1vO2c62+C6LnxhpipwR+5x9mIZR4ErXxGwXxF8A==", + "requires": { + "async": "2.6.0", + "big.js": "5.0.3", + "bs58": "4.0.1", + "cids": "0.5.3", + "concat-stream": "1.6.1", + "detect-node": "2.0.3", + "flatmap": "0.0.3", + "glob": "7.1.2", + "ipfs-block": "0.6.1", + "ipfs-unixfs": "0.1.14", + "ipld-dag-pb": "0.13.1", + "is-ipfs": "0.3.2", + "is-stream": "1.1.0", + "lru-cache": "4.1.2", + "multiaddr": "3.0.2", + "multihashes": "0.4.13", + "ndjson": "1.5.0", + "once": "1.4.0", + "peer-id": "0.10.6", + "peer-info": "0.11.6", + "promisify-es6": "1.0.3", + "pull-defer": "0.2.2", + "pull-pushable": "2.2.0", + "pump": "3.0.0", + "qs": "6.5.1", + "readable-stream": "2.3.5", + "stream-http": "2.8.0", + "stream-to-pull-stream": "1.7.2", + "streamifier": "0.1.1", + "tar-stream": "1.5.5" + }, + "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + }, + "big.js": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.0.3.tgz", + "integrity": "sha512-av8LNZGBl4cg2r4ZhWqghJOxi2P8UCcWhdmrFgcHPMmUJ6jx1FbnyxjwL4URYzMK3QJg60qeMefQhv9G14oYKA==" + }, + "concat-stream": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.1.tgz", + "integrity": "sha512-gslSSJx03QKa59cIKqeJO9HQ/WZMotvYJCuaUULrLpjj8oG40kV2Z+gz82pVxlTkOADi4PJxQPPfhl1ELYrrXw==", + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.5", + "typedarray": "0.0.6" + } + }, + "lru-cache": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", + "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "readable-stream": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "stream-http": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.0.tgz", + "integrity": "sha512-sZOFxI/5xw058XIRHl4dU3dZ+TTOIGJR78Dvo0oEAejIt4ou27k+3ne1zYmCV+v7UucbxIFQuOgnkTVHh8YPnw==", + "requires": { + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.5", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" + } + } + } + }, + "ipfs-block": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/ipfs-block/-/ipfs-block-0.6.1.tgz", + "integrity": "sha512-28dgGsb2YsYnFs+To4cVBX8e/lTCb8eWDzGhN5csj3a/sHMOYrHeK8+Ez0IV67CI3lqKGuG/ZD01Cmd6JUvKrQ==", + "requires": { + "cids": "0.5.3" + } + }, + "ipfs-unixfs": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/ipfs-unixfs/-/ipfs-unixfs-0.1.14.tgz", + "integrity": "sha512-s1tEnwKhdd17MmyC/EUMNVMDYzKhCiHDI11TF8tSBeWkEQp+0WUxkYuqvz0R5TSi2lNDJ/oVnEmwWhki2spUiQ==", + "requires": { + "protons": "1.0.1" + } + }, + "ipld-dag-pb": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.13.1.tgz", + "integrity": "sha512-HxybRQvpY8IQ9T0bImlT5v4LBR3jJAgEnFRA/ZU2UNIiBuRkbirI9+VSX03+WkiYooiFMoZz6Qp/xYMdoogNWg==", + "requires": { + "async": "2.6.0", + "bs58": "4.0.1", + "buffer-loader": "0.0.1", + "cids": "0.5.3", + "ipfs-block": "0.6.1", + "is-ipfs": "0.3.2", + "multihashes": "0.4.13", + "multihashing-async": "0.4.8", + "protons": "1.0.1", + "pull-stream": "3.6.2", + "pull-traverse": "1.0.3", + "stable": "0.1.6" + }, + "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + } + } + }, "is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -5600,14 +5836,31 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, + "is-ipfs": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-ipfs/-/is-ipfs-0.3.2.tgz", + "integrity": "sha512-82V1j4LMkYy7H4seQQzOWqo7FiW3I64/1/ryo3dhtWKfOvm7ZolLMRQQfGKs4OXWauh5rAkPnamVcRISHwhmpQ==", + "requires": { + "bs58": "4.0.1", + "cids": "0.5.3", + "multihashes": "0.4.13" + } + }, + "is-my-ip-valid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", + "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", + "dev": true + }, "is-my-json-valid": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", - "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", + "version": "2.17.2", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", + "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", "dev": true, "requires": { "generate-function": "2.0.0", "generate-object-property": "1.2.0", + "is-my-ip-valid": "1.0.0", "jsonpointer": "4.0.1", "xtend": "4.0.1" } @@ -5677,6 +5930,11 @@ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" }, + "is-promise": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz", + "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU=" + }, "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", @@ -5684,13 +5942,10 @@ "dev": true }, "is-resolvable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", - "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", - "dev": true, - "requires": { - "tryit": "1.0.3" - } + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true }, "is-stream": { "version": "1.1.0", @@ -5912,8 +6167,7 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "json3": { "version": "3.3.2", @@ -6148,6 +6402,11 @@ "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", "dev": true }, + "keypair": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/keypair/-/keypair-1.0.1.tgz", + "integrity": "sha1-dgNxknCvtlZO04oiCHoG/Jqk6hs=" + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -6188,6 +6447,76 @@ "type-check": "0.3.2" } }, + "libp2p-crypto": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.12.1.tgz", + "integrity": "sha512-1/z8rxZ0DcQNreZhEsl7PnLr7DWOioSvYbKBLGkRwNRiNh1JJLgh0PdTySBb44wkrOGT+TxcGRd7iq3/X6Wxwg==", + "requires": { + "asn1.js": "5.0.0", + "async": "2.6.0", + "browserify-aes": "1.1.1", + "bs58": "4.0.1", + "keypair": "1.0.1", + "libp2p-crypto-secp256k1": "0.2.2", + "multihashing-async": "0.4.8", + "node-forge": "0.7.4", + "pem-jwk": "1.5.1", + "protons": "1.0.1", + "rsa-pem-to-jwk": "1.1.3", + "tweetnacl": "1.0.0", + "webcrypto-shim": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8" + }, + "dependencies": { + "asn1.js": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.0.0.tgz", + "integrity": "sha512-Y+FKviD0uyIWWo/xE0XkUl0x1allKFhzEVJ+//2Dgqpy+n+B77MlPNqvyk7Vx50M9XyVzjnRhDqJAEAsyivlbA==", + "requires": { + "bn.js": "4.11.8", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + }, + "browserify-aes": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.1.1.tgz", + "integrity": "sha512-UGnTYAnB2a3YuYKIRy1/4FB2HdM866E0qC46JXvVTYKlBlZlnvfpSfY6OKfXZAkv70eJ2a1SqzpAo5CRhZGDFg==", + "requires": { + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.1.3", + "evp_bytestokey": "1.0.3", + "inherits": "2.0.3", + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.0.tgz", + "integrity": "sha1-cT2LgY2kIGh0C/aDhtBHnmb8ins=" + } + } + }, + "libp2p-crypto-secp256k1": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.2.2.tgz", + "integrity": "sha1-DdUh8Yq8TjahUuJOmzYwewrpzwU=", + "requires": { + "async": "2.5.0", + "multihashing-async": "0.4.8", + "nodeify": "1.0.1", + "safe-buffer": "5.1.1", + "secp256k1": "3.5.0" + } + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -6421,6 +6750,11 @@ } } }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, "lodash.isarguments": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", @@ -6456,6 +6790,11 @@ "integrity": "sha1-jMP7NcLZSsxEOhhj4C+kB5nqbyg=", "dev": true }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -6486,6 +6825,11 @@ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", "dev": true }, + "lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=" + }, "log-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", @@ -6575,6 +6919,11 @@ "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" }, + "looper": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/looper/-/looper-3.0.0.tgz", + "integrity": "sha1-LvpUw7HLq6m5Su4uWRSwvlf7t0k=" + }, "loose-envify": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", @@ -6981,6 +7330,84 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "multiaddr": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-3.0.2.tgz", + "integrity": "sha512-TLEujk9VD1SR8HgV00rr1I3MWOk4t0GSDvxzzOO1m1hfxdv4DkFHmKKUHngUCiWHDeClHKSSV23Ig5/Mav3MQw==", + "requires": { + "bs58": "4.0.1", + "ip": "1.1.5", + "lodash.filter": "4.6.0", + "lodash.map": "4.6.0", + "varint": "5.0.0", + "xtend": "4.0.1" + }, + "dependencies": { + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + } + } + }, + "multibase": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.4.0.tgz", + "integrity": "sha512-fnYvZJWDn3eSJ7EeWvS8zbOpRwuyPHpDggSnqGXkQMvYED5NdO9nyqnZboGvAT+r/60J8KZ09tW8YJHkS22sFw==", + "requires": { + "base-x": "3.0.4" + } + }, + "multicodec": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.2.6.tgz", + "integrity": "sha512-VGyRUDkxdJzWnj9x3C49MzI3+TtKKDYNfIBOaWBCNuPk6CE5CwwkL15gJtsLDfLay0fL4xTh4Af3kBbJSxSppw==", + "requires": { + "varint": "5.0.0" + } + }, + "multihashes": { + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.13.tgz", + "integrity": "sha512-HwJGEKPCpLlNlgGQA56CYh/Wsqa+c4JAq8+mheIgw7OK5T4QvNJqgp6TH8gZ4q4l1aiWeNat/H/MrFXmTuoFfQ==", + "requires": { + "bs58": "4.0.1", + "varint": "5.0.0" + } + }, + "multihashing-async": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.4.8.tgz", + "integrity": "sha512-LCc4lfxmTJOHKIjZjFNgvmfB6nXS/ErLInT9uwU8udFrRm2PH+aTPk3mfCREKmCiSHOlCWiv2O8rlnBx+OjlMw==", + "requires": { + "async": "2.6.0", + "blakejs": "1.1.0", + "js-sha3": "0.7.0", + "multihashes": "0.4.13", + "murmurhash3js": "3.0.1", + "nodeify": "1.0.1" + }, + "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + }, + "js-sha3": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.7.0.tgz", + "integrity": "sha512-Wpks3yBDm0UcL5qlVhwW9Jr9n9i4FfeWBFOOXP5puDS/SiudJGhw7DPyBqn3487qD4F0lsC0q3zxink37f7zeA==" + } + } + }, + "murmurhash3js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/murmurhash3js/-/murmurhash3js-3.0.1.tgz", + "integrity": "sha1-Ppg+W0fCoG9DpxMXTn5DXKBEuZg=" + }, "mute-stream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", @@ -7013,6 +7440,24 @@ "xml-char-classes": "1.0.0" } }, + "ndjson": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/ndjson/-/ndjson-1.5.0.tgz", + "integrity": "sha1-rmA7NrE0vOw0e0UkIrC/mNWDLsg=", + "requires": { + "json-stringify-safe": "5.0.1", + "minimist": "1.2.0", + "split2": "2.2.0", + "through2": "2.0.3" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } + }, "negotiator": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", @@ -7078,6 +7523,11 @@ "minimatch": "3.0.4" } }, + "node-forge": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.4.tgz", + "integrity": "sha512-8Df0906+tq/omxuCZD6PqhPaQDYuyJ1d+VITgxoIA8zvQd1ru+nMJcDChHH324MWitIgbVkAkQoGEEVJNpn/PA==" + }, "node-gyp": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.6.2.tgz", @@ -7207,6 +7657,15 @@ } } }, + "nodeify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nodeify/-/nodeify-1.0.1.tgz", + "integrity": "sha1-ZKtpp7268DzhB7TwM1yHwLnpGx0=", + "requires": { + "is-promise": "1.0.1", + "promise": "1.3.0" + } + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -7354,7 +7813,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1.0.2" } @@ -7756,6 +8214,68 @@ "sha.js": "2.4.9" } }, + "peer-id": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.10.6.tgz", + "integrity": "sha512-NyJgPRy108amQClcuBI/VZtyFJLDaTsPC3nVhZ87mpY5JVFmI2Er4atMap6/ToRJxm/RBX1Nh8CMxzlXCpfKKw==", + "requires": { + "async": "2.6.0", + "libp2p-crypto": "0.12.1", + "lodash": "4.17.5", + "multihashes": "0.4.13" + }, + "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.5" + } + }, + "lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + } + } + }, + "peer-info": { + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/peer-info/-/peer-info-0.11.6.tgz", + "integrity": "sha512-xrVNiAF1IhVJNGEg5P2UQN+subaEkszT8YkC3zdy06MK0vTH3cMHB+HH+ZURkoSLssc3HbK58ecXeKpQ/4zq5w==", + "requires": { + "lodash.uniqby": "4.7.0", + "multiaddr": "3.0.2", + "peer-id": "0.10.6" + } + }, + "pem-jwk": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pem-jwk/-/pem-jwk-1.5.1.tgz", + "integrity": "sha1-eoY3/S9nqCflfAxC4cI8P9Us+wE=", + "requires": { + "asn1.js": "1.0.3" + }, + "dependencies": { + "asn1.js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-1.0.3.tgz", + "integrity": "sha1-KBuj7B8kSP52X5Kk7s+IP+E2S1Q=", + "requires": { + "bn.js": "1.3.0", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "bn.js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz", + "integrity": "sha1-DbTL+W+PI7dC9by50ap6mZSgXoM=", + "optional": true + } + } + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -9823,6 +10343,35 @@ "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, + "promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/promise/-/promise-1.3.0.tgz", + "integrity": "sha1-5cyaTIJ45GZP/twBx9qEhCsEAXU=", + "requires": { + "is-promise": "1.0.1" + } + }, + "promisify-es6": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/promisify-es6/-/promisify-es6-1.0.3.tgz", + "integrity": "sha512-N9iVG+CGJsI4b4ZGazjwLnxErD2d9Pe4DPvvXSxYA9tFNu8ymXME4Qs5HIQ0LMJpNM7zj+m0NlNnNeqFpKzqnA==" + }, + "protocol-buffers-schema": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz", + "integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w==" + }, + "protons": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/protons/-/protons-1.0.1.tgz", + "integrity": "sha512-+0ZKnfVs+4c43tbAQ5j0Mck8wPcLnlxUYzKQoB4iDW4ocdXGnN4P+0dDbgX1FTpoY9+7P2Tn2scJyHHqj+S/lQ==", + "requires": { + "protocol-buffers-schema": "3.3.2", + "safe-buffer": "5.1.1", + "signed-varint": "2.0.1", + "varint": "5.0.0" + } + }, "proxy-addr": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", @@ -9879,6 +10428,35 @@ "randombytes": "2.0.5" } }, + "pull-defer": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/pull-defer/-/pull-defer-0.2.2.tgz", + "integrity": "sha1-CIew/7MK8ypW2+z6csFnInHwexM=" + }, + "pull-pushable": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pull-pushable/-/pull-pushable-2.2.0.tgz", + "integrity": "sha1-Xy867UethpGfAbEqLpnW8b13ZYE=" + }, + "pull-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.2.tgz", + "integrity": "sha1-HqFMbxMXTmrE3vDCpOdlZ7fLDFw=" + }, + "pull-traverse": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pull-traverse/-/pull-traverse-1.0.3.tgz", + "integrity": "sha1-dPtde+f6a9enjpeTPhmbeUWGaTg=" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "1.4.1", + "once": "1.4.0" + } + }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -9899,8 +10477,7 @@ "qs": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", - "dev": true + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "query-string": { "version": "4.3.4", @@ -10410,6 +10987,45 @@ "inherits": "2.0.3" } }, + "rsa-pem-to-jwk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/rsa-pem-to-jwk/-/rsa-pem-to-jwk-1.1.3.tgz", + "integrity": "sha1-JF52vbfnI0z+58oDLTG1TDj6uY4=", + "requires": { + "object-assign": "2.1.1", + "rsa-unpack": "0.0.6" + }, + "dependencies": { + "object-assign": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", + "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo=" + } + } + }, + "rsa-unpack": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/rsa-unpack/-/rsa-unpack-0.0.6.tgz", + "integrity": "sha1-9Q69VqYoN45jHylxYQJs6atO3bo=", + "requires": { + "optimist": "0.3.7" + }, + "dependencies": { + "optimist": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", + "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=", + "requires": { + "wordwrap": "0.0.3" + } + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + } + } + }, "run-async": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", @@ -10554,6 +11170,21 @@ } } }, + "secp256k1": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.5.0.tgz", + "integrity": "sha512-e5QIJl8W7Y4tT6LHffVcZAxJjvpgE5Owawv6/XCYPQljE9aP2NFFddQ8OYMKhdLshNu88FfL3qCN3/xYkXGRsA==", + "requires": { + "bindings": "1.3.0", + "bip66": "1.1.5", + "bn.js": "4.11.8", + "create-hash": "1.1.3", + "drbg.js": "1.0.1", + "elliptic": "6.4.0", + "nan": "2.7.0", + "safe-buffer": "5.1.1" + } + }, "selenium-server": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/selenium-server/-/selenium-server-3.7.1.tgz", @@ -10686,6 +11317,14 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "signed-varint": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/signed-varint/-/signed-varint-2.0.1.tgz", + "integrity": "sha1-UKmYnafJjCxh2tEZvJdHDvhSgSk=", + "requires": { + "varint": "5.0.0" + } + }, "sinon": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/sinon/-/sinon-2.4.1.tgz", @@ -10984,6 +11623,14 @@ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=" }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "requires": { + "through2": "2.0.3" + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -11006,6 +11653,11 @@ "tweetnacl": "0.14.5" } }, + "stable": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.6.tgz", + "integrity": "sha1-kQ9dKu17Ugxud3SZwfMuE5/eyxA=" + }, "stackframe": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.4.tgz", @@ -11048,6 +11700,20 @@ "xtend": "4.0.1" } }, + "stream-to-pull-stream": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.2.tgz", + "integrity": "sha1-dXYJrhzr0zx0MtSvvjH/eGULnd4=", + "requires": { + "looper": "3.0.0", + "pull-stream": "3.6.2" + } + }, + "streamifier": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", + "integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=" + }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", @@ -11255,6 +11921,17 @@ "inherits": "2.0.3" } }, + "tar-stream": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.5.tgz", + "integrity": "sha512-mQdgLPc/Vjfr3VWqWbfxW8yQNiJCbAZ+Gf6GDu1Cy0bdb33ofyiNGBtAY96jHFhDuivCwgW1H9DgTON+INiXgg==", + "requires": { + "bl": "1.2.1", + "end-of-stream": "1.4.1", + "readable-stream": "2.3.3", + "xtend": "4.0.1" + } + }, "test-exclude": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", @@ -11292,6 +11969,15 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "requires": { + "readable-stream": "2.3.3", + "xtend": "4.0.1" + } + }, "thunkify": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/thunkify/-/thunkify-2.1.2.tgz", @@ -11400,12 +12086,6 @@ } } }, - "tryit": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", - "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", - "dev": true - }, "tty-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", @@ -11455,8 +12135,7 @@ "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "uglify-js": { "version": "3.1.3", @@ -11673,6 +12352,11 @@ "spdx-expression-parse": "1.0.4" } }, + "varint": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.0.tgz", + "integrity": "sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8=" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -11800,6 +12484,9 @@ } } }, + "webcrypto-shim": { + "version": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8" + }, "webpack": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-2.7.0.tgz", @@ -12121,8 +12808,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { "version": "0.2.1", diff --git a/package.json b/package.json index c6686e70..49586aaf 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "dependencies": { "axios": "^0.17.0", "ethereumjs-testrpc": "^6.0.1", + "ipfs-api": "^18.1.2", "truffle-contract": "^3.0.1", "vue": "^2.5.3", "vue-router": "^2.8.1" diff --git a/src/components/Loan.vue b/src/components/Loan.vue index d840d1bd..d18f7629 100644 --- a/src/components/Loan.vue +++ b/src/components/Loan.vue @@ -87,11 +87,9 @@ Loan.borrowerAddress().then(borrowerAddress => { this.borrowerAddress = borrowerAddress }) - Loan.name().then(name => { - this.name = name - }) - Loan.use().then(use => { - this.use = use + Loan.ipfsInfo().then(ipfsInfo => { + this.name = ipfsInfo.name + this.use = ipfsInfo.use }) Loan.loanAmount().then(loanAmount => { this.loanAmount = loanAmount diff --git a/src/js/ipfsQueries.js b/src/js/ipfsQueries.js new file mode 100644 index 00000000..8edd4c29 --- /dev/null +++ b/src/js/ipfsQueries.js @@ -0,0 +1,20 @@ +import IpfsAPI from 'ipfs-api' + +class IpfsQueries { + constructor () { + this.ipfs = IpfsAPI() + } + + getHash (hash) { + return this.ipfs.get(hash) + } + + addNameUseHash (name, use) { + // TODO: Discuss 'salt' with team. Has pros & cons + const ipfsData = JSON.stringify({name: name, use: use, salt: Math.random()}) + const buf = Buffer.from(ipfsData) + return this.ipfs.add(buf) + } +} + +export default new IpfsQueries() diff --git a/src/js/loan.js b/src/js/loan.js index 5bbf4e03..546a2822 100644 --- a/src/js/loan.js +++ b/src/js/loan.js @@ -1,5 +1,6 @@ import contract from 'truffle-contract' import LoanContract from '@contracts/LoanContract.json' +import IpfsQueries from './ipfsQueries' // This still isn't quite right, but I want a class not a const // to enable multiple loan contracts for each loan address @@ -61,24 +62,31 @@ class Loan { }) } - name () { + ipfsHash () { let self = this return new Promise((resolve, reject) => { - self.instance.name.call().then(name => { - resolve(name) + self.instance.ipfsHash.call().then(ipfsHash => { + resolve(ipfsHash) }).catch(err => { reject(err) }) }) } - use () { + parseIpfsInfo (ipfsInfo) { + const ipfsContent = ipfsInfo[0].content + return JSON.parse(ipfsContent) + } + + ipfsInfo () { let self = this return new Promise((resolve, reject) => { - self.instance.use.call().then(use => { - resolve(use) + return self.ipfsHash().then((hash) => { + return IpfsQueries.getHash(hash).then(ipfsInfo => { + resolve(self.parseIpfsInfo(ipfsInfo)) + }) }).catch(err => { reject(err) }) diff --git a/src/js/loanfactory.js b/src/js/loanfactory.js index 69e33ca1..a4595a5b 100644 --- a/src/js/loanfactory.js +++ b/src/js/loanfactory.js @@ -1,5 +1,6 @@ import contract from 'truffle-contract' import LoanFactoryContract from '@contracts/LoanFactory.json' +import IpfsQueries from './ipfsQueries' const LoanFactory = { @@ -66,7 +67,17 @@ const LoanFactory = { }) }, - create: function (loanAmountInEthers, repaymentDurationInDays, name, use) { + createIpfs: function (name, use) { + return new Promise((resolve, reject) => { + IpfsQueries.addNameUseHash(name, use).then(ipfsHash => { + resolve(ipfsHash) + }).catch(err => { + reject(err) + }) + }) + }, + + createLoan: function (loanAmountInEthers, repaymentDurationInDays, name, use) { let self = this return new Promise((resolve, reject) => { @@ -82,6 +93,19 @@ const LoanFactory = { reject(err) }) }) + }, + + create: function (loanAmountInEthers, repaymentDurationInDays, name, use) { + let self = this + + return new Promise((resolve, reject) => { + self.createIpfs(name, use).then((file) => { + const ipfsHash = file[0].path + resolve(self.createLoan(loanAmountInEthers, repaymentDurationInDays, ipfsHash)) + }).catch(err => { + reject(err) + }) + }) } }