I done local deploy
“icp_ledger_canister”: {
“type”: “custom”,
“candid”: “NO LINK ledger.did”,
“wasm”: “NO LINK ic/d87954601e4b22972899e9957e800406a0a6b929/canisters/ledger-canister.wasm.gz”,
“remote”: {
“id”: {
“ic”: “ryjl3-tyaaa-aaaaa-aaaba-cai”
}
}
},
“internet_identity” : {
“type”: “pull”,
“id”: “rdmx6-jaaaa-aaaaa-aaadq-cai”
}
and done appoval
dfx canister call --identity alice icp_ledger_canister icrc2_approve ‘(record{
spender= record {
owner = principal "’$MOTODEX_ADDRESS’";
};
amount= 1_000_000_000_000_000_000: nat;
})’
but this function call:
pub async fn purchase(type_nft: u8, referral: Option, attached_deposit: u128) {
let owner = STATE.with(|s| s.borrow_mut().contract.get_game_server());
let p = owner.owner;
let price_for_type = value_in_main_coin(type_nft);
ic_cdk::print(format!(“price_for_type {}”,price_for_type));
let caller = ic_cdk::caller();
let caller_acc = Account::from(caller);
ic_cdk::print(format!("caller {}",caller));
ic_cdk::print(format!("caller_acc {}",caller_acc));
transfer(
Principal::from_text("ryjl3-tyaaa-aaaaa-aaaba-cai").unwrap(),//MAINNET_LEDGER_CANISTER_ID,
TransferArgs {
memo: Memo(0),
amount: Tokens::from_e8s(price_for_type as u64),
fee: Tokens::from_e8s(0),//DEFAULT_FEE,//Tokens::from_e8s(0)
from_subaccount: None,
to: AccountIdentifier::new(&p, &DEFAULT_SUBACCOUNT),
created_at_time: None,
}
).await.expect("call to ledger failed").expect("transfer failed");
show no balance:
2024-02-28 10:16:37.646674 UTC: [Canister be2us-64aaa-aaaaa-qaabq-cai] Panicked at ‘transfer failed: InsufficientFunds { balance: Tokens { e8s: 0 } }’, motodex/src/update_method.rs:85:45
balance here:
Can anybody help?