Documentation
¶
Index ¶
- Constants
- Variables
- func CopyRouterState(dst, src *RouterState)
- func CopyToken(dst, src *token.Token)
- type Executor
- type Oracle
- type Pool
- type Proposal
- type RouterState
- type State
- type StateForProposal
- type Transaction
- type TxApply
- type TxCallParams
- type TxProposeParams
- type TxStakeParams
- type TxSwapParams
- type TxTransferParams
- type TxUnstakeParams
Constants ¶
View Source
const ( PoolInc = "incentive" PoolEco = "ecosystem" PoolInv = "investor" PoolTeam = "team" )
View Source
const ( TxActionTransfer = "transfer" TxActionStake = "stake" TxActionUnstake = "unstake" // router join or leave TxActionJoin = "join" TxActionLeave = "leave" // proposal TxActionPropose = "propose" TxActionCall = "call" TxActionSwap = "swap" )
View Source
const (
TxVersionV1 = "v1"
)
Variables ¶
View Source
var ( ErrInvalidFromRouter = errors.New("err_invalid_from_router") ErrInvalidNonce = errors.New("err_invalid_nonce") ErrInvalidAmount = errors.New("err_invalid_amount") ErrInvalidFee = errors.New("err_invalid_fee") ErrInvalidFeeRecipient = errors.New("err_invalid_fee_recipient") ErrInvalidTx = errors.New("err_invalid_tx") ErrInvalidTxField = errors.New("err_invalid_tx_field") ErrInvalidTxAction = errors.New("err_invalid_tx_action") ErrInvalidTxParams = errors.New("err_invalid_tx_params") ErrInvalidProposer = errors.New("err_invalid_proposer") ErrInvalidProposal = errors.New("err_invalid_proposal") ErrTxExecuted = errors.New("err_tx_executed") ErrInvalidStakePool = errors.New("err_invalid_stake_pool") ErrInvalidRouterAddress = errors.New("err_invalid_router_address") ErrInvalidRouterName = errors.New("err_invalid_router_name") ErrInsufficientStake = errors.New("err_insufficient_stake") ErrRouterAlreadyJoined = errors.New("err_router_already_joined") ErrNotARouter = errors.New("err_not_a_router") ErrNoProposalFound = errors.New("err_no_proposal_found") ErrInvalidAccountType = errors.New("err_invalid_account_type") )
View Source
var ( Fee01 = "0.01" Fee003 = "0.003" Fee001 = "0.001" Fee0005 = "0.0005" )
View Source
var TxActionsSupported = []string{ TxActionTransfer, TxActionStake, TxActionUnstake, TxActionJoin, TxActionLeave, TxActionPropose, TxActionCall, TxActionSwap, }
Functions ¶
func CopyRouterState ¶
func CopyRouterState(dst, src *RouterState)
Types ¶
type Executor ¶
type Executor struct { LocalState string `json:"localState"` LocalStateHash string `json:"localStateHash"` RunnedTimes int64 `json:"runnedTimes"` // in: tx, state, oracle, localState, initData out: state, localState, localStateHash error Execute func(*Transaction, *StateForProposal, *Oracle, string, string) (*StateForProposal, string, string, error) `json:"-"` }
type Oracle ¶
type Oracle struct {
EverTokens map[string]everSchema.TokenInfo
}
type Pool ¶
type Pool struct { TokenXTag string `json:"tokenXTag"` TokenYTag string `json:"tokenYTag"` FeeRatio string `json:"feeRatio"` }
pool on permaswap
type Proposal ¶
type Proposal struct { Name string `json:"name"` ID string `json:"id"` Start int64 `json:"start"` End int64 `json:"end"` RunTimes int64 `json:"runTimes"` Source string `json:"source"` InitData string `json:"initData"` OnlyAcceptedTxActions []string `json:"onlyAcceptedTxActions"` Executor *Executor `json:"executor"` }
type RouterState ¶
type RouterState struct { Router string `json:"router"` // router address Name string `json:"name"` Logo string `json:"logo"` // logo url Desc string `json:"desc"` // description Domain string `json:"domain"` Ip string `json:"ip"` SwapFeeRatio string `json:"swapFeeRatio"` SwapFeeRecipient string `json:"swapFeeRecipient"` Pools map[string]*Pool `json:"pools"` // pool id -> pool LpMinStake string `json:"lpMinStake"` // minum amount lp stake LpPenalty string `json:"lpPenalty"` // penalty for lp evil }
type State ¶
type State struct { Dapp string `json:"dapp"` ChainID string `json:"chainID"` Govern string `json:"govern"` // govern is an temporary solution and will use voting in the future FeeRecipient string `json:"feeRecipient"` RouterMinStake string `json:"routerMinStake"` // minum amount router stake Routers []string `json:"routers"` // [] router address RouterStates map[string]*RouterState `json:"routerState"` // router address -> router state Token *token.Token `json:"-"` // halo token Accounts map[string]*account.Account `json:"account"` // account ID -> account Proposals []*Proposal `json:"proposals"` // proposal hash -> proposal StakePools []string `json:"stakePools"` // stake pool //stakes pool only accept unstake OnlyUnStakePools []string `json:"onlyUnStakePools"` Executed []string `json:"executed"` // executed tx everhash hash Validity map[string]bool `json:"validity"` // executed tx everhash hash -> bool LatestTxHash string `json:"latestTxHash"` LatestTxEverHash string `json:"latestTxEverHash"` StateHash string `json:"stateHash"` }
func (*State) GetStateForProposal ¶
func (s *State) GetStateForProposal() *StateForProposal
func (*State) UpdateState ¶
func (s *State) UpdateState(ns *StateForProposal)
type StateForProposal ¶
type StateForProposal struct { Dapp string `json:"dapp"` ChainID string `json:"chainID"` Govern string `json:"govern"` // govern is an temporary solution and will use voting in the future FeeRecipient string `json:"feeRecipient"` RouterMinStake string `json:"minRouterStake"` // minum amount router stake Routers []string `json:"routers"` RouterStates map[string]*RouterState `json:"routerState"` // router id -> router state StakePools []string `json:"stakePools"` // stake pool OnlyUnStakePools []string `json:"onlyUnStakePools"` Token *token.Token `json:"token"` // halo token }
type Transaction ¶
type Transaction struct { Dapp string `json:"dapp"` ChainID string `json:"chainID"` EverHash string `json:"everHash"` // tx hash from everpay Router string `json:"router"` // tx from which router Action string `json:"action"` From string `json:"from"` Fee string `json:"fee"` FeeRecipient string `json:"feeRecipient"` Nonce string `json:"nonce"` Version string `json:"version"` Params string `json:"params"` Sig string `json:"sig"` }
func (*Transaction) ArHash ¶
func (t *Transaction) ArHash() []byte
func (*Transaction) Hash ¶
func (t *Transaction) Hash() []byte
func (*Transaction) HexHash ¶
func (t *Transaction) HexHash() string
func (*Transaction) String ¶
func (t *Transaction) String() string
type TxApply ¶
type TxApply struct { Tx Transaction `json:"tx"` DryRun bool `json:"dryRun"` }
type TxCallParams ¶
type TxProposeParams ¶
type TxStakeParams ¶
type TxSwapParams ¶
type TxSwapParams struct { }
type TxTransferParams ¶
type TxUnstakeParams ¶
Click to show internal directories.
Click to hide internal directories.