Crate pallet_exchange[][src]

Exchange Module

Exchange NFTs or FTs.

For pool, use bancor curve. y = m * x ^ n r = reverseRatio = ppm / 1000000 after integral and simplify, can get these formula buy: p = poolBalance * ((1 + amount / totalSupply) ** (1 / (reserveRatio)) - 1) sell: p = poolBalance * ( 1 - ( 1 - amount / totalSupply ) ** (1 / reserveRatio)) current price = poolBalance / (totalSupply * reserveRatio) when supply is 0, p = reserveRatio * m * amount ** (1/reserveRatio) Thanks for the explanation in Slava Balasanov’s article (https://blog.relevant.community/bonding-curves-in-depth-intuition-parametrization-d3905a681e0a)

Terminology

Interface

Dispatchable Functions

Re-exports

pub use $crate::traits::GetPalletVersion as _;

Structs

Module
NonFungibleOrderInfo

Order details.

SemiFungiblePoolInfo

Pool details.

Enums

Call

Dispatchable calls.

Error

Errors inform users that something went wrong.

RawEvent

Events for this module.

Traits

Config

Configure the pallet by specifying the parameters and types on which it depends.

Type Definitions

Event

RawEvent specialized for the configuration Config