1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::unnecessary_mut_passed)]
use codec::Codec;
use sp_std::vec::Vec;
sp_api::decl_runtime_apis! {
pub trait DexStableApi<CurrencyId, Balance, AccountId, PoolId> where
Balance: Codec,
CurrencyId: Codec,
AccountId: Codec,
PoolId: Codec,
{
fn get_virtual_price(pool_id: PoolId) -> Balance;
fn get_a(pool_id: PoolId) -> Balance;
fn get_a_precise(pool_id: PoolId) -> Balance;
fn get_currencies(pool_id: PoolId) -> Vec<CurrencyId>;
fn get_currency(pool_id: PoolId, index: u32) -> Option<CurrencyId>;
fn get_lp_currency(pool_id: PoolId) -> Option<CurrencyId>;
fn get_currency_precision_multipliers(pool_id: PoolId) -> Vec<Balance>;
fn get_currency_balances(pool_id: PoolId) -> Vec<Balance>;
fn get_number_of_currencies(pool_id: PoolId) -> u32;
fn get_admin_balances(pool_id: PoolId) -> Vec<Balance>;
fn calculate_currency_amount(pool_id: PoolId, amounts:Vec<Balance>, deposit: bool) -> Balance;
fn calculate_swap(pool_id: PoolId, in_index: u32, out_index: u32, in_amount: Balance) -> Balance;
fn calculate_remove_liquidity(pool_id: PoolId, amount: Balance) -> Vec<Balance>;
fn calculate_remove_liquidity_one_currency(pool_id: PoolId, amount:Balance, index: u32) -> Balance;
}
}