GoodReserveCDai
The GoodReserveCDai mints G$ based on the interest transferred from the FundManager. Only the FundManager can trigger minting.
The contract also acts as the GoodDollar liquidity pool and AMM (Automatic Market Maker) and enables methods to buy and sell G$s.
Events
UBIMinted
Emitted when new G$ tokens are minted.
TokenPurchased
Emitted when G$ tokens are purchased from the reserve.
TokenSold
Emitted when G$ tokens are sold to the reserve.
buy
Converts cDai tokens to GD tokens and updates the bonding curve params. The buy
occurs only if the G$ return is above the given minimum. It is possible to buy only with cDAI and when the contract is set to active. MUST call to cDAI approve
prior this action to allow this contract to accomplish the conversion.
Returns: How much G$ tokens were transferred.
sell
The sell
helper function burns G$ tokens and update the bonding curve params. The sell
occurs only if the token return is above the given minimum. Notice that there is a contribution amount from the given GD that remains in the reserve.
Returns: The tuple of two: cDAI received amount and G$ exit contribution.
mintRewardFromRR
Mint rewards for staking contracts in G$ and update RR requires minting permissions which is enforced by _mintGoodDollars
function.
Returns: The tuple of two: cDAI received amount and G$ exit contribution.
mintUBI
Only FundManager or other with mint G$ permission can call this to trigger minting. Reserve sends UBI + interest to FundManager.
Returns: The tuple of two: how much GD UBI was minted and how much cDAI collected from staking contracts.
Last updated