ENG

Whitepaper

Equations

Equations are smart contracts which handles rebalancing of the Pool. It is the integral component of maintaining pool. It allows creation of any rebalancing strategies to be deployed as a pool.

Weighted Equation is an implementation of pool maintaining logic, which balances the ration between two tokens one each pool with unique logic of ALEX. It is a basically fork of Balancer, which mainly uses constant product AMM but for ALEX, weight follows Black & Scholes delta. Details can be found on our whitepaper and here. Developers can use

`(contract-call?)`

for using this weighted equation anywhere in the smart contract.`(define-read-only (get-y-given-x (balance-x) (balance-y) (weight-x) (weight-y) (dy))`

`uint uint uint uint uint`

`bool | uint`

Get the appropriate value of dy from given dx which maintains the balance of given pool.

`(define-read-only (get-x-given-y (balance-x) (balance-y) (weight-x) (weight-y) (dx))`

`uint uint uint uint uint`

`bool | uint`

Get the appropriate value of dx from given dy which maintains the balance of given pool.

`(define-read-only (get-x-given-price (balance-x) (balance-y) (weight-x) (weight-y) (price))`

`uint uint uint uint uint`

`bool | uint`

Get the appropriate value of dx from given price which maintains the balance of given pool.

`(define-read-only (get-token-given-position (balance-x) (balance-y) (weight-x) (weight-y) (total-supply) (dx) (dy))`

`uint uint uint uint uint uint uint`

`bool | uint`

Get the appropriate value of token from given parameters which maintains the balance of given pool.

`(define-read-only (get-position-given-mint (balance-x) (balance-y) (weight-x) (weight-y) (total-supply) (token))`

`uint uint uint uint uint`

`bool | uint`

Get the appropriate position value (dx and dy) from given parameters such as minted amount and total supply which maintains the balance of given pool.

`(define-read-only (get-position-given-burn (balance-x) (balance-y) (weight-x) (weight-y) (total-supply) (token))`

`uint uint uint uint uint`

`bool | uint`

Identical to

`get-position-given-mint`

since it is reverse of calculation.Last modified 11mo ago

Copy link

Edit on GitHub

On this page

Weighted Equation

get-y-given-x

get-x-given-y

**get-**x-given-price

**get-**token-given-position

**get-**position-given-mint

**get-**position-given-burn