Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
LitePsmJob
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-or-later // Copyright (C) 2021 Dai Foundation // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. pragma solidity 0.8.13; import {IJob} from "./interfaces/IJob.sol"; interface SequencerLike { function isMaster(bytes32 network) external view returns (bool); } interface LitePsmLike { function chug() external returns (uint256 wad); function cut() external view returns (uint256 wad); function fill() external returns (uint256 wad); function gush() external view returns (uint256 wad); function rush() external view returns (uint256 wad); function trim() external returns (uint256 wad); } /// @title Call flap when possible contract LitePsmJob is IJob { SequencerLike public immutable sequencer; LitePsmLike public immutable litePsm; uint256 public immutable rushThreshold; uint256 public immutable cutThreshold; uint256 public immutable gushThreshold; // --- Errors --- error NotMaster(bytes32 network); error ThresholdNotReached(bytes4 fn); error UnsupportedFunction(bytes4 fn); // --- Events --- event Work(bytes32 indexed network, bytes4 indexed action); constructor( address _sequencer, address _litePsm, uint256 _rushThreshold, uint256 _cutThreshold, uint256 _gushThreshold ) { sequencer = SequencerLike(_sequencer); litePsm = LitePsmLike(_litePsm); rushThreshold = _rushThreshold; cutThreshold = _cutThreshold; gushThreshold = _gushThreshold; } function work(bytes32 network, bytes calldata args) public { if (!sequencer.isMaster(network)) revert NotMaster(network); (bytes4 fn) = abi.decode(args, (bytes4)); if (fn == litePsm.fill.selector) { if (litePsm.rush() >= rushThreshold) litePsm.fill(); else revert ThresholdNotReached(fn); } else if (fn == litePsm.chug.selector) { if(litePsm.cut() >= cutThreshold) litePsm.chug(); else revert ThresholdNotReached(fn); } else if (fn == litePsm.trim.selector) { if (litePsm.gush() >= gushThreshold) litePsm.trim(); else revert ThresholdNotReached(fn); } else { revert UnsupportedFunction(fn); } emit Work(network, fn); } function workable(bytes32 network) external view override returns (bool, bytes memory) { if (!sequencer.isMaster(network)) return (false, bytes("Network is not master")); if (litePsm.rush() >= rushThreshold) { return (true, abi.encode(litePsm.fill.selector)); } else if (litePsm.cut() >= cutThreshold) { return (true, abi.encode(litePsm.chug.selector)); } else if (litePsm.gush() >= gushThreshold) { return (true, abi.encode(litePsm.trim.selector)); } else { return (false, bytes("No work to do")); } } }
// SPDX-License-Identifier: AGPL-3.0-or-later // Copyright (C) 2021 Dai Foundation // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. pragma solidity >=0.8.0; /// @title Maker Keeper Network Job /// @notice A job represents an independant unit of work that can be done by a keeper interface IJob { /// @notice Executes this unit of work /// @dev Should revert iff workable() returns canWork of false /// @param network The name of the external keeper network /// @param args Custom arguments supplied to the job, should be copied from workable response function work(bytes32 network, bytes calldata args) external; /// @notice Ask this job if it has a unit of work available /// @dev This should never revert, only return false if nothing is available /// @dev This should normally be a view, but sometimes that's not possible /// @param network The name of the external keeper network /// @return canWork Returns true if a unit of work is available /// @return args The custom arguments to be provided to work() or an error string if canWork is false function workable(bytes32 network) external returns (bool canWork, bytes memory args); }
{ "remappings": [ "dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/", "dss-test/=lib/dss-test/src/", "forge-std/=lib/dss-test/lib/forge-std/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_sequencer","type":"address"},{"internalType":"address","name":"_litePsm","type":"address"},{"internalType":"uint256","name":"_rushThreshold","type":"uint256"},{"internalType":"uint256","name":"_cutThreshold","type":"uint256"},{"internalType":"uint256","name":"_gushThreshold","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"network","type":"bytes32"}],"name":"NotMaster","type":"error"},{"inputs":[{"internalType":"bytes4","name":"fn","type":"bytes4"}],"name":"ThresholdNotReached","type":"error"},{"inputs":[{"internalType":"bytes4","name":"fn","type":"bytes4"}],"name":"UnsupportedFunction","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"network","type":"bytes32"},{"indexed":true,"internalType":"bytes4","name":"action","type":"bytes4"}],"name":"Work","type":"event"},{"inputs":[],"name":"cutThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gushThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"litePsm","outputs":[{"internalType":"contract LitePsmLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rushThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sequencer","outputs":[{"internalType":"contract SequencerLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"network","type":"bytes32"},{"internalType":"bytes","name":"args","type":"bytes"}],"name":"work","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"network","type":"bytes32"}],"name":"workable","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61012060405234801561001157600080fd5b50604051610cde380380610cde83398101604081905261003091610073565b6001600160a01b039485166080529290931660a05260c05260e091909152610100526100c1565b80516001600160a01b038116811461006e57600080fd5b919050565b600080600080600060a0868803121561008b57600080fd5b61009486610057565b94506100a260208701610057565b6040870151606088015160809098015196999198509695945092505050565b60805160a05160c05160e05161010051610b6461017a60003960008181609c0152818161050301526108ca015260008181610184015281816103e301526108070152600081816101150152818161027e015261072c01526000818161013c0152818161029f01528181610326015281816104040152818161048b01528181610524015281816105ab0152818161074d0152818161082801526108eb01526000818160d6015281816101bc01526106850152610b646000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80636b72b3ad1161005b5780636b72b3ad146101105780636c88ec69146101375780638dce54b71461015e578063fd7ae24f1461017f57600080fd5b80631d2ab0001461008257806334a8a5bc146100975780635c1bba38146100d1575b600080fd5b6100956100903660046109b9565b6101a6565b005b6100be7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100f87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c8565b6100be7f000000000000000000000000000000000000000000000000000000000000000081565b6100f87f000000000000000000000000000000000000000000000000000000000000000081565b61017161016c366004610a35565b610661565b6040516100c8929190610a4e565b6100be7f000000000000000000000000000000000000000000000000000000000000000081565b604051637c530f1360e01b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690637c530f1390602401602060405180830381865afa15801561020b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022f9190610aad565b61025457604051636ac204fb60e11b8152600481018490526024015b60405180910390fd5b600061026282840184610ad6565b905063263aa31f60e01b6001600160e01b03198216016103c9577f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cbf0bfac6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031f9190610b00565b106103ae577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9c55ce16040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a89190610b00565b50610624565b8060405163a9c3ba3360e01b815260040161024b9190610b19565b63324d690560e11b6001600160e01b03198216016104e9577f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e6fd604c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610460573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104849190610b00565b106103ae577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b652df66040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610384573d6000803e3d6000fd5b63bf263f1d60e01b6001600160e01b0319821601610609577f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663881eb14e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a49190610b00565b106103ae577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340d9c0e36040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610384573d6000803e3d6000fd5b8060405163068d984960e21b815260040161024b9190610b19565b6040516001600160e01b031982169085907feca8f212cef77ccb379028b672e3b5c06e1ed77cb20542aedd699e43a9cd24c390600090a350505050565b604051637c530f1360e01b8152600481018290526000906060906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637c530f1390602401602060405180830381865afa1580156106cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f09190610aad565b61072a5750506040805180820190915260158152742732ba3bb7b9359034b9903737ba1036b0b9ba32b960591b6020820152600092909150565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cbf0bfac6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cd9190610b00565b10610805576040516001906107ed9063d9c55ce160e01b90602001610b19565b60405160208183030381529060405291509150915091565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e6fd604c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a89190610b00565b106108c8576040516001906107ed90634db296fb60e11b90602001610b19565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663881eb14e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096b9190610b00565b1061098b576040516001906107ed906340d9c0e360e01b90602001610b19565b505060408051808201909152600d81526c4e6f20776f726b20746f20646f60981b6020820152600092909150565b6000806000604084860312156109ce57600080fd5b83359250602084013567ffffffffffffffff808211156109ed57600080fd5b818601915086601f830112610a0157600080fd5b813581811115610a1057600080fd5b876020828501011115610a2257600080fd5b6020830194508093505050509250925092565b600060208284031215610a4757600080fd5b5035919050565b821515815260006020604081840152835180604085015260005b81811015610a8457858101830151858201606001528201610a68565b81811115610a96576000606083870101525b50601f01601f191692909201606001949350505050565b600060208284031215610abf57600080fd5b81518015158114610acf57600080fd5b9392505050565b600060208284031215610ae857600080fd5b81356001600160e01b031981168114610acf57600080fd5b600060208284031215610b1257600080fd5b5051919050565b6001600160e01b03199190911681526020019056fea26469706673582212209c4d0572fdd4e226aad7b5901a34f49b79cfd8a6e558c300379d7cdeb966094d64736f6c634300080d0033000000000000000000000000238b4e35daed6100c6162fae4510261f88996ec9000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530420000000000000000000000000000000000000000000c685fa11e01ec6f000000000000000000000000000000000000000000000000003f870857a3e0e380000000000000000000000000000000000000000000000018d0bf423c03d8de000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80636b72b3ad1161005b5780636b72b3ad146101105780636c88ec69146101375780638dce54b71461015e578063fd7ae24f1461017f57600080fd5b80631d2ab0001461008257806334a8a5bc146100975780635c1bba38146100d1575b600080fd5b6100956100903660046109b9565b6101a6565b005b6100be7f00000000000000000000000000000000000000000018d0bf423c03d8de00000081565b6040519081526020015b60405180910390f35b6100f87f000000000000000000000000238b4e35daed6100c6162fae4510261f88996ec981565b6040516001600160a01b0390911681526020016100c8565b6100be7f0000000000000000000000000000000000000000000c685fa11e01ec6f00000081565b6100f87f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf1685304281565b61017161016c366004610a35565b610661565b6040516100c8929190610a4e565b6100be7f000000000000000000000000000000000000000000003f870857a3e0e380000081565b604051637c530f1360e01b8152600481018490527f000000000000000000000000238b4e35daed6100c6162fae4510261f88996ec96001600160a01b031690637c530f1390602401602060405180830381865afa15801561020b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022f9190610aad565b61025457604051636ac204fb60e11b8152600481018490526024015b60405180910390fd5b600061026282840184610ad6565b905063263aa31f60e01b6001600160e01b03198216016103c9577f0000000000000000000000000000000000000000000c685fa11e01ec6f0000007f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663cbf0bfac6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031f9190610b00565b106103ae577f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663d9c55ce16040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a89190610b00565b50610624565b8060405163a9c3ba3360e01b815260040161024b9190610b19565b63324d690560e11b6001600160e01b03198216016104e9577f000000000000000000000000000000000000000000003f870857a3e0e38000007f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663e6fd604c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610460573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104849190610b00565b106103ae577f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b0316639b652df66040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610384573d6000803e3d6000fd5b63bf263f1d60e01b6001600160e01b0319821601610609577f00000000000000000000000000000000000000000018d0bf423c03d8de0000007f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663881eb14e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a49190610b00565b106103ae577f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b03166340d9c0e36040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610384573d6000803e3d6000fd5b8060405163068d984960e21b815260040161024b9190610b19565b6040516001600160e01b031982169085907feca8f212cef77ccb379028b672e3b5c06e1ed77cb20542aedd699e43a9cd24c390600090a350505050565b604051637c530f1360e01b8152600481018290526000906060906001600160a01b037f000000000000000000000000238b4e35daed6100c6162fae4510261f88996ec91690637c530f1390602401602060405180830381865afa1580156106cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f09190610aad565b61072a5750506040805180820190915260158152742732ba3bb7b9359034b9903737ba1036b0b9ba32b960591b6020820152600092909150565b7f0000000000000000000000000000000000000000000c685fa11e01ec6f0000007f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663cbf0bfac6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cd9190610b00565b10610805576040516001906107ed9063d9c55ce160e01b90602001610b19565b60405160208183030381529060405291509150915091565b7f000000000000000000000000000000000000000000003f870857a3e0e38000007f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663e6fd604c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a89190610b00565b106108c8576040516001906107ed90634db296fb60e11b90602001610b19565b7f00000000000000000000000000000000000000000018d0bf423c03d8de0000007f000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530426001600160a01b031663881eb14e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096b9190610b00565b1061098b576040516001906107ed906340d9c0e360e01b90602001610b19565b505060408051808201909152600d81526c4e6f20776f726b20746f20646f60981b6020820152600092909150565b6000806000604084860312156109ce57600080fd5b83359250602084013567ffffffffffffffff808211156109ed57600080fd5b818601915086601f830112610a0157600080fd5b813581811115610a1057600080fd5b876020828501011115610a2257600080fd5b6020830194508093505050509250925092565b600060208284031215610a4757600080fd5b5035919050565b821515815260006020604081840152835180604085015260005b81811015610a8457858101830151858201606001528201610a68565b81811115610a96576000606083870101525b50601f01601f191692909201606001949350505050565b600060208284031215610abf57600080fd5b81518015158114610acf57600080fd5b9392505050565b600060208284031215610ae857600080fd5b81356001600160e01b031981168114610acf57600080fd5b600060208284031215610b1257600080fd5b5051919050565b6001600160e01b03199190911681526020019056fea26469706673582212209c4d0572fdd4e226aad7b5901a34f49b79cfd8a6e558c300379d7cdeb966094d64736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000238b4e35daed6100c6162fae4510261f88996ec9000000000000000000000000f6e72db5454dd049d0788e411b06cfaf168530420000000000000000000000000000000000000000000c685fa11e01ec6f000000000000000000000000000000000000000000000000003f870857a3e0e380000000000000000000000000000000000000000000000018d0bf423c03d8de000000
-----Decoded View---------------
Arg [0] : _sequencer (address): 0x238b4E35dAed6100C6162fAE4510261f88996EC9
Arg [1] : _litePsm (address): 0xf6e72Db5454dd049d0788e411b06CfAF16853042
Arg [2] : _rushThreshold (uint256): 15000000000000000000000000
Arg [3] : _cutThreshold (uint256): 300000000000000000000000
Arg [4] : _gushThreshold (uint256): 30000000000000000000000000
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000238b4e35daed6100c6162fae4510261f88996ec9
Arg [1] : 000000000000000000000000f6e72db5454dd049d0788e411b06cfaf16853042
Arg [2] : 0000000000000000000000000000000000000000000c685fa11e01ec6f000000
Arg [3] : 000000000000000000000000000000000000000000003f870857a3e0e3800000
Arg [4] : 00000000000000000000000000000000000000000018d0bf423c03d8de000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.