From f00cd2acfaecc328fd89d467f78c5dac398cd466 Mon Sep 17 00:00:00 2001 From: Federico Date: Tue, 2 Aug 2022 16:16:03 -0300 Subject: [PATCH] use DAB proxy --- magic_bridge/ic/src/magic_bridge/src/dab.rs | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/magic_bridge/ic/src/magic_bridge/src/dab.rs b/magic_bridge/ic/src/magic_bridge/src/dab.rs index 094e1d88..00ecfa81 100644 --- a/magic_bridge/ic/src/magic_bridge/src/dab.rs +++ b/magic_bridge/ic/src/magic_bridge/src/dab.rs @@ -8,6 +8,8 @@ use crate::factory::CreateCanisterParam; use crate::{magic::STATE, types::*}; const DAB_TOKEN_ADDRESS: &str = "eclat-5qaaa-aaaaa-aaica-cai"; +const DAB_PROXY_ADDRESS: &str = "tdc6j-iiaaa-aaaah-abj2q-cai"; + const MAX_DAB_RETRIES: u8 = 10; #[derive(CandidType, Deserialize, Clone, PartialEq, Debug)] @@ -94,6 +96,7 @@ async fn register_dip20( params: &CreateCanisterParam, ) -> Result<(), OperationError> { let dab_tokens_address = ic_kit::Principal::from_str(&DAB_TOKEN_ADDRESS).unwrap(); + let dab_proxy_address = ic_kit::Principal::from_str(&DAB_PROXY_ADDRESS).unwrap(); let details = vec![ ( @@ -120,16 +123,16 @@ async fn register_dip20( details: details, }; - let canister_call: (DABResponse,) = match ic::call(dab_tokens_address, "add", (dab_args,)).await - { - Ok(res) => res, - Err((code, err)) => { - return Err(OperationError::Unknown(format!( - "RejectionCode: {:?}\n{}", - code, err - ))) - } - }; + let canister_call: (DABResponse,) = + match ic::call(dab_proxy_address, "add", (dab_tokens_address, dab_args)).await { + Ok(res) => res, + Err((code, err)) => { + return Err(OperationError::Unknown(format!( + "RejectionCode: {:?}\n{}", + code, err + ))) + } + }; match canister_call { (Ok(_),) => return Ok(()),