Spot - Detailed Documentation
The Maker Protocol's liaison between the Oracles and Core Contracts
- Contract Name: spot.sol
- Type/Category: DSS —> Core Module
The
Spot
liaison between the oracles
and the core contracts. It functions as an interface contract and only stores the current ilk
list.
- All mathematical operations will revert on overflow or underflow
- All methods execute in constant time
ilk
a given collateral typeilk.pip
the contract which holds the current price of a givenilk
ilk.mat
the liquidation ratio for a givenilk
vat
the core of the mcd systempar
value of DAI in the reference asset (e.g. $1 per DAI)
- Only authorized users can update any variables in contract
poke
is the only non-authenticated function in spot
. The function takes in a bytes32
of the ilk
to be "poked". poke
calls two external
functions:- 1.
peek
calls the OSM for the givenilk
and takes back in theval
andhas
(a boolean which is false if there was an error in theosm
). The second external call only happens ifhas == true
. - 2.When calculating the
spot
, thepar
is crucial to this calculation as it defines the relationship between DAI and 1 unit of value in the price. Theval
is then divided by thepar
(to get a ratio ofval
toDAI
) and then the resulting value is divided by theilk.mat
. This gives us the currentspot
price for the givenilk
. - 3.
file
is then called after calculating thespot
. This updates thevat
with the current liquidation price of theilk
which the function was called for.
The methods in the
spotter
are relatively basic compared to most other portions of dss
. There is not much room for user error in the single unauthed method poke
. If an incorrect bytes32
is supplied the call will fail.Any module that is authed against the
spot
has full root access, and can, therefore, add and remove which ilks
can be "poked". While not completely breaking the system, this could cause considerable risk.A bug in
spot
would most likely result in the prices for collaterals not being updated anymore. In this case, the system would need to authorize a new spot
which would then be able to update the prices. Overall this is not a catastrophic failure as this would only pause all price fluctuation for some period.The
spot
relies upon a set of trusted oracles to provide price data. Should these price feeds fail, it would become possible for unbacked Dai to be minted, or safe Vaults could be unfairly liquidated.When
poke
is not called frequently enough, the Vat
's spot
price will become stale. This could arise for a few reasons including tragedy of the commons or miner collusion and could lead to negative outcomes such as inappropriate liquidations, or the prevention of liquidations that should be possible.Last modified 3yr ago