#marketplaces #helper #swap #cw721 #cw721-marketplace #cw721-marketplace-permissioned #cw721-marketplace-single-collection

cw721-marketplace-utils

Utility types and helpers for cw721-marketplace, cw721-marketplace-permissioned and cw721-marketplace-single-collection

1 unstable release

0.1.5 May 17, 2024

#18 in #cw721

Download history 9/week @ 2024-06-02 16/week @ 2024-06-09 11/week @ 2024-06-16 2/week @ 2024-06-23 5/week @ 2024-07-14 1/week @ 2024-07-21 8/week @ 2024-07-28 1/week @ 2024-08-04 10/week @ 2024-08-25 12/week @ 2024-09-01 92/week @ 2024-09-08 6/week @ 2024-09-15

120 downloads per month
Used in 3 crates

Apache-2.0

8KB
104 lines

Cw721-marketplace-utils

Utility functions, types and helpers intended for use in the following packages:

  • cw721-marketplace
  • cw721-marketplace-permissioned
  • cw721-marketplace-single-collection

This package was created to reduce the amount of redundant code inside the above 3 very similar packages.

Query

PageResult{swaps, page, total} - A formatter struct for paginated swaps data

ListResponse{swaps} - Response type for entry point List

DetailsResponse{creator, contract, payment_token, token_id, expires, price, swap_type} - Response type for entry point Details

Swap

SwapType{Offer, Sale} - Enum type for CW721Swap that distinguishes whether the cw721 token is for sale by owner, or being bid on buy a potential buyer.

CW721Swap{id, creator, nft_contract, payment_token, token_id, expires, price, swap_type} - Struct for creating or finishing a cw721 marketplace swap using entry point Create or entry point Finish

Fees

FeeSplit{marketplace, seller} - A formatter struct for split ratios for marketplaces that collect a fee share of swaps when the Finish entry point is executed.

fee_percentage(amount, share_percent) - Utility function that bifurcates a price value into a FeeSplit when given a swap price and a percentage amount.


XXX Note: This package is a work in progress and part of an unfinished journey of deduplicating redundant code in the cw721 marketplace repostories.

Dependencies

~3.5–5.5MB
~116K SLoC