FuelLabs/sway

Subcurrency example possible changes

开放

#2,473 创建于 2022年8月8日

 (0 条评论) (0 个反应) (0 位负责人)Rust (5,421 个派生)batch import
P: lowThe Sway Bookdocumentationgood first issue

仓库指标

星标
 (61,702 个星标)
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);
    },
};

贡献者指南