Rate Limiting Withdrawals

Introduction

The Rate Limiting Withdrawals ADO acts as a bank account that limits the frequency and size of an account holder's withdrawals. Only one type of coin can be used.

Ado_type: rate-limiting-withdrawals

InstantiateMsg

pub struct InstantiateMsg {
    pub allowed_coin: CoinAndLimit,
    pub minimal_withdrawal_frequency: MinimumFrequency,
    pub kernel_address: String,
    pub owner: Option<String>,
}
NameTypeDescription

allowed_coin

Set the allowed coin denom and the maximum amount allowed to withdraw.

minimal_withdrawal_frequency

The time required between withdrawals. Specified in milliseconds. Cannot be 0.

kernel_address

String

Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts.

owner

Option<String>

Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.

CoinAndLimit

pub struct CoinAndLimit {
    pub coin: String,
    pub limit: Uint128,
}
NameTypeDescription

coin

String

Sets the accepted coin denom.

limit

Uint128

Sets the withdrawal limit in terms of amount.

MinimumFrequency

pub enum MinimumFrequency {
     Time { time: MillisecondsDuration },
     }
  • Time: A time in milliseconds. For example 3600 would specify that each the user needs to wait 3600 milliseconds between withdrawals.

ExecuteMsg

Deposits

Deposit funds for the specified recipient.

Only the allowed coin in instantiation can be deposited.

pub enum ExecuteMsg {
    Deposits {
        recipient: Option<String>,
    }
}
NameTypeDescription

recipient

Option<String>

The owner of the deposited funds. If not set, defaults to the sender.

WithdrawFunds

Enough time should pass since the last withdrawal.

pub enum ExecuteMsg{
     WithdrawFunds {
        amount: Uint128,
    }
}
NameTypeDescription

amount

Uint128

The amount of coins to withdraw.

Base Executes

The rest of the execute messages can be found in the ADO Base section.

QueryMsg

CoinAllowanceDetails

Provides the allowed coin and limits for withdrawal size and frequency.

pub enum QueryMsg{
    #[returns(CoinAllowance)]
    CoinAllowanceDetails {}
    }

CoinAllowance

Returns a CoinAllowance struct.

pub struct CoinAllowance {
    pub coin: String,
    pub limit: Uint128,
    pub minimal_withdrawal_frequency: MillisecondsDuration,
}
NameTypeDescription

coin

string

The coin denom.

limit

Uint128

The amount allowed to withdraw per withdrawal.

minimal_withdrawal_frequency

The time required between withdrawals. Specified in milliseconds.

AccountDetails

Shows the balance and latest withdrawal time.

pub enum QueryMsg{
     #[returns(AccountDetails)]
     AccountDetails {
        account: String,
    }
}
NameTypeDescription

account

String

The address to check the account for.

AccountDetails

Returns an AccountDetails struct.

pub struct AccountDetails {
    pub balance: Uint128,
    pub latest_withdrawal: Option<Timestamp>,
}
NameTypeDescription

balance

Uint128

The balance of the specified address.

latest_withdrawal

Option<Timestamp>

The time of the last withdrawal of the specified address.

Base Queries

The rest of the query messages can be found in the ADO Base section.

Last updated

Additional Resources

GithubWebsite