FuelLabs/sway

Subcurrency example possible changes

Open

#2,473 建立於 2022年8月8日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)Rust (5,421 fork)batch import
P: lowThe Sway Bookdocumentationgood first issue

倉庫指標

Star
 (61,702 star)
PR 合併指標
 (平均合併 22小時 6分鐘) (30 天內合併 16 個 PR)

描述

In the "send" function in the subcurrency example, it checks that the msg_sender() Address is the same as the address of the contract creator. This seems like faulty logic as that means only the contract creator can send tokens (ever). If for some reason this is the desired logic, i think theres still a change required which would be to use a internal function to avoid repeating this piece of code

let sender: Result<Identity, AuthError> = msg_sender();
let sender: Address = match sender.unwrap() {
    Identity::Address(addr) => {
        assert(addr == ~Address::from(MINTER));
        addr
},
    _ => {
        revert(0);
    },
};

貢獻者指南