Skip to content

Commit

Permalink
Set spot to 0 for when osm is voided, then make urns can not be liqui…
Browse files Browse the repository at this point in the history
…dated in this state
  • Loading branch information
gbalabasquer authored Oct 24, 2019
1 parent 3cc7b71 commit 72cd6f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cat.sol
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ contract Cat is DSNote {
VatLike.Urn memory u = vat.urns(ilk, urn);

require(live == 1);
require(mul(u.ink, i.spot) < mul(u.art, i.rate));
require(i.spot > 0 && mul(u.ink, i.spot) < mul(u.art, i.rate));

uint lot = min(u.ink, ilks[ilk].lump);
uint art = min(u.art, mul(lot, u.art) / u.ink);
Expand Down
10 changes: 4 additions & 6 deletions src/spot.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ contract Spotter is DSNote {

// --- Update value ---
function poke(bytes32 ilk) external {
(bytes32 val, bool zzz) = ilks[ilk].pip.peek();
if (zzz) {
uint256 spot = rdiv(rdiv(mul(uint(val), 10 ** 9), par), ilks[ilk].mat);
vat.file(ilk, "spot", spot);
emit Poke(ilk, val, spot);
}
(bytes32 val, bool has) = ilks[ilk].pip.peek();
uint256 spot = has ? rdiv(rdiv(mul(uint(val), 10 ** 9), par), ilks[ilk].mat) : 0;
vat.file(ilk, "spot", spot);
emit Poke(ilk, val, spot);
}
}

0 comments on commit 72cd6f6

Please sign in to comment.