utils

package
v0.0.0-...-eccf466 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenToMint = 1e18
)

Variables

This section is empty.

Functions

func CheckTxTopics

func CheckTxTopics(res abcitypes.ResponseDeliverTx, expectedTopics []string) error

CheckTxTopics checks if all expected topics are present in the transaction response

func DecodeContractCallResponse

func DecodeContractCallResponse(response interface{}, callArgs factory.CallArgs, res abcitypes.ResponseDeliverTx) error

DecodeContractCallResponse decodes the response of a contract call query

func IsContractAccount

func IsContractAccount(acc authtypes.AccountI) error

IsContractAccount checks if the given account is a contract account

func RegisterERC20

func RegisterERC20(tf factory.TxFactory, network network.Network, data ERC20RegistrationData) (erc20types.TokenPair, error)

RegisterERC20 is a helper function to register ERC20 token through submitting a governance proposal and having it pass. It returns the registered token pair.

func RegisterIBCERC20Coins

func RegisterIBCERC20Coins(
	network *network.UnitTestNetwork,
	tokenReceiver sdk.AccAddress,
	denomTrace transfertypes.DenomTrace,
) (erc20types.TokenPair, error)

RegisterIBCERC20Coins uses the UnitNetwork to register the denomTrace as an ERC20 token. The function performs all the required steps for the registration like registering the denom trace in the transfer keeper and minting the token with the bank. Returns the TokenPair or an error.

func RegisterIslmERC20Coins

func RegisterIslmERC20Coins(
	network network.UnitTestNetwork,
	tokenReceiver sdk.AccAddress,
) (erc20types.TokenPair, error)

RegisterIslmERC20Coins uses the UnitNetwork to register the aISLM token as an ERC20 token. The function performs all the required steps for the registration like registering the denom trace in the transfer keeper and minting the token with the bank. Returns the TokenPair or an error.

func SubmitProposal

func SubmitProposal(tf factory.TxFactory, network network.Network, proposerPriv cryptotypes.PrivKey, proposal govv1beta1.Content) (uint64, error)

SubmitProposal is a helper function to submit a governance proposal and return the proposal ID.

func VoteOnProposal

func VoteOnProposal(tf factory.TxFactory, voterPriv cryptotypes.PrivKey, proposalID uint64, option govv1.VoteOption) error

VoteOnProposal is a helper function to vote on a governance proposal given the private key of the voter and the option to vote.

Types

type ERC20RegistrationData

type ERC20RegistrationData struct {
	// Address is the address of the ERC20 token.
	Address common.Address
	// Denom is the ERC20 token denom.
	Denom string
	// ProposerPriv is the private key used to sign the proposal and voting transactions.
	ProposerPriv cryptotypes.PrivKey
}

ERC20RegistrationData is the necessary data to provide in order to register an ERC20 token.

func (ERC20RegistrationData) ValidateBasic

func (ed ERC20RegistrationData) ValidateBasic() error

ValidateBasic does stateless validation of the data for the ERC20 registration.

Jump to

Keyboard shortcuts

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