NatLabs/icrc1

icrc1_transfer not decrementing fee from sender

Closed this issue · 2 comments

Hello, I am working with the Motoko Bootcamp and helped by building a quick minter for som ICRC1 tokens to be used by the students. you can check it out here :
https://dpzjy-fyaaa-aaaah-abz7a-cai.ic0.app/
That has 2 canisters and the data canister talks to an untouched implementation of your repo... it seems that it is not charging the fee on a successful transaction ... here is the candid of the token canister we launched:
https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.ic0.app/?id=db3eq-6iaaa-aaaah-abz6a-cai

we will probably take it down after the bootcamp.... I followed through the code and though it does check that the transaction has the correct fee, it is never burned... I would imagine that adding a fee subtraction to this would do the trick, but want to confirm I did not implement it incorrectly or you have a better idea ... would like to use this standard again and your repo was a great help so THANK YOU ...
the following is from src/ICRC1/Account.mo - starting at line 182


    /// Transfers tokens from the sender to the
    /// recipient in the tx request
    public func transfer_balance(
        accounts : T.AccountBalances,
        tx_req : T.TransactionRequest,
    ) {
        let { encoded; amount } = tx_req;

        update_balance(
            accounts,
            encoded.from,
            func(balance) {
                balance - amount;
            },
        );

        update_balance(
            accounts,
            encoded.to,
            func(balance) {
                balance + amount;
            },
        );
    };

please let me know, students are using this as we speak :)

Actually looks like you solved it in the latest commit ... I pulled the repo before this commit:
8584dad

Hey @mbeekman, sorry for any inconvenience this may have caused. Unfortunately, the library was not fully implemented at that time. I hope you were able to upgrade to the latest version without any issues.

I will release a stable version on GitHub and mops soon when this issue #3 is resolved.