Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
rename hat to cap
Browse files Browse the repository at this point in the history
Clearer intent and avoids confusion with ds-chief `hat`. Another
candidate, `lid`, was considered but is being reserved for other
purposes.
  • Loading branch information
rainbreak committed Dec 7, 2017
1 parent 76f3469 commit c84d1ef
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Sai has the following core components:
Sai is configured by the following 'risk parameters':

- `way`: Sai reference price drift
- `hat`: Debt ceiling
- `cap`: Debt ceiling
- `mat`: Liquidation ratio
- `tax`: Stability fee
- `axe`: Liquidation penalty
Expand Down Expand Up @@ -333,7 +333,7 @@ Script output gist
- `top`: top-level system manager

- `way`: which way the target price is heading
- `hat`: upper limit of Sai issuance
- `cap`: upper limit of Sai issuance
- `mat`: lower limit of collateralisation
- `tax`: continually paid by CDP holders
- `axe`: penalty applied to bad CDP holders
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Actions:
safe determine if a cup is safe
setAxe update the liquidation penalty
setFee update the governance fee
setHat update the debt ceiling
setCap update the debt ceiling
setMat update the liquidation ratio
setTapGap update the spread on `boom` and `bust`
setTax update the stability fee
Expand All @@ -115,7 +115,7 @@ Vars, Getters, Utils:
fog get the amount of skr pending liquidation
gem get the collateral token
gov get the governance token
hat get the debt ceiling
cap get the debt ceiling
ice get the good debt
ink get the amount of skr collateral locked in a cup
joy get the amount of surplus sai
Expand Down
4 changes: 2 additions & 2 deletions bin/deploy-live-public
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ CHAIN=$(seth chain)
. load-env-$CHAIN

##### configure risk params
# mat = 1.5 axe = 1.2 hat = 100,000,000 gap = 1 [but configurable, +/- 5%]
# mat = 1.5 axe = 1.2 cap = 100,000,000 gap = 1 [but configurable, +/- 5%]
# tax = way = 1 [default]

seth send $SAI_MOM "setHat(uint256)" $(seth --to-uint256 $(seth --to-wei 100000000 ETH))
seth send $SAI_MOM "setCap(uint256)" $(seth --to-uint256 $(seth --to-wei 100000000 ETH))
seth send $SAI_MOM "setMat(uint256)" $(seth --to-uint256 $(seth --to-wei 1500000000 ETH))
seth send $SAI_MOM "setAxe(uint256)" $(seth --to-uint256 $(seth --to-wei 1200000000 ETH))

Expand Down
2 changes: 1 addition & 1 deletion bin/validate-deployment
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test $(sai pip) =
test $(sai pep) =

# risk parameters
test $(sai hat) = $(sai wad -h 100000000.0)
test $(sai cap) = $(sai wad -h 100000000.0)
test $(sai mat) = $(sai ray -h 1.50)
test $(sai axe) = $(sai ray -h 1.20)
test $(sai tax) = $(sai ray -h 1.0)
Expand Down
5 changes: 5 additions & 0 deletions libexec/sai/sai-cap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
### sai-cap -- get the debt ceiling
set -e
wad=$(seth call "${SAI_TUB?}" "cap()")
sai wad -h "$wad"
5 changes: 0 additions & 5 deletions libexec/sai/sai-hat

This file was deleted.

9 changes: 9 additions & 0 deletions libexec/sai/sai-setCap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
### sai-setCap -- update the debt ceiling
### Usage: sai setCap <new-cap>
set -e
[ $# = 1 ] || sai setCap --usage
wad=$(sai wad -h "$1")
echo >&2 "Setting cap to $wad..."
wad=$(sai wad "$1")
(set -x; seth send "${SAI_MOM?}" "setCap(uint256)" "$wad")
9 changes: 0 additions & 9 deletions libexec/sai/sai-setHat

This file was deleted.

4 changes: 2 additions & 2 deletions src/mom.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ contract SaiMom is DSThing {
vox = vox_;
}
// Debt ceiling
function setHat(uint wad) public note auth {
tub.mold("hat", wad);
function setCap(uint wad) public note auth {
tub.mold("cap", wad);
}
// Liquidation ratio
function setMat(uint ray) public note auth {
Expand Down
34 changes: 17 additions & 17 deletions src/sai.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ contract SaiTestBase is DSTest, DSMath {
mark(1 ether);
mark(gov, 1 ether);

mom.setHat(20 ether);
mom.setCap(20 ether);
}
}

Expand Down Expand Up @@ -253,11 +253,11 @@ contract SaiTubTest is SaiTestBase {
}
function testMold() public {
var setAxe = bytes4(keccak256('setAxe(uint256)'));
var setHat = bytes4(keccak256('setHat(uint256)'));
var setCap = bytes4(keccak256('setCap(uint256)'));
var setMat = bytes4(keccak256('setMat(uint256)'));

assertTrue(mom.call(setHat, 0 ether));
assertTrue(mom.call(setHat, 5 ether));
assertTrue(mom.call(setCap, 0 ether));
assertTrue(mom.call(setCap, 5 ether));

assertTrue(!mom.call(setAxe, ray(2 ether)));
assertTrue( mom.call(setMat, ray(2 ether)));
Expand Down Expand Up @@ -410,15 +410,15 @@ contract SaiTubTest is SaiTestBase {
tub.free(cup, 3 ether); // 175% -- fails
}
function testFailDrawOverDebtCeiling() public {
mom.setHat(4 ether);
mom.setCap(4 ether);
tub.join(10 ether);
var cup = tub.open();
tub.lock(cup, 10 ether);

tub.draw(cup, 5 ether);
}
function testDebtCeiling() public {
mom.setHat(5 ether);
mom.setCap(5 ether);
mom.setMat(ray(2 ether)); // require 200% collat
tub.join(10 ether);
var cup = tub.open();
Expand All @@ -442,7 +442,7 @@ contract SaiTubTest is SaiTestBase {
contract CageTest is SaiTestBase {
// ensure cage sets the settle prices right
function cageSetup() public returns (bytes32) {
mom.setHat(5 ether); // 5 sai debt ceiling
mom.setCap(5 ether); // 5 sai debt ceiling
mark(1 ether); // price 1:1 gem:ref
mom.setMat(ray(2 ether)); // require 200% collat
tub.join(10 ether);
Expand Down Expand Up @@ -1179,7 +1179,7 @@ contract LiquidationTest is SaiTestBase {
return wdiv(min, jam);
}
function testLiq() public {
mom.setHat(100 ether);
mom.setCap(100 ether);
mark(2 ether);

tub.join(10 ether);
Expand Down Expand Up @@ -1212,7 +1212,7 @@ contract LiquidationTest is SaiTestBase {
return wdiv(pro, con);
}
function testCollat() public {
mom.setHat(100 ether);
mom.setCap(100 ether);
mark(2 ether);

tub.join(10 ether);
Expand Down Expand Up @@ -1240,7 +1240,7 @@ contract LiquidationTest is SaiTestBase {
}

function testBustMint() public {
mom.setHat(100 ether);
mom.setCap(100 ether);
mom.setMat(ray(wdiv(3 ether, 2 ether))); // 150% liq limit
mark(2 ether);

Expand Down Expand Up @@ -1287,7 +1287,7 @@ contract LiquidationTest is SaiTestBase {
assertEq(skr.totalSupply(), 12 ether);
}
function testBustNoMint() public {
mom.setHat(1000 ether);
mom.setCap(1000 ether);
mom.setMat(ray(2 ether)); // 200% liq limit
mom.setAxe(ray(1.5 ether)); // 150% liq penalty
mark(20 ether);
Expand Down Expand Up @@ -1612,7 +1612,7 @@ contract TaxTest is SaiTestBase {
mark(10 ether);
gem.mint(1000 ether);

mom.setHat(1000 ether);
mom.setCap(1000 ether);
mom.setTax(1000000564701133626865910626); // 5% / day
cup = tub.open();
tub.join(100 ether);
Expand Down Expand Up @@ -1768,7 +1768,7 @@ contract WayTest is SaiTestBase {
mark(10 ether);
gem.mint(1000 ether);

mom.setHat(1000 ether);
mom.setCap(1000 ether);

cup = tub.open();
tub.join(100 ether);
Expand Down Expand Up @@ -2020,7 +2020,7 @@ contract GasTest is SaiTestBase {
mark(1 ether);
gem.mint(1000 ether);

mom.setHat(1000 ether);
mom.setCap(1000 ether);

cup = tub.open();
tub.join(1000 ether);
Expand Down Expand Up @@ -2117,7 +2117,7 @@ contract FeeTest is SaiTestBase {
gem.mint(1000 ether);
gov.mint(100 ether);

mom.setHat(1000 ether);
mom.setCap(1000 ether);
mom.setFee(1000000564701133626865910626); // 5% / day

// warp(1 days); // make chi,rhi != 1
Expand Down Expand Up @@ -2264,7 +2264,7 @@ contract FeeTaxTest is SaiTestBase {
gem.mint(1000 ether);
gov.mint(100 ether);

mom.setHat(1000 ether);
mom.setCap(1000 ether);
mom.setFee(1000000564701133626865910626); // 5% / day
mom.setTax(1000000564701133626865910626); // 5% / day

Expand Down Expand Up @@ -2342,7 +2342,7 @@ contract FeeTaxTest is SaiTestBase {

contract AxeTest is SaiTestBase {
function axeSetup() public returns (bytes32) {
mom.setHat(1000 ether);
mom.setCap(1000 ether);
mark(1 ether);
mom.setMat(ray(2 ether)); // require 200% collat
tub.join(20 ether);
Expand Down
6 changes: 3 additions & 3 deletions src/tub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract SaiTub is DSThing, SaiTubEvents {
address public pit; // Governance Vault

uint256 public axe; // Liquidation penalty
uint256 public hat; // Debt ceiling
uint256 public cap; // Debt ceiling
uint256 public mat; // Liquidation ratio
uint256 public tax; // Stability fee
uint256 public fee; // Governance fee
Expand Down Expand Up @@ -130,7 +130,7 @@ contract SaiTub is DSThing, SaiTubEvents {
//--Risk-parameter-config-------------------------------------------

function mold(bytes32 param, uint val) public note auth {
if (param == 'hat') hat = val;
if (param == 'cap') cap = val;
else if (param == 'mat') { require(val >= RAY); mat = val; }
else if (param == 'tax') { require(val >= RAY); drip(); tax = val; }
else if (param == 'fee') { require(val >= RAY); drip(); fee = val; }
Expand Down Expand Up @@ -269,7 +269,7 @@ contract SaiTub is DSThing, SaiTubEvents {
sai.mint(cups[cup].lad, wad);

require(safe(cup));
require(sai.totalSupply() <= hat);
require(sai.totalSupply() <= cap);
}
function wipe(bytes32 cup, uint wad) public note {
require(!off);
Expand Down

0 comments on commit c84d1ef

Please sign in to comment.