Timevault

Loading...
{
  ;; Register with the NameReg contract.
  [0] "TimeVault"
  (call (- (gas) 100) 0x2d0aceee7e5ab874e22ccf8d1a649f59106d74e8 0 0 9 0 0)

  ;; Register the owner of the money in the contract
  [['owner]]:(caller)
  ;; Initialize the waiting period to 3600 seconds (60 minutes)
  [['waiting_period]]:3600

  (return 0 (lll
    ;; Owner starts a withdrawal authorisation
    (if (&& (= (caller) @@'owner) (= (calldataload 0) "withdrawal"))
      [['withdrawal_start]]:(timestamp)
      ;; Else, when owner finalises withdrawal after waiting period and time has elapsed
      (when (&& (= (caller) @@'owner) (= (calldataload 0) "finalize")
                 (< (+ @@'withdrawal_start @@'waiting_period) (timestamp)))
        ;; Send money to sender
        (suicide @@'owner)
      )
    )
  0))
}

LLL contract for Ethereum

Timevault contract in LLL

Preferences

Note: Your changes won't be saved, because not Logged-in.

Create your own Contract