Latch

Docs

Latch is one contract on Robinhood Chain that holds locks nobody can release early. It has no owner, no admin function, no fee and no upgrade.

Token locks

  • lockTokens(token, amount, beneficiary, cliff, end, note) pulls the tokens in (approve first). Fee-on-transfer tokens are recorded at the amount that actually arrived.
  • Nothing is claimable before cliff. After it, the vested amount grows in a straight line from the lock's start to end; at end everything is claimable. cliff == end makes a plain time lock.
  • Only the beneficiary can call claim(id), as often as they like. The creator of the lock cannot take anything back.
  • Locks are limited to ten years.

Position locks

  • lockNft(nft, tokenId, unlockAt, note) holds any NFT until unlockAt (approve it first). NFTs sent to Latch any other way are refused, so nothing can get stuck.
  • For Uniswap v3 positions (position manager 0x7399…E0D3) the owner can call collectFees(id) at any time: the trading fees go to the owner and the liquidity stays locked.
  • extend(id, later) moves the unlock date later, never earlier. transferLock(id, to) hands the lock to another address.
  • After the unlock date the owner calls withdrawNft(id) to get the position back.

Reading locks

  • Every lock is stored in the contract: tokenLock(id), nftLock(id), locksOfToken(token), tokenLocksOf(account), nftLocksOf(account), recentTokenLocks(n).
  • The public page for a token is latchlock.xyz/?t=<token address>.

Risks

  • A lock really cannot be cancelled. Check the amount, beneficiary and dates before you confirm.
  • Locked LP still carries price risk: the position stays in the pool and moves with it.
  • Unaudited. Tested on a fork of Robinhood Chain with real USDG, WETH and a real Uniswap v3 position.

Contracts

Latchdeploys at launch
Uniswap v3 positions0x7399…E0D3