Closed stevenkhong closed 3 years ago
Add Zilo implementation which enables maintaining multiple Zilo instances at the same time.
Significant changes to original SDK:
zilswap.zilliqa
readonly
private readonly
zilswap.callContract
public
zilswap.approveTokenTransferIfRequired
zilswap.zilos
zilswap.registerZilo
zilswap.deregisterZilo
zilswap.subscribeToAppChanges
TODOs:
const zilswap = new Zilswap(Network.TestNet, provider) 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") } // removed zilswap.deregisterZilo(ZILO_ADDRESS)
Add Zilo implementation which enables maintaining multiple Zilo instances at the same time.
Significant changes to original SDK:
zilswap.zilliqa
is nowreadonly
instead ofprivate readonly
zilswap.callContract
is now apublic
functionzilswap.approveTokenTransferIfRequired
takes in a third variable for spender contract hashzilswap.zilos
added as a map of registered Zilo instanceszilswap.registerZilo
added as entry function to creating new Zilo instanceszilswap.deregisterZilo
added as exit function to tear down Zilo instanceszilswap.subscribeToAppChanges
updated to tear down previous subscription on entry, and subscribe to additional registered Zilo contracts.TODOs: