formula

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	One            = big.NewInt(1)
	MaxWeight      = uint(100)
	MinPrecision   = 32
	MaxPrecision   = 127
	Fixed1         = hexToBig("0x080000000000000000000000000000000")
	Fixed2         = hexToBig("0x100000000000000000000000000000000")
	Ln2Numerator   = hexToBig("0x3f80fe03f80fe03f80fe03f80fe03f8")
	Ln2Denominator = hexToBig("0x5b9de1d10bf4103d647b0955897ba80")
)

Functions

func CalculatePurchaseReturn

func CalculatePurchaseReturn(supply *big.Int, reserve *big.Int, crr uint, deposit *big.Int) *big.Int

Return = supply * ((1 + deposit / reserve) ^ (crr / 100) - 1)

func CalculateSaleAmount

func CalculateSaleAmount(supply *big.Int, reserve *big.Int, crr uint, wantReceive *big.Int) *big.Int

func CalculateSaleReturn

func CalculateSaleReturn(supply *big.Int, reserve *big.Int, crr uint, sellAmount *big.Int) *big.Int

Return = reserve * (1 - (1 - sellAmount / supply) ^ (1 / (crr / 100)))

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL