MentoExpansionController

The contract controls how new GoodDollar tokens are minted and distributed for UBI.

MentoExpansionController

The contract controls how new GoodDollar tokens are minted and distributed for UBI.

Contract Specs

The MentoExpansionController is the heart of GoodDollar's UBI (Universal Basic Income) distribution mechanism. It controls how new GoodDollar tokens are minted and distributed to users. The contract generates UBI tokens through two primary mechanisms: (1) interest earned on reserve collateral, and (2) expansion based on configured rates. These newly minted tokens are then distributed to verified users through the distribution helper, fulfilling GoodDollar's mission of providing universal basic income.

Events

ExpansionConfigSet

Emitted when the expansion config is set for an exchange.

Parameter name
Annotation

exchangeId

The ID of the exchange.

expansionRate

The rate of expansion in percentage with 1e18 being 100%.

expansionfrequency

The frequency of expansion in seconds.

event ExpansionConfigSet(
    bytes32 indexed exchangeId,
    uint64 expansionRate,
    uint32 expansionfrequency
);

RewardMinted

Emitted when a reward is minted.

Parameter name
Annotation

exchangeId

The ID of the exchange.

to

The address of the recipient of the reward.

amount

The amount of G$ tokens minted as reward.

InterestUBIMinted

Emitted when UBI is minted through collecting reserve interest.

Parameter name
Annotation

exchangeId

The ID of the exchange.

amount

The amount of G$ tokens minted as UBI from interest.

ExpansionUBIMinted

Emitted when UBI is minted through expansion.

Parameter name
Annotation

exchangeId

The ID of the exchange.

amount

The amount of G$ tokens minted as UBI from expansion.

Functions

setExpansionConfig

Sets the expansion configuration for the given exchange. The expansion rate is in percentage with 1e18 being 100%, and expansion frequency is in seconds.

Parameter name
Annotation

exchangeId

The ID of the exchange to set the expansion config for.

expansionRate

The rate of expansion in percentage with 1e18 being 100%.

expansionFrequency

The frequency of expansion in seconds.

mintUBIFromInterest

Mints UBI for the given exchange from collecting reserve interest. Calls the exchange provider's mintFromInterest and distributes minted tokens through the distribution helper.

Parameter name
Annotation

exchangeId

The ID of the exchange to mint UBI for.

reserveInterest

The amount of reserve tokens collected from interest.

mintUBIFromReserveBalance

Mints UBI for the given exchange by comparing the actual reserve balance of the contract to the virtual balance. Calculates the difference and mints tokens accordingly.

Parameter name
Annotation

exchangeId

The ID of the exchange to mint UBI for.

Returns: The amount of G$ tokens minted.

mintUBIFromExpansion

Mints UBI for the given exchange by calculating the expansion rate. Checks if expansionFrequency time has passed since lastExpansion, calculates expansion scaler, and mints tokens accordingly.

Parameter name
Annotation

exchangeId

The ID of the exchange to mint UBI for.

Returns: The amount of G$ tokens minted.

mintRewardFromRR

Mints a reward amount of tokens for a specific recipient. Updates the reserve ratio through the exchange provider and mints tokens directly to the recipient address.

Parameter name
Annotation

exchangeId

The ID of the exchange.

to

The address of the recipient of the reward.

amount

The amount of G$ tokens to mint as reward.

Last updated

Was this helpful?