2021-09-11 21:50:36 +00:00
|
|
|
import statusgo_backend/tokens as statusgo_backend_tokens
|
2021-09-11 12:27:07 +00:00
|
|
|
import tokens_backend as status_tokens
|
2021-09-11 12:09:52 +00:00
|
|
|
import eth/contracts
|
2021-09-08 18:05:39 +00:00
|
|
|
import ../eventemitter
|
|
|
|
|
|
|
|
type
|
|
|
|
TokensModel* = ref object
|
|
|
|
events*: EventEmitter
|
|
|
|
|
|
|
|
proc newTokensModel*(events: EventEmitter): TokensModel =
|
|
|
|
result = TokensModel()
|
|
|
|
result.events = events
|
|
|
|
|
|
|
|
proc getSNTAddress*(): string =
|
|
|
|
result = status_tokens.getSNTAddress()
|
|
|
|
|
|
|
|
proc getCustomTokens*(self: TokensModel, useCached: bool = true): seq[Erc20Contract] =
|
2021-09-11 21:50:36 +00:00
|
|
|
result = statusgo_backend_tokens.getCustomTokens(useCached)
|
2021-09-08 18:05:39 +00:00
|
|
|
|
|
|
|
proc removeCustomToken*(self: TokensModel, address: string) =
|
2021-09-11 21:50:36 +00:00
|
|
|
statusgo_backend_tokens.removeCustomToken(address)
|
2021-09-08 18:05:39 +00:00
|
|
|
|
|
|
|
proc getSNTBalance*(account: string): string =
|
|
|
|
result = status_tokens.getSNTBalance(account)
|
|
|
|
|
|
|
|
proc tokenDecimals*(contract: Contract): int =
|
|
|
|
result = status_tokens.tokenDecimals(contract)
|
|
|
|
|
|
|
|
proc tokenName*(contract: Contract): string =
|
|
|
|
result = status_tokens.tokenName(contract)
|
|
|
|
|
|
|
|
proc tokensymbol*(contract: Contract): string =
|
|
|
|
result = status_tokens.tokensymbol(contract)
|
|
|
|
|
|
|
|
proc getTokenBalance*(tokenAddress: string, account: string): string =
|
|
|
|
result = status_tokens.getTokenBalance(tokenAddress, account)
|
|
|
|
|
|
|
|
proc getToken*(self: TokensModel, tokenAddress: string): Erc20Contract =
|
|
|
|
result = status_tokens.getToken(tokenAddress)
|
|
|
|
|
|
|
|
export newErc20Contract
|
|
|
|
export getErc20Contracts
|
|
|
|
export Erc20Contract
|
|
|
|
export getErc20ContractByAddress
|