Address Contract Verified
Address
0x2fb18b28fB39Ec3b26C3B5AF5222e2ca3B8B2269
Balance
0 ETH
Nonce
1
Code Size
6435 bytes
Creator
0x34DBF275...7490 at tx 0x1d1f23f1...8b511b
Indexed Transactions
0
Contract Bytecode
6435 bytes
0x608060405234801561000f575f80fd5b50600436106100a7575f3560e01c8063bf353dbb1161006f578063bf353dbb14610139578063c1c0e9c414610169578063c6f396db14610187578063ed49d2f8146101a5578063f602c805146101c3578063f751cd8f146101e3576100a7565b806329ae8114146100ab5780633ab0b3c1146100c757806365fae35e146100e35780639c52a7f1146100ff578063a07bc02a1461011b575b5f80fd5b6100c560048036038101906100c09190610f9e565b6101ed565b005b6100e160048036038101906100dc9190611036565b610316565b005b6100fd60048036038101906100f89190611074565b61057a565b005b61011960048036038101906101149190611074565b610681565b005b610123610787565b60405161013091906110fa565b60405180910390f35b610153600480360381019061014e9190611074565b6107ab565b6040516101609190611122565b60405180910390f35b6101716107bf565b60405161017e919061114a565b60405180910390f35b61018f610c29565b60405161019c919061117d565b60405180910390f35b6101ad610d74565b6040516101ba9190611122565b60405180910390f35b6101cb610d7a565b6040516101da939291906111a5565b60405180910390f35b6101eb610db0565b005b60015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20541461026c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026390611234565b60405180910390fd5b7f6d617844656c6179000000000000000000000000000000000000000000000000820361029f57806001819055506102da565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102d1906112c2565b60405180910390fd5b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c78260405161030a9190611122565b60405180910390a25050565b60015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205414610395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038c90611234565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fa9061132a565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff1660025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c05760025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fdbc628f334a9c7bf46419d864ca89e17415703fa12263f2284d94cc9b75b659e60405160405180910390a25b8160025f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806002600101819055506001544261051a9190611375565b60028001819055508173ffffffffffffffffffffffffffffffffffffffff167f0f870ae93c797c0a219447673e1027ae91aaa67bc1ad8f3951235edfc925f5be82600280015460405161056e9291906113a8565b60405180910390a25050565b60015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054146105f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f090611234565b60405180910390fd5b60015f808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b60015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205414610700576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f790611234565b60405180910390fd5b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b7f000000000000000000000000bc8959ae2d4e9b385fe620bef48c2fd7f4a8473681565b5f602052805f5260405f205f915090505481565b5f8060026040518060600160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152505090505f73ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff16036108a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a090611419565b60405180910390fd5b805f015173ffffffffffffffffffffffffffffffffffffffff163f816020015114610909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090090611481565b60405180910390fd5b8060400151421115610950576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610947906114e9565b60405180910390fd5b805f015173ffffffffffffffffffffffffffffffffffffffff16639486b5666040518163ffffffff1660e01b8152600401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190611531565b6109ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f6906115a6565b60405180910390fd5b60025f8082015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182015f9055600282015f905550507f000000000000000000000000bc8959ae2d4e9b385fe620bef48c2fd7f4a8473673ffffffffffffffffffffffffffffffffffffffff1663be6002c2825f0151636146195460e01b604051602001610a8f919061160f565b6040516020818303038152906040526040518363ffffffff1660e01b8152600401610abb9291906116b3565b5f604051808303815f875af1158015610ad6573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f82011682018060405250810190610afe91906117ff565b5060017f000000000000000000000000bc8959ae2d4e9b385fe620bef48c2fd7f4a8473673ffffffffffffffffffffffffffffffffffffffff1663bf353dbb306040518263ffffffff1660e01b8152600401610b5a919061114a565b602060405180830381865afa158015610b75573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b99919061185a565b14610bd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd0906118cf565b60405180910390fd5b805f015173ffffffffffffffffffffffffffffffffffffffff167fd074dc2801f2a4136a42e9fae80ca2c91228872a7a4996e6b47e10879559c0bf60405160405180910390a2805f015191505090565b5f8073ffffffffffffffffffffffffffffffffffffffff1660025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015610cc7575060025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163f600260010154145b8015610cd7575060028001544211155b8015610d6f575060025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639486b5666040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d4a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d6e9190611531565b5b905090565b60015481565b6002805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b60015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205414610e2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2690611234565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff1660025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160315610f255760025f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fdbc628f334a9c7bf46419d864ca89e17415703fa12263f2284d94cc9b75b659e60405160405180910390a260025f8082015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182015f9055600282015f905550505b565b5f604051905090565b5f80fd5b5f80fd5b5f819050919050565b610f4a81610f38565b8114610f54575f80fd5b50565b5f81359050610f6581610f41565b92915050565b5f819050919050565b610f7d81610f6b565b8114610f87575f80fd5b50565b5f81359050610f9881610f74565b92915050565b5f8060408385031215610fb457610fb3610f30565b5b5f610fc185828601610f57565b9250506020610fd285828601610f8a565b9150509250929050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61100582610fdc565b9050919050565b61101581610ffb565b811461101f575f80fd5b50565b5f813590506110308161100c565b92915050565b5f806040838503121561104c5761104b610f30565b5b5f61105985828601611022565b925050602061106a85828601610f57565b9150509250929050565b5f6020828403121561108957611088610f30565b5b5f61109684828501611022565b91505092915050565b5f819050919050565b5f6110c26110bd6110b884610fdc565b61109f565b610fdc565b9050919050565b5f6110d3826110a8565b9050919050565b5f6110e4826110c9565b9050919050565b6110f4816110da565b82525050565b5f60208201905061110d5f8301846110eb565b92915050565b61111c81610f6b565b82525050565b5f6020820190506111355f830184611113565b92915050565b61114481610ffb565b82525050565b5f60208201905061115d5f83018461113b565b92915050565b5f8115159050919050565b61117781611163565b82525050565b5f6020820190506111905f83018461116e565b92915050565b61119f81610f38565b82525050565b5f6060820190506111b85f83018661113b565b6111c56020830185611196565b6111d26040830184611113565b949350505050565b5f82825260208201905092915050565b7f5374617247756172642f6e6f742d617574686f72697a656400000000000000005f82015250565b5f61121e6018836111da565b9150611229826111ea565b602082019050919050565b5f6020820190508181035f83015261124b81611212565b9050919050565b7f5374617247756172642f66696c652d756e7265636f676e697a65642d706172615f8201527f6d00000000000000000000000000000000000000000000000000000000000000602082015250565b5f6112ac6021836111da565b91506112b782611252565b604082019050919050565b5f6020820190508181035f8301526112d9816112a0565b9050919050565b7f5374617247756172642f7a65726f2d7370656c6c2d61646472657373000000005f82015250565b5f611314601c836111da565b915061131f826112e0565b602082019050919050565b5f6020820190508181035f83015261134181611308565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61137f82610f6b565b915061138a83610f6b565b92508282019050808211156113a2576113a1611348565b5b92915050565b5f6040820190506113bb5f830185611196565b6113c86020830184611113565b9392505050565b7f5374617247756172642f756e706c6f747465642d7370656c6c000000000000005f82015250565b5f6114036019836111da565b915061140e826113cf565b602082019050919050565b5f6020820190508181035f830152611430816113f7565b9050919050565b7f5374617247756172642f77726f6e672d636f64656861736800000000000000005f82015250565b5f61146b6018836111da565b915061147682611437565b602082019050919050565b5f6020820190508181035f8301526114988161145f565b9050919050565b7f5374617247756172642f657870697265642d7370656c6c0000000000000000005f82015250565b5f6114d36017836111da565b91506114de8261149f565b602082019050919050565b5f6020820190508181035f830152611500816114c7565b9050919050565b61151081611163565b811461151a575f80fd5b50565b5f8151905061152b81611507565b92915050565b5f6020828403121561154657611545610f30565b5b5f6115538482850161151d565b91505092915050565b7f5374617247756172642f6e6f742d7965742d65786563757461626c65000000005f82015250565b5f611590601c836111da565b915061159b8261155c565b602082019050919050565b5f6020820190508181035f8301526115bd81611584565b9050919050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b5f819050919050565b611609611604826115c4565b6115ef565b82525050565b5f61161a82846115f8565b60048201915081905092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015611660578082015181840152602081019050611645565b5f8484015250505050565b5f601f19601f8301169050919050565b5f61168582611629565b61168f8185611633565b935061169f818560208601611643565b6116a88161166b565b840191505092915050565b5f6040820190506116c65f83018561113b565b81810360208301526116d8818461167b565b90509392505050565b5f80fd5b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61171f8261166b565b810181811067ffffffffffffffff8211171561173e5761173d6116e9565b5b80604052505050565b5f611750610f27565b905061175c8282611716565b919050565b5f67ffffffffffffffff82111561177b5761177a6116e9565b5b6117848261166b565b9050602081019050919050565b5f6117a361179e84611761565b611747565b9050828152602081018484840111156117bf576117be6116e5565b5b6117ca848285611643565b509392505050565b5f82601f8301126117e6576117e56116e1565b5b81516117f6848260208601611791565b91505092915050565b5f6020828403121561181457611813610f30565b5b5f82015167ffffffffffffffff81111561183157611830610f34565b5b61183d848285016117d2565b91505092915050565b5f8151905061185481610f74565b92915050565b5f6020828403121561186f5761186e610f30565b5b5f61187c84828501611846565b91505092915050565b7f5374617247756172642f73756250726f78792d6f776e65722d6368616e6765005f82015250565b5f6118b9601f836111da565b91506118c482611885565b602082019050919050565b5f6020820190508181035f8301526118e6816118ad565b905091905056fea2646970667358221220608898f9f93c0c7ffb62a4dfa9c0cac9c0d64da0aee3cef9f2c6e2933349795064736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: cancun
Optimization: No
StarGuard.sol 228 lines
// SPDX-FileCopyrightText: © 2025 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// 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.24;
interface SubProxyLike {
/**
* @notice Executes a calldata-encoded call `args` in the context of `target`
* @param target The target contract
* @param args The calldata-encoded call
* @return out The result of the execution
*/
function exec(address target, bytes calldata args) external payable returns (bytes memory out);
/**
* @notice Check owner access
* @param usr The address to check
* @return allowed The result of the check
*/
function wards(address usr) external view returns (uint256 allowed);
}
interface StarSpellLike {
/**
* @notice Executes actions performed on behalf of the `SubProxy` – i.e. the actual payload
* @dev Required, will be called by the StarGuard during permissionless execution
*/
function execute() external;
/**
* @notice Checks if the star payload is executable in the current block
* @dev Required, useful for implementing "earliest launch date" or "office hours" strategy
* @return result The result of the check (true = executable, false = not)
*/
function isExecutable() external view returns (bool result);
}
contract StarGuard {
// --- structs ---
/**
* @notice Star payload data
* @param addr The payload address
* @param tag The keccak hash of the bytecode
* @param deadline The timestamp after which the spell is no longer executable
*/
struct SpellData {
address addr;
bytes32 tag;
uint256 deadline;
}
// --- storage variables ---
/// @notice Addresses with owner access on this contract
mapping(address usr => uint256 allowed) public wards;
/// @notice Maximum delay in seconds between whitelisting and execution
uint256 public maxDelay;
/// @notice "Whitelisted" star payload data
SpellData public spellData;
// --- immutables ---
/// @notice Star admin contract (instance of `SubProxy`)
SubProxyLike public immutable subProxy;
// --- events ---
/**
* @notice `usr` was granted owner access
* @param usr The user address
*/
event Rely(address indexed usr);
/**
* @notice `usr` owner access was revoked
* @param usr The user address
*/
event Deny(address indexed usr);
/**
* @notice A contract parameter was updated
* @param what The changed parameter name
* @param data The new value of the parameter
*/
event File(bytes32 indexed what, uint256 data);
/**
* @notice A payload has been whitelisted
* @param addr The payload address
* @param tag The payload codehash
* @param deadline The timestamp after which the spell is no longer executable
*/
event Plot(address indexed addr, bytes32 tag, uint256 deadline);
/**
* @notice A previously "whitelisted" payload has been dropped
* @param addr The payload address
*/
event Drop(address indexed addr);
/**
* @notice A previously whitelisted payload has been executed
* @param addr The payload address
*/
event Exec(address indexed addr);
// --- modifiers ---
/**
* @notice Check if sender is authorized
*/
modifier auth() {
require(wards[msg.sender] == 1, "StarGuard/not-authorized");
_;
}
// --- constructor ---
constructor(address subProxy_) {
subProxy = SubProxyLike(subProxy_);
wards[msg.sender] = 1;
emit Rely(msg.sender);
}
// --- administration ---
/**
* @notice Grants `usr` admin access to this contract
* @param usr The user address
*/
function rely(address usr) external auth {
wards[usr] = 1;
emit Rely(usr);
}
/**
* @notice Revokes `usr` admin access from this contract
* @param usr The user address
*/
function deny(address usr) external auth {
wards[usr] = 0;
emit Deny(usr);
}
/**
* @notice Updates mutable variables
* @param what Name of the mutable variable
* @param data New value of the variable
*/
function file(bytes32 what, uint256 data) external auth {
if (what == "maxDelay") {
maxDelay = data;
} else {
revert("StarGuard/file-unrecognized-param");
}
emit File(what, data);
}
// --- operations ---
/**
* @notice "Whitelists" the payload for the future execution
* @param addr_ The Star payload to be whitelisted
* @param tag_ The keccak hash of the bytecode
*/
function plot(address addr_, bytes32 tag_) external auth {
require(addr_ != address(0), "StarGuard/zero-spell-address");
if (spellData.addr != address(0)) emit Drop(spellData.addr);
spellData.addr = addr_;
spellData.tag = tag_;
spellData.deadline = block.timestamp + maxDelay;
emit Plot(addr_, tag_, spellData.deadline);
}
/**
* @notice Removes the payload from the "whitelist"
*/
function drop() external auth {
if (spellData.addr == address(0)) return;
emit Drop(spellData.addr);
delete spellData;
}
/**
* @notice Checks if the plotted payload is executable in the current block
* @return result The result of the check (true = executable, false = reverts)
*/
function prob() external view returns (bool) {
return (
spellData.addr != address(0) && spellData.tag == spellData.addr.codehash
&& block.timestamp <= spellData.deadline && StarSpellLike(spellData.addr).isExecutable()
);
}
/**
* @notice Executes previously scheduled payload
* @return addr Executed payload address
*/
function exec() external returns (address addr) {
SpellData memory spellDataCopy = spellData;
require(spellDataCopy.addr != address(0), "StarGuard/unplotted-spell");
require(spellDataCopy.tag == spellDataCopy.addr.codehash, "StarGuard/wrong-codehash");
require(block.timestamp <= spellDataCopy.deadline, "StarGuard/expired-spell");
require(StarSpellLike(spellDataCopy.addr).isExecutable(), "StarGuard/not-yet-executable");
delete spellData;
subProxy.exec(spellDataCopy.addr, abi.encodePacked(StarSpellLike.execute.selector));
require(subProxy.wards(address(this)) == 1, "StarGuard/subProxy-owner-change");
emit Exec(spellDataCopy.addr);
return spellDataCopy.addr;
}
}
Read Contract
maxDelay 0xed49d2f8 → uint256
prob 0xc6f396db → bool
spellData 0xf602c805 → address, bytes32, uint256
subProxy 0xa07bc02a → address
wards 0xbf353dbb → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
deny 0x9c52a7f1
address usr
drop 0xf751cd8f
No parameters
exec 0xc1c0e9c4
No parameters
returns: address
file 0x29ae8114
bytes32 what
uint256 data
plot 0x3ab0b3c1
address addr_
bytes32 tag_
rely 0x65fae35e
address usr
Recent Transactions
No transactions found for this address