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

Commit c84d1ef

Browse files
committed
rename hat to cap
Clearer intent and avoids confusion with ds-chief `hat`. Another candidate, `lid`, was considered but is being reserved for other purposes.
1 parent 76f3469 commit c84d1ef

11 files changed

+43
-43
lines changed

DEVELOPING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Sai has the following core components:
4444
Sai is configured by the following 'risk parameters':
4545

4646
- `way`: Sai reference price drift
47-
- `hat`: Debt ceiling
47+
- `cap`: Debt ceiling
4848
- `mat`: Liquidation ratio
4949
- `tax`: Stability fee
5050
- `axe`: Liquidation penalty
@@ -333,7 +333,7 @@ Script output gist
333333
- `top`: top-level system manager
334334

335335
- `way`: which way the target price is heading
336-
- `hat`: upper limit of Sai issuance
336+
- `cap`: upper limit of Sai issuance
337337
- `mat`: lower limit of collateralisation
338338
- `tax`: continually paid by CDP holders
339339
- `axe`: penalty applied to bad CDP holders

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Actions:
9292
safe determine if a cup is safe
9393
setAxe update the liquidation penalty
9494
setFee update the governance fee
95-
setHat update the debt ceiling
95+
setCap update the debt ceiling
9696
setMat update the liquidation ratio
9797
setTapGap update the spread on `boom` and `bust`
9898
setTax update the stability fee
@@ -115,7 +115,7 @@ Vars, Getters, Utils:
115115
fog get the amount of skr pending liquidation
116116
gem get the collateral token
117117
gov get the governance token
118-
hat get the debt ceiling
118+
cap get the debt ceiling
119119
ice get the good debt
120120
ink get the amount of skr collateral locked in a cup
121121
joy get the amount of surplus sai

bin/deploy-live-public

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ CHAIN=$(seth chain)
3030
. load-env-$CHAIN
3131

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

36-
seth send $SAI_MOM "setHat(uint256)" $(seth --to-uint256 $(seth --to-wei 100000000 ETH))
36+
seth send $SAI_MOM "setCap(uint256)" $(seth --to-uint256 $(seth --to-wei 100000000 ETH))
3737
seth send $SAI_MOM "setMat(uint256)" $(seth --to-uint256 $(seth --to-wei 1500000000 ETH))
3838
seth send $SAI_MOM "setAxe(uint256)" $(seth --to-uint256 $(seth --to-wei 1200000000 ETH))
3939

bin/validate-deployment

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test $(sai pip) =
99
test $(sai pep) =
1010

1111
# risk parameters
12-
test $(sai hat) = $(sai wad -h 100000000.0)
12+
test $(sai cap) = $(sai wad -h 100000000.0)
1313
test $(sai mat) = $(sai ray -h 1.50)
1414
test $(sai axe) = $(sai ray -h 1.20)
1515
test $(sai tax) = $(sai ray -h 1.0)

libexec/sai/sai-cap

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
### sai-cap -- get the debt ceiling
3+
set -e
4+
wad=$(seth call "${SAI_TUB?}" "cap()")
5+
sai wad -h "$wad"

libexec/sai/sai-hat

-5
This file was deleted.

libexec/sai/sai-setCap

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

libexec/sai/sai-setHat

-9
This file was deleted.

src/mom.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ contract SaiMom is DSThing {
2222
vox = vox_;
2323
}
2424
// Debt ceiling
25-
function setHat(uint wad) public note auth {
26-
tub.mold("hat", wad);
25+
function setCap(uint wad) public note auth {
26+
tub.mold("cap", wad);
2727
}
2828
// Liquidation ratio
2929
function setMat(uint ray) public note auth {

src/sai.t.sol

+17-17
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ contract SaiTestBase is DSTest, DSMath {
205205
mark(1 ether);
206206
mark(gov, 1 ether);
207207

208-
mom.setHat(20 ether);
208+
mom.setCap(20 ether);
209209
}
210210
}
211211

@@ -253,11 +253,11 @@ contract SaiTubTest is SaiTestBase {
253253
}
254254
function testMold() public {
255255
var setAxe = bytes4(keccak256('setAxe(uint256)'));
256-
var setHat = bytes4(keccak256('setHat(uint256)'));
256+
var setCap = bytes4(keccak256('setCap(uint256)'));
257257
var setMat = bytes4(keccak256('setMat(uint256)'));
258258

259-
assertTrue(mom.call(setHat, 0 ether));
260-
assertTrue(mom.call(setHat, 5 ether));
259+
assertTrue(mom.call(setCap, 0 ether));
260+
assertTrue(mom.call(setCap, 5 ether));
261261

262262
assertTrue(!mom.call(setAxe, ray(2 ether)));
263263
assertTrue( mom.call(setMat, ray(2 ether)));
@@ -410,15 +410,15 @@ contract SaiTubTest is SaiTestBase {
410410
tub.free(cup, 3 ether); // 175% -- fails
411411
}
412412
function testFailDrawOverDebtCeiling() public {
413-
mom.setHat(4 ether);
413+
mom.setCap(4 ether);
414414
tub.join(10 ether);
415415
var cup = tub.open();
416416
tub.lock(cup, 10 ether);
417417

418418
tub.draw(cup, 5 ether);
419419
}
420420
function testDebtCeiling() public {
421-
mom.setHat(5 ether);
421+
mom.setCap(5 ether);
422422
mom.setMat(ray(2 ether)); // require 200% collat
423423
tub.join(10 ether);
424424
var cup = tub.open();
@@ -442,7 +442,7 @@ contract SaiTubTest is SaiTestBase {
442442
contract CageTest is SaiTestBase {
443443
// ensure cage sets the settle prices right
444444
function cageSetup() public returns (bytes32) {
445-
mom.setHat(5 ether); // 5 sai debt ceiling
445+
mom.setCap(5 ether); // 5 sai debt ceiling
446446
mark(1 ether); // price 1:1 gem:ref
447447
mom.setMat(ray(2 ether)); // require 200% collat
448448
tub.join(10 ether);
@@ -1179,7 +1179,7 @@ contract LiquidationTest is SaiTestBase {
11791179
return wdiv(min, jam);
11801180
}
11811181
function testLiq() public {
1182-
mom.setHat(100 ether);
1182+
mom.setCap(100 ether);
11831183
mark(2 ether);
11841184

11851185
tub.join(10 ether);
@@ -1212,7 +1212,7 @@ contract LiquidationTest is SaiTestBase {
12121212
return wdiv(pro, con);
12131213
}
12141214
function testCollat() public {
1215-
mom.setHat(100 ether);
1215+
mom.setCap(100 ether);
12161216
mark(2 ether);
12171217

12181218
tub.join(10 ether);
@@ -1240,7 +1240,7 @@ contract LiquidationTest is SaiTestBase {
12401240
}
12411241

12421242
function testBustMint() public {
1243-
mom.setHat(100 ether);
1243+
mom.setCap(100 ether);
12441244
mom.setMat(ray(wdiv(3 ether, 2 ether))); // 150% liq limit
12451245
mark(2 ether);
12461246

@@ -1287,7 +1287,7 @@ contract LiquidationTest is SaiTestBase {
12871287
assertEq(skr.totalSupply(), 12 ether);
12881288
}
12891289
function testBustNoMint() public {
1290-
mom.setHat(1000 ether);
1290+
mom.setCap(1000 ether);
12911291
mom.setMat(ray(2 ether)); // 200% liq limit
12921292
mom.setAxe(ray(1.5 ether)); // 150% liq penalty
12931293
mark(20 ether);
@@ -1612,7 +1612,7 @@ contract TaxTest is SaiTestBase {
16121612
mark(10 ether);
16131613
gem.mint(1000 ether);
16141614

1615-
mom.setHat(1000 ether);
1615+
mom.setCap(1000 ether);
16161616
mom.setTax(1000000564701133626865910626); // 5% / day
16171617
cup = tub.open();
16181618
tub.join(100 ether);
@@ -1768,7 +1768,7 @@ contract WayTest is SaiTestBase {
17681768
mark(10 ether);
17691769
gem.mint(1000 ether);
17701770

1771-
mom.setHat(1000 ether);
1771+
mom.setCap(1000 ether);
17721772

17731773
cup = tub.open();
17741774
tub.join(100 ether);
@@ -2020,7 +2020,7 @@ contract GasTest is SaiTestBase {
20202020
mark(1 ether);
20212021
gem.mint(1000 ether);
20222022

2023-
mom.setHat(1000 ether);
2023+
mom.setCap(1000 ether);
20242024

20252025
cup = tub.open();
20262026
tub.join(1000 ether);
@@ -2117,7 +2117,7 @@ contract FeeTest is SaiTestBase {
21172117
gem.mint(1000 ether);
21182118
gov.mint(100 ether);
21192119

2120-
mom.setHat(1000 ether);
2120+
mom.setCap(1000 ether);
21212121
mom.setFee(1000000564701133626865910626); // 5% / day
21222122

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

2267-
mom.setHat(1000 ether);
2267+
mom.setCap(1000 ether);
22682268
mom.setFee(1000000564701133626865910626); // 5% / day
22692269
mom.setTax(1000000564701133626865910626); // 5% / day
22702270

@@ -2342,7 +2342,7 @@ contract FeeTaxTest is SaiTestBase {
23422342

23432343
contract AxeTest is SaiTestBase {
23442344
function axeSetup() public returns (bytes32) {
2345-
mom.setHat(1000 ether);
2345+
mom.setCap(1000 ether);
23462346
mark(1 ether);
23472347
mom.setMat(ray(2 ether)); // require 200% collat
23482348
tub.join(20 ether);

src/tub.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contract SaiTub is DSThing, SaiTubEvents {
3333
address public pit; // Governance Vault
3434

3535
uint256 public axe; // Liquidation penalty
36-
uint256 public hat; // Debt ceiling
36+
uint256 public cap; // Debt ceiling
3737
uint256 public mat; // Liquidation ratio
3838
uint256 public tax; // Stability fee
3939
uint256 public fee; // Governance fee
@@ -130,7 +130,7 @@ contract SaiTub is DSThing, SaiTubEvents {
130130
//--Risk-parameter-config-------------------------------------------
131131

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

271271
require(safe(cup));
272-
require(sai.totalSupply() <= hat);
272+
require(sai.totalSupply() <= cap);
273273
}
274274
function wipe(bytes32 cup, uint wad) public note {
275275
require(!off);

0 commit comments

Comments
 (0)