Skip to content

ariady-putra/morbid

Repository files navigation

Davy Jones' Locker


Fifteen men on the dead man's chest—
...Yo-ho-ho, and a bottle of rum!
Drink and the devil had done for the rest—
...Yo-ho-ho, and a bottle of rum!


This is a dead-man's switch contract where you can:

  • Create Chest
  • Add Treasure
  • Delay Unlock
  • Unlock Chest
  • Resend Chest

Create Chest

Mints ChestLock and ChestKey(s), a new address will be generated. Send ChestLock while depositing initial assets. Keep ChestKey token(s) in your wallet, you will need to show it when DelayUnlock.

Give access for delaying the chest unlocking deadline to anyone by sending them the ChestKey token.

Add Treasure

Anyone can deposit more assets to the chest. Don't forget to include an arbitrary inline datum to be redeemable.

Delay Unlock

Show the matching ChestKey token to postpone the chest unlocking deadline.

Unlock Chest

Redeem all assets from the chest when the deadline has passed. You will also receive the ChestLock NFT.

Resend Chest

Resend ChestLock to the chest address. Similar to CreateChest but it is done by the chest unlocker. There is no real benefit to do this, but it's possible.


Chest Address Sample

Updated for aiken v1.0.14-alpha:

addr_test1wze6hmn8spj3lcqrckjmytms0uwm4830zjvdwzqsyrzlusqfhsyck

View it in action on CExplorer.

Timeline

  • Create Chest
    https://preview.cexplorer.io/tx/218c1cb8564e1223202b7116d9897d955e493f44776d93b826e698c768a8b1c6
    Mints 2 ChestKey tokens. Sends some arbitrary tokens as well.

  • Add Treasure
    https://preview.cexplorer.io/tx/9db99e7b49963bb5f63fbac80030c916b3a8a14e2b829e50cf87555d4f565aa2
    Put an arbitrary inline datum and send some arbitrary tokens.

  • Delay Unlock
    https://preview.cexplorer.io/tx/0970f113f9004b184b72ac25533a5900360252b58d6a9c9b8af5a6245fb470f5
    Postpone chest unlocking deadline.

  • Unlock Chest
    https://preview.cexplorer.io/tx/ca73a798869583209fe6330519710138bd05b9bdbdca2511442e22f1e18d2709
    Redeem all assets including ChestLock NFT (named as Dead Man's Chest) from the chest.

  • Resend Chest
    https://preview.cexplorer.io/tx/10eead16236bb0c0d7fa1dae9d4c03dffdd8d927f89201449c8dd4f286035da3
    Resend ChestLock to the chest address and some arbitrary tokens.

  • Share Access
    https://preview.cexplorer.io/tx/b3b9c8d961120f9f7cf173884938877146b641612c5d2bd9c0c14a5f7e21b19b
    Share 1 ChestKey token to another address.

  • Delay Unlock (by another address)
    https://preview.cexplorer.io/tx/f0082d9e75fae24ec0c7ff8668ce4ed7206385afe01d13e215ef80c832dac2d5
    Using the shared ChestKey token.



But one man of her crew alive,
What put to sea with seventy-five.