server

package
v0.0.0-...-0db867e Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The address used to deploy the contract becomes the owner
	// We use the first address in the HD wallet that ganache creates with the seed in the docker-compose
	OwnerPrivateKey = "0xca3f21d12dbd7a6a301a70414c40c555761dfce4b3f84cb8ce5f9760a783e3f0"
	ContractAddr    = "0xc4680463046E64b10Da390d9049D24b8EC43AaAB"
)
View Source
const (
	GanacheNetworkAddr = "ws://127.0.0.1:8545"
)

Variables

View Source
var (
	OwnerTransactor *bind.TransactOpts
	DecimalToInt    = decimal.New(1, 18) // can also call decimals() on the contract to get the exponent (18)
	UsdkABI         abi.ABI
)

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Type               ActivityType    `json:"type"`
	Asset              string          `json:"asset"`
	Amount             decimal.Decimal `json:"amount"`
	DestinationAddress string          `json:"destinationAddress,omitempty"`
	ID                 uint64          `json:"id"`
	ChainTxID          string          `json:"chainId,omitempty"` // the id on the blockchain
	Status             Status          `json:"status"`            // CREATED|COMPLETED
	CreatedAt          time.Time       `json:"createdAt"`
	CompeletedAt       *time.Time      `json:"compeletedAt,omitempty"`
}

type ActivityType

type ActivityType string
const (
	TypeDeposit    ActivityType = "DEPOSIT"
	TypeWithdrawal ActivityType = "WITHDRAWAL"
)

type Balances

type Balances struct {
	UsdOnPlatform decimal.Decimal `json:"usdOnPlatform"`
	UsdInReserve  decimal.Decimal `json:"usdInReserve"`
	UsdkMinted    decimal.Decimal `json:"usdkMinted"`
}

type ChainId

type ChainId *big.Int
var (
	ChainIDMainnet ChainId = big.NewInt(1)
	ChainIDRopsten ChainId = big.NewInt(3)
	ChainIDRinkeby ChainId = big.NewInt(4)
	ChainIDLocal   ChainId = big.NewInt(1337)
)

type Deposit

type Deposit struct {
	Asset  string          `json:"asset"`
	Amount decimal.Decimal `json:"amount"`
}

type EthClient

type EthClient interface {
	ethereum.ChainStateReader
	bind.ContractBackend
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func Init

func Init() *Server

func (*Server) Broadcast

func (s *Server) Broadcast(ctx context.Context, x *types.Transaction) error

func (*Server) CreateDeposit

func (s *Server) CreateDeposit(req *Deposit) (*Activity, error)

func (*Server) CreateWithdrawal

func (s *Server) CreateWithdrawal(req *Withdrawal) (*Activity, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Status

type Status string
const (
	Created   Status = "CREATED"
	Completed Status = "COMPLETED"
)

type Withdrawal

type Withdrawal struct {
	Asset              string          `json:"asset"`
	Amount             decimal.Decimal `json:"amount"`
	DestinationAddress string          `json:"destinationAddress"`
}

Jump to

Keyboard shortcuts

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