Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Spotter
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2026-02-16T07:28:37.712857Z
Constructor Arguments
000000000000000000000000f99e69ae8a291cec187d1c756f0ea851135e1a2b
Arg [0] (address) : 0xf99e69ae8a291cec187d1c756f0ea851135e1a2b
Contract.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/// spot.sol -- Spotter
pragma solidity ^0.6.12;
interface VatLike {
function file(bytes32, bytes32, uint) external;
}
interface PipLike {
function peek() external returns (bytes32, bool);
}
contract Spotter {
// --- Auth ---
mapping (address => uint) public wards;
function rely(address guy) external auth {
wards[guy] = 1;
emit Rely(guy);
}
function deny(address guy) external auth {
wards[guy] = 0;
emit Deny(guy);
}
modifier auth {
require(wards[msg.sender] == 1, "Spotter/not-authorized");
_;
}
// --- Data ---
struct Ilk {
PipLike pip; // Price Feed
uint256 mat; // Liquidation ratio [ray]
}
mapping (bytes32 => Ilk) public ilks;
VatLike public vat; // CDP Engine
uint256 public par; // ref per dai [ray]
uint256 public live;
// --- Events ---
event Poke(bytes32 ilk, bytes32 val, uint256 spot);
event Rely(address indexed guy);
event Deny(address indexed guy);
event File(bytes32 indexed ilk, bytes32 indexed what, address data);
event File(bytes32 indexed what, uint256 data);
event File(bytes32 indexed ilk, bytes32 indexed what, uint256 data);
event Cage();
// --- Init ---
constructor(address vat_) public {
wards[msg.sender] = 1;
vat = VatLike(vat_);
par = ONE;
live = 1;
}
// --- Math ---
uint constant ONE = 10 ** 27;
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x);
}
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = mul(x, ONE) / y;
}
// --- Administration ---
function file(bytes32 ilk, bytes32 what, address pip_) external auth {
require(live == 1, "Spotter/not-live");
if (what == "pip") {
ilks[ilk].pip = PipLike(pip_);
emit File(ilk, what, pip_);
} else {
revert("Spotter/file-unrecognized-param");
}
}
function file(bytes32 what, uint data) external auth {
require(live == 1, "Spotter/not-live");
if (what == "par") {
par = data;
emit File(what, data);
} else {
revert("Spotter/file-unrecognized-param");
}
}
function file(bytes32 ilk, bytes32 what, uint data) external auth {
require(live == 1, "Spotter/not-live");
if (what == "mat") {
ilks[ilk].mat = data;
emit File(ilk, what, data);
} else {
revert("Spotter/file-unrecognized-param");
}
}
// --- Update value ---
function poke(bytes32 ilk) external {
(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);
}
function cage() external auth {
live = 0;
emit Cage();
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"Contract.sol":"Spotter"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"vat_","internalType":"address"}]},{"type":"event","name":"Cage","inputs":[],"anonymous":false},{"type":"event","name":"Deny","inputs":[{"type":"address","name":"guy","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"File","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"what","internalType":"bytes32","indexed":true},{"type":"address","name":"data","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"File","inputs":[{"type":"bytes32","name":"what","internalType":"bytes32","indexed":true},{"type":"uint256","name":"data","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"File","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"what","internalType":"bytes32","indexed":true},{"type":"uint256","name":"data","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Poke","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32","indexed":false},{"type":"bytes32","name":"val","internalType":"bytes32","indexed":false},{"type":"uint256","name":"spot","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Rely","inputs":[{"type":"address","name":"guy","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cage","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deny","inputs":[{"type":"address","name":"guy","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"file","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32"},{"type":"bytes32","name":"what","internalType":"bytes32"},{"type":"uint256","name":"data","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"file","inputs":[{"type":"bytes32","name":"what","internalType":"bytes32"},{"type":"uint256","name":"data","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"file","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32"},{"type":"bytes32","name":"what","internalType":"bytes32"},{"type":"address","name":"pip_","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"pip","internalType":"contract PipLike"},{"type":"uint256","name":"mat","internalType":"uint256"}],"name":"ilks","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"live","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"par","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"poke","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rely","inputs":[{"type":"address","name":"guy","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract VatLike"}],"name":"vat","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"wards","inputs":[{"type":"address","name":"","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50604051610a5f380380610a5f8339818101604052602081101561003357600080fd5b5051336000908152602081905260409020600190819055600280546001600160a01b039093166001600160a01b0319909316929092179091556b033b2e3c9fd0803ce80000006003556004556109d18061008e6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806369245009116100715780636924500914610188578063957aa58c146101905780639c52a7f114610198578063bf353dbb146101be578063d9638d36146101e4578063ebecb39d14610224576100b4565b80631504460f146100b95780631a0b287e146100d857806329ae81141461010157806336569e7714610124578063495d32cb1461014857806365fae35e14610162575b600080fd5b6100d6600480360360208110156100cf57600080fd5b5035610256565b005b6100d6600480360360608110156100ee57600080fd5b50803590602081013590604001356103e1565b6100d66004803603604081101561011757600080fd5b508035906020013561052e565b61012c610617565b604080516001600160a01b039092168252519081900360200190f35b610150610626565b60408051918252519081900360200190f35b6100d66004803603602081101561017857600080fd5b50356001600160a01b031661062c565b6100d66106c3565b610150610745565b6100d6600480360360208110156101ae57600080fd5b50356001600160a01b031661074b565b610150600480360360208110156101d457600080fd5b50356001600160a01b03166107e1565b610201600480360360208110156101fa57600080fd5b50356107f3565b604080516001600160a01b03909316835260208301919091528051918290030190f35b6100d66004803603606081101561023a57600080fd5b50803590602081013590604001356001600160a01b0316610818565b6000818152600160205260408082205481516359e02dd760e01b8152825184936001600160a01b03909316926359e02dd7926004808201939182900301818787803b1580156102a457600080fd5b505af11580156102b8573d6000803e3d6000fd5b505050506040513d60408110156102ce57600080fd5b50805160209091015190925090506000816102ea57600061031e565b61031e6103066102fe85633b9aca00610929565b600354610953565b60008681526001602081905260409091200154610953565b60025460408051630d05943f60e11b815260048101889052631cdc1bdd60e21b60248201526044810184905290519293506001600160a01b0390911691631a0b287e9160648082019260009290919082900301818387803b15801561038257600080fd5b505af1158015610396573d6000803e3d6000fd5b5050604080518781526020810187905280820185905290517fdfd7467e425a8107cfd368d159957692c25085aacbcf5228ce08f10f2146486e9350908190036060019150a150505050565b33600090815260208190526040902054600114610433576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b60045460011461047d576040805162461bcd60e51b815260206004820152601060248201526f53706f747465722f6e6f742d6c69766560801b604482015290519081900360640190fd5b81621b585d60ea1b14156104dc5760008381526001602081815260409283902090910183905581518381529151849286927f851aa1caf4888170ad8875449d18f0f512fd6deb2a6571ea1a41fb9f95acbcd192918290030190a3610529565b6040805162461bcd60e51b815260206004820152601f60248201527f53706f747465722f66696c652d756e7265636f676e697a65642d706172616d00604482015290519081900360640190fd5b505050565b33600090815260208190526040902054600114610580576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6004546001146105ca576040805162461bcd60e51b815260206004820152601060248201526f53706f747465722f6e6f742d6c69766560801b604482015290519081900360640190fd5b81623830b960e91b14156104dc57600381905560408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a25050565b6002546001600160a01b031681565b60035481565b3360009081526020819052604090205460011461067e576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b33600090815260208190526040902054600114610715576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b600060048190556040517f2308ed18a14e800c39b86eb6ea43270105955ca385b603b64eca89f98ae8fbda9190a1565b60045481565b3360009081526020819052604090205460011461079d576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b60006020819052908152604090205481565b600160208190526000918252604090912080549101546001600160a01b039091169082565b3360009081526020819052604090205460011461086a576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6004546001146108b4576040805162461bcd60e51b815260206004820152601060248201526f53706f747465722f6e6f742d6c69766560801b604482015290519081900360640190fd5b816207069760ec1b14156104dc5760008381526001602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582519081529151849286927f4ff2caaa972a7c6629ea01fae9c93d73cc307d13ea4c369f9bbbb7f9b7e9461d92918290030190a3610529565b60008115806109445750508082028282828161094157fe5b04145b61094d57600080fd5b92915050565b60008161096c846b033b2e3c9fd0803ce8000000610929565b8161097357fe5b04939250505056fe53706f747465722f6e6f742d617574686f72697a656400000000000000000000a264697066735822122089906389e2a5f84e7d913d866fc3b89e43968b2c38e892bacbfe6ab4502185b764736f6c634300060c0033000000000000000000000000f99e69ae8a291cec187d1c756f0ea851135e1a2b
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806369245009116100715780636924500914610188578063957aa58c146101905780639c52a7f114610198578063bf353dbb146101be578063d9638d36146101e4578063ebecb39d14610224576100b4565b80631504460f146100b95780631a0b287e146100d857806329ae81141461010157806336569e7714610124578063495d32cb1461014857806365fae35e14610162575b600080fd5b6100d6600480360360208110156100cf57600080fd5b5035610256565b005b6100d6600480360360608110156100ee57600080fd5b50803590602081013590604001356103e1565b6100d66004803603604081101561011757600080fd5b508035906020013561052e565b61012c610617565b604080516001600160a01b039092168252519081900360200190f35b610150610626565b60408051918252519081900360200190f35b6100d66004803603602081101561017857600080fd5b50356001600160a01b031661062c565b6100d66106c3565b610150610745565b6100d6600480360360208110156101ae57600080fd5b50356001600160a01b031661074b565b610150600480360360208110156101d457600080fd5b50356001600160a01b03166107e1565b610201600480360360208110156101fa57600080fd5b50356107f3565b604080516001600160a01b03909316835260208301919091528051918290030190f35b6100d66004803603606081101561023a57600080fd5b50803590602081013590604001356001600160a01b0316610818565b6000818152600160205260408082205481516359e02dd760e01b8152825184936001600160a01b03909316926359e02dd7926004808201939182900301818787803b1580156102a457600080fd5b505af11580156102b8573d6000803e3d6000fd5b505050506040513d60408110156102ce57600080fd5b50805160209091015190925090506000816102ea57600061031e565b61031e6103066102fe85633b9aca00610929565b600354610953565b60008681526001602081905260409091200154610953565b60025460408051630d05943f60e11b815260048101889052631cdc1bdd60e21b60248201526044810184905290519293506001600160a01b0390911691631a0b287e9160648082019260009290919082900301818387803b15801561038257600080fd5b505af1158015610396573d6000803e3d6000fd5b5050604080518781526020810187905280820185905290517fdfd7467e425a8107cfd368d159957692c25085aacbcf5228ce08f10f2146486e9350908190036060019150a150505050565b33600090815260208190526040902054600114610433576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b60045460011461047d576040805162461bcd60e51b815260206004820152601060248201526f53706f747465722f6e6f742d6c69766560801b604482015290519081900360640190fd5b81621b585d60ea1b14156104dc5760008381526001602081815260409283902090910183905581518381529151849286927f851aa1caf4888170ad8875449d18f0f512fd6deb2a6571ea1a41fb9f95acbcd192918290030190a3610529565b6040805162461bcd60e51b815260206004820152601f60248201527f53706f747465722f66696c652d756e7265636f676e697a65642d706172616d00604482015290519081900360640190fd5b505050565b33600090815260208190526040902054600114610580576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6004546001146105ca576040805162461bcd60e51b815260206004820152601060248201526f53706f747465722f6e6f742d6c69766560801b604482015290519081900360640190fd5b81623830b960e91b14156104dc57600381905560408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a25050565b6002546001600160a01b031681565b60035481565b3360009081526020819052604090205460011461067e576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b33600090815260208190526040902054600114610715576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b600060048190556040517f2308ed18a14e800c39b86eb6ea43270105955ca385b603b64eca89f98ae8fbda9190a1565b60045481565b3360009081526020819052604090205460011461079d576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b60006020819052908152604090205481565b600160208190526000918252604090912080549101546001600160a01b039091169082565b3360009081526020819052604090205460011461086a576040805162461bcd60e51b8152602060048201526016602482015260008051602061097c833981519152604482015290519081900360640190fd5b6004546001146108b4576040805162461bcd60e51b815260206004820152601060248201526f53706f747465722f6e6f742d6c69766560801b604482015290519081900360640190fd5b816207069760ec1b14156104dc5760008381526001602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582519081529151849286927f4ff2caaa972a7c6629ea01fae9c93d73cc307d13ea4c369f9bbbb7f9b7e9461d92918290030190a3610529565b60008115806109445750508082028282828161094157fe5b04145b61094d57600080fd5b92915050565b60008161096c846b033b2e3c9fd0803ce8000000610929565b8161097357fe5b04939250505056fe53706f747465722f6e6f742d617574686f72697a656400000000000000000000a264697066735822122089906389e2a5f84e7d913d866fc3b89e43968b2c38e892bacbfe6ab4502185b764736f6c634300060c0033