aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Feature Request] Interface Pattern

Open babyface001 opened this issue 3 years ago • 6 comments
trafficstars

🚀 Feature Request

Interface Pattern for Wallet

Motivation

current wallet use 0x1::coin::transfer to transfer tokens, but how about a token with custom transfer

maybe we need some interface like ERC20

account::module::balance_of(address)
account::module::transfer

babyface001 avatar Oct 17 '22 12:10 babyface001

No interface, import module source

dulumao avatar Oct 18 '22 09:10 dulumao

@dulumao I mean for client side.

wallet app. token interface.

babyface001 avatar Oct 20 '22 12:10 babyface001

@dulumao I want a coin with custom transfer, but I can not override 0x1::coin::transfer, and wallet only call 0x1::coin::transfer to transfer, so my coin not work.

interface just a convention that a module should has some functions.

babyface001 avatar Oct 20 '22 12:10 babyface001

for example.

module Token::erc20 {
    public entry fun transfer(){
        // interface override.
        // your logic or just call 0x::coin::transfer
    }
}

babyface001 avatar Oct 20 '22 13:10 babyface001

maybe move should have some primitive like trait

babyface001 avatar Oct 20 '22 13:10 babyface001

someone get in touch in upstream https://github.com/move-language/move/issues/449

babyface001 avatar Oct 20 '22 13:10 babyface001

Yeah, this is a Move feature, not an Aptos, it'd be better to have that conversation upstream for now :).

davidiw avatar Oct 20 '22 18:10 davidiw