NEPs
NEPs copied to clipboard
Multi-Fungible-Token
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.
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'
}
Where are we standing on this? I think its a great idea.
@Lev-Stambler https://github.com/near/NEPs/pull/245
Is this going forward?
@joshuajbouw The most recent update I am aware of is here: https://github.com/near/NEPs/issues/246#issuecomment-1295118218