Skip to main content
Version: 3.0

NEAR, NFT, & FT Assets

💡Key Concept
For every use on a Key, the different types of assets can be mixed to create an infinite number of experiences!

Defining vs Funding Assets

An important distinction to be made is the difference between defining and funding assets. Defining an asset is similar to creating a blueprint for your drop while funding is the process of building it.

  • Defining an Asset: The process of creating a drop and outlining the behaviour expected for your keys. At this point, you've created a blueprint of your drop's expected assets but have not built it out.

  • Funding an Asset: Transferring ownership of defined assets to Keypom so that they can be redeemed by users claiming your keys.

Once a drop's assets have been defined and funded, keys can be used properly.

caution

If assets are not properly funded, users of your drop will not receive the assets promised to them.


NEAR Asset

A NEAR Asset attaches some NEAR that will be deposited in the user's account when claiming

Whenever a NEAR asset is present in a key use, the user will receive some NEAR for that particular key use. For example, if a key has 2 uses, and a NEAR asset is defined in the first use but not the second, then the user will only receive NEAR the first time they claim their key.

Structure

The structure of a NEAR asset is relatively simple. All that needs to be defined is the amount. Note that if multiple NEAR assets are defined in the same use, the claiming user will receive the sum of yoctonear contained in all the NEAR assets.

contract/src/models/external/models.rs
loading...

Funding

In the case of NEAR assets, defining and funding are synonomous. This is because the drop creation will fail if insufficient NEAR is provided. This NEAR can come from:


NFT Asset

A properly funded NFT Asset will allow a user to receive a Non-fungible Token when claiming

Whenever an NFT asset is present and properly funded in a key use, the user will receive an NFT for that particular key use. For example, if a key has 2 uses, and an NFT asset is defined in the first use but not the second, then the user will only receive an NFT the first time they claim their key.

Note that multiple different tokens can be sent at once by defining additional NFT Assets following the structure below.

Structure

When defining an NFT Asset, only one item needs to be specified:

  • nft_contract_id: the contract that the NFT lives on.
contract/src/models/external/models.rs
loading...

Funding

caution

An improperly loaded NFT Asset will result in no NFT being sent to the user

In order to fund an NFT asset, you must transfer it to the Keypom contract: v3.keypom.near or v3.keypom.testnet. By doing this, you give the Keypom contract the ability to transfer it to the end user when they claim.

It is important that when transferring, you are transferring from the contract that you defined above. It is also important to include the dropId as a msg. This tells Keypom to associate the incoming NFT with your drop.

__tests__/creation/nft-creation.ava.ts
loading...

In the case where you have multiple NFT Assets, you will need to transfer the appropriate number of NFTs. For example, if you have 5 keys with 2 NFT Assets each, you will need to transfer 10 NFTs to Keypom.

When claiming, the user will receive the lastest NFT that was transferred to Keypom.

note

Only a drop's creator can fund its NFT Assets


FT Asset

A properly funded FT Asset will send the claiming user a predetermined amount of Fungible Tokens

Whenever an FT asset is present and properly funded in a key use, the user will receive a set amount of FTs for that particular key use. For example, if a key has 2 uses, and an FT asset is defined in the first use but not the second, then the user will only receive an the predefined amount of FTs the first time they claim their key.

Note that multiple different tokens can be sent at once by defining additional NFT Assets following the structure below.

Structure

When defining an FT Asset, a few things need to be defined:

  • ft_contract_id: The Fungible Token contract.
  • ft_amount: The amout of Fungible Tokens to be sent. Defined in the smallest divisible unit. For more, see the token's definition of the decimal value.
  • registration_cost: Specific to each FT contract, this is the cost to register the user on the FT contract.
contract/src/models/external/models.rs
loading...

Funding

caution

An improperly loaded FT Asset will result in no FTs being sent to the user

In order to fund a Fungible Token asset, you must transfer it to the Keypom contract: v3.keypom.near or v3.keypom.testnet. By doing this, you give the Keypom contract the FT balance necessary to transfer it to the end user when they claim.

It is important that when transferring, you are transferring from the contract that you defined above. It is also important to include the dropId as a msg. This tells Keypom to associate the incoming NFT with your drop.

__tests__/utils/ft-utils.ts
loading...
note

Anybody can fund a drop's FT Assets