Resolver
View Source: @nomisma/elektro-protocol-aux/contracts/delegate/Resolver.sol
↗ Extends: RoleAware
Resolver
Contract is used to store mapping between keccak signatures and address of deployed contract. It is used by router to resolve and call correct contract address. This contract is an essential part of Elektro's Proxy Pattern architecture! It does NOT get redeployed during a system on-chain upgrade, only internal storage gets updated to store data for newly deployed/upgraded implementations contracts throughout the system.
Contract Members
Constants & Variables
IMPORTANT: This is a signature of the native Router function that can NOT be shadowed by any implementation contract. We check a keccak signature against it for every
register()
to make sure this doesn't happen. In the case of shadowing, Resolver'slookup()
will return an incorrect address, since with any call in this case only {Router.setResolver()} will be called.
SignatureRegistered
Event fired for every newly registered function signature on Resolver.
Parameters
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | |
destination | address |
SignatureUpdated
Event fired for every updated (e.g. arguments changed after upgrade) function signature on Resolver.
Parameters
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | |
destination | address |
SignatureRemoved
Event fired for every updated (e.g. arguments changed after upgrade) function signature on Resolver.
Parameters
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 |
Functions
(address roleManager)
bulkRegister(bytes32[] keccakSignatures, address[] destinations)
register(bytes32 keccakSignature, address destination)
bulkUpdate(bytes32[] keccakSignatures, address[] destinations)
updateSignature(bytes32 keccakSignature, address destination)
removeSignature(bytes32 keccakSignature)
lookup(bytes4 signature)
stringToSig(string signature)
_register(bytes32 keccakSignature, address destination)
_updateSignature(bytes32 keccakSignature, address destination)
assertSignatureAndDestination(bytes32 keccakSignature, address destination)
Constructor setting {RoleManager} contract to storage
Arguments
Name | Type | Description |
---|---|---|
roleManager | address | address of {RoleManager} contract |
bulkRegister
Function to register mapping of multiple signatures to corresponding smart contract addresses.
Arguments
Name | Type | Description |
---|---|---|
keccakSignatures | bytes32[] | array of signatures to be registered |
destinations | address[] | array of contract addresses that signatures will point to |
register
Function to register single keccakSignature
to address mapping
Arguments
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | signature to be registered |
destination | address | contract address that signature will point to See {_register} |
bulkUpdate
Function to update existing signatures in bulk during a SC upgrade
Arguments
Name | Type | Description |
---|---|---|
keccakSignatures | bytes32[] | signatures to be updated |
destinations | address[] | contract addresses that signatures will point to |
updateSignature
Function to update existing keccakSignature
to address mapping, used during SC upgrade
Arguments
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | signature to be updated |
destination | address | contract address that signature will point to |
removeSignature
Function to remove single keccakSignature
.
Arguments
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | signature to be removed |
lookup
View to check address of contract for given first 4 bytes of keccak signature
.
Arguments
Name | Type | Description |
---|---|---|
signature | bytes4 |
stringToSig
Converts string signature to first 4 bytes of keccak signature
.
Arguments
Name | Type | Description |
---|---|---|
signature | string |
_register
Function to register single keccakSignature
to address mapping and emit a SignatureRegistered
event that can be found in the transaction events.
Arguments
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | |
destination | address |
_updateSignature
Arguments
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | |
destination | address |
assertSignatureAndDestination
Arguments
Name | Type | Description |
---|---|---|
keccakSignature | bytes32 | |
destination | address |
Last updated