Address Contract Verified
Address
0x164F66fF8a675DA2B66f8912b58B79D4AC05Ac11
Balance
0 ETH
Nonce
1
Code Size
6602 bytes
Creator
0xFb37A6BC...a02c at tx 0xd3b08f1c...8c7346
Indexed Transactions
0
Contract Bytecode
6602 bytes
0x608060405260043610610090575f3560e01c8063ce1e462611610058578063ce1e462614610162578063e0a7704a1461018c578063ee2453c6146101b4578063f2fde38b146101d0578063f8b2cb4f146101f857610090565b806327e235e3146100945780636b4c991b146100d0578063715018a6146100f85780638da5cb5b1461010e578063a4b3bc0114610138575b5f80fd5b34801561009f575f80fd5b506100ba60048036038101906100b59190610b01565b610234565b6040516100c79190610b44565b60405180910390f35b3480156100db575f80fd5b506100f660048036038101906100f19190610c99565b610249565b005b348015610103575f80fd5b5061010c61025d565b005b348015610119575f80fd5b50610122610270565b60405161012f9190610cef565b60405180910390f35b348015610143575f80fd5b5061014c610297565b6040516101599190610cef565b60405180910390f35b34801561016d575f80fd5b506101766102a5565b6040516101839190610d82565b60405180910390f35b348015610197575f80fd5b506101b260048036038101906101ad9190610b01565b6102b4565b005b6101ce60048036038101906101c99190610dee565b6102c8565b005b3480156101db575f80fd5b506101f660048036038101906101f19190610b01565b6103bf565b005b348015610203575f80fd5b5061021e60048036038101906102199190610b01565b610443565b60405161022b9190610b44565b60405180910390f35b6001602052805f5260405f205f915090505481565b610251610489565b61025a81610510565b50565b610265610489565b61026e5f610531565b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f6102a06105f2565b905090565b60606102af610627565b905090565b6102bc610489565b6102c5816106c5565b50565b5f83836040516024016102dc929190610e5a565b6040516020818303038152906040527fa7c8b96a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506103708261036890611192565b823334610715565b6103af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a690611214565b60405180910390fd5b6103b984846108d9565b50505050565b6103c7610489565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610437575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161042e9190610cef565b60405180910390fd5b61044081610531565b50565b5f60015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610491610a68565b73ffffffffffffffffffffffffffffffffffffffff166104af610270565b73ffffffffffffffffffffffffffffffffffffffff161461050e576104d2610a68565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016105059190610cef565b60405180910390fd5b565b5f610519610a6f565b90508181600101908161052c919061142c565b505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f806105fc610a6f565b9050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b60605f610632610a6f565b90508060010180546106439061125f565b80601f016020809104026020016040519081016040528092919081815260200182805461066f9061125f565b80156106ba5780601f10610691576101008083540402835291602001916106ba565b820191905f5260205f20905b81548152906001019060200180831161069d57829003601f168201915b505050505091505090565b5f6106ce610a6f565b905081815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b5f8061071f610a6f565b90505f604051806101000160405280885f015181526020018673ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200185815260200187815260200183600101805461078a9061125f565b80601f01602080910402602001604051908101604052809291908181526020018280546107b69061125f565b80156108015780601f106107d857610100808354040283529160200191610801565b820191905f5260205f20905b8154815290600101906020018083116107e457829003601f168201915b5050505050815260200188604001515163ffffffff16815260200188602001518152509050815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318cea58d8289604001518a606001516040518463ffffffff1660e01b815260040161088d939291906117ef565b6020604051808303815f875af11580156108a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108cd919061186e565b92505050949350505050565b8060015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20541015610959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610950906118e3565b60405180910390fd5b8060015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546109a5919061192e565b925050819055508060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546109f89190611961565b925050819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a5c9190610b44565b60405180910390a35050565b5f33905090565b5f7f804776a84f3d03ad8442127b1451e2fbbb6a715c681d6a83c9e9fca787b99300905090565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610ad082610aa7565b9050919050565b610ae081610ac6565b8114610aea575f80fd5b50565b5f81359050610afb81610ad7565b92915050565b5f60208284031215610b1657610b15610a9f565b5b5f610b2384828501610aed565b91505092915050565b5f819050919050565b610b3e81610b2c565b82525050565b5f602082019050610b575f830184610b35565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610bab82610b65565b810181811067ffffffffffffffff82111715610bca57610bc9610b75565b5b80604052505050565b5f610bdc610a96565b9050610be88282610ba2565b919050565b5f67ffffffffffffffff821115610c0757610c06610b75565b5b610c1082610b65565b9050602081019050919050565b828183375f83830152505050565b5f610c3d610c3884610bed565b610bd3565b905082815260208101848484011115610c5957610c58610b61565b5b610c64848285610c1d565b509392505050565b5f82601f830112610c8057610c7f610b5d565b5b8135610c90848260208601610c2b565b91505092915050565b5f60208284031215610cae57610cad610a9f565b5b5f82013567ffffffffffffffff811115610ccb57610cca610aa3565b5b610cd784828501610c6c565b91505092915050565b610ce981610ac6565b82525050565b5f602082019050610d025f830184610ce0565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610d3f578082015181840152602081019050610d24565b5f8484015250505050565b5f610d5482610d08565b610d5e8185610d12565b9350610d6e818560208601610d22565b610d7781610b65565b840191505092915050565b5f6020820190508181035f830152610d9a8184610d4a565b905092915050565b610dab81610b2c565b8114610db5575f80fd5b50565b5f81359050610dc681610da2565b92915050565b5f80fd5b5f60808284031215610de557610de4610dcc565b5b81905092915050565b5f805f60608486031215610e0557610e04610a9f565b5b5f610e1286828701610aed565b9350506020610e2386828701610db8565b925050604084013567ffffffffffffffff811115610e4457610e43610aa3565b5b610e5086828701610dd0565b9150509250925092565b5f604082019050610e6d5f830185610ce0565b610e7a6020830184610b35565b9392505050565b5f80fd5b5f80fd5b5f67ffffffffffffffff821115610ea357610ea2610b75565b5b602082029050602081019050919050565b5f80fd5b5f610eca610ec584610e89565b610bd3565b90508083825260208201905060208402830185811115610eed57610eec610eb4565b5b835b81811015610f165780610f028882610aed565b845260208401935050602081019050610eef565b5050509392505050565b5f82601f830112610f3457610f33610b5d565b5b8135610f44848260208601610eb8565b91505092915050565b5f67ffffffffffffffff821115610f6757610f66610b75565b5b602082029050602081019050919050565b5f67ffffffffffffffff821115610f9257610f91610b75565b5b610f9b82610b65565b9050602081019050919050565b5f610fba610fb584610f78565b610bd3565b905082815260208101848484011115610fd657610fd5610b61565b5b610fe1848285610c1d565b509392505050565b5f82601f830112610ffd57610ffc610b5d565b5b813561100d848260208601610fa8565b91505092915050565b5f61102861102384610f4d565b610bd3565b9050808382526020820190506020840283018581111561104b5761104a610eb4565b5b835b8181101561109257803567ffffffffffffffff8111156110705761106f610b5d565b5b80860161107d8982610fe9565b8552602085019450505060208101905061104d565b5050509392505050565b5f82601f8301126110b0576110af610b5d565b5b81356110c0848260208601611016565b91505092915050565b5f608082840312156110de576110dd610e81565b5b6110e86080610bd3565b90505f82013567ffffffffffffffff81111561110757611106610e85565b5b61111384828501610c6c565b5f83015250602061112684828501610db8565b602083015250604082013567ffffffffffffffff81111561114a57611149610e85565b5b61115684828501610f20565b604083015250606082013567ffffffffffffffff81111561117a57611179610e85565b5b6111868482850161109c565b60608301525092915050565b5f61119d36836110c9565b9050919050565b7f4d657461436f696e3a20756e617574686f72697a6564207472616e73616374695f8201527f6f6e000000000000000000000000000000000000000000000000000000000000602082015250565b5f6111fe602283610d12565b9150611209826111a4565b604082019050919050565b5f6020820190508181035f83015261122b816111f2565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061127657607f821691505b60208210810361128957611288611232565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026112eb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826112b0565b6112f586836112b0565b95508019841693508086168417925050509392505050565b5f819050919050565b5f61133061132b61132684610b2c565b61130d565b610b2c565b9050919050565b5f819050919050565b61134983611316565b61135d61135582611337565b8484546112bc565b825550505050565b5f90565b611371611365565b61137c818484611340565b505050565b5b8181101561139f576113945f82611369565b600181019050611382565b5050565b601f8211156113e4576113b58161128f565b6113be846112a1565b810160208510156113cd578190505b6113e16113d9856112a1565b830182611381565b50505b505050565b5f82821c905092915050565b5f6114045f19846008026113e9565b1980831691505092915050565b5f61141c83836113f5565b9150826002028217905092915050565b61143582610d08565b67ffffffffffffffff81111561144e5761144d610b75565b5b611458825461125f565b6114638282856113a3565b5f60209050601f831160018114611494575f8415611482578287015190505b61148c8582611411565b8655506114f3565b601f1984166114a28661128f565b5f5b828110156114c9578489015182556001820191506020850194506020810190506114a4565b868310156114e657848901516114e2601f8916826113f5565b8355505b6001600288020188555050505b505050505050565b5f82825260208201905092915050565b5f61151582610d08565b61151f81856114fb565b935061152f818560208601610d22565b61153881610b65565b840191505092915050565b61154c81610ac6565b82525050565b61155b81610b2c565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f61158582611561565b61158f818561156b565b935061159f818560208601610d22565b6115a881610b65565b840191505092915050565b5f63ffffffff82169050919050565b6115cb816115b3565b82525050565b5f61010083015f8301518482035f8601526115ec828261150b565b91505060208301516116016020860182611543565b5060408301516116146040860182611543565b5060608301516116276060860182611552565b506080830151848203608086015261163f828261157b565b91505060a083015184820360a0860152611659828261150b565b91505060c083015161166e60c08601826115c2565b5060e083015161168160e0860182611552565b508091505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6116c08383611543565b60208301905092915050565b5f602082019050919050565b5f6116e28261168c565b6116ec8185611696565b93506116f7836116a6565b805f5b8381101561172757815161170e88826116b5565b9750611719836116cc565b9250506001810190506116fa565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f611768838361157b565b905092915050565b5f602082019050919050565b5f61178682611734565b611790818561173e565b9350836020820285016117a28561174e565b805f5b858110156117dd57848403895281516117be858261175d565b94506117c983611770565b925060208a019950506001810190506117a5565b50829750879550505050505092915050565b5f6060820190508181035f83015261180781866115d1565b9050818103602083015261181b81856116d8565b9050818103604083015261182f818461177c565b9050949350505050565b5f8115159050919050565b61184d81611839565b8114611857575f80fd5b50565b5f8151905061186881611844565b92915050565b5f6020828403121561188357611882610a9f565b5b5f6118908482850161185a565b91505092915050565b7f4d657461436f696e3a20696e73756666696369656e742062616c616e636500005f82015250565b5f6118cd601e83610d12565b91506118d882611899565b602082019050919050565b5f6020820190508181035f8301526118fa816118c1565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61193882610b2c565b915061194383610b2c565b925082820390508181111561195b5761195a611901565b5b92915050565b5f61196b82610b2c565b915061197683610b2c565b925082820190508082111561198e5761198d611901565b5b9291505056fea264697066735822122005d4b1199dcc51a5c22ded4f5c9aebaf55c20edaabdb6c8e6f7d6e5854adb73264736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: No
MetaCoin.sol 63 lines
// SPDX-License-Identifier: MIT
// Tells the Solidity compiler to compile only from v0.8.13 to v0.9.0
pragma solidity ^0.8.12;
import {Ownable} from "openzeppelin/access/Ownable.sol";
import {PredicateClient} from "../mixins/PredicateClient.sol";
import {PredicateMessage} from "../interfaces/IPredicateClient.sol";
import {IPredicateManager} from "../interfaces/IPredicateManager.sol";
// This is just a simple example of a coin-like contract.
// It is not ERC20 compatible and cannot be expected to talk to other
// coin/token contracts.
contract MetaCoin is PredicateClient, Ownable {
mapping(address => uint256) public balances;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
constructor(address _owner, address _serviceManager, string memory _policyID) Ownable(_owner) {
balances[_owner] = 10_000_000_000_000;
_initPredicateClient(_serviceManager, _policyID);
}
function sendCoin(address receiver, uint256 amount, PredicateMessage calldata predicateMessage) public payable {
bytes memory encodedSigAndArgs = abi.encodeWithSignature("_sendCoin(address,uint256)", receiver, amount);
require(
_authorizeTransaction(predicateMessage, encodedSigAndArgs, msg.sender, msg.value),
"MetaCoin: unauthorized transaction"
);
// business logic function that is protected
_sendCoin(receiver, amount);
}
// @inheritdoc IPredicateClient
function setPolicy(
string memory _policyID
) external onlyOwner {
_setPolicy(_policyID);
}
// @inheritdoc IPredicateClient
function setPredicateManager(
address _predicateManager
) public onlyOwner {
_setPredicateManager(_predicateManager);
}
// business logic function that is protected
function _sendCoin(address receiver, uint256 amount) internal {
require(balances[msg.sender] >= amount, "MetaCoin: insufficient balance");
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Transfer(msg.sender, receiver, amount);
}
function getBalance(
address addr
) public view returns (uint256) {
return balances[addr];
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
PredicateClient.sol 104 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import {IPredicateManager, Task} from "../interfaces/IPredicateManager.sol";
import "../interfaces/IPredicateClient.sol";
abstract contract PredicateClient is IPredicateClient {
// @notice the storage slot for the PredicateClientStorage struct
// @dev keccak256(abi.encode(uint256(keccak256("predicate.storage.PredicateClient")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant _PREDICATE_CLIENT_STORAGE_SLOT =
0x804776a84f3d03ad8442127b1451e2fbbb6a715c681d6a83c9e9fca787b99300;
// @notice retrieves the PredicateClientStorage struct from the configured storage slot
function _getPredicateClientStorage() private pure returns (PredicateClientStorage storage $) {
assembly {
$.slot := _PREDICATE_CLIENT_STORAGE_SLOT
}
}
/**
* @notice Sets a policy and serviceManager for the predicate client.
* @param _serviceManagerAddress Address of the associated PredicateManager contract.
* @param _policyID A string representing the predicate policyID.
* @dev This function enables clients to define execution rules or parameters for tasks they submit.
* The policy governs how tasks submitted by the caller are executed, ensuring compliance with predefined rules.
*/
function _initPredicateClient(address _serviceManagerAddress, string memory _policyID) internal {
PredicateClientStorage storage $ = _getPredicateClientStorage();
$.serviceManager = IPredicateManager(_serviceManagerAddress);
$.policyID = _policyID;
}
// @notice internal function to set the policyID
function _setPolicy(
string memory _policyID
) internal {
PredicateClientStorage storage $ = _getPredicateClientStorage();
$.policyID = _policyID;
}
// @inheritdoc IPredicateClient
function getPolicy() external view override returns (string memory) {
return _getPolicy();
}
// @notice internal function to get the policyID from PredicateClientStorage
function _getPolicy() internal view returns (string memory) {
PredicateClientStorage storage $ = _getPredicateClientStorage();
return $.policyID;
}
// @notice internal function to set the Predicate ServiceManager
function _setPredicateManager(
address _predicateManager
) internal {
PredicateClientStorage storage $ = _getPredicateClientStorage();
$.serviceManager = IPredicateManager(_predicateManager);
}
// @inheritdoc IPredicateClient
function getPredicateManager() external view override returns (address) {
return _getPredicateManager();
}
// @notice internal function to get the Predicate ServiceManager address from PredicateClientStorage
function _getPredicateManager() internal view returns (address) {
PredicateClientStorage storage $ = _getPredicateClientStorage();
return address($.serviceManager);
}
/**
* @notice Restricts access to the Predicate ServiceManager
*/
modifier onlyPredicateServiceManager() {
PredicateClientStorage storage $ = _getPredicateClientStorage();
if (msg.sender != address($.serviceManager)) {
revert PredicateClient__Unauthorized();
}
_;
}
function _authorizeTransaction(
PredicateMessage memory _predicateMessage,
bytes memory _encodedSigAndArgs,
address _msgSender,
uint256 _value
) internal returns (bool) {
PredicateClientStorage storage $ = _getPredicateClientStorage();
Task memory task = Task({
msgSender: _msgSender,
target: address(this),
value: _value,
encodedSigAndArgs: _encodedSigAndArgs,
policyID: $.policyID,
quorumThresholdCount: uint32(_predicateMessage.signerAddresses.length),
taskId: _predicateMessage.taskId,
expireByBlockNumber: _predicateMessage.expireByBlockNumber
});
return
$.serviceManager.validateSignatures(task, _predicateMessage.signerAddresses, _predicateMessage.signatures);
}
}
IPredicateClient.sol 60 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import {IPredicateManager} from "../interfaces/IPredicateManager.sol";
// @notice Struct that bundles together a task's parameters for validation
struct PredicateMessage {
// the unique identifier for the task
string taskId;
// the expiration block number for the task
uint256 expireByBlockNumber;
// the operators that have signed the task
address[] signerAddresses;
// the signatures of the operators that have signed the task
bytes[] signatures;
}
// @notice Struct to contain stateful values for PredicateClient-type contracts
// @custom:storage-location erc7201:predicate.storage.PredicateClient
struct PredicateClientStorage {
IPredicateManager serviceManager;
string policyID;
}
// @notice error type for unauthorized access
error PredicateClient__Unauthorized();
// @notice Interface for a PredicateClient-type contract that enables clients to define execution rules or parameters for tasks they submit
interface IPredicateClient {
/**
* @notice Sets a policy for the calling address, associating it with a policy document stored on IPFS.
* @param _policyID A string representing the policyID from on chain.
* @dev This function enables clients to define execution rules or parameters for tasks they submit.
* The policy governs how tasks submitted by the caller are executed, ensuring compliance with predefined rules.
*/
function setPolicy(
string memory _policyID
) external;
/**
* @notice Retrieves the policy for the calling address.
* @return The policyID associated with the calling address.
*/
function getPolicy() external view returns (string memory);
/**
* @notice Function for setting the Predicate ServiceManager
* @param _predicateManager address of the service manager
*/
function setPredicateManager(
address _predicateManager
) external;
/**
* @notice Function for getting the Predicate ServiceManager
* @return address of the service manager
*/
function getPredicateManager() external view returns (address);
}
IPredicateManager.sol 176 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
// @notice Struct that bundles together a task's parameters for validation
struct Task {
// the unique identifier for the task
string taskId;
// the address of the sender of the task
address msgSender;
// the address of the target contract for the task
address target;
// the value to send with the task
uint256 value;
// the encoded signature and arguments for the task
bytes encodedSigAndArgs;
// the policy ID associated with the task
string policyID;
// the number of signatures required to authorize the task
uint32 quorumThresholdCount;
// the block number by which the task must be executed
uint256 expireByBlockNumber;
}
// @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management.
struct SignatureWithSaltAndExpiry {
// the signature itself, formatted as a single bytes object
bytes signature;
// the salt used to generate the signature
bytes32 salt;
// the expiration timestamp (UTC) of the signature
uint256 expiry;
}
/**
* @title Minimal interface for a ServiceManager-type contract that forms the single point for an AVS to push updates to EigenLayer
* @author Predicate Labs, Inc
*/
interface IPredicateManager {
/**
* @notice Sets the metadata URI for the AVS
* @param _metadataURI is the metadata URI for the AVS
*/
function setMetadataURI(
string memory _metadataURI
) external;
/**
* @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator registration with the AVS
* @param operatorSigningKey The address of the operator's signing key.
* @param operatorSignature The signature, salt, and expiry of the operator's signature.
*/
function registerOperatorToAVS(
address operatorSigningKey,
SignatureWithSaltAndExpiry memory operatorSignature
) external;
/**
* @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator deregistration from the AVS
* @param operator The address of the operator to deregister.
*/
function deregisterOperatorFromAVS(
address operator
) external;
/**
* @notice Returns the list of strategies that the operator has potentially restaked on the AVS
* @param operator The address of the operator to get restaked strategies for
* @dev This function is intended to be called off-chain
* @dev No guarantee is made on whether the operator has shares for a strategy in a quorum or uniqueness
* of each element in the returned array. The off-chain service should do that validation separately
*/
function getOperatorRestakedStrategies(
address operator
) external view returns (address[] memory);
/**
* @notice Returns the list of strategies that the AVS supports for restaking
* @dev This function is intended to be called off-chain
* @dev No guarantee is made on uniqueness of each element in the returned array.
* The off-chain service should do that validation separately
*/
function getRestakeableStrategies() external view returns (address[] memory);
/**
* @notice Sets a policy ID for the sender, defining execution rules or parameters for tasks
* @param policyID string pointing to the policy details
* @dev Only callable by client contracts or EOAs to associate a policy with their address
* @dev Emits a SetPolicy event upon successful association
*/
function setPolicy(
string memory policyID
) external;
/**
* @notice Removes a policy ID for the sender, removing execution rules or parameters for tasks
* @param policyID string pointing to the policy details
* @dev Only callable by client contracts or EOAs to disassociate a policy with their address
* @dev Emits a RemovedPolicy event upon successful association
*/
function removePolicy(
string memory policyID
) external;
/**
* @notice Deploys a policy with ID with execution rules or parameters for tasks
* @param _policyID string pointing to the policy details
* @param _policy string containing the policy details
* @param _quorumThreshold The number of signatures required to authorize a task
* @dev Only callable by service manager deployer
* @dev Emits a DeployedPolicy event upon successful deployment
*/
function deployPolicy(string memory _policyID, string memory _policy, uint256 _quorumThreshold) external;
/**
* @notice Gets array of deployed policies
*/
function getDeployedPolicies() external view returns (string[] memory);
/**
* @notice Deploys a social graph which clients can use in policy
* @param _socialGraphID is a unique identifier
* @param _socialGraphConfig is the config for the social graph
* @dev Only callable by service manager deployer
* @dev Emits a SocialGraphDeployed event upon successful deployment
*/
function deploySocialGraph(string memory _socialGraphID, string memory _socialGraphConfig) external;
/**
* @notice Returns the list of social graph IDs that the AVS supports
*/
function getSocialGraphIDs() external view returns (string[] memory);
/**
* @notice Verifies if a task is authorized by the required number of operators
* @param _task Parameters of the task including sender, target, function signature, arguments, quorum count, and expiry block
* @param signerAddresses Array of addresses of the operators who signed the task
* @param signatures Array of signatures from the operators authorizing the task
* @return isVerified Boolean indicating if the task has been verified by the required number of operators
* @dev This function checks the signatures against the hash of the task parameters to ensure task authenticity and authorization
*/
function validateSignatures(
Task memory _task,
address[] memory signerAddresses,
bytes[] memory signatures
) external returns (bool isVerified);
/**
* @notice Adds a new strategy to the Service Manager
* @dev Only callable by the contract owner. Adds a strategy that operators can stake on.
* @param _strategy The address of the strategy contract to add
* @param quorumNumber The quorum number associated with the strategy
* @param index The index of the strategy within the quorum
* @dev Emits a StrategyAdded event upon successful addition of the strategy
* @dev Reverts if the strategy does not exist or is already added
*/
function addStrategy(address _strategy, uint8 quorumNumber, uint256 index) external;
/**
* @notice Removes an existing strategy from the Service Manager
* @dev Only callable by the contract owner. Removes a strategy that operators are currently able to stake on.
* @param _strategy The address of the strategy contract to remove
* @dev Emits a StrategyRemoved event upon successful removal of the strategy
* @dev Reverts if the strategy is not currently added or if the address is invalid
*/
function removeStrategy(
address _strategy
) external;
/**
* @notice Enables the rotation of Predicate Signing Key for an operator
* @param _oldSigningKey address of the old signing key to remove
* @param _newSigningKey address of the new signing key to add
*/
function rotatePredicateSigningKey(address _oldSigningKey, address _newSigningKey) external;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Read Contract
balances 0x27e235e3 → uint256
getBalance 0xf8b2cb4f → uint256
getPolicy 0xce1e4626 → string
getPredicateManager 0xa4b3bc01 → address
owner 0x8da5cb5b → address
Write Contract 5 functions
These functions modify contract state and require a wallet transaction to execute.
renounceOwnership 0x715018a6
No parameters
sendCoin 0x6545dad6
address receiver
uint256 amount
tuple predicateMessage
setPolicy 0x6b4c991b
string _policyID
setPredicateManager 0xe0a7704a
address _predicateManager
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address