Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Latest 25 from a total of 65 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 19514815 | 364 days ago | IN | 0 ETH | 0.00089634 | ||||
Set User Role | 19479921 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479920 | 369 days ago | IN | 0 ETH | 0.00402367 | ||||
Set User Role | 19479918 | 369 days ago | IN | 0 ETH | 0.00402367 | ||||
Set User Role | 19479916 | 369 days ago | IN | 0 ETH | 0.00402367 | ||||
Set User Role | 19479914 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479913 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479911 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479910 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479909 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479907 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479906 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479904 | 369 days ago | IN | 0 ETH | 0.00402367 | ||||
Set User Role | 19479902 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479901 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479900 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479899 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479897 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479895 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479894 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479893 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479891 | 369 days ago | IN | 0 ETH | 0.00162666 | ||||
Set User Role | 19479890 | 369 days ago | IN | 0 ETH | 0.00465593 | ||||
Set Role Capabil... | 19479889 | 369 days ago | IN | 0 ETH | 0.00174088 | ||||
Set Role Capabil... | 19479888 | 369 days ago | IN | 0 ETH | 0.00412638 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
0x60806040 | 19437147 | 375 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x93d4f829...7F2072c6e The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Governor
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default 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 "./Dependencies/Auth.sol"; import {RolesAuthority} from "./Dependencies/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 better 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: AGPL-3.0-only pragma solidity 0.8.17; import {Authority} from "./Authority.sol"; /// @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), "Auth: 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); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.17; /// @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: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity 0.8.17; /** * @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.17; import "./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 } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.17; import {IRolesAuthority} from "./IRolesAuthority.sol"; import {Auth, Authority} from "./Auth.sol"; import "./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) 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; function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) { return (uint256(getUserRoles[user]) >> role) & 1 != 0; } function doesRoleHaveCapability( uint8 role, address target, bytes4 functionSig ) public view virtual returns (bool) { return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0; } function isPublicCapability(address target, bytes4 functionSig) public view returns (bool) { return capabilityFlag[target][functionSig] == CapabilityFlag.Public; } /*////////////////////////////////////////////////////////////// AUTHORIZATION LOGIC //////////////////////////////////////////////////////////////*/ /** @notice A user can call a given function signature on a given target address if: - The capability has not been burned - That capability is public, or the user has a role that has been granted the capability to call the function */ 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 Set a capability flag as public, meaning any account can call it. Or revoke this capability. /// @dev A capability cannot be made public if it has been burned. 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 Grant a specified role the ability to call a function on a target. /// @notice Has no effect function setRoleCapability( uint8 role, address target, bytes4 functionSig, bool enabled ) public virtual requiresAuth { if (enabled) { getRolesWithCapability[target][functionSig] |= bytes32(1 << role); enabledFunctionSigsByTarget[target].add(bytes32(functionSig)); if (!targets.contains(target)) { targets.add(target); } } else { getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role); // If no role exist for this target & functionSig, mark it as disabled if (getRolesWithCapability[target][functionSig] == bytes32(0)) { enabledFunctionSigsByTarget[target].remove(bytes32(functionSig)); } // If no enabled function signatures exist for this target, remove target if (enabledFunctionSigsByTarget[target].length() == 0) { targets.remove(target); } } emit RoleCapabilityUpdated(role, target, functionSig, enabled); } /// @notice Permanently burns a capability for a target. 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 //////////////////////////////////////////////////////////////*/ 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); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "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"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063b7009613116100b8578063d5afdbb01161007c578063d5afdbb01461030e578063dad7bb501461032e578063db7d03ab14610341578063ddb7a4de14610361578063ea7ca27614610381578063f2fde38b1461039457600080fd5b8063b7009613146102af578063b77925db146102c2578063bd516bed146102d5578063bf7e214f146102e8578063c6b0263e146102fb57600080fd5b80637a9e5e4b1161010a5780637a9e5e4b146101ed5780637d40583d146102005780638da5cb5b14610213578063920e08121461023e578063a41f9bb214610279578063b4bad06a1461028c57600080fd5b806306a36aee1461014757806308e4489c1461017a57806342d653ee1461018f57806367aff484146101af5780637917b794146101c2575b600080fd5b610167610155366004611477565b60096020526000908152604090205481565b6040519081526020015b60405180910390f35b61018d6101883660046114b1565b6103a7565b005b6101a261019d366004611477565b6104a7565b60405161017191906114e6565b61018d6101bd36600461154c565b6105b4565b6101676101d03660046114b1565b600b60209081526000928352604080842090915290825290205481565b61018d6101fb366004611477565b6106b7565b61018d61020e366004611595565b6107a1565b600054610226906001600160a01b031681565b6040516001600160a01b039091168152602001610171565b61026c61024c3660046114b1565b600a60209081526000928352604080842090915290825290205460ff1681565b6040516101719190611603565b610167610287366004611672565b610946565b61029f61029a36600461171f565b610997565b6040519015158152602001610171565b61029f6102bd366004611764565b6109d7565b61029f6102d03660046114b1565b610a94565b61018d6102e3366004611784565b610ae4565b600154610226906001600160a01b031681565b61018d61030936600461182a565b610b7a565b61032161031c366004611858565b610cce565b6040516101719190611897565b6101a261033c3660046118ca565b610d74565b61035461034f366004611477565b610e96565b60405161017191906118e3565b61037461036f366004611858565b610f73565b6040516101719190611925565b61029f61038f366004611966565b6110c1565b61018d6103a2366004611477565b6110ea565b6103bd336000356001600160e01b031916611167565b6103e25760405162461bcd60e51b81526004016103d990611992565b60405180910390fd5b60026001600160a01b0383166000908152600a602090815260408083206001600160e01b03198616845290915290205460ff166002811115610426576104266115ed565b036104435760405162461bcd60e51b81526004016103d9906119be565b6001600160a01b0382166000818152600a602090815260408083206001600160e01b031986168085529252808320805460ff19166002179055519092917fcbadb9d88ba94f6acc6c8645ed3731e2bbdb8e114a33ffcc0ab4277103e6e55291a35050565b60606000805b60ff818116116104f1576104c184826110c1565b156104d4576104d1600183611a15565b91505b60ff81811610156104f1576104ea816001611a28565b90506104ad565b5080156105ae5760008167ffffffffffffffff8111156105135761051361162b565b60405190808252806020026020018201604052801561053c578160200160208202803683370190505b50925060005b60ff818116116105ab5761055685826110c1565b1561058e578084838151811061056e5761056e611a41565b60ff909216602092830291909101909101528161058a81611a57565b9250505b60ff81811610156105ab576105a4816001611a28565b9050610542565b50505b50919050565b6105ca336000356001600160e01b031916611167565b6105e65760405162461bcd60e51b81526004016103d990611992565b8015610631576001600160a01b03831660009081526009602052604090208054600160ff85161b17905561061b600284611211565b61062c5761062a600284611233565b505b610669565b6001600160a01b03831660009081526009602052604090208054600160ff85161b19169081905561066957610667600284611248565b505b8160ff16836001600160a01b03167f4c9bdd0c8e073eb5eda2250b18d8e5121ff27b62064fbeeeed4869bb99bc5bf2836040516106aa911515815260200190565b60405180910390a3505050565b6000546001600160a01b031633148061074c575060015460405163b700961360e01b81526001600160a01b039091169063b70096139061070b90339030906001600160e01b03196000351690600401611a70565b602060405180830381865afa158015610728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074c9190611a9d565b61075557600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b6107b7336000356001600160e01b031916611167565b6107d35760405162461bcd60e51b81526004016103d990611992565b8015610849576001600160a01b0383166000818152600b602090815260408083206001600160e01b031987168085529083528184208054600160ff8c161b179055938352600690915290206108279161125d565b50610833600484611211565b61084457610842600484611233565b505b6108ec565b6001600160a01b0383166000908152600b602090815260408083206001600160e01b03198616845290915290208054600160ff87161b1916908190556108b7576001600160a01b03831660009081526006602052604090206108b5906001600160e01b03198416611269565b505b6001600160a01b03831660009081526006602052604090206108d890611275565b6000036108ec576108ea600484611248565b505b816001600160e01b031916836001600160a01b03168560ff167fa52ea92e6e955aa8ac66420b86350f7139959adfcc7e6a14eee1bd116d09860e84604051610938911515815260200190565b60405180910390a450505050565b60008060005b83518110156109905783818151811061096757610967611a41565b602002602001015160ff166001901b60001b82179150808061098890611a57565b91505061094c565b5092915050565b6001600160a01b0382166000908152600b602090815260408083206001600160e01b03198516845290915290205460ff84161c60011615155b9392505050565b6001600160a01b0382166000908152600a602090815260408083206001600160e01b03198516845290915281205460ff166002816002811115610a1c57610a1c6115ed565b03610a2b5760009150506109d0565b6001816002811115610a3f57610a3f6115ed565b03610a4e5760019150506109d0565b50506001600160a01b038083166000908152600b602090815260408083206001600160e01b031986168452825280832054938716835260099091529020541615156109d0565b600060016001600160a01b0384166000908152600a602090815260408083206001600160e01b03198716845290915290205460ff166002811115610ada57610ada6115ed565b1490505b92915050565b610afa336000356001600160e01b031916611167565b610b165760405162461bcd60e51b81526004016103d990611992565b60ff82166000908152600d60205260409020610b328282611b3d565b5080604051610b419190611bfd565b6040519081900381209060ff8416907f5afa6cb832e64679422963cbd864f0deac6e160cb4225bc11c0ed284718121bc90600090a35050565b610b90336000356001600160e01b031916611167565b610bac5760405162461bcd60e51b81526004016103d990611992565b60026001600160a01b0384166000908152600a602090815260408083206001600160e01b03198716845290915290205460ff166002811115610bf057610bf06115ed565b03610c0d5760405162461bcd60e51b81526004016103d9906119be565b8015610c50576001600160a01b0383166000908152600a602090815260408083206001600160e01b0319861684529091529020805460ff19166001179055610c86565b6001600160a01b0383166000908152600a602090815260408083206001600160e01b0319861684529091529020805460ff191690555b816001600160e01b031916836001600160a01b03167f950a343f5d10445e82a71036d3f4fb3016180a25805141932543b83e2078a93e836040516106aa911515815260200190565b60ff81166000908152600d60205260409020805460609190610cef90611aba565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611aba565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b50505050509050919050565b60606000805b60ff81811611610dcd57600160ff821685901c1615801590610da457610da1600184611a15565b92505b60ff8281161015610dc157610dba826001611a28565b9150610dc7565b50610dcd565b50610d7a565b5080156105ae5760008167ffffffffffffffff811115610def57610def61162b565b604051908082528060200260200182016040528015610e18578160200160208202803683370190505b50925060005b60ff818116116105ab57600160ff821686901c1615801590610e6d5781858481518110610e4d57610e4d611a41565b60ff9092166020928302919091019091015282610e6981611a57565b9350505b60ff8281161015610e8a57610e83826001611a28565b9150610e90565b506105ab565b50610e1e565b6001600160a01b038116600090815260066020526040812060609190610ebb9061127f565b8051909150156105ae57805167ffffffffffffffff811115610edf57610edf61162b565b604051908082528060200260200182016040528015610f08578160200160208202803683370190505b50915060005b8151811015610f6c57818181518110610f2957610f29611a41565b6020026020010151838281518110610f4357610f43611a41565b6001600160e01b031990921660209283029190910190910152610f6581611a57565b9050610f0e565b5050919050565b60606000805b610f836002611275565b811015610fd0576000610f9760028361128c565b90506000610fa582876110c1565b90508015610fbb57610fb8600185611a15565b93505b50508080610fc890611a57565b915050610f79565b5080156105ae5760008167ffffffffffffffff811115610ff257610ff261162b565b60405190808252806020026020018201604052801561101b578160200160208202803683370190505b509250600061102a600261127f565b905060005b81518110156110b857600082828151811061104c5761104c611a41565b60200260200101519050600061106282896110c1565b905080156110a3578187868151811061107d5761107d611a41565b6001600160a01b03909216602092830291909101909101528461109f81611a57565b9550505b505080806110b090611a57565b91505061102f565b50505050919050565b6001600160a01b0391909116600090815260096020526040902054600160ff9092161c16151590565b611100336000356001600160e01b031916611167565b61111c5760405162461bcd60e51b81526004016103d990611992565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6001546000906001600160a01b031680158015906111f1575060405163b700961360e01b81526001600160a01b0382169063b7009613906111b090879030908890600401611a70565b602060405180830381865afa1580156111cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f19190611a9d565b8061120957506000546001600160a01b038581169116145b949350505050565b6001600160a01b038116600090815260018301602052604081205415156109d0565b60006109d0836001600160a01b038416611298565b60006109d0836001600160a01b0384166112e7565b60006109d08383611298565b60006109d083836112e7565b6000610ade825490565b606060006109d0836113da565b60006109d08383611435565b60008181526001830160205260408120546112df57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ade565b506000610ade565b600081815260018301602052604081205480156113d057600061130b600183611c19565b855490915060009061131f90600190611c19565b905081811461138457600086600001828154811061133f5761133f611a41565b906000526020600020015490508087600001848154811061136257611362611a41565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061139557611395611c2c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ade565b6000915050610ade565b606081600001805480602002602001604051908101604052809291908181526020018280548015610d6857602002820191906000526020600020905b8154815260200190600101908083116114165750505050509050919050565b600082600001828154811061144c5761144c611a41565b9060005260206000200154905092915050565b6001600160a01b038116811461147457600080fd5b50565b60006020828403121561148957600080fd5b81356109d08161145f565b80356001600160e01b0319811681146114ac57600080fd5b919050565b600080604083850312156114c457600080fd5b82356114cf8161145f565b91506114dd60208401611494565b90509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561152157835160ff1683529284019291840191600101611502565b50909695505050505050565b803560ff811681146114ac57600080fd5b801515811461147457600080fd5b60008060006060848603121561156157600080fd5b833561156c8161145f565b925061157a6020850161152d565b9150604084013561158a8161153e565b809150509250925092565b600080600080608085870312156115ab57600080fd5b6115b48561152d565b935060208501356115c48161145f565b92506115d260408601611494565b915060608501356115e28161153e565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061162557634e487b7160e01b600052602160045260246000fd5b91905290565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561166a5761166a61162b565b604052919050565b6000602080838503121561168557600080fd5b823567ffffffffffffffff8082111561169d57600080fd5b818501915085601f8301126116b157600080fd5b8135818111156116c3576116c361162b565b8060051b91506116d4848301611641565b81815291830184019184810190888411156116ee57600080fd5b938501935b83851015611713576117048561152d565b825293850193908501906116f3565b98975050505050505050565b60008060006060848603121561173457600080fd5b61173d8461152d565b9250602084013561174d8161145f565b915061175b60408501611494565b90509250925092565b60008060006060848603121561177957600080fd5b833561173d8161145f565b6000806040838503121561179757600080fd5b6117a08361152d565b915060208084013567ffffffffffffffff808211156117be57600080fd5b818601915086601f8301126117d257600080fd5b8135818111156117e4576117e461162b565b6117f6601f8201601f19168501611641565b9150808252878482850101111561180c57600080fd5b80848401858401376000848284010152508093505050509250929050565b60008060006060848603121561183f57600080fd5b833561184a8161145f565b925061157a60208501611494565b60006020828403121561186a57600080fd5b6109d08261152d565b60005b8381101561188e578181015183820152602001611876565b50506000910152565b60208152600082518060208401526118b6816040850160208701611873565b601f01601f19169190910160400192915050565b6000602082840312156118dc57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156115215783516001600160e01b031916835292840192918401916001016118ff565b6020808252825182820181905260009190848201906040850190845b818110156115215783516001600160a01b031683529284019291840191600101611941565b6000806040838503121561197957600080fd5b82356119848161145f565b91506114dd6020840161152d565b602080825260129082015271105d5d1a0e8815539055551213d49256915160721b604082015260600190565b60208082526021908201527f526f6c6573417574686f726974793a204361706162696c697479204275726e656040820152601960fa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ade57610ade6119ff565b60ff8181168382160190811115610ade57610ade6119ff565b634e487b7160e01b600052603260045260246000fd5b600060018201611a6957611a696119ff565b5060010190565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215611aaf57600080fd5b81516109d08161153e565b600181811c90821680611ace57607f821691505b6020821081036105ae57634e487b7160e01b600052602260045260246000fd5b601f821115611b3857600081815260208120601f850160051c81016020861015611b155750805b601f850160051c820191505b81811015611b3457828155600101611b21565b5050505b505050565b815167ffffffffffffffff811115611b5757611b5761162b565b611b6b81611b658454611aba565b84611aee565b602080601f831160018114611ba05760008415611b885750858301515b600019600386901b1c1916600185901b178555611b34565b600085815260208120601f198616915b82811015611bcf57888601518255948401946001909101908401611bb0565b5085821015611bed5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251611c0f818460208701611873565b9190910192915050565b81810381811115610ade57610ade6119ff565b634e487b7160e01b600052603160045260246000fdfea264697066735822122086d7b84ed53d59025d0e3e66c9bd81c1d07fb61c47eff119cfa36b9268b5c03064736f6c63430008110033
Loading...
Loading
Loading...
Loading
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.