Skip to main content

Timelock System

The timelock creates a mandatory waiting period between initiating and completing a withdrawal.

How It Works

1

Initiate Withdrawal

User requests withdrawal from Social Vault
2

Timelock Starts

Request enters pending state with countdown
3

Guardian Notification

All 5 Guardians receive push notification
4

Approval Period

3/5 Guardians must approve before timelock expires
5

Release

After timelock + approvals, funds are released

Timelock Durations

Withdrawal AmountTimelock Period
< $10024 hours
100100 - 50036 hours
500500 - 1,00048 hours
1,0001,000 - 5,00060 hours
> $5,00072 hours

Cancellation

Withdrawals can be cancelled during the timelock:
  • By user: Cancel anytime before release
  • By Guardian: Any Guardian can cancel
  • Automatic: If 2+ Guardians flag as suspicious
// Cancellation scenarios
const withdrawal = {
  amount: 500,
  timelock: 48, // hours
  status: 'PENDING',
  approvals: 1,
  flags: 0
};

// User cancels
withdrawal.status = 'CANCELLED_BY_USER';

// Guardian cancels
withdrawal.status = 'CANCELLED_BY_GUARDIAN';

// Automatic cancellation (2+ flags)
if (withdrawal.flags >= 2) {
  withdrawal.status = 'CANCELLED_SUSPICIOUS';
}

Emergency Bypass

There is intentionally NO emergency bypass. This is by design to prevent coerced “emergency” transfers.
If you need immediate access to funds:
  1. Keep everyday spending in your regular wallet
  2. Only store long-term holdings in Social Vault
  3. Plan withdrawals in advance

Smart Contract Implementation

// SocialVault.sol (simplified)
struct Withdrawal {
    address recipient;
    uint256 amount;
    uint256 initiatedAt;
    uint256 timelockEnd;
    uint8 approvals;
    bool executed;
}

function initiateWithdrawal(uint256 amount) external {
    uint256 timelock = calculateTimelock(amount);

    withdrawals[withdrawalCount++] = Withdrawal({
        recipient: msg.sender,
        amount: amount,
        initiatedAt: block.timestamp,
        timelockEnd: block.timestamp + timelock,
        approvals: 0,
        executed: false
    });

    emit WithdrawalInitiated(msg.sender, amount, timelock);
}

function calculateTimelock(uint256 amount) internal pure returns (uint256) {
    if (amount < 100e6) return 24 hours;
    if (amount < 1000e6) return 48 hours;
    return 72 hours;
}

View Contract

Full Social Vault contract documentation