Interest Protocol
  • 👋Welcome to Interest Protocol
  • Overview
    • Sui💧
      • Contracts
        • Memez
        • Libs 📚
      • Suicoins
        • Swap
        • Dollar-Cost Averaging (DCA)
        • Airdrop
          • Suiplay Airdrop
        • Incinerator
        • Send
        • Merger
        • Suicoins Terminal
      • Memez.gg
        • Coins on Memez.GG
        • Memez.Fun
          • SDK
            • Pump API
            • Interfaces
          • Configuration
          • Migrators
          • Bonding Curve
          • Fees
      • IPX Coin Standard
    • Movement
      • Interest Protocol Decentralized Exchange (DEX)
        • Key Features
        • Core Innovations
      • sr-AMM
      • V3 (Soon)
    • Audits
    • Security
    • Deprecated
      • Coin X Oracle 🔮
        • Pyth Network
        • Switchboard
      • Sui Tears 💧
        • Airdrop
          • Airdrop
          • Airdrop Utils
          • Linear Vesting Airdrop
        • Capabilities
          • Access Control
          • Owner
          • Quest
          • Timelock
        • Collections
          • Bitmap
          • Coin Decimals
        • DeFi
          • Oracle
          • Farm
          • Fund
          • Linear Vesting Wallet
          • Linear Clawback Vesting Wallet
          • Vesting
        • Governance
          • DAO
          • DAO Admin
          • DAO Treasury
        • Utils
          • ASCII
          • Comparator
          • Merkle Proof
          • Vectors
        • Math
          • Fixed Point 64
          • Fixed Point Roll
          • Fixed Point Wad
          • Int
          • Math64
          • Math128
          • Math256
      • CLAMM🐚
        • Hooks
      • Whitepapers
  • Glossary
Powered by GitBook
On this page
  • Structs
  • Timelock
  • Interface
  • unlock_time
  • lock
  • unlock

Was this helpful?

Export as PDF
  1. Overview
  2. Deprecated
  3. Sui Tears 💧
  4. Capabilities

Timelock

It locks any object with the store ability for a specific amount of time. We do not provide a function to read the data inside the {Timelock} to prevent capabilities from being used.

Structs

Timelock

  struct Timelock<T: store> has key, store {
    id: UID,
    unlock_time: u64,
    data: T,
  }
  • unlock_time - The unlock time in milliseconds.

  • data - Any object with the store ability.

Interface

unlock_time

Returns the unlock time in milliseconds.

public fun unlock_time<T: store>(self: &Timelock<T>): u64
  • @param self: A {Timelock}

  • @return u64. The self.unlock_time.

lock

Locks the data for unlock_time milliseconds.

public fun lock<T: store>(
    data: T, 
    c: &Clock,
    unlock_time: u64,
    ctx: &mut TxContext
): Timelock<T>
  • @param data: An object with the store ability.

  • @param c: The shared sui::clock::Clock object.

  • @param unlock_time: The lock period in milliseconds.

  • @return {Timelock}.

Aborts

  • unlock_time is in the past.

unlock

Unlocks a {Timelock} and returns the locked resource T.

public fun unlock<T: store>(self: Timelock<T>, c:&Clock): T
  • @param self: A {Timelock}

  • @param c: The shared sui::clock::Clock object.

  • @return T. An object with the store ability.

Aborts

  • unlock_time has not passed.

PreviousQuestNextCollections

Last updated 1 year ago

Was this helpful?