AddressResolver
This contract acts as a bridge for name-to-address resolution. It delegates the resolution to the AddressManager. By separating the logic, we can maintain flexibility in address management without affecting the resolving process.
_addressManager
contract IAddressManager _addressManager
AddressManagerChanged
event AddressManagerChanged(address addressManager)
RESOLVER_DENIED
error RESOLVER_DENIED()
RESOLVER_INVALID_ADDR
error RESOLVER_INVALID_ADDR()
RESOLVER_ZERO_ADDR
error RESOLVER_ZERO_ADDR(uint256 chainId, bytes32 name)
onlyFromNamed
modifier onlyFromNamed(bytes32 name)
Parameters
Name | Type | Description |
---|---|---|
name | bytes32 | The name to check against. |
onlyFromNamed2
modifier onlyFromNamed2(bytes32 name1, bytes32 name2)
Parameters
Name | Type | Description |
---|---|---|
name1 | bytes32 | The first name to check against. |
name2 | bytes32 | The second name to check against. |
resolve
function resolve(bytes32 name, bool allowZeroAddress) public view virtual returns (address payable addr)
Resolves a name to its address on the current chain.
Parameters
Name | Type | Description |
---|---|---|
name | bytes32 | Name whose address is to be resolved. |
allowZeroAddress | bool | If set to true, does not throw if the resolved address is address(0) . |
Return Values
Name | Type | Description |
---|---|---|
addr | address payable | Address associated with the given name. |
resolve
function resolve(uint256 chainId, bytes32 name, bool allowZeroAddress) public view virtual returns (address payable addr)
Resolves a name to its address on a specified chain.
Parameters
Name | Type | Description |
---|---|---|
chainId | uint256 | The chainId of interest. |
name | bytes32 | Name whose address is to be resolved. |
allowZeroAddress | bool | If set to true, does not throw if the resolved address is address(0) . |
Return Values
Name | Type | Description |
---|---|---|
addr | address payable | Address associated with the given name on the specified chain. |
addressManager
function addressManager() public view returns (address)
Fetches the AddressManager's address.
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The current address of the AddressManager. |
_init
function _init(address addressManager_) internal virtual
Parameters
Name | Type | Description |
---|---|---|
addressManager_ | address | Address of the AddressManager. |