Methods
Swaps go through the engine’s swap_simple, with a route as message. All other methods are called through the engine on "dex_id": "slimedragon.near/xyk": calls with dex_call, and views with dex_view. Arguments and responses are Borsh, in base64. Types are in Types.
Every call needs to be authorized: a dex_call, or a DexCall in execute_operations, not in the operations of a deposit.
“Attach” is the attached_assets of the dex_call, from the caller’s inner balance. “NEAR for storage” means Plach uses what the call stores and sends the rest to the caller’s wallet.
| Method | Arguments | Attach | Response | Who |
|---|---|---|---|---|
create_pool |
CreatePoolArgs |
NEAR for storage, the initial liquidity or the launched token | CreatePoolResponse { pool_id: u32 } |
Anyone |
edit_fees |
EditFeesArgs { pool_id: u32, fees: FeeConfiguration } |
NEAR for the storage of new account receivers, or nothing | nothing | The owner of an unlocked private pool |
lock_pool |
LockPoolArgs { pool_id: u32 } |
Nothing | nothing | The owner of a V2 private pool |
upgrade_pool |
UpgradePoolArgs { pool_id: u32 } |
NEAR for storage | nothing | Anyone, for a V1 pool |
See Pools.
Liquidity
Section titled “Liquidity”| Method | Arguments | Attach | Response | Who |
|---|---|---|---|---|
register_liquidity |
RegisterLiquidityArgs { pool_id: u32 } |
NEAR for storage | nothing | Anyone, for a public pool |
add_liquidity |
AddLiquidityArgs { pool_id: u32, min_shares_received: Option<u128> } |
Both assets of the pool | nothing | Registered accounts in public pools, the owner in private pools |
remove_liquidity |
RemoveLiquidityArgs { pool_id: u32, shares_to_remove: Option<u128>, min_assets_received: Option<(u128, u128)> } |
Nothing | nothing | Shareholders of public pools, the owner of an unlocked private pool |
What an addition doesn’t use, and the assets of removed liquidity, are sent to the caller’s wallet. See Liquidity.
| Method | Arguments | Attach | Response | Who |
|---|---|---|---|---|
register_fee_assets |
RegisterFeeAssetsArgs { asset_ids: Vec<AssetId> } |
NEAR for storage | nothing | Anyone, for themselves |
withdraw_fees |
WithdrawFeesArgs { assets: Vec<AssetId> } |
Nothing | nothing | Anyone, for themselves |
withdraw_community_fee |
WithdrawCommunityFeeArgs { account_id: AccountId } |
Nothing | nothing | Anyone, for any account |
withdraw_fees moves the caller’s collected fees to their inner balance. withdraw_community_fee sends the account’s community fees to its wallet. See Fees.
set_fee_discount_signer (SetFeeDiscountSignerArgs { fee_discount_signer_public_key: Option<PublicKey> }) sets the key that signs fee discounts, or turns them off. Only slimedragon.near can call it.
| Method | Arguments | Response |
|---|---|---|
get_pool |
GetPoolArgs { pool_id: u32 } |
Option<PoolView> |
get_pools |
GetPoolsArgs { start_index: u32, limit: u32 } |
Vec<PoolView> |
get_pool_count |
none | u32 |
get_pool_shares |
GetPoolSharesArgs { pool_ids: Vec<u32>, account_id: AccountId } |
Vec<Option<u128>>: shares in each pool, None if not registered or not a public pool |
pool_needs_upgrade |
PoolNeedsUpgradeArgs { pool_id: u32 } |
bool: whether the pool is V1 |
get_pending_fees |
GetPendingFeesArgs { account_id: AccountId, asset_ids: Vec<AssetId> } |
HashMap<AssetId, u128>: collected fees, for the registered fee assets |
get_community_owned_fees |
GetCommunityOwnedFeesArgs { account_id: AccountId } |
u128: community fees in yoctoNEAR |
get_fee_discount_signer |
none | Option<PublicKey> |
For views without arguments, pass "" as args.