Epoch Manager

The Epoch Manager is a contract which sole purpose is to generate epochs on MANTRA, acting like a clock for the other contracts.

An Epoch is a period of time that is defined by the duration parameter on EpochConfig, and they are used by other contracts to take timely actions. For example, the Farm Manager uses epochs to calculate the farm rewards for its users.

How it works

The epoch configuration is set up when the contract is instantiated. The epoch configuration defines the duration of an epoch and when the genesis epoch is going to take place, i.e. the first epoch.

Then, when querying the contract, the epochs in the system are derived based on the genesis epoch and duration values.

Instantiate

Instantiates an instance of the epoch manager contract

{
  "owner": "mantra1...",
  "epoch_config": {
    "duration": "86400",
    "genesis_epoch": "1571797"
  }
}
Key
Type
Description

owner

String

The owner of the contract

epoch_config

EpochConfig

The configuration for the epochs

ExecuteMsg

UpdateConfig

Updates the contract configuration. This can only be triggered by the contract owner.

{
  "update_config": {
    "epoch_config": {
      "duration": "86400",
      "genesis_epoch": "1571797"
    }
  }
}
Key
Type
Description

epoch_config

Option<EpochConfig>

The new epoch configuration

UpdateOwnership(::cw_ownable::Action)

Implements cw_ownable. Updates the contract's ownership. ::cw_ownable::Action can be TransferOwnership, AcceptOwnership and RenounceOwnership.

Note: This is a cw_ownable message.

Propose to transfer the contract's ownership to another account, optionally with an expiry time. Can only be called by the contract's current owner. Any existing pending ownership transfer is overwritten.

{
  "update_ownership": {
    "transfer_ownership": {
      "new_owner": "mantra1...",
      "expiry": {
        "at_height": "424242424242"
      }
    }
  }
}
Key
Type
Description

new_owner

String

The new owner proposed,

expiry

Option<Expiration>

Optional expiration time parameter.

QueryMsg

Config

Returns the configuration of the contract.

{
  "config": {}
}

CurrentEpoch

Returns the current epoch based on the current timestamp.

{
  "current_epoch": {}
}

Epoch

Returns the epoch with the given ID.

{
  "epoch": {
    "id": 100
  }
}
Key
Type
Description

id

u64

The id of the epoch to be queried.

Ownership

Returns the ownership of the contract.

Note: This is a cw_ownable query.

{
  "ownership": {}
}

MigrateMsg

Message to migrate the contract to a new code ID.

{}

Last updated