Documentation
¶
Index ¶
- Variables
- func AbiArgumentsForPayload() abi.Arguments
- func NewEVMHooks(k Keeper) evmtypes.EvmHooks
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type EVMHooks
- type Keeper
- func (k Keeper) AddPendingInbound(ctx context.Context, inbound types.Inbound) error
- func (k Keeper) AllPendingInbounds(goCtx context.Context, req *types.QueryAllPendingInboundsRequest) (*types.QueryAllPendingInboundsResponse, error)
- func (k Keeper) AttachOutboundsToExistingUniversalTx(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse, ...) error
- func (k Keeper) BuildOutboundsFromReceipt(ctx context.Context, utxId string, receipt *evmtypes.MsgEthereumTxResponse) ([]*types.OutboundTx, error)
- func (k Keeper) BuildPcUniversalTxKey(ctx context.Context, pc types.PCTx) (string, error)
- func (k Keeper) CalculateGasCost(baseFee sdkmath.LegacyDec, maxFeePerGas *big.Int, ...) (*big.Int, error)
- func (k Keeper) CallFactoryGetOriginForUEA(ctx sdk.Context, from, factoryAddr, ueaAddr common.Address) (*types.UniversalAccountId, bool, error)
- func (k Keeper) CallFactoryToDeployUEA(ctx sdk.Context, from, factoryAddr common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallFactoryToGetUEAAddressForOrigin(ctx sdk.Context, from, factoryAddr common.Address, ...) (common.Address, bool, error)
- func (k Keeper) CallPRC20Deposit(ctx sdk.Context, prc20Address, to common.Address, amount *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallPRC20DepositAutoSwap(ctx sdk.Context, prc20Address, to common.Address, amount *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallUEADomainSeparator(ctx sdk.Context, from, ueaAddr common.Address) ([32]byte, error)
- func (k Keeper) CallUEAExecutePayload(ctx sdk.Context, from, ueaAddr common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallUEAMigrateUEA(ctx sdk.Context, from, ueaAddr common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallUniversalCoreSetGasPrice(ctx sdk.Context, chainID string, price *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CreateUniversalTx(ctx context.Context, key string, utx types.UniversalTx) error
- func (k Keeper) CreateUniversalTxFromPCTx(ctx context.Context, pcTx types.PCTx) (*types.UniversalTx, error)
- func (k Keeper) CreateUniversalTxFromReceiptIfOutbound(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse, pcTx types.PCTx) error
- func (k Keeper) DeductAndBurnFees(ctx context.Context, from sdk.AccAddress, gasCost *big.Int) error
- func (k Keeper) DeployUEA(ctx context.Context, evmFrom common.Address, ...) ([]byte, error)
- func (k Keeper) DeployUEAV2(ctx context.Context, evmFrom common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) ExecuteInbound(ctx context.Context, utx types.UniversalTx) error
- func (k Keeper) ExecuteInboundFunds(ctx context.Context, utx types.UniversalTx) error
- func (k Keeper) ExecuteInboundFundsAndPayload(ctx context.Context, utx types.UniversalTx) error
- func (k Keeper) ExecuteInboundGas(ctx context.Context, inbound types.Inbound) error
- func (k Keeper) ExecuteInboundGasAndPayload(ctx context.Context, utx types.UniversalTx) error
- func (k Keeper) ExecutePayload(ctx context.Context, evmFrom common.Address, ...) error
- func (k Keeper) ExecutePayloadV2(ctx context.Context, evmFrom common.Address, ueaAddr common.Address, ...) (*vmtypes.MsgEthereumTxResponse, error)
- func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState
- func (k Keeper) FinalizeOutbound(ctx context.Context, utxId string, outbound types.OutboundTx) error
- func (k Keeper) GetGasPrice(ctx context.Context, chainID string) (types.GasPrice, bool, error)
- func (k Keeper) GetModuleAccountNonce(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetPayloadHashEVM(ctx sdk.Context, from, ueaAddr common.Address, ...) (common.Hash, error)
- func (k *Keeper) GetUeModuleAddress(ctx context.Context) (common.Address, string)
- func (k Keeper) GetUniversalTx(ctx context.Context, key string) (types.UniversalTx, bool, error)
- func (k Keeper) GetUniversalTxStatus(ctx context.Context, key string) (types.UniversalTxStatus, bool, error)
- func (k Keeper) HasUniversalTx(ctx context.Context, key string) (bool, error)
- func (k Keeper) IncrementModuleAccountNonce(ctx sdk.Context) (uint64, error)
- func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error
- func (k Keeper) IsPendingInbound(ctx context.Context, inbound types.Inbound) (bool, error)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) MigrateUEA(ctx context.Context, evmFrom common.Address, ...) error
- func (k Keeper) MintPCTokensDirectly(ctx sdk.Context, recipient sdk.AccAddress, amount sdkmath.Int) error
- func (k Keeper) RemovePendingInbound(ctx context.Context, inbound types.Inbound) error
- func (k Keeper) SchemaBuilder() *collections.SchemaBuilder
- func (k Keeper) SetGasPrice(ctx context.Context, chainID string, gasPrice types.GasPrice) error
- func (k Keeper) SetModuleAccountNonce(ctx sdk.Context, nonce uint64) error
- func (k Keeper) StoreVerifiedPayloadHash(ctx sdk.Context, utx types.UniversalTx, ueaAddr common.Address, ...) error
- func (k Keeper) UpdateOutbound(ctx context.Context, utxId string, outbound types.OutboundTx) error
- func (k Keeper) UpdateParams(ctx context.Context, params types.Params) error
- func (k Keeper) UpdateUniversalTx(ctx context.Context, key string, updateFn func(*types.UniversalTx) error) error
- func (k Keeper) UpdateUniversalTxStatus(ctx context.Context, key string, newStatus types.UniversalTxStatus) error
- func (k Keeper) VoteGasPrice(ctx context.Context, universalValidator sdk.ValAddress, observedChainId string, ...) error
- func (k Keeper) VoteInbound(ctx context.Context, universalValidator sdk.ValAddress, inbound types.Inbound) error
- func (k Keeper) VoteOnInboundBallot(ctx context.Context, universalValidator sdk.ValAddress, inbound types.Inbound) (isFinalized bool, isNew bool, err error)
- func (k Keeper) VoteOnOutboundBallot(ctx context.Context, universalValidator sdk.ValAddress, utxId string, ...) (isFinalized bool, isNew bool, err error)
- func (k Keeper) VoteOutbound(ctx context.Context, universalValidator sdk.ValAddress, utxId string, ...) error
- type Querier
- func (k Querier) AllGasPrices(goCtx context.Context, req *types.QueryAllGasPricesRequest) (*types.QueryAllGasPricesResponse, error)
- func (k Querier) AllUniversalTx(goCtx context.Context, req *types.QueryAllUniversalTxRequest) (*types.QueryAllUniversalTxResponse, error)
- func (k Querier) GasPrice(goCtx context.Context, req *types.QueryGasPriceRequest) (*types.QueryGasPriceResponse, error)
- func (k Querier) GetUniversalTx(goCtx context.Context, req *types.QueryGetUniversalTxRequest) (*types.QueryGetUniversalTxResponse, error)
- func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- type QuerierV2
Constants ¶
This section is empty.
Variables ¶
var UNIVERSAL_PAYLOAD_TYPEHASH = common.HexToHash("0x1d8b43e5066bd20bfdacf7b8f4790c0309403b18434e3699ce3c5e57502ed8c4")
Functions ¶
func AbiArgumentsForPayload ¶
AbiArgumentsForPayload returns the abi.Arguments for encoding a UniversalPayload struct
func NewEVMHooks ¶ added in v0.0.13
NewEVMHooks creates a new instance of EVMHooks.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the module MsgServer interface
Types ¶
type EVMHooks ¶ added in v0.0.13
type EVMHooks struct {
// contains filtered or unexported fields
}
EVMHooks implements the EVM post-processing hooks. This hook will be invoked after every EVM transaction execution and is responsible for detecting outbound events and creating UniversalTx if needed.
func (EVMHooks) PostTxProcessing ¶ added in v0.0.13
func (h EVMHooks) PostTxProcessing( ctx sdk.Context, sender common.Address, msg core.Message, receipt *ethtypes.Receipt, ) error
PostTxProcessing is called by the EVM module after transaction execution. It inspects the receipt and creates UniversalTx + Outbound only if UniversalTxWithdraw event is detected.
type Keeper ¶
type Keeper struct {
Params collections.Item[types.Params]
// Inbound trackers
PendingInbounds collections.KeySet[string]
// UniversalTx collection
UniversalTx collections.Map[string, types.UniversalTx]
// Module account manual nonce
ModuleAccountNonce collections.Item[uint64]
// GasPrices collection stores aggregated gas price data for each chain
GasPrices collections.Map[string, types.GasPrice]
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService storetypes.KVStoreService, logger log.Logger, authority string, evmKeeper types.EVMKeeper, feemarketKeeper types.FeeMarketKeeper, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, uregistryKeeper types.UregistryKeeper, utxverifierKeeper types.UtxverifierKeeper, uvalidatorKeeper types.UValidatorKeeper, ) Keeper
NewKeeper creates a new Keeper instance
func (Keeper) AddPendingInbound ¶
AddPendingInbound adds an inbound synthetic to the pending set if not already present
func (Keeper) AllPendingInbounds ¶
func (k Keeper) AllPendingInbounds(goCtx context.Context, req *types.QueryAllPendingInboundsRequest) (*types.QueryAllPendingInboundsResponse, error)
AllPendingInbounds implements types.QueryServer.
func (Keeper) AttachOutboundsToExistingUniversalTx ¶ added in v0.0.13
func (k Keeper) AttachOutboundsToExistingUniversalTx( ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse, utx types.UniversalTx, ) error
AttachOutboundsToExistingUniversalTx Used when UniversalTx already exists (e.g. inbound execution) It attaches outbounds extracted from receipt to the existing utx.
func (Keeper) BuildOutboundsFromReceipt ¶ added in v0.0.13
func (k Keeper) BuildOutboundsFromReceipt( ctx context.Context, utxId string, receipt *evmtypes.MsgEthereumTxResponse, ) ([]*types.OutboundTx, error)
func (Keeper) BuildPcUniversalTxKey ¶ added in v0.0.13
func (Keeper) CalculateGasCost ¶
func (k Keeper) CalculateGasCost( baseFee sdkmath.LegacyDec, maxFeePerGas *big.Int, maxPriorityFeePerGas *big.Int, gasUsed uint64, ) (*big.Int, error)
CalculateGasCost calculates the gas cost based on EIP-1559 fee mechanism: 1. Effective Gas Price = min(maxFeePerGas, baseFee + maxPriorityFeePerGas) 2. Total Fee = gasUsed × Effective Gas Price Parameters: - baseFee: current network base fee - maxFeePerGas: maximum total fee user is willing to pay - maxPriorityFeePerGas: maximum tip to validator - gasUsed: amount of gas consumed
func (Keeper) CallFactoryGetOriginForUEA ¶ added in v0.0.16
func (k Keeper) CallFactoryGetOriginForUEA( ctx sdk.Context, from, factoryAddr, ueaAddr common.Address, ) (*types.UniversalAccountId, bool, error)
CallFactoryGetOriginForUEA checks if a given address is a UEA Returns the UniversalAccountId and a boolean indicating if the address is a UEA
func (Keeper) CallFactoryToDeployUEA ¶
func (k Keeper) CallFactoryToDeployUEA( ctx sdk.Context, from, factoryAddr common.Address, universalAccount *types.UniversalAccountId, ) (*evmtypes.MsgEthereumTxResponse, error)
CallFactoryToDeployUEA deploys a new UEA using factory contract Returns deployment response or error if deployment fails
func (Keeper) CallFactoryToGetUEAAddressForOrigin ¶
func (k Keeper) CallFactoryToGetUEAAddressForOrigin( ctx sdk.Context, from, factoryAddr common.Address, universalAccount *types.UniversalAccountId, ) (common.Address, bool, error)
CallFactoryToGetUEAAddressForOrigin calls FactoryV1.getUEAForOrigin(...)
func (Keeper) CallPRC20Deposit ¶
func (k Keeper) CallPRC20Deposit( ctx sdk.Context, prc20Address, to common.Address, amount *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
Calls Handler Contract to deposit prc20 tokens
func (Keeper) CallPRC20DepositAutoSwap ¶
func (k Keeper) CallPRC20DepositAutoSwap( ctx sdk.Context, prc20Address, to common.Address, amount *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
Calls Handler Contract to deposit prc20 tokens
func (Keeper) CallUEADomainSeparator ¶
func (k Keeper) CallUEADomainSeparator( ctx sdk.Context, from, ueaAddr common.Address, ) ([32]byte, error)
CallUEADomainSeparator fetches the domainSeparator from the UEA contract
func (Keeper) CallUEAExecutePayload ¶
func (k Keeper) CallUEAExecutePayload( ctx sdk.Context, from, ueaAddr common.Address, universal_payload *types.UniversalPayload, verificationData []byte, ) (*evmtypes.MsgEthereumTxResponse, error)
CallUEAExecutePayload executes a universal payload through UEA
func (Keeper) CallUEAMigrateUEA ¶
func (k Keeper) CallUEAMigrateUEA( ctx sdk.Context, from, ueaAddr common.Address, migration_payload *types.MigrationPayload, signature []byte, ) (*evmtypes.MsgEthereumTxResponse, error)
CallUEAMigrateUEA migrates UEA through existing UEA
func (Keeper) CallUniversalCoreSetGasPrice ¶
func (k Keeper) CallUniversalCoreSetGasPrice( ctx sdk.Context, chainID string, price *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
Calls UniversalCore Contract to set gas price
func (Keeper) CreateUniversalTx ¶
CreateUniversalTx stores a new UniversalTx
func (Keeper) CreateUniversalTxFromPCTx ¶ added in v0.0.13
func (Keeper) CreateUniversalTxFromReceiptIfOutbound ¶ added in v0.0.13
func (k Keeper) CreateUniversalTxFromReceiptIfOutbound( ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse, pcTx types.PCTx, ) error
CreateUniversalTxFromReceiptIfOutbound Creates a UniversalTx ONLY if outbound events exist in the receipt. Safe to call from ExecutePayload, EVM hooks
func (Keeper) DeductAndBurnFees ¶
DeductAndBurnFees deducts gas fees from the user's smart account and burns them. The process happens in two steps: 1. Transfer coins from user account to module account 2. Burn coins from module account Returns error if either transfer or burn fails
func (Keeper) DeployUEA ¶
func (k Keeper) DeployUEA(ctx context.Context, evmFrom common.Address, universalAccountId *types.UniversalAccountId) ([]byte, error)
updateParams is for updating params collections of the module
func (Keeper) DeployUEAV2 ¶
func (k Keeper) DeployUEAV2(ctx context.Context, evmFrom common.Address, universalAccountId *types.UniversalAccountId) (*evmtypes.MsgEthereumTxResponse, error)
updateParams is for updating params collections of the module
func (Keeper) ExecuteInbound ¶
func (Keeper) ExecuteInboundFunds ¶
func (Keeper) ExecuteInboundFundsAndPayload ¶
func (Keeper) ExecuteInboundGas ¶
func (Keeper) ExecuteInboundGasAndPayload ¶
func (Keeper) ExecutePayload ¶
func (k Keeper) ExecutePayload(ctx context.Context, evmFrom common.Address, universalAccountId *types.UniversalAccountId, universalPayload *types.UniversalPayload, verificationData string) error
updateParams is for updating params collections of the module
func (Keeper) ExecutePayloadV2 ¶
func (k Keeper) ExecutePayloadV2(ctx context.Context, evmFrom common.Address, ueaAddr common.Address, universalPayload *types.UniversalPayload, verificationData string) (*vmtypes.MsgEthereumTxResponse, error)
ExecutePayloadV2 executes a universal payload through a UEA. The caller is responsible for resolving and validating ueaAddr before calling this function.
func (*Keeper) ExportGenesis ¶
func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState
ExportGenesis exports the module's state to a genesis state.
func (Keeper) FinalizeOutbound ¶ added in v0.0.13
func (Keeper) GetGasPrice ¶
func (Keeper) GetModuleAccountNonce ¶
GetModuleAccountNonce returns the current module account nonce. If not set yet, it safely defaults to 0.
func (Keeper) GetPayloadHashEVM ¶
func (k Keeper) GetPayloadHashEVM( ctx sdk.Context, from, ueaAddr common.Address, payload types.AbiUniversalPayload, ) (common.Hash, error)
GetPayloadHashEVM computes the EIP-712 style payload hash using the UEA contract's domainSeparator
func (*Keeper) GetUeModuleAddress ¶
func (Keeper) GetUniversalTx ¶
GetUniversalTx retrieves a UniversalTx by key, returns (value, found, error)
func (Keeper) GetUniversalTxStatus ¶
func (k Keeper) GetUniversalTxStatus(ctx context.Context, key string) (types.UniversalTxStatus, bool, error)
GetUniversalTxStatus retrieves the status of a UniversalTx
func (Keeper) HasUniversalTx ¶
HasUniversalTx checks if a UniversalTx exists
func (Keeper) IncrementModuleAccountNonce ¶
IncrementModuleAccountNonce increases the nonce by 1 and stores it back.
func (*Keeper) InitGenesis ¶
InitGenesis initializes the module's state from a genesis state.
func (Keeper) IsPendingInbound ¶
IsPendingInbound checks if an inbound synthetic is pending
func (Keeper) MigrateUEA ¶
func (k Keeper) MigrateUEA(ctx context.Context, evmFrom common.Address, universalAccountId *types.UniversalAccountId, migrationPayload *types.MigrationPayload, signature string) error
updateParams is for updating params collections of the module
func (Keeper) MintPCTokensDirectly ¶
func (k Keeper) MintPCTokensDirectly(ctx sdk.Context, recipient sdk.AccAddress, amount sdkmath.Int) error
TODO: temporary don't use in any fn
func (Keeper) RemovePendingInbound ¶
RemovePendingInbound removes an inbound synthetic from the pending set
func (Keeper) SchemaBuilder ¶
func (k Keeper) SchemaBuilder() *collections.SchemaBuilder
func (Keeper) SetGasPrice ¶
func (Keeper) SetModuleAccountNonce ¶
SetModuleAccountNonce allows explicitly setting the nonce (optional, for migration or testing).
func (Keeper) StoreVerifiedPayloadHash ¶
func (k Keeper) StoreVerifiedPayloadHash( ctx sdk.Context, utx types.UniversalTx, ueaAddr common.Address, ueModuleAccAddress common.Address, ) error
StoreVerifiedPayloadHash stores one payload hash for a given inbound tx
func (Keeper) UpdateOutbound ¶ added in v0.0.13
func (Keeper) UpdateParams ¶
updateParams is for updating params collections of the module
func (Keeper) UpdateUniversalTx ¶
func (k Keeper) UpdateUniversalTx( ctx context.Context, key string, updateFn func(*types.UniversalTx) error, ) error
UpdateUniversalTx updates an existing UniversalTx in the store. It fetches the UniversalTx, applies the update function, and saves it back.
func (Keeper) UpdateUniversalTxStatus ¶
func (k Keeper) UpdateUniversalTxStatus(ctx context.Context, key string, newStatus types.UniversalTxStatus) error
UpdateUniversalTxStatus sets a new status for the UniversalTx
func (Keeper) VoteGasPrice ¶
func (Keeper) VoteInbound ¶
func (k Keeper) VoteInbound(ctx context.Context, universalValidator sdk.ValAddress, inbound types.Inbound) error
voteInbound is for uvalidators for voting on synthetic asset inbound bridging
func (Keeper) VoteOnInboundBallot ¶
func (Keeper) VoteOnOutboundBallot ¶ added in v0.0.13
func (Keeper) VoteOutbound ¶ added in v0.0.13
func (k Keeper) VoteOutbound( ctx context.Context, universalValidator sdk.ValAddress, utxId string, outboundId string, observedTx types.OutboundObservation, ) error
VoteOutbound is for uvalidators for voting on observed outbound tx on external chain
type Querier ¶
type Querier struct {
Keeper
}
func NewQuerier ¶
func (Querier) AllGasPrices ¶
func (k Querier) AllGasPrices(goCtx context.Context, req *types.QueryAllGasPricesRequest) (*types.QueryAllGasPricesResponse, error)
AllGasPrices implements types.QueryServer.
func (Querier) AllUniversalTx ¶
func (k Querier) AllUniversalTx(goCtx context.Context, req *types.QueryAllUniversalTxRequest) (*types.QueryAllUniversalTxResponse, error)
AllUniversalTx implements types.QueryServer.
func (Querier) GasPrice ¶
func (k Querier) GasPrice(goCtx context.Context, req *types.QueryGasPriceRequest) (*types.QueryGasPriceResponse, error)
GasPrice implements types.QueryServer.
func (Querier) GetUniversalTx ¶
func (k Querier) GetUniversalTx(goCtx context.Context, req *types.QueryGetUniversalTxRequest) (*types.QueryGetUniversalTxResponse, error)
GetUniversalTx implements types.QueryServer.
func (Querier) Params ¶
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
type QuerierV2 ¶ added in v0.0.16
type QuerierV2 struct {
Keeper
}
QuerierV2 implements the uexecutor.v2 QueryServer, returning native types.
func NewQuerierV2 ¶ added in v0.0.16
func (QuerierV2) GetUniversalTx ¶ added in v0.0.16
func (k QuerierV2) GetUniversalTx(goCtx context.Context, req *typesv2.QueryGetUniversalTxRequest) (*typesv2.QueryGetUniversalTxResponse, error)
GetUniversalTx implements typesv2.QueryServer. Returns the native UniversalTx type (not legacy) for the given ID.
Source Files
¶
- create_outbound.go
- deploy_uea.go
- evm.go
- evm_hooks.go
- execute_inbound.go
- execute_inbound_funds.go
- execute_inbound_funds_and_payload.go
- execute_inbound_gas.go
- execute_inbound_gas_and_payload.go
- execute_payload.go
- fees.go
- gas_price.go
- genesis.go
- handler.go
- inbound.go
- keeper.go
- msg_deploy_uea.go
- msg_execute_payload.go
- msg_migrate_uea.go
- msg_server.go
- msg_update_params.go
- msg_vote_inbound.go
- msg_vote_outbound.go
- outbound.go
- payload.go
- query_server.go
- query_server_v2.go
- universal_tx.go
- voting.go