chain

package
v16.0.0-rc2-testnet Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPositionID

func GetPositionID(responseJson map[string]interface{}) (string, error)

func ParseEvent

func ParseEvent(responseJson map[string]interface{}, field string) (string, error)

Types

type Config

type Config struct {
	initialization.ChainMeta

	ValidatorInitConfigs []*initialization.NodeConfig
	// voting period is number of blocks it takes to deposit, 1.2 seconds per validator to vote on the prop, and a buffer.
	VotingPeriod          float32
	ExpeditedVotingPeriod float32
	// upgrade proposal height for chain.
	UpgradePropHeight    int64
	LatestProposalNumber int
	LatestLockNumber     int
	NodeConfigs          []*NodeConfig
	NodeTempConfigs      []*NodeConfig

	LatestCodeId int
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, containerManager *containers.Manager, id string, initValidatorConfigs []*initialization.NodeConfig) *Config

func (*Config) CreateNode

func (c *Config) CreateNode(initNode *initialization.Node) *NodeConfig

CreateNode returns new initialized NodeConfig.

func (*Config) CreateNodeTemp

func (c *Config) CreateNodeTemp(initNode *initialization.Node) *NodeConfig

CreateNodeTemp returns new initialized NodeConfig and appends it to a separate list of temporary nodes. This is used for nodes that are intended to only exist for a single test. Without this separation, parallel tests will try and use this node and fail.

func (*Config) GetDefaultNode

func (c *Config) GetDefaultNode() (*NodeConfig, error)

GetDefaultNode returns the default node of the chain. The default node is the first one created. Returns error if no ndoes created.

func (*Config) GetNodeAtIndex

func (c *Config) GetNodeAtIndex(nodeIndex int) (*NodeConfig, error)

Returns the nodeIndex'th node on the chain

func (*Config) GetPersistentPeers

func (c *Config) GetPersistentPeers() []string

GetPersistentPeers returns persistent peers from every node associated with a chain.

func (*Config) RemoveNode

func (c *Config) RemoveNode(nodeName string) error

RemoveNode removes node and stops it from running.

func (*Config) RemoveTempNode

func (c *Config) RemoveTempNode(nodeName string) error

RemoveTempNode removes a temporary node and stops it from running.

func (*Config) SendIBC

func (c *Config) SendIBC(dstChain *Config, recipient string, token sdk.Coin)

func (*Config) SubmitCreateConcentratedPoolProposal

func (c *Config) SubmitCreateConcentratedPoolProposal() (uint64, error)

func (*Config) WaitForNumEpochs

func (c *Config) WaitForNumEpochs(epochsToWait int64, epochIdentifier string)

WaitForNumEpochs waits for the chain to to go through a given number of epochs.

func (*Config) WaitForNumHeights

func (c *Config) WaitForNumHeights(heightsToWait int64)

WaitForNumHeights waits for all nodes to go through a given number of heights.

func (*Config) WaitUntilEpoch

func (c *Config) WaitUntilEpoch(epoch int64, epochIdentifier string)

WaitUntilEpoch waits for the chain to reach the specified epoch.

func (*Config) WaitUntilHeight

func (c *Config) WaitUntilHeight(height int64)

WaitUntilHeight waits for all validators to reach the specified height at the minimum. returns error, if any.

type NodeConfig

type NodeConfig struct {
	initialization.Node

	OperatorAddress  string
	SnapshotInterval uint64
	// contains filtered or unexported fields
}

func NewNodeConfig

func NewNodeConfig(t *testing.T, initNode *initialization.Node, initConfig *initialization.NodeConfig, chainId string, containerManager *containers.Manager) *NodeConfig

NewNodeConfig returens new initialized NodeConfig.

func (*NodeConfig) AddToExistingLock

func (n *NodeConfig) AddToExistingLock(tokens sdk.Int, denom, duration, from string)

func (*NodeConfig) BankSend

func (n *NodeConfig) BankSend(amount string, sendAddress string, receiveAddress string)

func (*NodeConfig) CollectSpreadRewards

func (n *NodeConfig) CollectSpreadRewards(from, positionIds string)

CollectSpreadRewards collects spread rewards earned by concentrated position in range of [lowerTick; upperTick] in pool with id of poolId

func (*NodeConfig) CreateBalancerPool

func (n *NodeConfig) CreateBalancerPool(poolFile, from string) uint64

func (*NodeConfig) CreateConcentratedPool

func (n *NodeConfig) CreateConcentratedPool(from, denom1, denom2 string, tickSpacing uint64, spreadFactor string) (uint64, error)

CreateConcentratedPool creates a concentrated pool. Returns pool id of newly created pool on success

func (*NodeConfig) CreateConcentratedPosition

func (n *NodeConfig) CreateConcentratedPosition(from, lowerTick, upperTick string, tokens string, token0MinAmt, token1MinAmt int64, poolId uint64) uint64

CreateConcentratedPosition creates a concentrated position from [lowerTick; upperTick] in pool with id of poolId token{0,1} - liquidity to create position with

func (*NodeConfig) CreateStableswapPool

func (n *NodeConfig) CreateStableswapPool(poolFile, from string) uint64

func (*NodeConfig) CreateWallet

func (n *NodeConfig) CreateWallet(walletName string) string

This method also funds fee tokens from the `initialization.ValidatorWalletName` account. TODO: Abstract this to be a fee token provider account.

func (*NodeConfig) CreateWalletAndFund

func (n *NodeConfig) CreateWalletAndFund(walletName string, tokensToFund []string) string

func (*NodeConfig) CreateWalletAndFundFrom

func (n *NodeConfig) CreateWalletAndFundFrom(newWalletName string, fundingWalletName string, tokensToFund []string) string

func (*NodeConfig) DepositProposal

func (n *NodeConfig) DepositProposal(proposalNumber int, isExpedited bool)

func (*NodeConfig) EnableSuperfluidAsset

func (n *NodeConfig) EnableSuperfluidAsset(srcChain *Config, denom string)

func (*NodeConfig) ExitPool

func (n *NodeConfig) ExitPool(from, minAmountsOut string, poolId uint64, shareAmountIn string)

func (*NodeConfig) FailIBCTransfer

func (n *NodeConfig) FailIBCTransfer(from, recipient, amount string)

func (*NodeConfig) FundCommunityPool

func (n *NodeConfig) FundCommunityPool(sendAddress string, funds string)

func (*NodeConfig) GetHostPort

func (n *NodeConfig) GetHostPort(portId string) (string, error)

func (*NodeConfig) GetWallet

func (n *NodeConfig) GetWallet(walletName string) string

func (*NodeConfig) InstantiateWasmContract

func (n *NodeConfig) InstantiateWasmContract(codeId, initMsg, from string)

func (*NodeConfig) JoinPoolExactAmountIn

func (n *NodeConfig) JoinPoolExactAmountIn(tokenIn string, poolId uint64, shareOutMinAmount string, from string)

func (*NodeConfig) LockAndAddToExistingLock

func (n *NodeConfig) LockAndAddToExistingLock(srcChain *Config, amount sdk.Int, denom, lockupWalletAddr, lockupWalletSuperfluidAddr string)

func (*NodeConfig) LockTokens

func (n *NodeConfig) LockTokens(tokens string, duration string, from string)

func (*NodeConfig) LogActionF

func (n *NodeConfig) LogActionF(msg string, args ...interface{})

func (*NodeConfig) ParamChangeProposal

func (n *NodeConfig) ParamChangeProposal(subspace, key string, value []byte, chain *Config) error

func (*NodeConfig) QueryAllSuperfluidAssets

func (n *NodeConfig) QueryAllSuperfluidAssets() []superfluidtypes.SuperfluidAsset

QueryAllSuperfluidAssets returns all authorized superfluid assets.

func (*NodeConfig) QueryArithmeticTwap

func (n *NodeConfig) QueryArithmeticTwap(poolId uint64, baseAsset, quoteAsset string, startTime time.Time, endTime time.Time) (sdk.Dec, error)

func (*NodeConfig) QueryArithmeticTwapToNow

func (n *NodeConfig) QueryArithmeticTwapToNow(poolId uint64, baseAsset, quoteAsset string, startTime time.Time) (sdk.Dec, error)

func (*NodeConfig) QueryBalances

func (n *NodeConfig) QueryBalances(address string) (sdk.Coins, error)

QueryBalancer returns balances at the address.

func (*NodeConfig) QueryCFMMPool

func (n *NodeConfig) QueryCFMMPool(poolId uint64) (gammtypes.CFMMPoolI, error)

func (*NodeConfig) QueryCommunityPoolModuleAccount

func (n *NodeConfig) QueryCommunityPoolModuleAccount() string

func (*NodeConfig) QueryConcentratedPooIdLinkFromCFMM

func (n *NodeConfig) QueryConcentratedPooIdLinkFromCFMM(cfmmPoolId uint64) uint64

func (*NodeConfig) QueryConcentratedPool

func (n *NodeConfig) QueryConcentratedPool(poolId uint64) (cltypes.ConcentratedPoolExtension, error)

func (*NodeConfig) QueryConcentratedPositions

func (n *NodeConfig) QueryConcentratedPositions(address string) []model.FullPositionBreakdown

func (*NodeConfig) QueryContractsFromId

func (n *NodeConfig) QueryContractsFromId(codeId int) ([]string, error)

func (*NodeConfig) QueryCurrentEpoch

func (n *NodeConfig) QueryCurrentEpoch(identifier string) int64

func (*NodeConfig) QueryCurrentHeight

func (n *NodeConfig) QueryCurrentHeight() (int64, error)

QueryCurrentHeight returns the current block height of the node or error.

func (*NodeConfig) QueryGRPCGateway

func (n *NodeConfig) QueryGRPCGateway(path string, parameters ...string) ([]byte, error)

func (*NodeConfig) QueryGeometricTwap

func (n *NodeConfig) QueryGeometricTwap(poolId uint64, baseAsset, quoteAsset string, startTime time.Time, endTime time.Time) (sdk.Dec, error)

func (*NodeConfig) QueryGeometricTwapToNow

func (n *NodeConfig) QueryGeometricTwapToNow(poolId uint64, baseAsset, quoteAsset string, startTime time.Time) (sdk.Dec, error)

func (*NodeConfig) QueryGovModuleAccount

func (n *NodeConfig) QueryGovModuleAccount() string

func (*NodeConfig) QueryHashFromBlock

func (n *NodeConfig) QueryHashFromBlock(height int64) (string, error)

QueryHashFromBlock gets block hash at a specific height. Otherwise, error.

func (*NodeConfig) QueryIntermediaryAccount

func (n *NodeConfig) QueryIntermediaryAccount(denom string, valAddr string) (int, error)

func (*NodeConfig) QueryLatestBlockTime

func (n *NodeConfig) QueryLatestBlockTime() time.Time

QueryLatestBlockTime returns the latest block time.

func (*NodeConfig) QueryLatestWasmCodeID

func (n *NodeConfig) QueryLatestWasmCodeID() uint64

func (*NodeConfig) QueryListSnapshots

func (n *NodeConfig) QueryListSnapshots() ([]*tmabcitypes.Snapshot, error)

QueryListSnapshots gets all snapshots currently created for a node.

func (*NodeConfig) QueryNumPools

func (n *NodeConfig) QueryNumPools() uint64

func (*NodeConfig) QueryParams

func (n *NodeConfig) QueryParams(subspace, key string) string

QueryParams extracts the params for a given subspace and key. This is done generically via json to avoid having to specify the QueryParamResponse type (which may not exist for all params).

func (*NodeConfig) QueryPoolType

func (n *NodeConfig) QueryPoolType(poolId string) string

func (*NodeConfig) QueryPropStatus

func (n *NodeConfig) QueryPropStatus(proposalNumber int) (string, error)

func (*NodeConfig) QueryPropStatusTimed

func (n *NodeConfig) QueryPropStatusTimed(proposalNumber int, desiredStatus string, totalTime chan time.Duration)

func (*NodeConfig) QueryPropTally

func (n *NodeConfig) QueryPropTally(proposalNumber int) (sdk.Int, sdk.Int, sdk.Int, sdk.Int, error)

func (*NodeConfig) QueryProtoRevAllRouteStatistics

func (n *NodeConfig) QueryProtoRevAllRouteStatistics() ([]protorevtypes.RouteStatistics, error)

QueryProtoRevAllRouteStatistics gets all of the route statistics that the module has recorded.

func (*NodeConfig) QueryProtoRevBaseDenoms

func (n *NodeConfig) QueryProtoRevBaseDenoms() ([]protorevtypes.BaseDenom, error)

QueryProtoRevBaseDenoms gets the base denoms used to construct cyclic arbitrage routes.

func (*NodeConfig) QueryProtoRevDeveloperAccount

func (n *NodeConfig) QueryProtoRevDeveloperAccount() (sdk.AccAddress, error)

QueryProtoRevDeveloperAccount gets the developer account of the module.

func (*NodeConfig) QueryProtoRevEnabled

func (n *NodeConfig) QueryProtoRevEnabled() (bool, error)

QueryProtoRevEnabled queries if the protorev module is enabled.

func (*NodeConfig) QueryProtoRevMaxPoolPointsPerBlock

func (n *NodeConfig) QueryProtoRevMaxPoolPointsPerBlock() (uint64, error)

QueryProtoRevMaxPoolPointsPerBlock gets the max pool points per block of the module.

func (*NodeConfig) QueryProtoRevMaxPoolPointsPerTx

func (n *NodeConfig) QueryProtoRevMaxPoolPointsPerTx() (uint64, error)

QueryProtoRevMaxPoolPointsPerTx gets the max pool points per tx of the module.

func (*NodeConfig) QueryProtoRevNumberOfTrades

func (n *NodeConfig) QueryProtoRevNumberOfTrades() (sdk.Int, error)

QueryProtoRevNumberOfTrades gets the number of trades the protorev module has executed.

func (*NodeConfig) QueryProtoRevPoolWeights

func (n *NodeConfig) QueryProtoRevPoolWeights() (protorevtypes.PoolWeights, error)

QueryProtoRevPoolWeights gets the pool point weights of the module.

func (*NodeConfig) QueryProtoRevProfits

func (n *NodeConfig) QueryProtoRevProfits() ([]sdk.Coin, error)

QueryProtoRevProfits gets the profits the protorev module has made.

func (*NodeConfig) QueryProtoRevTokenPairArbRoutes

func (n *NodeConfig) QueryProtoRevTokenPairArbRoutes() ([]protorevtypes.TokenPairArbRoutes, error)

QueryProtoRevTokenPairArbRoutes gets all of the token pair hot routes that the module is currently using.

func (*NodeConfig) QuerySupply

func (n *NodeConfig) QuerySupply() (sdk.Coins, error)

func (*NodeConfig) QuerySupplyOf

func (n *NodeConfig) QuerySupplyOf(denom string) (sdk.Int, error)

func (*NodeConfig) QueryWasmSmart

func (n *NodeConfig) QueryWasmSmart(contract string, msg string, result any) error

func (*NodeConfig) QueryWasmSmartArray

func (n *NodeConfig) QueryWasmSmartArray(contract string, msg string) (resultArray []interface{}, err error)

func (*NodeConfig) QueryWasmSmartObject

func (n *NodeConfig) QueryWasmSmartObject(contract string, msg string) (resultObject map[string]interface{}, err error)

func (*NodeConfig) Run

func (n *NodeConfig) Run() error

Run runs a node container for the given nodeIndex. The node configuration must be already added to the chain config prior to calling this method.

func (*NodeConfig) SendIBC

func (n *NodeConfig) SendIBC(dstChain *Config, recipient string, token sdk.Coin)

func (*NodeConfig) SendIBCTransfer

func (n *NodeConfig) SendIBCTransfer(dstChain *Config, from, recipient, memo string, token sdk.Coin)

func (*NodeConfig) SetupRateLimiting

func (n *NodeConfig) SetupRateLimiting(paths, gov_addr string, chain *Config) (string, error)

TODO remove chain from this as input

func (*NodeConfig) Status

func (n *NodeConfig) Status() (resultStatus, error)

func (*NodeConfig) Stop

func (n *NodeConfig) Stop() error

Stop stops the node from running and removes its container.

func (*NodeConfig) StoreWasmCode

func (n *NodeConfig) StoreWasmCode(wasmFile, from string) int

func (*NodeConfig) SubmitCreateConcentratedPoolProposal

func (n *NodeConfig) SubmitCreateConcentratedPoolProposal(initialDeposit sdk.Coin) int

func (*NodeConfig) SubmitParamChangeProposal

func (n *NodeConfig) SubmitParamChangeProposal(proposalJson, from string) int

func (*NodeConfig) SubmitSuperfluidProposal

func (n *NodeConfig) SubmitSuperfluidProposal(asset string, initialDeposit sdk.Coin) int

func (*NodeConfig) SubmitTextProposal

func (n *NodeConfig) SubmitTextProposal(text string, initialDeposit sdk.Coin, isExpedited bool) int

func (*NodeConfig) SubmitTickSpacingReductionProposal

func (n *NodeConfig) SubmitTickSpacingReductionProposal(poolTickSpacingRecords string, initialDeposit sdk.Coin, isExpedited bool)

func (*NodeConfig) SubmitUpgradeProposal

func (n *NodeConfig) SubmitUpgradeProposal(upgradeVersion string, upgradeHeight int64, initialDeposit sdk.Coin)

func (*NodeConfig) SuperfluidDelegate

func (n *NodeConfig) SuperfluidDelegate(lockNumber int, valAddress string, from string)

func (*NodeConfig) SwapExactAmountIn

func (n *NodeConfig) SwapExactAmountIn(tokenInCoin, tokenOutMinAmountInt string, swapRoutePoolIds string, swapRouteDenoms string, from string)

SwapExactAmountIn swaps tokenInCoin to get at least tokenOutMinAmountInt of the other token's pool out. swapRoutePoolIds is the comma separated list of pool ids to swap through. swapRouteDenoms is the comma separated list of denoms to swap through. To reproduce locally: docker container exec <container id> osmosisd tx gamm swap-exact-amount-in <tokeinInCoin> <tokenOutMinAmountInt> --swap-route-pool-ids <swapRoutePoolIds> --swap-route-denoms <swapRouteDenoms> --chain-id=<id>--from=<address> --keyring-backend=test -b=block --yes --log_format=json

func (*NodeConfig) VoteNoProposal

func (n *NodeConfig) VoteNoProposal(from string, proposalNumber int)

func (*NodeConfig) VoteYesProposal

func (n *NodeConfig) VoteYesProposal(from string, proposalNumber int)

func (*NodeConfig) WaitUntil

func (n *NodeConfig) WaitUntil(doneCondition func(syncInfo coretypes.SyncInfo) bool)

WaitUntil waits until node reaches doneCondition. Return nil if reached, error otherwise.

func (*NodeConfig) WasmExecute

func (n *NodeConfig) WasmExecute(contract, execMsg, from string)

func (*NodeConfig) WithSetupTime

func (n *NodeConfig) WithSetupTime(t time.Time) *NodeConfig

func (*NodeConfig) WithdrawPosition

func (n *NodeConfig) WithdrawPosition(from, liquidityOut string, positionId uint64)

Jump to

Keyboard shortcuts

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