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

Version: 2.0.2-beta.1

InstantiateMsg

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

CoinAndLimit

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

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>,
    }
}

WithdrawFunds

Withdraw funds from the available balance.

Enough time should pass since the last withdrawal.

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

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,
}

AccountDetails

Shows the balance and latest withdrawal time.

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

AccountDetails

Returns an AccountDetails struct.

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

Base Queries

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

Additional Resources

GithubWebsite