8000 GitHub - dkcmist/solana-nft
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dkcmist/solana-nft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NFT vault and escrow Contract

Architecture Overview

The FSN Vaults contract allows 2 wallets to trade escrows of tokens between eachother in a trustless manner

The escrows can contain any number of native, cw20, or cw721 tokens


High Level

Say we have 2 users:

Alice - the seller

Bob - the buyer


Alice wants to sell

Alice wants to sell 5 FSN + 10 CW20 + Dog NFT #3

At a price of 10 OSMO + Cat NFT #8

In order, Alice will

  • Create a listing with ExecuteMsg::CreateListing, sending 5 FSN along with the message
  • Send 10 CW20 + Dog NFT #3 to the contract, specifying the Listing ID in each message
  • Call ExecuteMsg::Finalize, specifying an Expiration
    • Once Finalize has been called, the listing can be purchased and Alice can no longer make changes
    • If the listing is not purchased before Expiration, Alice can call ExecuteMsg::Refund to remove the funds + delete the Listing

Bob wants to buy

Bob sees this listing and wants to buy it

In order, Bob will

  • Create a bucket with ExecuteMsg::CreateListing, sending 10 OSMO along with the message
  • Send Cat NFT #8 to the contract, specifying the Bucket ID in the message
  • Call ExecuteMsg::BuyListing, specifying the listing ID being purchased (listing_id: 1), and the bucket ID to use (bucket_id: 1)

If the assets in Bucket #1 match the price of Listing #1, ownership of each will be traded between them


Alice and Bob remove their proceeds

Now that the trade is complete, both Alice and Bob can remove their proceeds from the contract

Alice can now remove sale proceeds by calling ExecuteMsg::RemoveBucket {bucket_id: 1}

Bob can now remove purchase proceeds by calling ExecuteMsg::WithdrawPurchased {listing_id: 1}



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0