NEPs icon indicating copy to clipboard operation
NEPs copied to clipboard

Multi-Fungible-Token

Open marco-sundsk opened this issue 3 years ago • 5 comments

Proposal for multi-fungible-token

In Ref Finance, we handle all swap pools in one contract, which means, when we release LP token for each pool, those tokens are exist in single contract, which can NOT be supported by current NEP-141 standard.

Now, based on NEP-141, actually we extended it to support multi-token in one contract, change some interfaces and leave the whole working process untouched.
Here is the way: we change the following interface, add a heading 'm' to the name and, compare to the original one in NEP-141, token_id: String is added as first parameter of each interface:

  • mft_resolve_transfer in trait MFTTokenResolver
  • mft_on_transfer in trait MFTTokenReceiver
  • mft_transfer
  • mft_transfer_call
  • mft_metadata, return the same FungibleTokenMetadata structure in NEP-141
  • mft_register
  • mft_total_supply
  • mft_balance_of

When the value of this field equals to predecessor_id or the token contract id, the interface has the same behaviors with original one in NEP-141. Otherwise, the token_id stands for inner-index in the token contract.

For detailed implementation, please see here

In this way, this protocol can handle both FT token and MFT token.

marco-sundsk avatar Jun 30 '21 09:06 marco-sundsk

I use current standart for impliment it

mint supply_max/amount 10000 https://explorer.testnet.near.org/transactions/3JyXzQD4o2QLVnu7YAur1gjwfVBjFGmjVLw8MtHZXZ33 nft_transfer for 1 amount https://explorer.testnet.near.org/transactions/AizxpxJC7cSeAv9RKB3rB4ZuHn8Yxezs2GFYwkJxBgGE

near view arterra.testnet nft_token '{"token_id":"QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq:arterrateam.testnet"}'
{
  token_id: 'QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq:arterrateam.testnet',
  owner_id: 'arterrateam.testnet',
  supply: 9996,
  metadata: {
    title: "Programmer's lunch",
    description: 'A limited series of representations of what some programmers fill their life cells with',
    media: 'QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq',
    copies: 10000,
    supply_max: 10000
  },
  approved_account_ids: null,
  metadata_id: 'QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq'
}
near view arterra.testnet nft_token '{"token_id":"QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq:serhii-1205.testnet"}'
{
  token_id: 'QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq:serhii-1205.testnet',
  owner_id: 'serhii-1205.testnet',
  supply: 1,
  metadata: {
    title: "Programmer's lunch",
    description: 'A limited series of representations of what some programmers fill their life cells with',
    media: 'QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq',
    copies: 10000,
    supply_max: 10000
  },
  approved_account_ids: null,
  metadata_id: 'QmXnfHFhjnT19J2pfXjDydzhexpWvbuHaCr9a1X3mHsfZq'
}

ilyar avatar Jul 27 '21 06:07 ilyar

Where are we standing on this? I think its a great idea.

Lev-Stambler avatar Jan 11 '22 13:01 Lev-Stambler

@Lev-Stambler https://github.com/near/NEPs/pull/245

sb- avatar Jan 18 '22 05:01 sb-

Is this going forward?

joshuajbouw avatar Dec 07 '22 13:12 joshuajbouw

@joshuajbouw The most recent update I am aware of is here: https://github.com/near/NEPs/issues/246#issuecomment-1295118218

frol avatar Dec 20 '22 11:12 frol