Skip to content

Instantly share code, notes, and snippets.

@toml01
Created April 6, 2022 15:19
Show Gist options
  • Save toml01/b2a9ba69c7e7763d1953db8e6e48fd4c to your computer and use it in GitHub Desktop.
Save toml01/b2a9ba69c7e7763d1953db8e6e48fd4c to your computer and use it in GitHub Desktop.
LegenDAO APIs Description

Platform

Transactions

/// Once a user redeems, the amount redeemed starts the unconding period
Redeem {
    amount: Option<Uint128>,
},
/// Once an unbonding is vested, the user can claim it (claims everything that is available to claim)
ClaimRedeemed {},
/// Sending tokens from the platform to any other predefined contract
SendFromPlatform {
    contract_addr: HumanAddr,
    amount: Option<Uint128>,
    memo: Option<String>,
    msg: Binary,
},

Receive transactions

This section describes the inner messages of the Receeive API.

/// Deposit (stake/lock) $LGND to platform
Deposit { to: HumanAddr },

Transaction results

Redeem { status: ResponseStatus },
ClaimRedeemed { status: ResponseStatus },
SendFromPlatform { status: ResponseStatus },
Deposit { status: ResponseStatus },

where ResponseStatus is:

enum ResponseStatus {
    Success,
    Failure,
}

Queries

/// User's balance
Balance {
    address: HumanAddr,
    key: String,
},
/// Number of unbondings currently
NumOfPendingClaims {},

Permit queries

This section describes the inner messages of the Permits API.

/// User's balance
Balance {},

Query results

Balance(Balances),
NumOfPendingClaims(Uint128),

where Balances is:

struct Balances {
    staked: u128,
    pending_redeem: RedeemInfo,
}

struct RedeemInfo {
    unbondings: Vec<UnbondingRecord>, // Sorted by start time, bulked by day
    claimable: u128,
}

struct UnbondingRecord {
    end_ts: u64,
    amount: u128,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment