Weekly Update

I’m a Dad again(for the fourth time). Weston James was born on Tuesday evening June the 20th. Mom and baby are healthy. Big Bro, Big Sis, and Big Sis 2 are super excited, and Dad is really proud. I guess I’m a professional solidity developer as someone paid me actual money(well ETH) for the contract we are discussing today. Not a lot, but enough be significant. Work continues on the whitepaper for the first service offering that Catallax will be trying to launch. Lawyers, accountants, legalese, etc., etc.

Today we are going to do some testing with time. The is going to be very important once we start testing our demurrage code. In our decaying token we used passing block numbers to calculate our decay periods. In the example today we are going to use the actual time system in Ethereum. This system isn’t an exact science since we are somewhat dependent on the Miners to give a truthful timestamp on each block. You would not use this system if you were doing calculations on short time scales because a miner could attempt to cheat your contract. Our example today uses month long periods so we should be fine using time.



The contract we are going to develop is called a DisciplineWallet. Do you have lambo money from buying into the ethereum crowdsale two years ago? Afraid you’re going to get spooked and sell? Use the DisciplineWallet and restrict access to your ETH on a monthly basis.



When we first started talking about this contract the client wanted the payout to be consistent in USD. We went back and forth and finally decided that we needed to do it in ETH because there isn’t really a good USD to ETH Oracle that is reliable over long periods of time. If you know of one, please let me know and I’ll try to update this contract to do USD instead.



Our contract will do the following:

Be initialized with a term in months and an amount of ETH to pay out each month

Take Deposits in ETH

Expose a Withdraw function that can be called once a month to send the specified amount of ETH to the owner of the contract

Let us change the owner of the contract

Withdraw all the remaining ETH to a specified address once the term has run its course

Give us a safety function to move coins out of the contact if we accidentally send ERC20 tokens to the contract

Use the fallback function as a deposit function

Tell us when the next withdrawal is available

Once we write up our contract we are going to want to test it. To do this we are going to need a blockchain environment that will let us make time go by quickly. Fortunately, the testrpc that is packaged with the truffle dev environment lets us do this with the following call: