Skip to content

Commit

Permalink
Merge pull request #32 from InverseFinance/fed-market-ceiling
Browse files Browse the repository at this point in the history
add fed market ceiling
  • Loading branch information
08xmt authored Dec 10, 2022
2 parents a0b2fdb + cf7cdc0 commit 8434d27
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Fed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ contract Fed {
uint public supplyCeiling;
uint public globalSupply;
mapping (IMarket => uint) public supplies;
mapping (IMarket => uint) public ceilings;

constructor (IDBR _dbr, IDola _dola, address _gov, address _chair, uint _supplyCeiling) {
dbr = _dbr;
Expand Down Expand Up @@ -59,6 +60,16 @@ contract Fed {
supplyCeiling = _supplyCeiling;
}

/**
@notice Set a market's isolated ceiling of the Fed. Only callable by governance.
@param _market Market to set the ceiling for
@param _ceiling Amount to set the ceiling to
*/
function changeMarketCeiling(IMarket _market, uint _ceiling) public {
require(msg.sender == gov, "ONLY GOV");
ceilings[_market] = _ceiling;
}

/**
@notice Set the chair of the fed. Only callable by governance.
@param _chair Address of the new chair.
Expand All @@ -79,7 +90,7 @@ contract Fed {

/**
@notice Expand the amount of DOLA by depositing the amount into a specific market.
@dev While not immediately dangerous to the DOLA peg, make sure the market can absorb the new potential supply.
@dev While not immediately dangerous to the DOLA peg, make sure the market can absorb the new potential supply. Market must have a positive ceiling before expansion.
@param market The market to add additional DOLA supply to.
@param amount The amount of DOLA to mint and supply to the market.
*/
Expand All @@ -91,6 +102,7 @@ contract Fed {
supplies[market] += amount;
globalSupply += amount;
require(globalSupply <= supplyCeiling);
require(supplies[market] <= ceilings[market]);
emit Expansion(market, amount);
}

Expand Down

0 comments on commit 8434d27

Please sign in to comment.