DApp for StandingOrders
MIT License
The UI is live at http://stors.dappstar.io. The contract is deployed on Main, Ropsten and Kovan networks.
As a smart contract can not do anything by itself there is no straightforward way to have automatic recurring payments. You always need an external call (transaction) to trigger a payment.
Create a contract that acts as a proxy between payer and receiver. The payer creates the contract and specifies receiver, payment interval and amount. The payer funds the contract, the receiver can collect funds from the contract according to the parameters set by the payer.
The contract takes care that
Let's say I have rented a Lambo that costs 1 Ether every week. I set up a standing order with the following parameters:
When the order is created it will appear on http://stors.dappstar.io as outgoing order. Also the renting company will see the order on stors.dappstar.io as incoming order. Initially the standing order will not have any funds in it, so the renting company will not be able to collect anything. The UI will reflect that the order is underfunded, as the first payment was due already 3 days ago! Let's fix this by opening the "Add funds" dialog.
The "Add funds" screen displays on the left side the current contract information. Current funding state will read something like "Contract is missing 1 eth!". On the right side I can specify how much ETH to add; the UI will calculate how many payments will be covered based on the entered amount, or how much ETH are necessary based on the entered number of payments.
I want to fund the contract to cover 2 months, so I choose to fund 8 ETH. Once I'm satisfied with the parameters I click on "Add funds" to initiate the transaction. The funds will now be transferred from my account to the contract.
If the rental company now checks http://stors.dappstar.io, it will see the incoming order listed with 1 ether available to collect. It can click on the "collect funds" button, and 1 ether will be transferred from the contract to the rental company's wallet. Note that only 1 ether is available to collect, although I have put 8 ETH to the contract. Only after another payment period is passed there will be one more ether available to collect for the rental company.
The solidity part of the dapp consists of a factory contract and the actual standing order contracts. When creating a new standing order you interact with the contract factory, which will deploy a new standing order. Checkout StandingOrder.sol which contains all solidity code and more detailed documentation.
At the moment the stors dapp is available on these networks:
This code is licensed under the MIT License.