Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 194 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set User Role | 21389611 | 449 days ago | IN | 0 ETH | 0.0005206 | ||||
| Set User Role | 21389611 | 449 days ago | IN | 0 ETH | 0.00052077 | ||||
| Set User Role | 21389591 | 449 days ago | IN | 0 ETH | 0.00053152 | ||||
| Set User Role | 21389360 | 449 days ago | IN | 0 ETH | 0.00078118 | ||||
| Set User Role | 21389360 | 449 days ago | IN | 0 ETH | 0.00083722 | ||||
| Set User Role | 21389360 | 449 days ago | IN | 0 ETH | 0.00083698 | ||||
| Set Role Capabil... | 21389360 | 449 days ago | IN | 0 ETH | 0.00089902 | ||||
| Set Role Capabil... | 21389360 | 449 days ago | IN | 0 ETH | 0.00089902 | ||||
| Set Role Capabil... | 21389360 | 449 days ago | IN | 0 ETH | 0.00089902 | ||||
| Set Role Capabil... | 21389360 | 449 days ago | IN | 0 ETH | 0.00089902 | ||||
| Set Role Capabil... | 21388776 | 449 days ago | IN | 0 ETH | 0.00557344 | ||||
| Set Role Capabil... | 21388776 | 449 days ago | IN | 0 ETH | 0.00350035 | ||||
| Set Role Capabil... | 21388775 | 449 days ago | IN | 0 ETH | 0.00134761 | ||||
| Set Role Capabil... | 21388771 | 449 days ago | IN | 0 ETH | 0.00350035 | ||||
| Set Role Capabil... | 21388771 | 449 days ago | IN | 0 ETH | 0.00350035 | ||||
| Set Role Capabil... | 21388770 | 449 days ago | IN | 0 ETH | 0.00350035 | ||||
| Set Role Capabil... | 21388770 | 449 days ago | IN | 0 ETH | 0.00171113 | ||||
| Set Role Capabil... | 21388768 | 449 days ago | IN | 0 ETH | 0.00134886 | ||||
| Set Role Capabil... | 21388740 | 449 days ago | IN | 0 ETH | 0.00350035 | ||||
| Set Role Capabil... | 21388739 | 449 days ago | IN | 0 ETH | 0.00557344 | ||||
| Set Role Capabil... | 21388731 | 449 days ago | IN | 0 ETH | 0.00211366 | ||||
| Set Role Capabil... | 21388731 | 449 days ago | IN | 0 ETH | 0.00171113 | ||||
| Set Role Capabil... | 21388715 | 449 days ago | IN | 0 ETH | 0.00143721 | ||||
| Set Role Capabil... | 21388714 | 449 days ago | IN | 0 ETH | 0.00350035 | ||||
| Set Role Capabil... | 21388712 | 449 days ago | IN | 0 ETH | 0.00136118 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x60806040 | 21181998 | 478 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Governor
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.17;
import {EnumerableSet} from "./dependencies/EnumerableSet.sol";
import {Authority} from "solmate/auth/Auth.sol";
import {RolesAuthority} from "./RolesAuthority.sol";
/// @notice Role based Authority that supports up to 256 roles.
/// @notice We have taken the tradeoff of additional storage usage for easier readabiliy without using off-chain / indexing services.
/// @author BadgerDAO Expanded from Solmate RolesAuthority
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)
contract Governor is RolesAuthority {
using EnumerableSet for EnumerableSet.Bytes32Set;
using EnumerableSet for EnumerableSet.AddressSet;
bytes32 NO_ROLES = bytes32(0);
struct Role {
uint8 roleId;
string roleName;
}
struct Capability {
address target;
bytes4 functionSig;
uint8[] roles;
}
mapping(uint8 => string) internal roleNames;
event RoleNameSet(uint8 indexed role, string indexed name);
/// @notice The contract constructor initializes RolesAuthority with the given owner.
/// @param _owner The address of the owner, who gains all permissions by default.
constructor(address _owner) RolesAuthority(_owner, Authority(address(this))) {}
/// @notice Returns a list of users that are assigned a specific role.
/// @dev This function searches all users and checks if they are assigned the given role.
/// @dev Intended for off-chain utility only due to inefficiency.
/// @param role The role ID to find users for.
/// @return usersWithRole An array of addresses that are assigned the given role.
function getUsersByRole(uint8 role) external view returns (address[] memory usersWithRole) {
// Search over all users: O(n) * 2
uint256 count;
for (uint256 i = 0; i < users.length(); i++) {
address user = users.at(i);
bool _canCall = doesUserHaveRole(user, role);
if (_canCall) {
count += 1;
}
}
if (count > 0) {
uint256 j = 0;
usersWithRole = new address[](count);
address[] memory _usrs = users.values();
for (uint256 i = 0; i < _usrs.length; i++) {
address user = _usrs[i];
bool _canCall = doesUserHaveRole(user, role);
if (_canCall) {
usersWithRole[j] = user;
j++;
}
}
}
}
/// @notice Returns a list of roles that an address has.
/// @dev This function searches all roles and checks if they are assigned to the given user.
/// @dev Intended for off-chain utility only due to inefficiency.
/// @param user The address of the user.
/// @return rolesForUser An array of role IDs that the user has.
function getRolesForUser(address user) external view returns (uint8[] memory rolesForUser) {
// Enumerate over all possible roles and check if enabled
uint256 count;
for (uint8 i = 0; i <= type(uint8).max;) {
if (doesUserHaveRole(user, i)) {
count += 1;
}
if (i < type(uint8).max) {
i = i + 1;
} else {
break;
}
}
if (count > 0) {
uint256 j = 0;
rolesForUser = new uint8[](count);
for (uint8 i = 0; i <= type(uint8).max;) {
if (doesUserHaveRole(user, i)) {
rolesForUser[j] = i;
j++;
}
if (i < type(uint8).max) {
i = i + 1;
} else {
break;
}
}
}
}
/// @notice Converts a byte map representation to an array of role IDs.
/// @param byteMap The bytes32 value encoding the roles.
/// @return roleIds An array of role IDs extracted from the byte map.
function getRolesFromByteMap(bytes32 byteMap) public pure returns (uint8[] memory roleIds) {
uint256 count;
for (uint8 i = 0; i <= type(uint8).max;) {
bool roleEnabled = (uint256(byteMap >> i) & 1) != 0;
if (roleEnabled) {
count += 1;
}
if (i < type(uint8).max) {
i = i + 1;
} else {
break;
}
}
if (count > 0) {
uint256 j = 0;
roleIds = new uint8[](count);
for (uint8 i = 0; i <= type(uint8).max;) {
bool roleEnabled = (uint256(byteMap >> i) & 1) != 0;
if (roleEnabled) {
roleIds[j] = i;
j++;
}
if (i < type(uint8).max) {
i = i + 1;
} else {
break;
}
}
}
}
/// @notice Converts an array of role IDs to a byte map representation.
/// @param roleIds An array of role IDs.
/// @return A bytes32 value encoding the roles.
function getByteMapFromRoles(uint8[] memory roleIds) public pure returns (bytes32) {
bytes32 _data;
for (uint256 i = 0; i < roleIds.length; i++) {
_data |= bytes32(1 << uint256(roleIds[i]));
}
return _data;
}
/// @notice Retrieves all function signatures enabled for a target address.
/// @param _target The target contract address.
/// @return _funcs An array of function signatures enabled for the target.
function getEnabledFunctionsInTarget(address _target) public view returns (bytes4[] memory _funcs) {
bytes32[] memory _sigs = enabledFunctionSigsByTarget[_target].values();
if (_sigs.length > 0) {
_funcs = new bytes4[](_sigs.length);
for (uint256 i = 0; i < _sigs.length; ++i) {
_funcs[i] = bytes4(_sigs[i]);
}
}
}
/// @notice Retrieves the name associated with a role ID.
/// @param role The role ID.
/// @return roleName The name of the role.
function getRoleName(uint8 role) external view returns (string memory roleName) {
return roleNames[role];
}
/// @notice Sets the name for a specific role ID for improved readability.
/// @dev This function requires authorization.
/// @param role The role ID.
/// @param roleName The name to assign to the role.
function setRoleName(uint8 role, string memory roleName) external requiresAuth {
roleNames[role] = roleName;
emit RoleNameSet(role, roleName);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
abstract contract Auth {
event OwnershipTransferred(address indexed user, address indexed newOwner);
event AuthorityUpdated(address indexed user, Authority indexed newAuthority);
address public owner;
Authority public authority;
constructor(address _owner, Authority _authority) {
owner = _owner;
authority = _authority;
emit OwnershipTransferred(msg.sender, _owner);
emit AuthorityUpdated(msg.sender, _authority);
}
modifier requiresAuth() virtual {
require(isAuthorized(msg.sender, msg.sig), "UNAUTHORIZED");
_;
}
function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {
Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.
// Checking if the caller is the owner only after calling the authority saves gas in most cases, but be
// aware that this makes protected functions uncallable even to the owner if the authority is out of order.
return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
}
function setAuthority(Authority newAuthority) public virtual {
// We check if the caller is the owner first because we want to ensure they can
// always swap out the authority even if it's reverting or using up a lot of gas.
require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));
authority = newAuthority;
emit AuthorityUpdated(msg.sender, newAuthority);
}
function transferOwnership(address newOwner) public virtual requiresAuth {
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
}
/// @notice A generic interface for a contract which provides authorization data to an Auth instance.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
interface Authority {
function canCall(
address user,
address target,
bytes4 functionSig
) external view returns (bool);
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.17;
import {Auth, Authority} from "solmate/auth/Auth.sol";
import {EnumerableSet} from "./dependencies/EnumerableSet.sol";
import {IRolesAuthority} from "./interfaces/IRolesAuthority.sol";
/// @notice Role based Authority that supports up to 256 roles.
/// @author BadgerDAO expanded with capability burning and enumeration of role holders and targets
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)
contract RolesAuthority is IRolesAuthority, Auth, Authority {
using EnumerableSet for EnumerableSet.Bytes32Set;
using EnumerableSet for EnumerableSet.AddressSet;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}
/*//////////////////////////////////////////////////////////////
ROLE/USER STORAGE
//////////////////////////////////////////////////////////////*/
EnumerableSet.AddressSet internal users;
EnumerableSet.AddressSet internal targets;
mapping(address => EnumerableSet.Bytes32Set) internal enabledFunctionSigsByTarget;
EnumerableSet.Bytes32Set internal enabledFunctionSigsPublic;
mapping(address => bytes32) public getUserRoles;
mapping(address => mapping(bytes4 => CapabilityFlag)) public capabilityFlag;
mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;
/// @notice Checks if a user has a specific role.
/// @param user The address of the user to check.
/// @param role The role to check for.
/// @return bool True if the user has the role, false otherwise.
function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {
return (uint256(getUserRoles[user]) >> role) & 1 != 0;
}
/// @notice Checks if a role has the capability to call a specific function on a target contract.
/// @param role The role to check the capability for.
/// @param target The address of the target contract.
/// @param functionSig The function signature to check the capability for.
/// @return bool True if the role has the capability, false otherwise.
function doesRoleHaveCapability(uint8 role, address target, bytes4 functionSig)
public
view
virtual
returns (bool)
{
return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;
}
/// @notice Checks if a function on a target contract is publicly accessible.
/// @param target The address of the target contract.
/// @param functionSig The function signature to check.
/// @return bool True if the function is public, false otherwise.
function isPublicCapability(address target, bytes4 functionSig) public view returns (bool) {
return capabilityFlag[target][functionSig] == CapabilityFlag.Public;
}
/*//////////////////////////////////////////////////////////////
AUTHORIZATION LOGIC
//////////////////////////////////////////////////////////////*/
/// @notice Checks if a user has the authorization to call a specific function on a target contract.
/// @notice Authorization is granted if the function's capability is set to public, or if the user possesses a role with the required capability, provided the capability has not been burned.
/// @param user The address of the user attempting to call the function.
/// @param target The address of the contract containing the function.
/// @param functionSig The function signature being called.
/// @return bool Returns true if the user is authorized to call the function, false otherwise.
function canCall(address user, address target, bytes4 functionSig) public view virtual override returns (bool) {
CapabilityFlag flag = capabilityFlag[target][functionSig];
if (flag == CapabilityFlag.Burned) {
return false;
} else if (flag == CapabilityFlag.Public) {
return true;
} else {
return bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];
}
}
/*//////////////////////////////////////////////////////////////
ROLE CAPABILITY CONFIGURATION LOGIC
//////////////////////////////////////////////////////////////*/
/// @notice Enables or disables public access to a specific function signature on a target contract.
/// @dev Checks to ensure the capability has not been previously burned before allowing modification.
/// @param target The contract address whose function signature's capability is being modified.
/// @param functionSig The function signature whose capability flag is being set.
/// @param enabled A boolean indicating whether to enable (true) or disable (false) public access.
function setPublicCapability(address target, bytes4 functionSig, bool enabled) public virtual requiresAuth {
require(capabilityFlag[target][functionSig] != CapabilityFlag.Burned, "RolesAuthority: Capability Burned");
if (enabled) {
capabilityFlag[target][functionSig] = CapabilityFlag.Public;
} else {
capabilityFlag[target][functionSig] = CapabilityFlag.None;
}
emit PublicCapabilityUpdated(target, functionSig, enabled);
}
/// @notice Grants or revokes a specified role's ability to call a function on a target.
/// @notice If the capability is already public or has been burned, this function will have no effect.
/// @param role The role ID to update the capability for.
/// @param target The address of the contract where the function signature resides.
/// @param functionSig The function signature to update the capability for.
/// @param enabled True to grant the capability, false to revoke it.
function setRoleCapability(uint8 role, address target, bytes4 functionSig, bool enabled)
public
virtual
requiresAuth
{
if (enabled) {
// Grant the role the capability to call the function signature on the target.
getRolesWithCapability[target][functionSig] |= bytes32(1 << role);
enabledFunctionSigsByTarget[target].add(bytes32(functionSig));
if (!targets.contains(target)) {
targets.add(target);
}
} else {
// Revoke the role's capability to call the function signature on the target.
getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);
// If no roles are left with the capability to call the function signature, remove it from the list of enabled function signatures for the target.
if (getRolesWithCapability[target][functionSig] == bytes32(0)) {
enabledFunctionSigsByTarget[target].remove(bytes32(functionSig));
}
// If no function signatures are left enabled for the target, remove the target.
if (enabledFunctionSigsByTarget[target].length() == 0) {
targets.remove(target);
}
}
emit RoleCapabilityUpdated(role, target, functionSig, enabled);
}
/// @notice Permanently burns a capability for a target, preventing it from being called in the future.
/// @dev Intended for use to renounce a capability of a governance entity.
/// @param target The address of the contract where the capability is being burned.
/// @param functionSig The function signature of the capability being burned.
function burnCapability(address target, bytes4 functionSig) public virtual requiresAuth {
require(capabilityFlag[target][functionSig] != CapabilityFlag.Burned, "RolesAuthority: Capability Burned");
capabilityFlag[target][functionSig] = CapabilityFlag.Burned;
emit CapabilityBurned(target, functionSig);
}
/*//////////////////////////////////////////////////////////////
USER ROLE ASSIGNMENT LOGIC
//////////////////////////////////////////////////////////////*/
/// @notice Assigns or removes a role for an address.
/// @param user The address of the user to assign/remove the role to/from.
/// @param role The role ID to assign/remove.
/// @param enabled True to assign the role, false to remove it.
function setUserRole(address user, uint8 role, bool enabled) public virtual requiresAuth {
if (enabled) {
getUserRoles[user] |= bytes32(1 << role);
if (!users.contains(user)) {
users.add(user);
}
} else {
getUserRoles[user] &= ~bytes32(1 << role);
// Remove user if no more roles
if (getUserRoles[user] == bytes32(0)) {
users.remove(user);
}
}
emit UserRoleUpdated(user, role, enabled);
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.17;
import {EnumerableSet} from "../dependencies/EnumerableSet.sol";
/// @notice Role based Authority that supports up to 256 roles.
/// @author BadgerDAO
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)
interface IRolesAuthority {
event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);
event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);
event CapabilityBurned(address indexed target, bytes4 indexed functionSig);
event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);
enum CapabilityFlag {
None,
Public,
Burned
}
}{
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
"solmate/=lib/solmate/src/",
"arbitrum-token-bridge/=lib/token-bridge-contracts/contracts/",
"corn-standard-solidity/=lib/corn-standard-solidity/src/",
"bitcorn-token/=lib/bitcorn-token/src/",
"@arbitrum/=lib/token-bridge-contracts/node_modules/@arbitrum/",
"@offchainlabs/=lib/token-bridge-contracts/node_modules/@offchainlabs/",
"@openzeppelin/contracts-upgradeable/=lib/token-bridge-contracts/node_modules/@openzeppelin/contracts-upgradeable/",
"@openzeppelin/contracts/=lib/token-bridge-contracts/node_modules/@openzeppelin/contracts/",
"chimera/=lib/chimera/src/",
"halmos-cheatcodes/=lib/bitcorn-token/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
"safe-contracts/=lib/safe-tools/lib/safe-contracts/",
"safe-tools/=lib/safe-tools/src/",
"solady/=lib/safe-tools/lib/solady/",
"token-bridge-contracts/=lib/token-bridge-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract Authority","name":"newAuthority","type":"address"}],"name":"AuthorityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"bytes4","name":"functionSig","type":"bytes4"}],"name":"CapabilityBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"bytes4","name":"functionSig","type":"bytes4"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"PublicCapabilityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"role","type":"uint8"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"bytes4","name":"functionSig","type":"bytes4"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"RoleCapabilityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"role","type":"uint8"},{"indexed":true,"internalType":"string","name":"name","type":"string"}],"name":"RoleNameSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint8","name":"role","type":"uint8"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"UserRoleUpdated","type":"event"},{"inputs":[],"name":"authority","outputs":[{"internalType":"contract Authority","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"functionSig","type":"bytes4"}],"name":"burnCapability","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"functionSig","type":"bytes4"}],"name":"canCall","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"capabilityFlag","outputs":[{"internalType":"enum IRolesAuthority.CapabilityFlag","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"role","type":"uint8"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"functionSig","type":"bytes4"}],"name":"doesRoleHaveCapability","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint8","name":"role","type":"uint8"}],"name":"doesUserHaveRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8[]","name":"roleIds","type":"uint8[]"}],"name":"getByteMapFromRoles","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"}],"name":"getEnabledFunctionsInTarget","outputs":[{"internalType":"bytes4[]","name":"_funcs","type":"bytes4[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"role","type":"uint8"}],"name":"getRoleName","outputs":[{"internalType":"string","name":"roleName","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getRolesForUser","outputs":[{"internalType":"uint8[]","name":"rolesForUser","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"byteMap","type":"bytes32"}],"name":"getRolesFromByteMap","outputs":[{"internalType":"uint8[]","name":"roleIds","type":"uint8[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"getRolesWithCapability","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getUserRoles","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"role","type":"uint8"}],"name":"getUsersByRole","outputs":[{"internalType":"address[]","name":"usersWithRole","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"functionSig","type":"bytes4"}],"name":"isPublicCapability","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract Authority","name":"newAuthority","type":"address"}],"name":"setAuthority","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"functionSig","type":"bytes4"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setPublicCapability","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"role","type":"uint8"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"functionSig","type":"bytes4"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setRoleCapability","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"role","type":"uint8"},{"internalType":"string","name":"roleName","type":"string"}],"name":"setRoleName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint8","name":"role","type":"uint8"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setUserRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040526000600c5534801561001557600080fd5b50604051611d5e380380611d5e833981016040819052610034916100cf565b600080546001600160a01b03199081166001600160a01b03841690811783556001805430931683179055604051849384928492909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a36040516001600160a01b0382169033907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350505050506100ff565b6000602082840312156100e157600080fd5b81516001600160a01b03811681146100f857600080fd5b9392505050565b611c508061010e6000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063b7009613116100b8578063d5afdbb01161007c578063d5afdbb01461030e578063dad7bb501461032e578063db7d03ab14610341578063ddb7a4de14610361578063ea7ca27614610381578063f2fde38b1461039457600080fd5b8063b7009613146102af578063b77925db146102c2578063bd516bed146102d5578063bf7e214f146102e8578063c6b0263e146102fb57600080fd5b80637a9e5e4b1161010a5780637a9e5e4b146101ed5780637d40583d146102005780638da5cb5b14610213578063920e08121461023e578063a41f9bb214610279578063b4bad06a1461028c57600080fd5b806306a36aee1461014757806308e4489c1461017a57806342d653ee1461018f57806367aff484146101af5780637917b794146101c2575b600080fd5b610167610155366004611453565b60096020526000908152604090205481565b6040519081526020015b60405180910390f35b61018d61018836600461148d565b6103a7565b005b6101a261019d366004611453565b6104a7565b60405161017191906114c2565b61018d6101bd366004611528565b6105b4565b6101676101d036600461148d565b600b60209081526000928352604080842090915290825290205481565b61018d6101fb366004611453565b6106b7565b61018d61020e366004611571565b6107a1565b600054610226906001600160a01b031681565b6040516001600160a01b039091168152602001610171565b61026c61024c36600461148d565b600a60209081526000928352604080842090915290825290205460ff1681565b60405161017191906115df565b61016761028736600461164e565b610946565b61029f61029a3660046116fb565b610991565b6040519015158152602001610171565b61029f6102bd366004611740565b6109d1565b61029f6102d036600461148d565b610a8e565b61018d6102e3366004611760565b610ade565b600154610226906001600160a01b031681565b61018d610309366004611806565b610b74565b61032161031c366004611834565b610cc8565b6040516101719190611873565b6101a261033c3660046118a6565b610d6e565b61035461034f366004611453565b610e90565b60405161017191906118bf565b61037461036f366004611834565b610f65565b6040516101719190611901565b61029f61038f366004611942565b61109d565b61018d6103a2366004611453565b6110c6565b6103bd336000356001600160e01b031916611143565b6103e25760405162461bcd60e51b81526004016103d99061196e565b60405180910390fd5b60026001600160a01b0383166000908152600a602090815260408083206001600160e01b03198616845290915290205460ff166002811115610426576104266115c9565b036104435760405162461bcd60e51b81526004016103d990611994565b6001600160a01b0382166000818152600a602090815260408083206001600160e01b031986168085529252808320805460ff19166002179055519092917fcbadb9d88ba94f6acc6c8645ed3731e2bbdb8e114a33ffcc0ab4277103e6e55291a35050565b60606000805b60ff818116116104f1576104c1848261109d565b156104d4576104d16001836119eb565b91505b60ff81811610156104f1576104ea8160016119fe565b90506104ad565b5080156105ae5760008167ffffffffffffffff81111561051357610513611607565b60405190808252806020026020018201604052801561053c578160200160208202803683370190505b50925060005b60ff818116116105ab57610556858261109d565b1561058e578084838151811061056e5761056e611a17565b60ff909216602092830291909101909101528161058a81611a2d565b9250505b60ff81811610156105ab576105a48160016119fe565b9050610542565b50505b50919050565b6105ca336000356001600160e01b031916611143565b6105e65760405162461bcd60e51b81526004016103d99061196e565b8015610631576001600160a01b03831660009081526009602052604090208054600160ff85161b17905561061b6002846111ed565b61062c5761062a60028461120f565b505b610669565b6001600160a01b03831660009081526009602052604090208054600160ff85161b19169081905561066957610667600284611224565b505b8160ff16836001600160a01b03167f4c9bdd0c8e073eb5eda2250b18d8e5121ff27b62064fbeeeed4869bb99bc5bf2836040516106aa911515815260200190565b60405180910390a3505050565b6000546001600160a01b031633148061074c575060015460405163b700961360e01b81526001600160a01b039091169063b70096139061070b90339030906001600160e01b03196000351690600401611a46565b602060405180830381865afa158015610728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074c9190611a73565b61075557600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b6107b7336000356001600160e01b031916611143565b6107d35760405162461bcd60e51b81526004016103d99061196e565b8015610849576001600160a01b0383166000818152600b602090815260408083206001600160e01b031987168085529083528184208054600160ff8c161b1790559383526006909152902061082791611239565b506108336004846111ed565b6108445761084260048461120f565b505b6108ec565b6001600160a01b0383166000908152600b602090815260408083206001600160e01b03198616845290915290208054600160ff87161b1916908190556108b7576001600160a01b03831660009081526006602052604090206108b5906001600160e01b03198416611245565b505b6001600160a01b03831660009081526006602052604090206108d890611251565b6000036108ec576108ea600484611224565b505b816001600160e01b031916836001600160a01b03168560ff167fa52ea92e6e955aa8ac66420b86350f7139959adfcc7e6a14eee1bd116d09860e84604051610938911515815260200190565b60405180910390a450505050565b60008060005b835181101561098a5783818151811061096757610967611a17565b602002602001015160ff166001901b60001b82179150808060010191505061094c565b5092915050565b6001600160a01b0382166000908152600b602090815260408083206001600160e01b03198516845290915290205460ff84161c60011615155b9392505050565b6001600160a01b0382166000908152600a602090815260408083206001600160e01b03198516845290915281205460ff166002816002811115610a1657610a166115c9565b03610a255760009150506109ca565b6001816002811115610a3957610a396115c9565b03610a485760019150506109ca565b50506001600160a01b038083166000908152600b602090815260408083206001600160e01b031986168452825280832054938716835260099091529020541615156109ca565b600060016001600160a01b0384166000908152600a602090815260408083206001600160e01b03198716845290915290205460ff166002811115610ad457610ad46115c9565b1490505b92915050565b610af4336000356001600160e01b031916611143565b610b105760405162461bcd60e51b81526004016103d99061196e565b60ff82166000908152600d60205260409020610b2c8282611b15565b5080604051610b3b9190611bd5565b6040519081900381209060ff8416907f5afa6cb832e64679422963cbd864f0deac6e160cb4225bc11c0ed284718121bc90600090a35050565b610b8a336000356001600160e01b031916611143565b610ba65760405162461bcd60e51b81526004016103d99061196e565b60026001600160a01b0384166000908152600a602090815260408083206001600160e01b03198716845290915290205460ff166002811115610bea57610bea6115c9565b03610c075760405162461bcd60e51b81526004016103d990611994565b8015610c4a576001600160a01b0383166000908152600a602090815260408083206001600160e01b0319861684529091529020805460ff19166001179055610c80565b6001600160a01b0383166000908152600a602090815260408083206001600160e01b0319861684529091529020805460ff191690555b816001600160e01b031916836001600160a01b03167f950a343f5d10445e82a71036d3f4fb3016180a25805141932543b83e2078a93e836040516106aa911515815260200190565b60ff81166000908152600d60205260409020805460609190610ce990611a90565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1590611a90565b8015610d625780601f10610d3757610100808354040283529160200191610d62565b820191906000526020600020905b815481529060010190602001808311610d4557829003601f168201915b50505050509050919050565b60606000805b60ff81811611610dc757600160ff821685901c1615801590610d9e57610d9b6001846119eb565b92505b60ff8281161015610dbb57610db48260016119fe565b9150610dc1565b50610dc7565b50610d74565b5080156105ae5760008167ffffffffffffffff811115610de957610de9611607565b604051908082528060200260200182016040528015610e12578160200160208202803683370190505b50925060005b60ff818116116105ab57600160ff821686901c1615801590610e675781858481518110610e4757610e47611a17565b60ff9092166020928302919091019091015282610e6381611a2d565b9350505b60ff8281161015610e8457610e7d8260016119fe565b9150610e8a565b506105ab565b50610e18565b6001600160a01b038116600090815260066020526040812060609190610eb59061125b565b8051909150156105ae57805167ffffffffffffffff811115610ed957610ed9611607565b604051908082528060200260200182016040528015610f02578160200160208202803683370190505b50915060005b8151811015610f5e57818181518110610f2357610f23611a17565b6020026020010151838281518110610f3d57610f3d611a17565b6001600160e01b031990921660209283029190910190910152600101610f08565b5050919050565b60606000805b610f756002611251565b811015610fb7576000610f89600283611268565b90506000610f97828761109d565b90508015610fad57610faa6001856119eb565b93505b5050600101610f6b565b5080156105ae5760008167ffffffffffffffff811115610fd957610fd9611607565b604051908082528060200260200182016040528015611002578160200160208202803683370190505b5092506000611011600261125b565b905060005b815181101561109457600082828151811061103357611033611a17565b602002602001015190506000611049828961109d565b9050801561108a578187868151811061106457611064611a17565b6001600160a01b03909216602092830291909101909101528461108681611a2d565b9550505b5050600101611016565b50505050919050565b6001600160a01b0391909116600090815260096020526040902054600160ff9092161c16151590565b6110dc336000356001600160e01b031916611143565b6110f85760405162461bcd60e51b81526004016103d99061196e565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6001546000906001600160a01b031680158015906111cd575060405163b700961360e01b81526001600160a01b0382169063b70096139061118c90879030908890600401611a46565b602060405180830381865afa1580156111a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cd9190611a73565b806111e557506000546001600160a01b038581169116145b949350505050565b6001600160a01b038116600090815260018301602052604081205415156109ca565b60006109ca836001600160a01b038416611274565b60006109ca836001600160a01b0384166112c3565b60006109ca8383611274565b60006109ca83836112c3565b6000610ad8825490565b606060006109ca836113b6565b60006109ca8383611411565b60008181526001830160205260408120546112bb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ad8565b506000610ad8565b600081815260018301602052604081205480156113ac5760006112e7600183611bf1565b85549091506000906112fb90600190611bf1565b905081811461136057600086600001828154811061131b5761131b611a17565b906000526020600020015490508087600001848154811061133e5761133e611a17565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061137157611371611c04565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ad8565b6000915050610ad8565b606081600001805480602002602001604051908101604052809291908181526020018280548015610d6257602002820191906000526020600020905b8154815260200190600101908083116113f25750505050509050919050565b600082600001828154811061142857611428611a17565b9060005260206000200154905092915050565b6001600160a01b038116811461145057600080fd5b50565b60006020828403121561146557600080fd5b81356109ca8161143b565b80356001600160e01b03198116811461148857600080fd5b919050565b600080604083850312156114a057600080fd5b82356114ab8161143b565b91506114b960208401611470565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156114fd57835160ff16835292840192918401916001016114de565b50909695505050505050565b803560ff8116811461148857600080fd5b801515811461145057600080fd5b60008060006060848603121561153d57600080fd5b83356115488161143b565b925061155660208501611509565b915060408401356115668161151a565b809150509250925092565b6000806000806080858703121561158757600080fd5b61159085611509565b935060208501356115a08161143b565b92506115ae60408601611470565b915060608501356115be8161151a565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061160157634e487b7160e01b600052602160045260246000fd5b91905290565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561164657611646611607565b604052919050565b6000602080838503121561166157600080fd5b823567ffffffffffffffff8082111561167957600080fd5b818501915085601f83011261168d57600080fd5b81358181111561169f5761169f611607565b8060051b91506116b084830161161d565b81815291830184019184810190888411156116ca57600080fd5b938501935b838510156116ef576116e085611509565b825293850193908501906116cf565b98975050505050505050565b60008060006060848603121561171057600080fd5b61171984611509565b925060208401356117298161143b565b915061173760408501611470565b90509250925092565b60008060006060848603121561175557600080fd5b83356117198161143b565b6000806040838503121561177357600080fd5b61177c83611509565b915060208084013567ffffffffffffffff8082111561179a57600080fd5b818601915086601f8301126117ae57600080fd5b8135818111156117c0576117c0611607565b6117d2601f8201601f1916850161161d565b915080825287848285010111156117e857600080fd5b80848401858401376000848284010152508093505050509250929050565b60008060006060848603121561181b57600080fd5b83356118268161143b565b925061155660208501611470565b60006020828403121561184657600080fd5b6109ca82611509565b60005b8381101561186a578181015183820152602001611852565b50506000910152565b602081526000825180602084015261189281604085016020870161184f565b601f01601f19169190910160400192915050565b6000602082840312156118b857600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156114fd5783516001600160e01b031916835292840192918401916001016118db565b6020808252825182820181905260009190848201906040850190845b818110156114fd5783516001600160a01b03168352928401929184019160010161191d565b6000806040838503121561195557600080fd5b82356119608161143b565b91506114b960208401611509565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b60208082526021908201527f526f6c6573417574686f726974793a204361706162696c697479204275726e656040820152601960fa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ad857610ad86119d5565b60ff8181168382160190811115610ad857610ad86119d5565b634e487b7160e01b600052603260045260246000fd5b600060018201611a3f57611a3f6119d5565b5060010190565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215611a8557600080fd5b81516109ca8161151a565b600181811c90821680611aa457607f821691505b6020821081036105ae57634e487b7160e01b600052602260045260246000fd5b601f821115611b10576000816000526020600020601f850160051c81016020861015611aed5750805b601f850160051c820191505b81811015611b0c57828155600101611af9565b5050505b505050565b815167ffffffffffffffff811115611b2f57611b2f611607565b611b4381611b3d8454611a90565b84611ac4565b602080601f831160018114611b785760008415611b605750858301515b600019600386901b1c1916600185901b178555611b0c565b600085815260208120601f198616915b82811015611ba757888601518255948401946001909101908401611b88565b5085821015611bc55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251611be781846020870161184f565b9190910192915050565b81810381811115610ad857610ad86119d5565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202d1d38354a112964fe746d592a54e0cb8c85eaab72c66f659b791f54a07da2f964736f6c63430008190033000000000000000000000000770a2350a9dc3daa77cdab2dd7f15aae2a44e8c1
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063b7009613116100b8578063d5afdbb01161007c578063d5afdbb01461030e578063dad7bb501461032e578063db7d03ab14610341578063ddb7a4de14610361578063ea7ca27614610381578063f2fde38b1461039457600080fd5b8063b7009613146102af578063b77925db146102c2578063bd516bed146102d5578063bf7e214f146102e8578063c6b0263e146102fb57600080fd5b80637a9e5e4b1161010a5780637a9e5e4b146101ed5780637d40583d146102005780638da5cb5b14610213578063920e08121461023e578063a41f9bb214610279578063b4bad06a1461028c57600080fd5b806306a36aee1461014757806308e4489c1461017a57806342d653ee1461018f57806367aff484146101af5780637917b794146101c2575b600080fd5b610167610155366004611453565b60096020526000908152604090205481565b6040519081526020015b60405180910390f35b61018d61018836600461148d565b6103a7565b005b6101a261019d366004611453565b6104a7565b60405161017191906114c2565b61018d6101bd366004611528565b6105b4565b6101676101d036600461148d565b600b60209081526000928352604080842090915290825290205481565b61018d6101fb366004611453565b6106b7565b61018d61020e366004611571565b6107a1565b600054610226906001600160a01b031681565b6040516001600160a01b039091168152602001610171565b61026c61024c36600461148d565b600a60209081526000928352604080842090915290825290205460ff1681565b60405161017191906115df565b61016761028736600461164e565b610946565b61029f61029a3660046116fb565b610991565b6040519015158152602001610171565b61029f6102bd366004611740565b6109d1565b61029f6102d036600461148d565b610a8e565b61018d6102e3366004611760565b610ade565b600154610226906001600160a01b031681565b61018d610309366004611806565b610b74565b61032161031c366004611834565b610cc8565b6040516101719190611873565b6101a261033c3660046118a6565b610d6e565b61035461034f366004611453565b610e90565b60405161017191906118bf565b61037461036f366004611834565b610f65565b6040516101719190611901565b61029f61038f366004611942565b61109d565b61018d6103a2366004611453565b6110c6565b6103bd336000356001600160e01b031916611143565b6103e25760405162461bcd60e51b81526004016103d99061196e565b60405180910390fd5b60026001600160a01b0383166000908152600a602090815260408083206001600160e01b03198616845290915290205460ff166002811115610426576104266115c9565b036104435760405162461bcd60e51b81526004016103d990611994565b6001600160a01b0382166000818152600a602090815260408083206001600160e01b031986168085529252808320805460ff19166002179055519092917fcbadb9d88ba94f6acc6c8645ed3731e2bbdb8e114a33ffcc0ab4277103e6e55291a35050565b60606000805b60ff818116116104f1576104c1848261109d565b156104d4576104d16001836119eb565b91505b60ff81811610156104f1576104ea8160016119fe565b90506104ad565b5080156105ae5760008167ffffffffffffffff81111561051357610513611607565b60405190808252806020026020018201604052801561053c578160200160208202803683370190505b50925060005b60ff818116116105ab57610556858261109d565b1561058e578084838151811061056e5761056e611a17565b60ff909216602092830291909101909101528161058a81611a2d565b9250505b60ff81811610156105ab576105a48160016119fe565b9050610542565b50505b50919050565b6105ca336000356001600160e01b031916611143565b6105e65760405162461bcd60e51b81526004016103d99061196e565b8015610631576001600160a01b03831660009081526009602052604090208054600160ff85161b17905561061b6002846111ed565b61062c5761062a60028461120f565b505b610669565b6001600160a01b03831660009081526009602052604090208054600160ff85161b19169081905561066957610667600284611224565b505b8160ff16836001600160a01b03167f4c9bdd0c8e073eb5eda2250b18d8e5121ff27b62064fbeeeed4869bb99bc5bf2836040516106aa911515815260200190565b60405180910390a3505050565b6000546001600160a01b031633148061074c575060015460405163b700961360e01b81526001600160a01b039091169063b70096139061070b90339030906001600160e01b03196000351690600401611a46565b602060405180830381865afa158015610728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074c9190611a73565b61075557600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b6107b7336000356001600160e01b031916611143565b6107d35760405162461bcd60e51b81526004016103d99061196e565b8015610849576001600160a01b0383166000818152600b602090815260408083206001600160e01b031987168085529083528184208054600160ff8c161b1790559383526006909152902061082791611239565b506108336004846111ed565b6108445761084260048461120f565b505b6108ec565b6001600160a01b0383166000908152600b602090815260408083206001600160e01b03198616845290915290208054600160ff87161b1916908190556108b7576001600160a01b03831660009081526006602052604090206108b5906001600160e01b03198416611245565b505b6001600160a01b03831660009081526006602052604090206108d890611251565b6000036108ec576108ea600484611224565b505b816001600160e01b031916836001600160a01b03168560ff167fa52ea92e6e955aa8ac66420b86350f7139959adfcc7e6a14eee1bd116d09860e84604051610938911515815260200190565b60405180910390a450505050565b60008060005b835181101561098a5783818151811061096757610967611a17565b602002602001015160ff166001901b60001b82179150808060010191505061094c565b5092915050565b6001600160a01b0382166000908152600b602090815260408083206001600160e01b03198516845290915290205460ff84161c60011615155b9392505050565b6001600160a01b0382166000908152600a602090815260408083206001600160e01b03198516845290915281205460ff166002816002811115610a1657610a166115c9565b03610a255760009150506109ca565b6001816002811115610a3957610a396115c9565b03610a485760019150506109ca565b50506001600160a01b038083166000908152600b602090815260408083206001600160e01b031986168452825280832054938716835260099091529020541615156109ca565b600060016001600160a01b0384166000908152600a602090815260408083206001600160e01b03198716845290915290205460ff166002811115610ad457610ad46115c9565b1490505b92915050565b610af4336000356001600160e01b031916611143565b610b105760405162461bcd60e51b81526004016103d99061196e565b60ff82166000908152600d60205260409020610b2c8282611b15565b5080604051610b3b9190611bd5565b6040519081900381209060ff8416907f5afa6cb832e64679422963cbd864f0deac6e160cb4225bc11c0ed284718121bc90600090a35050565b610b8a336000356001600160e01b031916611143565b610ba65760405162461bcd60e51b81526004016103d99061196e565b60026001600160a01b0384166000908152600a602090815260408083206001600160e01b03198716845290915290205460ff166002811115610bea57610bea6115c9565b03610c075760405162461bcd60e51b81526004016103d990611994565b8015610c4a576001600160a01b0383166000908152600a602090815260408083206001600160e01b0319861684529091529020805460ff19166001179055610c80565b6001600160a01b0383166000908152600a602090815260408083206001600160e01b0319861684529091529020805460ff191690555b816001600160e01b031916836001600160a01b03167f950a343f5d10445e82a71036d3f4fb3016180a25805141932543b83e2078a93e836040516106aa911515815260200190565b60ff81166000908152600d60205260409020805460609190610ce990611a90565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1590611a90565b8015610d625780601f10610d3757610100808354040283529160200191610d62565b820191906000526020600020905b815481529060010190602001808311610d4557829003601f168201915b50505050509050919050565b60606000805b60ff81811611610dc757600160ff821685901c1615801590610d9e57610d9b6001846119eb565b92505b60ff8281161015610dbb57610db48260016119fe565b9150610dc1565b50610dc7565b50610d74565b5080156105ae5760008167ffffffffffffffff811115610de957610de9611607565b604051908082528060200260200182016040528015610e12578160200160208202803683370190505b50925060005b60ff818116116105ab57600160ff821686901c1615801590610e675781858481518110610e4757610e47611a17565b60ff9092166020928302919091019091015282610e6381611a2d565b9350505b60ff8281161015610e8457610e7d8260016119fe565b9150610e8a565b506105ab565b50610e18565b6001600160a01b038116600090815260066020526040812060609190610eb59061125b565b8051909150156105ae57805167ffffffffffffffff811115610ed957610ed9611607565b604051908082528060200260200182016040528015610f02578160200160208202803683370190505b50915060005b8151811015610f5e57818181518110610f2357610f23611a17565b6020026020010151838281518110610f3d57610f3d611a17565b6001600160e01b031990921660209283029190910190910152600101610f08565b5050919050565b60606000805b610f756002611251565b811015610fb7576000610f89600283611268565b90506000610f97828761109d565b90508015610fad57610faa6001856119eb565b93505b5050600101610f6b565b5080156105ae5760008167ffffffffffffffff811115610fd957610fd9611607565b604051908082528060200260200182016040528015611002578160200160208202803683370190505b5092506000611011600261125b565b905060005b815181101561109457600082828151811061103357611033611a17565b602002602001015190506000611049828961109d565b9050801561108a578187868151811061106457611064611a17565b6001600160a01b03909216602092830291909101909101528461108681611a2d565b9550505b5050600101611016565b50505050919050565b6001600160a01b0391909116600090815260096020526040902054600160ff9092161c16151590565b6110dc336000356001600160e01b031916611143565b6110f85760405162461bcd60e51b81526004016103d99061196e565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6001546000906001600160a01b031680158015906111cd575060405163b700961360e01b81526001600160a01b0382169063b70096139061118c90879030908890600401611a46565b602060405180830381865afa1580156111a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cd9190611a73565b806111e557506000546001600160a01b038581169116145b949350505050565b6001600160a01b038116600090815260018301602052604081205415156109ca565b60006109ca836001600160a01b038416611274565b60006109ca836001600160a01b0384166112c3565b60006109ca8383611274565b60006109ca83836112c3565b6000610ad8825490565b606060006109ca836113b6565b60006109ca8383611411565b60008181526001830160205260408120546112bb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ad8565b506000610ad8565b600081815260018301602052604081205480156113ac5760006112e7600183611bf1565b85549091506000906112fb90600190611bf1565b905081811461136057600086600001828154811061131b5761131b611a17565b906000526020600020015490508087600001848154811061133e5761133e611a17565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061137157611371611c04565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ad8565b6000915050610ad8565b606081600001805480602002602001604051908101604052809291908181526020018280548015610d6257602002820191906000526020600020905b8154815260200190600101908083116113f25750505050509050919050565b600082600001828154811061142857611428611a17565b9060005260206000200154905092915050565b6001600160a01b038116811461145057600080fd5b50565b60006020828403121561146557600080fd5b81356109ca8161143b565b80356001600160e01b03198116811461148857600080fd5b919050565b600080604083850312156114a057600080fd5b82356114ab8161143b565b91506114b960208401611470565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156114fd57835160ff16835292840192918401916001016114de565b50909695505050505050565b803560ff8116811461148857600080fd5b801515811461145057600080fd5b60008060006060848603121561153d57600080fd5b83356115488161143b565b925061155660208501611509565b915060408401356115668161151a565b809150509250925092565b6000806000806080858703121561158757600080fd5b61159085611509565b935060208501356115a08161143b565b92506115ae60408601611470565b915060608501356115be8161151a565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061160157634e487b7160e01b600052602160045260246000fd5b91905290565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561164657611646611607565b604052919050565b6000602080838503121561166157600080fd5b823567ffffffffffffffff8082111561167957600080fd5b818501915085601f83011261168d57600080fd5b81358181111561169f5761169f611607565b8060051b91506116b084830161161d565b81815291830184019184810190888411156116ca57600080fd5b938501935b838510156116ef576116e085611509565b825293850193908501906116cf565b98975050505050505050565b60008060006060848603121561171057600080fd5b61171984611509565b925060208401356117298161143b565b915061173760408501611470565b90509250925092565b60008060006060848603121561175557600080fd5b83356117198161143b565b6000806040838503121561177357600080fd5b61177c83611509565b915060208084013567ffffffffffffffff8082111561179a57600080fd5b818601915086601f8301126117ae57600080fd5b8135818111156117c0576117c0611607565b6117d2601f8201601f1916850161161d565b915080825287848285010111156117e857600080fd5b80848401858401376000848284010152508093505050509250929050565b60008060006060848603121561181b57600080fd5b83356118268161143b565b925061155660208501611470565b60006020828403121561184657600080fd5b6109ca82611509565b60005b8381101561186a578181015183820152602001611852565b50506000910152565b602081526000825180602084015261189281604085016020870161184f565b601f01601f19169190910160400192915050565b6000602082840312156118b857600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156114fd5783516001600160e01b031916835292840192918401916001016118db565b6020808252825182820181905260009190848201906040850190845b818110156114fd5783516001600160a01b03168352928401929184019160010161191d565b6000806040838503121561195557600080fd5b82356119608161143b565b91506114b960208401611509565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b60208082526021908201527f526f6c6573417574686f726974793a204361706162696c697479204275726e656040820152601960fa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ad857610ad86119d5565b60ff8181168382160190811115610ad857610ad86119d5565b634e487b7160e01b600052603260045260246000fd5b600060018201611a3f57611a3f6119d5565b5060010190565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215611a8557600080fd5b81516109ca8161151a565b600181811c90821680611aa457607f821691505b6020821081036105ae57634e487b7160e01b600052602260045260246000fd5b601f821115611b10576000816000526020600020601f850160051c81016020861015611aed5750805b601f850160051c820191505b81811015611b0c57828155600101611af9565b5050505b505050565b815167ffffffffffffffff811115611b2f57611b2f611607565b611b4381611b3d8454611a90565b84611ac4565b602080601f831160018114611b785760008415611b605750858301515b600019600386901b1c1916600185901b178555611b0c565b600085815260208120601f198616915b82811015611ba757888601518255948401946001909101908401611b88565b5085821015611bc55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251611be781846020870161184f565b9190910192915050565b81810381811115610ad857610ad86119d5565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202d1d38354a112964fe746d592a54e0cb8c85eaab72c66f659b791f54a07da2f964736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000770a2350a9dc3daa77cdab2dd7f15aae2a44e8c1
-----Decoded View---------------
Arg [0] : _owner (address): 0x770a2350A9DC3daa77cdab2Dd7f15Aae2A44E8C1
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000770a2350a9dc3daa77cdab2dd7f15aae2a44e8c1
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.