blockchain

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Bitcoin  = BlockchainName("bitcoin")
	Ethereum = BlockchainName("ethereum")
	ERC20    = BlockchainName("erc20")
)
View Source
var (
	BTC  = TokenName("BTC")
	ETH  = TokenName("ETH")
	WBTC = TokenName("WBTC")
	REN  = TokenName("REN")
	DGX  = TokenName("DGX")
	ZRX  = TokenName("ZRX")
	OMG  = TokenName("OMG")
	DAI  = TokenName("DAI")
	PAX  = TokenName("PAX")
	USDC = TokenName("USDC")
	GUSD = TokenName("GUSD")
	TUSD = TokenName("TUSD")
)
View Source
var (
	TokenBTC  = Token{BTC, 8, Bitcoin}
	TokenETH  = Token{ETH, 18, Ethereum}
	TokenWBTC = Token{WBTC, 8, ERC20}
	TokenREN  = Token{REN, 18, ERC20}
	TokenDGX  = Token{DGX, 9, ERC20}
	TokenZRX  = Token{ZRX, 18, ERC20}
	TokenOMG  = Token{OMG, 18, ERC20}
	TokenTUSD = Token{TUSD, 18, ERC20}
	TokenDAI  = Token{DAI, 18, ERC20}
	TokenUSDC = Token{USDC, 6, ERC20}
	TokenGUSD = Token{GUSD, 2, ERC20}
	TokenPAX  = Token{PAX, 18, ERC20}
)

Functions

func NewErrUnsupportedBlockchain

func NewErrUnsupportedBlockchain(blockchain BlockchainName) error

func NewErrUnsupportedToken

func NewErrUnsupportedToken(token TokenName) error

NewErrUnsupportedToken returns a new ErrUnsupportedToken error.

Types

type Balance

type Balance struct {
	Address  string `json:"address"`
	Decimals int    `json:"decimals"`
	Amount   string `json:"balance"`
}

type Blockchain

type Blockchain struct {
	Name    BlockchainName `json:"name"`
	Address string         `json:"address"`
}

type BlockchainName

type BlockchainName string

type Cost

type Cost map[TokenName]*big.Int

Cost of an atomic swap

func CostBlobToCost

func CostBlobToCost(costBlob CostBlob) Cost

CostBlobToCost converts cost blob to cost

type CostBlob

type CostBlob map[TokenName]string

TODO: Why this is in foundation? CostBlob is the json representation of cost.

func CostToCostBlob

func CostToCostBlob(cost Cost) CostBlob

CostToCostBlob converts cost to cost blob

type ErrUnsupportedToken

type ErrUnsupportedToken error

ErrUnsupportedToken is returned when the token is not supported by swapperd.

type Token

type Token struct {
	Name       TokenName      `json:"name"`
	Decimals   int            `json:"decimals"`
	Blockchain BlockchainName `json:"blockchain"`
}

Token represents the token we are trading.

func PatchToken

func PatchToken(token string) (Token, error)

func (Token) AdditionalTransactionFee

func (token Token) AdditionalTransactionFee(amount *big.Int) *big.Int

func (Token) Generate

func (Token) Generate(rand *rand.Rand, size int) reflect.Value

func (Token) String

func (token Token) String() string

type TokenName

type TokenName string

Jump to

Keyboard shortcuts

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