FuelLabs/sway

Subcurrency example possible changes

オープン

#2,473 opened on 2022/08/08

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Rust (5,421 件のフォーク)batch import
P: lowThe Sway Bookdocumentationgood first issue

Repository metrics

Stars
 (61,702 個のスター)
PR merge metrics
 (平均マージ 22h 6m) (30d で 16 merged PRs)

説明

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);
    },
};

コントリビューターガイド