testnet
GitHub

DefaultStaticPrecompiles

DefaultStaticPrecompiles(stakingKeeper, distributionKeeper, bankKeeper, ...) map[common.Address]vm.PrecompiledContract

This function constructs and returns the complete, default set of static precompiles for the Maroo network. It is the central point of assembly, combining standard Cosmos SDK precompiles (for staking, governance, etc.) with Maroo's specific precompiles (OKRW, PCL). This function is typically called once during the application's setup in app.go to configure the EVM keeper.

Parameters

Name Type Required Description
stakingKeeper stakingkeeper.Keeper The keeper for the x/staking module, required by the Staking precompile.
distributionKeeper distributionkeeper.Keeper The keeper for the x/distribution module, required by the Distribution precompile.
bankKeeper cmn.BankKeeper The keeper for the x/bank module, used by multiple precompiles for token operations.
okrwKeeper okrwkeeper.Keeper The keeper for Maroo's x/okrw module, required by the OKRW precompile to handle minting and parameter access.
pclKeeper *pclkeeper.Keeper The keeper for Maroo's x/pcl module, required by the PCL precompile to manage compliance policies.
... various Other keepers for standard precompiles like governance, slashing, and IBC.

Returns

Type: map[common.Address]vm.PrecompiledContract

Returns a map where keys are the Ethereum addresses of the precompiles and values are the Go objects that implement the precompile logic.

Examples

Standard usage in app.go

This shows the typical invocation of `DefaultStaticPrecompiles`, passing in all the necessary keepers from the application object (`app`) to construct the precompile set for the EVM.

// In app.go, during the EVMKeeper setup...

precompiles := precompiletypes.DefaultStaticPrecompiles(
	app.StakingKeeper,
	app.DistrKeeper,
	app.BankKeeper,
	app.Erc20Keeper,
	app.TransferKeeper,
	app.IBCKeeper.ChannelKeeper,
	app.GovKeeper,
	app.SlashingKeeper,
	app.OkrwKeeper,
	app.PclKeeper,
	app.AccountKeeper,
	app.AppCodec(),
)

evmKeeper := evmkeeper.NewKeeper(
    // ... other params
    precompiles,
    // ... other params
)

Customizing for a private network (disabling governance)

This example demonstrates how a developer could create a custom precompile set by copying the body of `DefaultStaticPrecompiles` and removing certain precompiles, such as the governance precompile, which might not be needed for a permissioned network.

// In a modified defaults.go for a private network
func CustomStaticPrecompiles(...) map[common.Address]vm.PrecompiledContract {
	precompiles := precompiletypes.NewStaticPrecompiles().
		WithPraguePrecompiles().
		WithP256Precompile().
		WithBech32Precompile().
		WithStakingPrecompile(stakingKeeper, bankKeeper, opts...).
		WithBankPrecompile(bankKeeper, erc20Keeper)
		// .WithGovPrecompile(...) is intentionally omitted

	marooPrecompiles := StaticPrecompiles(precompiles).
		WithOkrwPrecompile(bankKeeper, okrwKeeper, accountKeeper).
		WithPclPrecompile(bankKeeper, pclKeeper)

	return map[common.Address]vm.PrecompiledContract(marooPrecompiles)
}
ESC
Type to search