Documentation ¶
Index ¶
- Constants
- func GetAddress(accountName string) string
- func GetKey(accountName string) cryptotypes.PrivKey
- func SanitizeFilename(filename string) string
- func ToOrderPlacementExecuteMsg(fundedOrder FundedOrder) []byte
- func ToSeiOrderPlacement(fundedOrder FundedOrder) dextypes.Order
- func ToUpdateMultiCollateralWhitelistExecuteMsg(whitelistedAccounts []string) []byte
- type Balance
- type BankBalanceExpectation
- type Cancel
- type Client
- func (c *Client) ExecuteContract(contractAddr string, code uint64, executeMsg string, fund string) (*sdk.TxResponse, error)
- func (c *Client) GetBankBalance(account string, denom string) sdk.Coin
- func (c *Client) GetCurrentEpoch() uint64
- func (c *Client) GetOracleWhitelist() oracletypes.DenomList
- func (c *Client) InstantiateContract(code uint64, instantiateMsg string) (*sdk.TxResponse, error)
- func (c *Client) IsProposalHandled(proposalId string) bool
- func (c *Client) QueryContract(queryMsg string, contractAddr string) (*wasmdtypes.QuerySmartContractStateResponse, error)
- func (c *Client) RegisterOracleDenom(title string, denoms []string) string
- func (c *Client) RegisterOracleDenomAndWaitForApproval(filename string)
- func (c *Client) RegisterPair(title string, contractAddr string, pairs []*dextypes.Pair) (*sdk.TxResponse, error)
- func (c *Client) RegisterPairAndWaitForApproval(title string, contractAddr string, pairs []*dextypes.Pair) error
- func (c *Client) SendCancel(order Cancel, contractAddr string, monikerToOrderIds map[string]uint64) error
- func (c *Client) SendOracleDenomProposal(title string, denoms []string) string
- func (c *Client) SendOraclePrice(coins sdk.DecCoins) error
- func (c *Client) SendOrder(order FundedOrder, contractAddr string) (dextypes.MsgPlaceOrdersResponse, error)
- func (c *Client) SendPairsProposal(title string, contractAddr string, pairs []*dextypes.Pair) (*sdk.TxResponse, error)
- func (c *Client) SendRegisterContract(contractAddr string, codeId uint64, needHook bool) (*sdk.TxResponse, error)
- func (c *Client) Vote(proposalId string) error
- type ContractBalance
- type ContractGetOrderResponse
- type ContractOrder
- type ContractPosition
- type ContractSignedDecimal
- type Deposit
- type EncodingConfig
- type Expectations
- type FundedOrder
- type Input
- type LiquidationRequest
- type MultiCollateralAccounts
- type OracleUpdate
- type Order
- type OrderData
- type OrderDetails
- type OrderPlacement
- type Pair
- type PortfolioSpecs
- type Position
- type Sleep
- type StartingBalance
- type SwapMulticollateralToBase
- type SwapMulticollateralToBaseMsg
- type Test
- type TxConfig
- type UpdateMultiCollateralWhitelist
- type UpdateMultiCollateralWhitelistMsg
Constants ¶
View Source
const ADMIN_KEY_NAME = "admin"
View Source
const ALICE_KEY_NAME = "alice"
View Source
const BOB_KEY_NAME = "bob"
View Source
const CHAIN_ID = "sei-chain"
View Source
const KEY_SERVER = "http://localhost:8088"
View Source
const NODE_URI = "tcp://localhost:26657"
View Source
const ORACLE_HASH = "abc"
View Source
const VOTE_WAIT_SECONDS = 5
Variables ¶
This section is empty.
Functions ¶
func GetAddress ¶
func GetKey ¶
func GetKey(accountName string) cryptotypes.PrivKey
func SanitizeFilename ¶
func ToOrderPlacementExecuteMsg ¶
func ToOrderPlacementExecuteMsg(fundedOrder FundedOrder) []byte
func ToSeiOrderPlacement ¶
func ToSeiOrderPlacement(fundedOrder FundedOrder) dextypes.Order
Types ¶
type BankBalanceExpectation ¶
type Cancel ¶
func ParseCancel ¶
func ParseCancel(raw json.RawMessage) Cancel
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient( key cryptotypes.PrivKey, txConfig *TxConfig, encodingConfig *EncodingConfig, ) *Client
func NewClientWithDefaultConfig ¶
func NewClientWithDefaultConfig(key cryptotypes.PrivKey) *Client
func (*Client) ExecuteContract ¶
func (c *Client) ExecuteContract(contractAddr string, code uint64, executeMsg string, fund string) (*sdk.TxResponse, error)
This function takes custom executeMsg and call designated cosmwasm contract execute endpoint it returns the instantiated contract address if succeeds Input fund example: "1000usei". Empty string can be passed if this execution doesn't intend to attach any fund.
func (*Client) GetBankBalance ¶
func (*Client) GetCurrentEpoch ¶
func (*Client) GetOracleWhitelist ¶
func (c *Client) GetOracleWhitelist() oracletypes.DenomList
func (*Client) InstantiateContract ¶
This function takes custom instantiateMsg and instantiates cosmwasm contract it returns the instantiated contract address if succeeds
func (*Client) IsProposalHandled ¶
func (*Client) QueryContract ¶
func (c *Client) QueryContract(queryMsg string, contractAddr string) (*wasmdtypes.QuerySmartContractStateResponse, error)
This function takes custom queryMsg and get the corresponding state from the contract
func (*Client) RegisterOracleDenom ¶
func (*Client) RegisterOracleDenomAndWaitForApproval ¶
func (*Client) RegisterPair ¶
func (*Client) RegisterPairAndWaitForApproval ¶
func (*Client) SendCancel ¶
func (*Client) SendOracleDenomProposal ¶
func (*Client) SendOrder ¶
func (c *Client) SendOrder(order FundedOrder, contractAddr string) (dextypes.MsgPlaceOrdersResponse, error)
func (*Client) SendPairsProposal ¶
func (*Client) SendRegisterContract ¶
type ContractBalance ¶
type ContractBalance struct {
Amount ContractSignedDecimal `json:"amount"`
}
contract types below
func ParseContractBalance ¶
func ParseContractBalance(balanceBytes []byte) ContractBalance
type ContractGetOrderResponse ¶
type ContractGetOrderResponse struct {
Orders []ContractOrder `json:"orders"`
}
func ParseContractGetOrderResponse ¶
func ParseContractGetOrderResponse(orderBytes []byte) ContractGetOrderResponse
type ContractOrder ¶
type ContractOrder struct { Id uint64 `json:"id"` Account string `json:"account"` PriceDenom string `json:"price_denom"` AssetDenom string `json:"asset_denom"` Price ContractSignedDecimal `json:"price"` Quantity ContractSignedDecimal `json:"quantity"` RemainingQuantity ContractSignedDecimal `json:"remaining_quantity"` Direction string `json:"direction"` Effect string `json:"effect"` Leverage ContractSignedDecimal `json:"leverage"` OrderType string `json:"order_type"` }
type ContractPosition ¶
type ContractPosition struct { LongPosition ContractSignedDecimal `json:"long_position"` LongPositionMarginDebt ContractSignedDecimal `json:"long_position_margin_debt"` LongPositioLastFundingPaymentEpoch int64 `json:"long_position_last_funding_payment_epoch"` ShortPosition ContractSignedDecimal `json:"short_position"` ShortPositionMarginDebt ContractSignedDecimal `json:"short_position_margin_debt"` ShortPositioLastFundingPaymentEpoch int64 `json:"short_position_last_funding_payment_epoch"` }
func ParseContractPosition ¶
func ParseContractPosition(positionBytes []byte) ContractPosition
type ContractSignedDecimal ¶
type ContractSignedDecimal struct { Decimal string `json:"decimal"` Negative bool `json:"negative"` }
func (*ContractSignedDecimal) Multiply ¶
func (c *ContractSignedDecimal) Multiply(multiplier float64) ContractSignedDecimal
type Deposit ¶
func ParseDeposit ¶
func ParseDeposit(raw json.RawMessage) Deposit
type EncodingConfig ¶
type EncodingConfig struct { InterfaceRegistry types.InterfaceRegistry // NOTE: this field will be renamed to Codec Marshaler codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino }
func NewDefaultEncodingConfig ¶
func NewDefaultEncodingConfig() *EncodingConfig
type Expectations ¶
type Expectations struct { Balances []Balance `json:"balances"` Positions []Position `json:"positions"` Orders []Order `json:"orders"` PortfolioSpecs []PortfolioSpecs `json:"portfolio_specs"` BankBalances []BankBalanceExpectation `json:"bank_balances"` }
type FundedOrder ¶
type FundedOrder struct { Moniker string `json:"moniker"` Account string `json:"account"` Order OrderPlacement `json:"order"` Fund string `json:"fund"` }
func ParseFundedOrder ¶
func ParseFundedOrder(raw json.RawMessage) FundedOrder
type Input ¶
type Input struct { InputType string `json:"type"` Details json.RawMessage `json:"details"` }
type LiquidationRequest ¶
type LiquidationRequest struct { AccountToBeLiquidated string `json:"account"` Fund string `json:"fund"` }
func ParseLiquidation ¶
func ParseLiquidation(raw json.RawMessage) LiquidationRequest
type MultiCollateralAccounts ¶
type MultiCollateralAccounts struct {
Accounts []string `json:"accounts"`
}
func ParseMultiCollateralAccounts ¶
func ParseMultiCollateralAccounts(raw json.RawMessage) MultiCollateralAccounts
type OracleUpdate ¶
func ParseOracleUpdate ¶
func ParseOracleUpdate(raw json.RawMessage) OracleUpdate
type Order ¶
type Order struct { Account string `json:"account"` PriceDenom string `json:"price_denom"` AssetDenom string `json:"asset_denom"` ExpectedOrders []OrderDetails `json:"expected_orders"` }
type OrderDetails ¶
type OrderDetails struct { Price ContractSignedDecimal `json:"price"` Quantity ContractSignedDecimal `json:"quantity"` RemainingQuantity ContractSignedDecimal `json:"remaining_quantity"` Direction string `json:"direction"` Effect string `json:"effect"` Leverage ContractSignedDecimal `json:"leverage"` OrderType string `json:"order_type"` }
type OrderPlacement ¶
type OrderPlacement struct { PositionDirection string `json:"position_direction"` Price string `json:"price"` Quantity string `json:"quantity"` PriceDenom string `json:"price_denom"` AssetDenom string `json:"asset_denom"` PositionEffect string `json:"position_effect"` OrderType string `json:"order_type"` Leverage string `json:"leverage"` }
type PortfolioSpecs ¶
type PortfolioSpecs struct { Account string `json:"account"` Equity ContractSignedDecimal `json:"equity"` TotalPositionValue ContractSignedDecimal `json:"total_position_value"` BuyingPower ContractSignedDecimal `json:"buying_power"` UnrealizedPnl ContractSignedDecimal `json:"unrealized_pnl"` Leverage ContractSignedDecimal `json:"leverage"` }
func ParsePortfolioSpecs ¶
func ParsePortfolioSpecs(specsBytes []byte) PortfolioSpecs
type Position ¶
type Position struct { Account string `json:"account"` PriceDenom string `json:"price_denom"` AssetDenom string `json:"asset_denom"` LongPosition ContractSignedDecimal `json:"long_position"` LongPositionMarginDebt ContractSignedDecimal `json:"long_position_margin_debt"` LongPositioLastFundingPaymentEpoch int64 `json:"long_position_last_funding_payment_epoch"` ShortPosition ContractSignedDecimal `json:"short_position"` ShortPositionMarginDebt ContractSignedDecimal `json:"short_position_margin_debt"` ShortPositioLastFundingPaymentEpoch int64 `json:"short_position_last_funding_payment_epoch"` }
type Sleep ¶
type Sleep struct {
TillNextEpoch bool `json:"till_next_epoch"`
}
func ParseSleep ¶
func ParseSleep(raw json.RawMessage) Sleep
type StartingBalance ¶
func ParseStartingBalance ¶
func ParseStartingBalance(raw json.RawMessage) StartingBalance
type SwapMulticollateralToBaseMsg ¶
type SwapMulticollateralToBaseMsg struct {
SwapMulticollateralToBase SwapMulticollateralToBase `json:"swap_multicollateral_to_base"`
}
type Test ¶
type Test struct { Pairs []Pair `json:"pairs"` Inputs []Input `json:"inputs"` Expectations Expectations `json:"expectations"` }
func ParseTestFile ¶
type UpdateMultiCollateralWhitelistMsg ¶
type UpdateMultiCollateralWhitelistMsg struct {
UpdateMultiCollateralWhitelist UpdateMultiCollateralWhitelist `json:"update_multi_collateral_whitelist"`
}
Click to show internal directories.
Click to hide internal directories.