Module: chirp.move
The chirp module defines the $CHIRP Token as a standard Sui coin.
It also defines publicly accessible functions used to initiate all on-chain actions.
The module defines a shared Vault
object, which maintains an ObjectBag
(a named mapping) containing other objects defined by the other modules in the system. Existing objects can be replaced and the mapping can be extended with additional objects, allowing future changes. Currently, the vault object owns the following:
A
Treasury
, which contains the capability required to mint new CHIRP, and also the schedule configurationA
PoolDispatcher
, which contains aBag
associating pool names with their effective addressesA depository, an
ObjectTable
containing CHIRP tokens given as rewards to keepers — the table key is the address of the keeper that can claim the rewards
Function: mint
This function can be called to mint $CHIRP according to the schedule. Anyone can call the function and cause tokens to be minted and sent to the pools, provided the schedule allows to mint a new epoch.
Function: set_entry
This function can be used to replace a schedule entry. Only future or current schedule entries can be altered, as the schedule for previous mints cannot be changed. The function can only be called by providing a ScheduleAdminCap
.
Note that the check for which table entry is current is not based on the current time but rather on the latest active schedule entry. The active schedule entry is only changed when minting occurs, and therefore if no minting were to occur for a long time, the last schedule entry would remain active and could be changed. Since minting is an unpermissioned action, we consider this an intended design decision with no significant security impact.
Function: insert_entry
This function can be used to insert a new schedule entry. The new schedule entry can only be inserted in a future position. The function can only be called by providing a ScheduleAdminCap
.
The consideration expressed for set_entry
regarding how the currently active entry is computed applies for this function as well.
Function: remove_entry
This function can be used to remove a schedule entry. Only future schedule entries can be removed. The function can only be called by providing a ScheduleAdminCap
.
The consideration expressed for set_entry
regarding how the currently active entry is computed applies for this function as well.
Function: set_address_pool
This function can be used to set an entry in the address pool, changing which address is associated to a named pool. The function can only be called by providing a ScheduleAdminCap
.
The function cannot be used to add new named pools but only to change the address of an existing one.
Function: claim
This function can be used by keepers to claim $CHIRP rewards from the depository. The caller can specify an amount of tokens to claim, and therefore it is free to claim their full balance or make just a partial claim.
The claimed $CHIRP tokens are directly transferred to the address of the caller; therefore, the function is not exposed to social engineering or confused deputy attacks.
Function: deposit
This unpermissioned function is intended to be used by Chirp to distribute rewards to keepers. The function accepts a list of recipients and $CHIRP coins and stores the coins in the depository associated with their designated recipient. The rewards can then be claimed using the claim
function.