Skip to content

Latest commit

 

History

History
199 lines (114 loc) · 3.99 KB

zilo.zilo-1.md

File metadata and controls

199 lines (114 loc) · 3.99 KB

zilswap-sdk / Exports / zilo / Zilo

Class: Zilo

zilo

Zilo class to represent an instance of a ZilSwap Initial Launch Offering.

Usage:

const zilswap = new Zilswap(Network.TestNet)
await zilswap.initialize()
const zilo = await zilswap.registerZilo(ZILO_ADDRESS, ziloStateObserver)

const ziloState = zilo.getZiloState()

if (ziloState.state === ILOState.Active) {
   const amount = new BigNumber(1).shiftedBy(ZIL_DECIMALS).toString(10)
   const tx = await zilo.contribute(amount)

   console.log("distribute TX sent", tx.hash)
} else {
   console.log("ZILO not yet active")
}

Table of contents

Constructors

Methods

Constructors

constructor

new Zilo(zilswap, address)

Parameters

Name Type
zilswap Zilswap
address string

Defined in

zilo.ts:76

Methods

claim

claim(): Promise<null | ObservedTx>

Execute claim function if user contributed

Returns

Promise<null | ObservedTx>

Defined in

zilo.ts:223


complete

complete(): Promise<null | ObservedTx>

Returns

Promise<null | ObservedTx>

Defined in

zilo.ts:254


contribute

contribute(amountToContributeStr): Promise<null | ObservedTx>

Contribute to the ILO, may need to increase token allowance before proceeding

Parameters

Name Type Description
amountToContributeStr string is the exact amount of ZIL to be contribute as a unitless string (without decimals).

Returns

Promise<null | ObservedTx>

Defined in

zilo.ts:285


getZiloState

getZiloState(): ZiloAppState

Returns

ZiloAppState

Defined in

zilo.ts:178


initialize

initialize(observer?): Promise<void>

Parameters

Name Type
observer? OnStateUpdate

Returns

Promise<void>

Defined in

zilo.ts:83


updateBlockHeight

updateBlockHeight(height?): Promise<void>

Parameters

Name Type
height? number

Returns

Promise<void>

Defined in

zilo.ts:160


updateObserver

updateObserver(observer?): void

Parameters

Name Type
observer? OnStateUpdate

Returns

void

Defined in

zilo.ts:88


updateZiloState

updateZiloState(): Promise<void>

Returns

Promise<void>

Defined in

zilo.ts:126