diff --git a/Cargo.lock b/Cargo.lock index 51791a1..f5f31e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -717,7 +717,6 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "xrc", ] [[package]] @@ -2928,9 +2927,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -2949,9 +2948,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", diff --git a/Cargo.toml b/Cargo.toml index 8f5c511..04badad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ serde_json = "1" sha2 = "0.10" sha3 = "0.10" thiserror = "1.0" -time = { version = "0.3.28", features = ["macros", "parsing"] } +time = { version = "0.3.36", features = ["macros", "parsing"] } [profile.dev] debug = false diff --git a/docs/canisters/ekoke-liquidity-pool.md b/docs/canisters/ekoke-liquidity-pool.md index 0ca2716..d60a7dd 100644 --- a/docs/canisters/ekoke-liquidity-pool.md +++ b/docs/canisters/ekoke-liquidity-pool.md @@ -2,7 +2,7 @@ - [EKOKE Liquidity Pool Canister](#ekoke-liquidity-pool-canister) - [Introduction](#introduction) - - [Swap Account](#swap-account) + - [Refund to investors](#refund-to-investors) - [API](#api) - [HTTP API](#http-api) - [Request protocol](#request-protocol) @@ -13,27 +13,15 @@ ## Introduction -In order to guarantee a real value to the $EKOKE token, the EKOKE DAO manages a Liquidity Pool which has two accounts, the first is ICP and the second is ckBTC. +In order to guarantee a real value to the $EKOKE token, the EKOKE DAO manages a Liquidity Pool which has currently a ICP account. The liquidity pool can be funded by anyone by sending funds to the account returned by `liquidity_pool_accounts` call. For each Deferred NFT sold on the marketplace to the contract buyer, the 10% of the amount paid is sent by to the liquidity pool. This guarantees that the value of a $EKOKE is at least 10% of a NFT value. (More or less, there are also other criteria which determines the value of the token). -There's no way for any person to withdraw funds in the **Liquidity Pool**, they are locked forever. +## Refund to investors -## Swap Account - -In order to allow the exchange between the ICP sent after a sale on the marketplace into ckBTC, which will be considered as a value reserve, at the creation of the canister a Swap account is passed as argument. - -The swap account is an ICRC account which must have a certain ckBTC amount of it and which will guarantee an allowance to the ekoke liquidity pool canister in order to spend their ckBTC. At this point once a day the canister will try to swap its ICP into ckBTC from the account. - -The exchange ratio is calculated by using the XRC canister. - -The amount sent will be the minimum between: - -- the amount of ICP converted into ckBTC in the liquidity pool -- the amount of ckBTC on the swap account -- the allowance given to the ckBTC ledger for the swap account +In case a contract fails to be paid, the liquidity pool receives the initial deposit sent by the buyer. The liquidity pool funds are also used to refund the third party investors. ## API @@ -68,8 +56,7 @@ Returns an object containing the balance for each account in the liquidity pool ```json { - "icp": nat, - "ckbtc": nat + "icp": nat } ``` @@ -81,8 +68,5 @@ Returns the account for the liquidity pool { "icp": { "owner": "principal" - }, - "ckbtc": { - "owner": "principal" } } diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index cfe50d0..fb5b14a 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -130,13 +130,7 @@ impl TestEnv { ekoke_ledger_id, ); Self::install_ekoke_ledger(&pic, ekoke_ledger_id, ekoke_reward_pool_id); - Self::install_ekoke_liquidity_pool( - &pic, - ekoke_liquidity_pool_id, - icp_ledger_id, - ckbtc_id, - xrc_id, - ); + Self::install_ekoke_liquidity_pool(&pic, ekoke_liquidity_pool_id, icp_ledger_id); Self::install_ekoke_reward_pool( &pic, ekoke_reward_pool_id, @@ -299,18 +293,13 @@ impl TestEnv { pic: &PocketIc, ekoke_liquidity_pool_id: Principal, icp_ledger_canister: Principal, - ckbtc_canister: Principal, - xrc_canister: Principal, ) { pic.add_cycles(ekoke_liquidity_pool_id, DEFAULT_CYCLES); let wasm_bytes = Self::load_wasm(Canister::EkokeLiquidityPool); let init_arg = EkokeLiquidityPoolInitData { admins: vec![actor::admin()], - swap_account: actor::swap_account(), icp_ledger_canister, - ckbtc_canister, - xrc_canister, }; let init_arg = Encode!(&init_arg).unwrap(); diff --git a/integration-tests/tests/http/ekoke_liquidity_pool.rs b/integration-tests/tests/http/ekoke_liquidity_pool.rs index 8eb448e..bdbf4d3 100644 --- a/integration-tests/tests/http/ekoke_liquidity_pool.rs +++ b/integration-tests/tests/http/ekoke_liquidity_pool.rs @@ -11,10 +11,6 @@ fn test_http_should_get_liquidity_pool_accounts_and_balance() { let liquidity_pool_accounts: LiquidityPoolAccounts = http_client.http_request("liquidityPoolAccounts", serde_json::json!({})); - assert_eq!( - liquidity_pool_accounts.ckbtc.owner, - env.ekoke_liquidity_pool_id - ); assert_eq!( liquidity_pool_accounts.icp.owner, env.ekoke_liquidity_pool_id @@ -23,6 +19,5 @@ fn test_http_should_get_liquidity_pool_accounts_and_balance() { let liquidity_pool_balance: LiquidityPoolBalance = http_client.http_request("liquidityPoolBalance", serde_json::json!({})); - assert_eq!(liquidity_pool_balance.ckbtc, 0u64); assert_eq!(liquidity_pool_balance.icp, 0u64); } diff --git a/scripts/deploy_functions.sh b/scripts/deploy_functions.sh index feca37e..46a4eff 100644 --- a/scripts/deploy_functions.sh +++ b/scripts/deploy_functions.sh @@ -83,16 +83,12 @@ deploy_ekoke_liquidity_pool() { NETWORK="$2" EKOKE_LIQUIDITY_POOL_PRINCIPAL="$3" ADMINS="$4" - SWAP_ACCOUNT="$5" echo "deploying ekoke-liquidity-pool canister $EKOKE_LIQUIDITY_POOL_PRINCIPAL" ekoke_liquidity_pool_init_args="(record { - swap_account = $SWAP_ACCOUNT; admins = vec { $(for admin in $ADMINS; do echo "principal \"$admin\";"; done) }; - ckbtc_canister = principal \"mxzaz-hqaaa-aaaar-qaada-cai\"; icp_ledger_canister = principal \"ryjl3-tyaaa-aaaaa-aaaba-cai\"; - xrc_canister = principal \"uf6dk-hyaaa-aaaaq-qaaaq-cai\"; })" dfx deploy --mode=$INSTALL_MODE --yes --network="$NETWORK" --argument="$ekoke_liquidity_pool_init_args" ekoke-liquidity-pool diff --git a/scripts/deploy_ic.sh b/scripts/deploy_ic.sh index 296c121..b4a2087 100755 --- a/scripts/deploy_ic.sh +++ b/scripts/deploy_ic.sh @@ -6,7 +6,6 @@ source ./deploy_functions.sh source ./did.sh ADMIN_PRINCIPAL="$(dfx identity get-principal)" -SWAP_ACCOUNT="$(account "$ADMIN_PRINCIPAL")" ERC20_BRIDGE_ADDRESS="0xc08e14F47382BCc1dA6c3Ff366018cAb1c77091F" ERC20_SWAP_FEE="231634000000000" ERC20_NETWORK="Ethereum" @@ -48,7 +47,7 @@ case "$CANISTER" in ;; "ekoke-liquidity-pool") - deploy_ekoke_liquidity_pool "reinstall" "ic" "$EKOKE_LIQUIDITY_POOL_PRINCIPAL" "$ADMIN_PRINCIPAL" "$SWAP_ACCOUNT" + deploy_ekoke_liquidity_pool "reinstall" "ic" "$EKOKE_LIQUIDITY_POOL_PRINCIPAL" "$ADMIN_PRINCIPAL" ;; "ekoke-reward-pool") diff --git a/scripts/deploy_local.sh b/scripts/deploy_local.sh index 778bad1..ec37bab 100755 --- a/scripts/deploy_local.sh +++ b/scripts/deploy_local.sh @@ -14,7 +14,6 @@ source ./deploy_functions.sh source ./did.sh ADMIN_PRINCIPAL="$(dfx identity get-principal)" -SWAP_ACCOUNT="$(account "$ADMIN_PRINCIPAL")" ERC20_BRIDGE_ADDRESS="0xc08e14F47382BCc1dA6c3Ff366018cAb1c77091F" ERC20_SWAP_FEE="231634000000000" ERC20_NETWORK="Sepolia" @@ -28,7 +27,7 @@ set -e deploy_deferred "reinstall" "local" "$DEFERRED_PRINCIPAL" "$EKOKE_REWARD_POOL_PRINCIPAL" "$MARKETPLACE_PRINCIPAL" "$ADMIN_PRINCIPAL" deploy_ekoke_erc20_swap "reinstall" "local" "$EKOKE_ERC20_SWAP_PRINCIPAL" "$ADMIN_PRINCIPAL" "$EKOKE_LEDGER_PRINCIPAL" "$ERC20_BRIDGE_ADDRESS" "$ERC20_SWAP_FEE" "$ERC20_NETWORK" -deploy_ekoke_liquidity_pool "reinstall" "local" "$EKOKE_LIQUIDITY_POOL_PRINCIPAL" "$ADMIN_PRINCIPAL" "$SWAP_ACCOUNT" +deploy_ekoke_liquidity_pool "reinstall" "local" "$EKOKE_LIQUIDITY_POOL_PRINCIPAL" "$ADMIN_PRINCIPAL" deploy_ekoke_reward_pool "reinstall" "local" "$EKOKE_REWARD_POOL_PRINCIPAL" "$ADMIN_PRINCIPAL" "$EKOKE_LEDGER_PRINCIPAL" "$DEFERRED_PRINCIPAL" "$MARKETPLACE_PRINCIPAL" deploy_marketplace "reinstall" "local" "$MARKETPLACE_PRINCIPAL" "$DEFERRED_PRINCIPAL" "$EKOKE_REWARD_POOL_PRINCIPAL" "$ADMIN_PRINCIPAL" "$EKOKE_LIQUIDITY_POOL_PRINCIPAL" diff --git a/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did b/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did index 3e22068..765923c 100644 --- a/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did +++ b/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did @@ -42,9 +42,6 @@ type EkokeError = variant { }; type EkokeLiquidityPoolInitData = record { icp_ledger_canister : principal; - ckbtc_canister : principal; - swap_account : Account; - xrc_canister : principal; admins : vec principal; }; type HttpRequest = record { @@ -59,8 +56,8 @@ type HttpResponse = record { upgrade : opt bool; status_code : nat16; }; -type LiquidityPoolAccounts = record { icp : Account; ckbtc : Account }; -type LiquidityPoolBalance = record { icp : nat; ckbtc : nat }; +type LiquidityPoolAccounts = record { icp : Account }; +type LiquidityPoolBalance = record { icp : nat }; type PoolError = variant { PoolNotFound : nat; NotEnoughTokens }; type RegisterError = variant { TransactionNotFound }; type RejectionCode = variant { @@ -97,10 +94,7 @@ type TransferFromError = variant { service : (EkokeLiquidityPoolInitData) -> { admin_cycles : () -> (nat) query; admin_set_admins : (vec principal) -> (); - admin_set_ckbtc_canister : (principal) -> (); admin_set_icp_ledger_canister : (principal) -> (); - admin_set_swap_account : (Account) -> (); - admin_set_xrc_canister : (principal) -> (); http_request : (HttpRequest) -> (HttpResponse) query; liquidity_pool_accounts : () -> (LiquidityPoolAccounts) query; liquidity_pool_balance : () -> (Result) query; diff --git a/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.d.ts b/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.d.ts index b45c99b..ca3991d 100644 --- a/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.d.ts +++ b/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.d.ts @@ -45,9 +45,6 @@ export type EkokeError = { 'Configuration' : ConfigurationError } | { 'Ecdsa' : EcdsaError }; export interface EkokeLiquidityPoolInitData { 'icp_ledger_canister' : Principal, - 'ckbtc_canister' : Principal, - 'swap_account' : Account, - 'xrc_canister' : Principal, 'admins' : Array, } export interface HttpRequest { @@ -62,8 +59,8 @@ export interface HttpResponse { 'upgrade' : [] | [boolean], 'status_code' : number, } -export interface LiquidityPoolAccounts { 'icp' : Account, 'ckbtc' : Account } -export interface LiquidityPoolBalance { 'icp' : bigint, 'ckbtc' : bigint } +export interface LiquidityPoolAccounts { 'icp' : Account } +export interface LiquidityPoolBalance { 'icp' : bigint } export type PoolError = { 'PoolNotFound' : bigint } | { 'NotEnoughTokens' : null }; export type RegisterError = { 'TransactionNotFound' : null }; @@ -100,10 +97,7 @@ export type TransferFromError = { export interface _SERVICE { 'admin_cycles' : ActorMethod<[], bigint>, 'admin_set_admins' : ActorMethod<[Array], undefined>, - 'admin_set_ckbtc_canister' : ActorMethod<[Principal], undefined>, 'admin_set_icp_ledger_canister' : ActorMethod<[Principal], undefined>, - 'admin_set_swap_account' : ActorMethod<[Account], undefined>, - 'admin_set_xrc_canister' : ActorMethod<[Principal], undefined>, 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, 'liquidity_pool_accounts' : ActorMethod<[], LiquidityPoolAccounts>, 'liquidity_pool_balance' : ActorMethod<[], Result>, diff --git a/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.js b/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.js index f5def3c..e6c0ab8 100644 --- a/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.js +++ b/src/declarations/ekoke-liquidity-pool/ekoke-liquidity-pool.did.js @@ -1,13 +1,6 @@ export const idlFactory = ({ IDL }) => { - const Account = IDL.Record({ - 'owner' : IDL.Principal, - 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)), - }); const EkokeLiquidityPoolInitData = IDL.Record({ 'icp_ledger_canister' : IDL.Principal, - 'ckbtc_canister' : IDL.Principal, - 'swap_account' : Account, - 'xrc_canister' : IDL.Principal, 'admins' : IDL.Vec(IDL.Principal), }); const HttpRequest = IDL.Record({ @@ -22,14 +15,12 @@ export const idlFactory = ({ IDL }) => { 'upgrade' : IDL.Opt(IDL.Bool), 'status_code' : IDL.Nat16, }); - const LiquidityPoolAccounts = IDL.Record({ - 'icp' : Account, - 'ckbtc' : Account, - }); - const LiquidityPoolBalance = IDL.Record({ - 'icp' : IDL.Nat, - 'ckbtc' : IDL.Nat, + const Account = IDL.Record({ + 'owner' : IDL.Principal, + 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)), }); + const LiquidityPoolAccounts = IDL.Record({ 'icp' : Account }); + const LiquidityPoolBalance = IDL.Record({ 'icp' : IDL.Nat }); const ConfigurationError = IDL.Variant({ 'AdminsCantBeEmpty' : IDL.Null, 'AnonymousAdmin' : IDL.Null, @@ -128,10 +119,7 @@ export const idlFactory = ({ IDL }) => { return IDL.Service({ 'admin_cycles' : IDL.Func([], [IDL.Nat], ['query']), 'admin_set_admins' : IDL.Func([IDL.Vec(IDL.Principal)], [], []), - 'admin_set_ckbtc_canister' : IDL.Func([IDL.Principal], [], []), 'admin_set_icp_ledger_canister' : IDL.Func([IDL.Principal], [], []), - 'admin_set_swap_account' : IDL.Func([Account], [], []), - 'admin_set_xrc_canister' : IDL.Func([IDL.Principal], [], []), 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), 'liquidity_pool_accounts' : IDL.Func( [], @@ -142,15 +130,8 @@ export const idlFactory = ({ IDL }) => { }); }; export const init = ({ IDL }) => { - const Account = IDL.Record({ - 'owner' : IDL.Principal, - 'subaccount' : IDL.Opt(IDL.Vec(IDL.Nat8)), - }); const EkokeLiquidityPoolInitData = IDL.Record({ 'icp_ledger_canister' : IDL.Principal, - 'ckbtc_canister' : IDL.Principal, - 'swap_account' : Account, - 'xrc_canister' : IDL.Principal, 'admins' : IDL.Vec(IDL.Principal), }); return [EkokeLiquidityPoolInitData]; diff --git a/src/did/src/ekoke_liquidity_pool.rs b/src/did/src/ekoke_liquidity_pool.rs index 22b5e8e..49780c7 100644 --- a/src/did/src/ekoke_liquidity_pool.rs +++ b/src/did/src/ekoke_liquidity_pool.rs @@ -3,7 +3,6 @@ mod liquidity_pool; use candid::{CandidType, Deserialize, Principal}; -use icrc::icrc1::account::Account; pub use self::liquidity_pool::{LiquidityPoolAccounts, LiquidityPoolBalance}; @@ -11,12 +10,6 @@ pub use self::liquidity_pool::{LiquidityPoolAccounts, LiquidityPoolBalance}; #[derive(Debug, Clone, CandidType, Deserialize)] pub struct EkokeLiquidityPoolInitData { pub admins: Vec, - /// The canister ID of the CKBTC canister - pub ckbtc_canister: Principal, /// ICP ledger canister id pub icp_ledger_canister: Principal, - /// Swap account - pub swap_account: Account, - /// XRC canister - pub xrc_canister: Principal, } diff --git a/src/did/src/ekoke_liquidity_pool/liquidity_pool.rs b/src/did/src/ekoke_liquidity_pool/liquidity_pool.rs index 472e48c..c20ca4a 100644 --- a/src/did/src/ekoke_liquidity_pool/liquidity_pool.rs +++ b/src/did/src/ekoke_liquidity_pool/liquidity_pool.rs @@ -5,8 +5,6 @@ use serde::Serialize; /// The accounts that hold the liquidity pools for the CKBTC and ICP tokens. #[derive(Clone, Debug, PartialEq, Eq, CandidType, Deserialize, Serialize)] pub struct LiquidityPoolAccounts { - /// The account that holds the pool for the CKBTC token. - pub ckbtc: Account, /// The account that holds the pool for the ICP tokens. pub icp: Account, } @@ -14,8 +12,6 @@ pub struct LiquidityPoolAccounts { /// The balance of the liquidity pool #[derive(Clone, Debug, PartialEq, Eq, CandidType, Deserialize, Serialize)] pub struct LiquidityPoolBalance { - /// CKBTC tokens hold in the liquidity pool - pub ckbtc: Nat, /// ICP tokens hold in the liquidity pool pub icp: Nat, } diff --git a/src/ekoke_liquidity_pool/Cargo.toml b/src/ekoke_liquidity_pool/Cargo.toml index fe1b52d..03e7440 100644 --- a/src/ekoke_liquidity_pool/Cargo.toml +++ b/src/ekoke_liquidity_pool/Cargo.toml @@ -30,7 +30,6 @@ icrc = { path = "../icrc" } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } -xrc = { path = "../xrc" } [dev-dependencies] pretty_assertions = "1" diff --git a/src/ekoke_liquidity_pool/ekoke-liquidity-pool.did b/src/ekoke_liquidity_pool/ekoke-liquidity-pool.did index 3e22068..765923c 100644 --- a/src/ekoke_liquidity_pool/ekoke-liquidity-pool.did +++ b/src/ekoke_liquidity_pool/ekoke-liquidity-pool.did @@ -42,9 +42,6 @@ type EkokeError = variant { }; type EkokeLiquidityPoolInitData = record { icp_ledger_canister : principal; - ckbtc_canister : principal; - swap_account : Account; - xrc_canister : principal; admins : vec principal; }; type HttpRequest = record { @@ -59,8 +56,8 @@ type HttpResponse = record { upgrade : opt bool; status_code : nat16; }; -type LiquidityPoolAccounts = record { icp : Account; ckbtc : Account }; -type LiquidityPoolBalance = record { icp : nat; ckbtc : nat }; +type LiquidityPoolAccounts = record { icp : Account }; +type LiquidityPoolBalance = record { icp : nat }; type PoolError = variant { PoolNotFound : nat; NotEnoughTokens }; type RegisterError = variant { TransactionNotFound }; type RejectionCode = variant { @@ -97,10 +94,7 @@ type TransferFromError = variant { service : (EkokeLiquidityPoolInitData) -> { admin_cycles : () -> (nat) query; admin_set_admins : (vec principal) -> (); - admin_set_ckbtc_canister : (principal) -> (); admin_set_icp_ledger_canister : (principal) -> (); - admin_set_swap_account : (Account) -> (); - admin_set_xrc_canister : (principal) -> (); http_request : (HttpRequest) -> (HttpResponse) query; liquidity_pool_accounts : () -> (LiquidityPoolAccounts) query; liquidity_pool_balance : () -> (Result) query; diff --git a/src/ekoke_liquidity_pool/src/app.rs b/src/ekoke_liquidity_pool/src/app.rs index 2b1ce2e..f9df7b8 100644 --- a/src/ekoke_liquidity_pool/src/app.rs +++ b/src/ekoke_liquidity_pool/src/app.rs @@ -3,15 +3,12 @@ mod inspect; mod liquidity_pool; mod memory; mod roles; -#[cfg(test)] -mod test_utils; use candid::{Nat, Principal}; use did::ekoke::EkokeResult; use did::ekoke_liquidity_pool::{ EkokeLiquidityPoolInitData, LiquidityPoolAccounts, LiquidityPoolBalance, }; -use icrc::icrc1::account::Account; use self::configuration::Configuration; pub use self::inspect::Inspect; @@ -19,40 +16,13 @@ use self::liquidity_pool::LiquidityPool; use self::roles::RolesManager; use crate::utils; -#[cfg(target_family = "wasm")] -pub const LIQUIDITY_POOL_SWAP_INTERVAL: std::time::Duration = - std::time::Duration::from_secs(60 * 60 * 24); // 1 day - pub struct EkokeLiquidityPoolCanister; impl EkokeLiquidityPoolCanister { pub fn init(args: EkokeLiquidityPoolInitData) { - Configuration::set_ckbtc_canister(args.ckbtc_canister); Configuration::set_icp_ledger_canister(args.icp_ledger_canister); - Configuration::set_swap_account(args.swap_account); - Configuration::set_xrc_canister(args.xrc_canister); LiquidityPool::init(); RolesManager::set_admins(args.admins).unwrap(); - - Self::set_timers(); - } - - pub fn post_upgrade() { - Self::set_timers(); - } - - /// Set application timers - fn set_timers() { - #[cfg(target_family = "wasm")] - async fn swap_icp_to_btc_timer() { - let xrc_principal = Configuration::get_xrc_canister(); - let _ = LiquidityPool::swap_icp_to_btc(xrc_principal).await; - } - // Liquidity pool ICP -> BTC swap timer - #[cfg(target_family = "wasm")] - ic_cdk_timers::set_timer_interval(LIQUIDITY_POOL_SWAP_INTERVAL, || { - ic_cdk::spawn(swap_icp_to_btc_timer()); - }); } /// Get liquidity pool balance from the different ledgers @@ -73,22 +43,6 @@ impl EkokeLiquidityPoolCanister { utils::cycles() } - /// Set swap account - pub fn admin_set_swap_account(account: Account) { - if !Inspect::inspect_is_admin(utils::caller()) { - ic_cdk::trap("Unauthorized"); - } - Configuration::set_swap_account(account); - } - - /// Set ckbtc canister - pub fn admin_set_ckbtc_canister(canister_id: Principal) { - if !Inspect::inspect_is_admin(utils::caller()) { - ic_cdk::trap("Unauthorized"); - } - Configuration::set_ckbtc_canister(canister_id); - } - /// Set icp ledger canister pub fn admin_set_icp_ledger_canister(canister_id: Principal) { if !Inspect::inspect_is_admin(utils::caller()) { @@ -103,14 +57,6 @@ impl EkokeLiquidityPoolCanister { } RolesManager::set_admins(admins).unwrap(); } - - /// Set xrc canister - pub fn admin_set_xrc_canister(canister_id: Principal) { - if !Inspect::inspect_is_admin(utils::caller()) { - ic_cdk::trap("Unauthorized"); - } - Configuration::set_xrc_canister(canister_id); - } } #[cfg(test)] @@ -120,7 +66,6 @@ mod test { use pretty_assertions::assert_eq; - use super::test_utils::bob_account; use super::*; use crate::utils::caller; @@ -131,16 +76,11 @@ mod test { assert_eq!(RolesManager::get_admins(), vec![caller()]); // liquidity pool - assert_eq!(LiquidityPool::accounts().ckbtc.owner, utils::id()); - assert!(LiquidityPool::accounts().ckbtc.subaccount.is_none()); - - // swap account - assert_eq!(Configuration::get_swap_account(), bob_account()); + assert_eq!(LiquidityPool::accounts().icp.owner, utils::id()); + assert!(LiquidityPool::accounts().icp.subaccount.is_none()); // check canisters - assert_eq!(Configuration::get_ckbtc_canister(), caller()); assert_eq!(Configuration::get_icp_ledger_canister(), caller()); - assert_eq!(Configuration::get_xrc_canister(), caller()); } #[tokio::test] @@ -149,22 +89,6 @@ mod test { assert_eq!(EkokeLiquidityPoolCanister::admin_cycles(), utils::cycles()); } - #[test] - fn test_should_set_xrc_canister() { - init_canister(); - let canister_id = Principal::from_str("aaaaa-aa").unwrap(); - EkokeLiquidityPoolCanister::admin_set_xrc_canister(canister_id); - assert_eq!(Configuration::get_xrc_canister(), canister_id); - } - - #[test] - fn test_should_set_ckbtc_canister() { - init_canister(); - let canister_id = Principal::from_str("aaaaa-aa").unwrap(); - EkokeLiquidityPoolCanister::admin_set_ckbtc_canister(canister_id); - assert_eq!(Configuration::get_ckbtc_canister(), canister_id); - } - #[test] fn test_should_set_icp_ledger_canister() { init_canister(); @@ -184,10 +108,7 @@ mod test { fn init_canister() { let data = EkokeLiquidityPoolInitData { admins: vec![caller()], - swap_account: bob_account(), - ckbtc_canister: caller(), icp_ledger_canister: caller(), - xrc_canister: caller(), }; EkokeLiquidityPoolCanister::init(data); } diff --git a/src/ekoke_liquidity_pool/src/app/configuration.rs b/src/ekoke_liquidity_pool/src/app/configuration.rs index cc80fd4..ecf1daf 100644 --- a/src/ekoke_liquidity_pool/src/app/configuration.rs +++ b/src/ekoke_liquidity_pool/src/app/configuration.rs @@ -5,78 +5,24 @@ use std::cell::RefCell; use candid::Principal; -use did::{StorableAccount, StorablePrincipal}; +use did::StorablePrincipal; use ic_stable_structures::memory_manager::VirtualMemory; use ic_stable_structures::{DefaultMemoryImpl, StableCell}; -use icrc::icrc1::account::Account; -use crate::app::memory::{ - CKBTC_CANISTER_MEMORY_ID, ICP_LEDGER_CANISTER_MEMORY_ID, MEMORY_MANAGER, - SWAP_ACCOUNT_MEMORY_ID, XRC_CANISTER_MEMORY_ID, -}; +use crate::app::memory::{ICP_LEDGER_CANISTER_MEMORY_ID, MEMORY_MANAGER}; thread_local! { - - /// Swap account - static SWAP_ACCOUNT: RefCell>> = - RefCell::new(StableCell::new(MEMORY_MANAGER.with(|mm| mm.get(SWAP_ACCOUNT_MEMORY_ID)), - Account { - owner: Principal::anonymous(), - subaccount: None - }.into()).unwrap() - ); - - - /// Ckbtc canister - static CKBTC_CANISTER: RefCell>> = - RefCell::new(StableCell::new(MEMORY_MANAGER.with(|mm| mm.get(CKBTC_CANISTER_MEMORY_ID)), - Principal::anonymous().into()).unwrap() - ); - /// ICP ledger canister static ICP_LEDGER_CANISTER: RefCell>> = RefCell::new(StableCell::new(MEMORY_MANAGER.with(|mm| mm.get(ICP_LEDGER_CANISTER_MEMORY_ID)), Principal::anonymous().into()).unwrap() ); - - /// Xrc canister - static XRC_CANISTER: RefCell>> = - RefCell::new(StableCell::new(MEMORY_MANAGER.with(|mm| mm.get(XRC_CANISTER_MEMORY_ID)), - Principal::anonymous().into()).unwrap() - ); - - } /// canister configuration pub struct Configuration; impl Configuration { - /// Set swap account - pub fn set_swap_account(swap_account: Account) { - SWAP_ACCOUNT.with_borrow_mut(|cell| { - cell.set(swap_account.into()).unwrap(); - }); - } - - /// Get swap account address - pub fn get_swap_account() -> Account { - SWAP_ACCOUNT.with(|sa| sa.borrow().get().0) - } - - /// Set ckbtc canister address - pub fn set_ckbtc_canister(canister_id: Principal) { - CKBTC_CANISTER.with_borrow_mut(|cell| { - cell.set(canister_id.into()).unwrap(); - }); - } - - /// Get ckbtc canister address - #[allow(dead_code)] - pub fn get_ckbtc_canister() -> Principal { - CKBTC_CANISTER.with(|ckbtc| ckbtc.borrow().get().0) - } - /// Set icp ledger canister principal pub fn set_icp_ledger_canister(canister_id: Principal) { ICP_LEDGER_CANISTER.with_borrow_mut(|cell| { @@ -89,19 +35,6 @@ impl Configuration { pub fn get_icp_ledger_canister() -> Principal { ICP_LEDGER_CANISTER.with(|icp| icp.borrow().get().0) } - - /// Set xrc canister address - pub fn set_xrc_canister(canister_id: Principal) { - XRC_CANISTER.with_borrow_mut(|cell| { - cell.set(canister_id.into()).unwrap(); - }); - } - - /// Get xrc canister address - #[allow(dead_code)] - pub fn get_xrc_canister() -> Principal { - XRC_CANISTER.with(|xrc| xrc.borrow().get().0) - } } #[cfg(test)] @@ -112,14 +45,6 @@ mod test { use pretty_assertions::assert_eq; use super::*; - use crate::app::test_utils::bob_account; - - #[test] - fn test_should_set_swap_account() { - let swap_account = bob_account(); - Configuration::set_swap_account(swap_account); - assert_eq!(Configuration::get_swap_account(), swap_account); - } #[test] fn test_should_set_icp_canister() { @@ -129,22 +54,4 @@ mod test { Configuration::set_icp_ledger_canister(principal); assert_eq!(Configuration::get_icp_ledger_canister(), principal); } - - #[test] - fn test_should_set_ckbtc_canister() { - let principal = - Principal::from_str("bs5l3-6b3zu-dpqyj-p2x4a-jyg4k-goneb-afof2-y5d62-skt67-3756q-dqe") - .unwrap(); - Configuration::set_ckbtc_canister(principal); - assert_eq!(Configuration::get_ckbtc_canister(), principal); - } - - #[test] - fn test_should_set_xrc_canister() { - let principal = - Principal::from_str("bs5l3-6b3zu-dpqyj-p2x4a-jyg4k-goneb-afof2-y5d62-skt67-3756q-dqe") - .unwrap(); - Configuration::set_xrc_canister(principal); - assert_eq!(Configuration::get_xrc_canister(), principal); - } } diff --git a/src/ekoke_liquidity_pool/src/app/liquidity_pool.rs b/src/ekoke_liquidity_pool/src/app/liquidity_pool.rs index 9d7a81e..b70f23d 100644 --- a/src/ekoke_liquidity_pool/src/app/liquidity_pool.rs +++ b/src/ekoke_liquidity_pool/src/app/liquidity_pool.rs @@ -1,14 +1,10 @@ //! The liquidity pool provides the access to the internal "deposit-only" pool of liquidity that //! backs the value of the Ekoke token. -//! The pool can both contain ICP and ckBTC. -// ! The pool is not owned by anyone, and is not controlled by anyone, except the canister. - -mod xrc; use std::cell::RefCell; -use candid::{Nat, Principal}; -use did::ekoke::{BalanceError, EkokeError, EkokeResult}; +use candid::Principal; +use did::ekoke::{EkokeError, EkokeResult}; use did::ekoke_liquidity_pool::{LiquidityPoolAccounts, LiquidityPoolBalance}; use did::StorableAccount; use ic_stable_structures::memory_manager::VirtualMemory; @@ -16,11 +12,8 @@ use ic_stable_structures::{DefaultMemoryImpl, StableCell}; use icrc::icrc1::account::Account; use icrc::IcrcLedgerClient; -use self::xrc::Xrc; use crate::app::configuration::Configuration; -use crate::app::memory::{ - LIQUIDITY_POOL_ACCOUNT_MEMORY_ID, LIQUIDITY_POOL_CKBTC_ACCOUNT_MEMORY_ID, MEMORY_MANAGER, -}; +use crate::app::memory::{LIQUIDITY_POOL_ACCOUNT_MEMORY_ID, MEMORY_MANAGER}; use crate::utils; thread_local! { @@ -32,16 +25,6 @@ thread_local! { subaccount: None, }.into()).unwrap() ); - - /// Pool map is an association between a contract-id and the account which holds the pool for that contract. - /// There is an account for each contract. - static CKBTC_ACCOUNT: RefCell>> = - RefCell::new(StableCell::new(MEMORY_MANAGER.with(|mm| mm.get(LIQUIDITY_POOL_CKBTC_ACCOUNT_MEMORY_ID)), - Account { - owner: Principal::anonymous(), - subaccount: None, - }.into()).unwrap() - ); } pub struct LiquidityPool; @@ -49,19 +32,7 @@ pub struct LiquidityPool; impl LiquidityPool { /// Init liquidity pool pub fn init() { - // generate CkBTC account - CKBTC_ACCOUNT.with_borrow_mut(|account| { - account - .set( - Account { - owner: utils::id(), - subaccount: None, - } - .into(), - ) - .unwrap(); - }); - // generate CkBTC account + // generate ICP account ICP_ACCOUNT.with_borrow_mut(|account| { account .set( @@ -79,7 +50,6 @@ impl LiquidityPool { pub fn accounts() -> LiquidityPoolAccounts { LiquidityPoolAccounts { icp: ICP_ACCOUNT.with_borrow(|account| *account.get()).0, - ckbtc: CKBTC_ACCOUNT.with_borrow(|account| *account.get()).0, } } @@ -87,119 +57,14 @@ impl LiquidityPool { pub async fn balance() -> EkokeResult { let accounts = Self::accounts(); let icp_client = IcrcLedgerClient::from(Configuration::get_icp_ledger_canister()); - let ckbtc_client = IcrcLedgerClient::from(Configuration::get_ckbtc_canister()); let icp_balance = icp_client .icrc1_balance_of(accounts.icp) .await .map_err(|(code, msg)| EkokeError::CanisterCall(code, msg))?; - let ckbtc_balance = ckbtc_client - .icrc1_balance_of(accounts.ckbtc) - .await - .map_err(|(code, msg)| EkokeError::CanisterCall(code, msg))?; - Ok(LiquidityPoolBalance { - icp: icp_balance, - ckbtc: ckbtc_balance, - }) + Ok(LiquidityPoolBalance { icp: icp_balance }) } - - /// Swap the current liquidity pool in ICP to BTC using the swap account - #[allow(dead_code)] - pub async fn swap_icp_to_btc(xrc_principal: Principal) -> EkokeResult<()> { - // get the current exchange rate ICP/BTC - let rate = Xrc::get_icp_to_btc_rate(xrc_principal).await?; - let ckbtc_client = IcrcLedgerClient::from(Configuration::get_ckbtc_canister()); - // get current balance of swap account of CKBTC - let swap_account_balance = ckbtc_client - .icrc1_balance_of(Configuration::get_swap_account()) - .await - .map_err(|(code, msg)| EkokeError::CanisterCall(code, msg))?; - // get current ICP balance of the liquidity pool - let accounts = Self::accounts(); - let liquidity_pool_balance = Self::balance().await?; - - // check ckbtc allowance - let allowance = ckbtc_client - .icrc2_allowance(accounts.ckbtc, Configuration::get_swap_account()) - .await - .map_err(|(code, msg)| EkokeError::CanisterCall(code, msg))? - .allowance; - - // get amounts to trade - let amounts = Self::get_exchange_amounts( - rate, - allowance, - swap_account_balance, - liquidity_pool_balance.icp.clone(), - ); - - // check ICP balance - if liquidity_pool_balance.icp < amounts.icp { - // abort - return Err(EkokeError::Balance(BalanceError::InsufficientBalance)); - } - - // send ICP to swap account - let icp_client = IcrcLedgerClient::from(Configuration::get_icp_ledger_canister()); - icp_client - .icrc1_transfer( - Configuration::get_swap_account(), - liquidity_pool_balance.icp, - ) - .await - .map_err(|(code, msg)| EkokeError::CanisterCall(code, msg))? - .map_err(EkokeError::Icrc1Transfer)?; - // send BTC to liquidity pool - ckbtc_client - .icrc2_transfer_from( - accounts.ckbtc.subaccount, - Configuration::get_swap_account(), - accounts.ckbtc, - amounts.btc, - ) - .await - .map_err(|(code, msg)| EkokeError::CanisterCall(code, msg))? - .map_err(EkokeError::Icrc2Transfer)?; - - Ok(()) - } - - /// given exchange rates, the maximum allowance and the swap account balance and the liquidity pool balance - /// calculate the values to exchange in both ICP and BTC. - /// The values must match if converted to the same currency. - fn get_exchange_amounts( - icp_btc_rate: f64, - allowance: Nat, - swap_account_balance: Nat, - liquidity_pool_icp_balance: Nat, - ) -> ExchangeAmounts { - let sats_rate = Nat::from((icp_btc_rate * 100_000_000_f64) as u64); - // convert the ICP to Sats - let liquidity_pool_btc_balance = - (liquidity_pool_icp_balance.clone() * sats_rate.clone()) / 10_u32.pow(8); - println!("liquidity_pool_btc_balance: {}", liquidity_pool_btc_balance); - - // get the amount to exchange - // get the minimum between the allowance, the swap account BTC balance and the liquidity pool ICP balance (expressed in sats) - let sats_to_send_to_liquidity_pool = swap_account_balance - .min(allowance) - .min(liquidity_pool_btc_balance); - // convert to ICP - let icp_to_send_to_swap_account = - sats_to_send_to_liquidity_pool.clone() * 10_u32.pow(8) / sats_rate; - - ExchangeAmounts { - icp: icp_to_send_to_swap_account, - btc: sats_to_send_to_liquidity_pool, - } - } -} - -struct ExchangeAmounts { - icp: Nat, - /// Sats - btc: Nat, } #[cfg(test)] @@ -213,12 +78,8 @@ mod test { fn test_should_init_and_get_accounts() { LiquidityPool::init(); let account = LiquidityPool::accounts(); - assert_eq!(account.ckbtc.owner, utils::id()); assert_eq!(account.icp.owner, utils::id()); - assert_eq!( - account.ckbtc, - CKBTC_ACCOUNT.with_borrow(|account| account.get().clone()).0 - ); + assert_eq!( account.icp, ICP_ACCOUNT.with_borrow(|account| account.get().clone()).0 @@ -229,37 +90,6 @@ mod test { async fn test_should_get_balance() { LiquidityPool::init(); let balance = LiquidityPool::balance().await.unwrap(); - assert_eq!(balance.ckbtc, 888010101000000u64); assert_eq!(balance.icp, 888010101000000u64); } - - #[test] - fn test_should_calculate_the_exchange_amounts_icp_lt_btc() { - let icp_btc_rate = 0.00021543; - let swap_balance: Nat = 5_299_287_u64.into(); // about 2245$ - let allowance: Nat = 5_000_000_u64.into(); - let icp_balance: Nat = 716_774_022_u64.into(); // about 65$ - - // get amounts - let amounts = - LiquidityPool::get_exchange_amounts(icp_btc_rate, allowance, swap_balance, icp_balance); - - assert_eq!(amounts.btc, 154_414_u64); - assert_eq!(amounts.icp, 716_771_108_u64); - } - - #[test] - fn test_should_calculate_the_exchange_amounts_icp_gt_btc() { - let icp_btc_rate = 0.00021543; - let swap_balance: Nat = 5_299_287_u64.into(); // about 2245$ - let allowance: Nat = 50_000_u64.into(); // about 40$ - let icp_balance: Nat = 716_774_022_u64.into(); // about 65$ - - // get amounts - let amounts = - LiquidityPool::get_exchange_amounts(icp_btc_rate, allowance, swap_balance, icp_balance); - - assert_eq!(amounts.btc, 50_000_u64); - assert_eq!(amounts.icp, 232_093_951_u64); - } } diff --git a/src/ekoke_liquidity_pool/src/app/liquidity_pool/xrc.rs b/src/ekoke_liquidity_pool/src/app/liquidity_pool/xrc.rs deleted file mode 100644 index d483cf0..0000000 --- a/src/ekoke_liquidity_pool/src/app/liquidity_pool/xrc.rs +++ /dev/null @@ -1,51 +0,0 @@ -use candid::Principal; -#[cfg(target_arch = "wasm32")] -use did::ekoke::EkokeError; -use did::ekoke::EkokeResult; -#[cfg(target_arch = "wasm32")] -use xrc::{Asset, AssetClass, XrcClient}; - -pub struct Xrc; - -impl Xrc { - /// Get the ICP to BTC rate - /// Then you can convert ICP to BTC with: - /// BTC = value * ExchangeRate - #[allow(unused_variables)] - pub async fn get_icp_to_btc_rate(xrc_principal: Principal) -> EkokeResult { - #[cfg(not(target_arch = "wasm32"))] - { - Ok(0.0002162) - } - #[cfg(target_arch = "wasm32")] - { - let xrc = XrcClient::new(xrc_principal); - - // Base is the one on the left ICP/BTC - let base_asset = Asset { - symbol: "ICP".to_string(), - class: AssetClass::Cryptocurrency, - }; - let quote_asset = Asset { - symbol: "BTC".to_string(), - class: AssetClass::Cryptocurrency, - }; - - match xrc - .get_exchange_rate(base_asset, quote_asset) - .await - .map_err(|(rc, m)| EkokeError::CanisterCall(rc, m)) - { - Err(ekoke_error) => Err(ekoke_error), - Ok(Ok(exchange_rate)) => { - let rate = exchange_rate.rate as f64; - let decimals = exchange_rate.metadata.decimals; - let rate = rate / (10_u32.pow(decimals) as f64); - - Ok(rate) - } - Ok(Err(_)) => Err(EkokeError::XrcError), - } - } - } -} diff --git a/src/ekoke_liquidity_pool/src/app/memory.rs b/src/ekoke_liquidity_pool/src/app/memory.rs index dd9b1f6..31fe496 100644 --- a/src/ekoke_liquidity_pool/src/app/memory.rs +++ b/src/ekoke_liquidity_pool/src/app/memory.rs @@ -3,14 +3,10 @@ use ic_stable_structures::DefaultMemoryImpl; // Liquidity pool pub const LIQUIDITY_POOL_ACCOUNT_MEMORY_ID: MemoryId = MemoryId::new(10); -pub const LIQUIDITY_POOL_CKBTC_ACCOUNT_MEMORY_ID: MemoryId = MemoryId::new(11); // Configuration pub const ADMINS_MEMORY_ID: MemoryId = MemoryId::new(20); -pub const CKBTC_CANISTER_MEMORY_ID: MemoryId = MemoryId::new(21); -pub const ICP_LEDGER_CANISTER_MEMORY_ID: MemoryId = MemoryId::new(22); -pub const SWAP_ACCOUNT_MEMORY_ID: MemoryId = MemoryId::new(23); -pub const XRC_CANISTER_MEMORY_ID: MemoryId = MemoryId::new(24); +pub const ICP_LEDGER_CANISTER_MEMORY_ID: MemoryId = MemoryId::new(21); thread_local! { /// Memory manager diff --git a/src/ekoke_liquidity_pool/src/app/test_utils.rs b/src/ekoke_liquidity_pool/src/app/test_utils.rs deleted file mode 100644 index d570209..0000000 --- a/src/ekoke_liquidity_pool/src/app/test_utils.rs +++ /dev/null @@ -1,17 +0,0 @@ -use candid::Principal; -use icrc::icrc1::account::Account; - -pub fn bob() -> Principal { - Principal::from_text("bs5l3-6b3zu-dpqyj-p2x4a-jyg4k-goneb-afof2-y5d62-skt67-3756q-dqe").unwrap() -} - -pub fn bob_account() -> Account { - Account { - owner: bob(), - subaccount: Some([ - 0x21, 0xa9, 0x95, 0x49, 0xe7, 0x92, 0x90, 0x7c, 0x5e, 0x27, 0x5e, 0x54, 0x51, 0x06, - 0x8d, 0x4d, 0xdf, 0x4d, 0x43, 0xee, 0x8d, 0xca, 0xb4, 0x87, 0x56, 0x23, 0x1a, 0x8f, - 0xb7, 0x71, 0x31, 0x23, - ]), - } -} diff --git a/src/ekoke_liquidity_pool/src/lib.rs b/src/ekoke_liquidity_pool/src/lib.rs index 9fe035a..0fbf8bf 100644 --- a/src/ekoke_liquidity_pool/src/lib.rs +++ b/src/ekoke_liquidity_pool/src/lib.rs @@ -13,8 +13,7 @@ use did::ekoke::EkokeResult; use did::ekoke_liquidity_pool::{ EkokeLiquidityPoolInitData, LiquidityPoolAccounts, LiquidityPoolBalance, }; -use ic_cdk_macros::{init, post_upgrade, query, update}; -use icrc::icrc1::account::Account; +use ic_cdk_macros::{init, query, update}; use self::app::EkokeLiquidityPoolCanister; @@ -23,11 +22,6 @@ pub fn init(data: EkokeLiquidityPoolInitData) { EkokeLiquidityPoolCanister::init(data); } -#[post_upgrade] -pub fn post_upgrade() { - EkokeLiquidityPoolCanister::post_upgrade(); -} - #[query] #[candid_method(query)] pub async fn liquidity_pool_balance() -> EkokeResult { @@ -46,18 +40,6 @@ pub fn admin_cycles() -> Nat { EkokeLiquidityPoolCanister::admin_cycles() } -#[update] -#[candid_method(update)] -pub fn admin_set_swap_account(account: Account) { - EkokeLiquidityPoolCanister::admin_set_swap_account(account) -} - -#[update] -#[candid_method(update)] -pub fn admin_set_ckbtc_canister(canister_id: Principal) { - EkokeLiquidityPoolCanister::admin_set_ckbtc_canister(canister_id) -} - #[update] #[candid_method(update)] pub fn admin_set_icp_ledger_canister(canister_id: Principal) { @@ -70,12 +52,6 @@ pub fn admin_set_admins(admins: Vec) { EkokeLiquidityPoolCanister::admin_set_admins(admins) } -#[update] -#[candid_method(update)] -pub fn admin_set_xrc_canister(canister_id: Principal) { - EkokeLiquidityPoolCanister::admin_set_xrc_canister(canister_id) -} - // HTTP endpoint #[query] #[candid_method(query)] diff --git a/src/marketplace/src/client/ekoke_liquidity_pool.rs b/src/marketplace/src/client/ekoke_liquidity_pool.rs index e611266..2a89273 100644 --- a/src/marketplace/src/client/ekoke_liquidity_pool.rs +++ b/src/marketplace/src/client/ekoke_liquidity_pool.rs @@ -28,10 +28,6 @@ impl EkokeLiquidityPoolClient { owner: Principal::from_text("rrkah-fqaaa-aaaaa-aaaaq-cai").unwrap(), subaccount: None, }, - ckbtc: icrc::icrc1::account::Account { - owner: Principal::from_text("rrkah-fqaaa-aaaaa-aaaaq-cai").unwrap(), - subaccount: None, - }, }) } #[cfg(target_arch = "wasm32")]