GoodMarketMaker
Helper contract for the GoodReserveCDai. It serves as a dynamic reserve ratio market maker.
Events
BalancesUpdated
Emits when a change has occurred in a reserve balance, i.e. buy / sell will change the balance.
caller
The account who initiated the action.
reserveToken
The address of the reserve token.
amount
The incoming amount.
returnAmount
The return value.
totalSupply
The updated total supply.
reserveBalance
The updated reserve balance.
ReserveRatioUpdated
Emits when the ratio changed. The caller should be the Avatar by definition.
caller
The address of the staker.
nom
Nominator of the ratio.
denom
Denominator of the ratio.
calculateNewReserveRatio
Calculates how much to decrease the reserve ratio for _token
by the reserveRatioDailyExpansion
.
_token
The reserve token to calculate the reserve ratio for.
Returns: the new reserve ratio.
buyReturn
Calculates the buy return in G$ according to the given _tokenAmount
.
_token
The reserve token buying with.
_tokenAmount
The amount of reserve token buying with.
Returns: A number of G$ that should be given in exchange as calculated by the bonding curve.
sellReturn
Calculates the sell return in _token
according to the given _gdAmount
.
_token
The reserve token buying with.
_gdAmount
The amount of reserve token buying with.
Returns: A number of tokens that should be given in exchange as calculated by the bonding curve.
buy
Updates the _token
bonding curve params. Emits BalancesUpdated
with the new reserve token information.
_token
The reserve token buying with.
_tokenAmount
The amount of reserve token buying with.
Returns: A number of G$ that will be given in exchange as calculated by the bonding curve.
sellWithContribution
Calculates the sell return with contribution in _token
and update the bonding curve params. Emits BalancesUpdated
with the new reserve token information.
_token
The desired reserve token to have.
_gdAmount
The amount of G$ that are sold.
_contributionGdAmount
The number of G$ tokens that will not be traded for the reserve token.
Returns: A number of tokens that will be given in exchange as calculated by the bonding curve.
Last updated