Skip to content

HODL Vault Contract

A popular use case of Nexa is the HODL Vault. The HODL Vault locks a users coins for a predetermined amount of time and does not allow coins to be withdrawn from the vault until that time has elapsed.

"Overcome your own weak hands by using the HODL Vault. Keep your funds safe...even from yourself. Simply set the amount of time you want to lock your funds for and they'll stay safe and locked ready for the future."

pragma nexscript >= 1.0.2;

contract HODLVault(int visible unused idx, int visible block, pubkey hodlerKey) {
    function withdraw(sig hodlerSig) {
        // only allow withdrawing from the vault after the locked time has elapsed
        require(tx.time >= block);
        // Require hodlers's signature to match
        require(checkSig(hodlerSig, hodlerKey));
    }
}