foundation

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: GPL-3.0 Imports: 2 Imported by: 11

Documentation

Index

Constants

View Source
const (
	Inactive = iota
	Initiated
	Audited
	AuditFailed
	Redeemed
	Refunded
)
View Source
const ExpiryUnit = int64(2 * 60 * 60)

Variables

View Source
var (
	Bitcoin  = "bitcoin"
	Ethereum = "ethereum"
)
View Source
var (
	TokenBTC  = Token{"BTC", Bitcoin}
	TokenETH  = Token{"ETH", Ethereum}
	TokenWBTC = Token{"WBTC", Ethereum}
)

Functions

func NewErrUnsupportedToken

func NewErrUnsupportedToken(token string) error

Types

type ErrUnsupportedToken

type ErrUnsupportedToken string

func (ErrUnsupportedToken) Error

func (err ErrUnsupportedToken) Error() string

type Swap

type Swap struct {
	ID              SwapID
	Token           Token
	Value           *big.Int
	SecretHash      [32]byte
	TimeLock        int64
	SpendingAddress string
	FundingAddress  string
}

A Swap stores all of the information required to execute an atomic swap.

type SwapBlob

type SwapBlob struct {
	ID           SwapID `json:"id"`
	SendToken    string `json:"sendToken"`
	ReceiveToken string `json:"receiveToken"`

	// SendAmount and ReceiveAmount are hex encoded.
	SendAmount    string `json:"sendAmount"`
	ReceiveAmount string `json:"receiveAmount"`

	SendTo              string `json:"sendTo"`
	ReceiveFrom         string `json:"receiveFrom"`
	TimeLock            int64  `json:"timeLock"`
	SecretHash          string `json:"secretHash"`
	ShouldInitiateFirst bool   `json:"shouldInitiateFirst"`
}

A SwapBlob is used to encode a Swap for storage and transmission.

type SwapID

type SwapID string

A SwapID uniquely identifies a Swap that is being executed.

type SwapStatus

type SwapStatus struct {
	ID     SwapID `json:"id"`
	Status int    `json:"status"`
}

The SwapStatus indicates which phase of execution a Swap is in.

func NewSwapStatus

func NewSwapStatus(id SwapID, status int) SwapStatus

type Token

type Token struct {
	Name       string `json:"name"`
	Blockchain string `json:"blockchain"`
}

func (Token) String

func (token Token) String() string

Jump to

Keyboard shortcuts

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