Skip to content

CosmosSDK module for automatic execution of smart contracts

Notifications You must be signed in to change notification settings

emidev98/lifecycle-hooks

Repository files navigation

Lifecycle Hooks Module

IMG

Lifecycle Hooks is a CosmosSDK blockchain module that uses the modules lifecycle to facilitate the execution of smart contracts at the beign and end of each block.

Usecases

Automatic execution of smart contracts is very useful because it enables multiple usecases like for example:

  • laverage consensus of multiple parties to do oracle data voting,
  • decentralized LP rebalancing by a protocol itself,
  • automatic disputes resolution,
  • rewards claiming and restaking,

As you can see there are multiple use cases that will be enabled with this module.

Drawbacks

Automatic smart contract executions in consensus is a double edge sword because too many smart contract executions or too many operations in the smart contracts can slowdown the block production significantly.

Solution to the drawbacks

Governance

Collateral

Execution

The first messure to the issues is to involve `chain governance` to collectively vote on enabling each smart contract execution at begin or end block. That way the overall community can decide if the usecase and optimization of the smart contract is good enough for the required computation. A secondary measure is to `require a collateral deposit` for each smart contract that will be executed on block lifecycle. This deposit will burned if the smart contract fails the execution many times (which is defined in the module params). The latest measure is to allow smart contracts execution each `n number of blocks`. Which means that execution at end and begin block decreases computation complexity because it does not have to load all the wasm environment and try an execution each time.

About

CosmosSDK module for automatic execution of smart contracts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published