-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
;; Demo of market trade functionality | ||
|
||
;; Libraries | ||
(import asset.nft.basic :as nft) | ||
(import convex.asset :as asset) | ||
(import asset.market.trade :as trade) | ||
(import asset.wrap.convex :as wcvx) | ||
|
||
;; Mint an NFT | ||
(def nft-id (call nft (create {:foo :bar}))) | ||
|
||
;; The item we want to list, i.e. a set of one NFT | ||
(def item [nft #{nft-id}]) | ||
|
||
;; List the item for sale for price of 5000 tokens | ||
(trade/post item [wcvx 5000]) | ||
|
||
|
||
|
||
;; ===================================== | ||
;; IN ANOTHER account | ||
;; ===================================== | ||
;; Library imports | ||
(import asset.market.trade :as trade) | ||
(import asset.wrap.convex :as wcvx) | ||
(import convex.asset :as asset) | ||
|
||
;; Wrap some Convex Coins as a token to make purchase | ||
(wcvx/wrap 1000000) | ||
|
||
;; See available trades (raw data) | ||
trade/trades | ||
|
||
;; Buy a specific trade (insert chosen trade ID) | ||
(trade/buy 1) | ||
|