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"
}
}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"
}
}
}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"
}
}
}
}new_owner
String
The new owner proposed,
expiry
Option<Expiration>
Optional expiration time parameter.
Accept the pending ownership transfer. Can only be called by the pending owner.
{
"update_ownership": "accept_ownership"
}Give up the contract's ownership and the possibility of appointing a new owner. Can only be invoked by the contract's current owner. Any existing pending ownership transfer is canceled.
{
"update_ownership": "renounce_ownership"
}QueryMsg
Config
Returns the configuration of the contract.
{
"config": {}
}{
"epoch_config": {
"duration": "86400",
"genesis_epoch": "1571797"
}
}epoch_config
EpochConfig
The epoch configuration
CurrentEpoch
Returns the current epoch based on the current timestamp.
{
"current_epoch": {}
}{
"epoch": {
"id": 0,
"start_time": "1571797"
}
}epoch
Epoch
The current epoch
Epoch
Returns the epoch with the given ID.
{
"epoch": {
"id": 100
}
}id
u64
The id of the epoch to be queried.
{
"epoch": {
"id": 100,
"start_time": "1571797"
}
}epoch
Epoch
The queried epoch with the given id
Ownership
Returns the ownership of the contract.
Note: This is a cw_ownable query.
{
"ownership": {}
}{
"owner": "mantra1...",
"pending_owner": "mantra1...",
"pending_expiry": 424242424242
}owner
Option
The contract's current owner. None if the ownership has been renounced.
pending_owner
Option
The account who has been proposed to take over the ownership. None if there isn't a pending ownership transfer.
pending_expiry
Option
The deadline for the pending owner to accept the ownership. None if there isn't a pending ownership transfer, or if a transfer exists and it doesn't have a deadline.
MigrateMsg
Message to migrate the contract to a new code ID.
{}Last updated