CoreInternals
SigsSlot
struct SigsSlot {
bytes4[] value;
}
_ADMIN_SLOT
bytes32 _ADMIN_SLOT
Storage slot with the admin of the contract. This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is validated in the constructor.
_DUMMY_IMPLEMENTATION_SLOT
bytes32 _DUMMY_IMPLEMENTATION_SLOT
Storage slot with the address of the current dummy-implementation. This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is validated in the constructor.
_SIG_SLOT_BASE
bytes32 _SIG_SLOT_BASE
use EIP1967 proxy slot (see _DUMMY_IMPLEMENTATION_SLOT) except for first 4 bytes,
_getSlotImplSigsSlot
function _getSlotImplSigsSlot(address implementation_) internal pure returns (bytes32)
Returns the storage slot which stores the sigs array set for the implementation.
_getSlotSigsImplSlot
function _getSlotSigsImplSlot(bytes4 sig_) internal pure returns (bytes32 result_)
Returns the storage slot which stores the implementation address for the function sig.
_getAddressSlot
function _getAddressSlot(bytes32 slot_) internal view returns (address data_)
_Returns an address data_
located atslot*
.*
_setAddressSlot
function _setAddressSlot(bytes32 slot_, address data_) internal
_Sets an address data_
located atslot*
.*
_getSigsSlot
function _getSigsSlot(bytes32 slot_) internal pure returns (struct CoreInternals.SigsSlot _r)
Returns an SigsSlot
with member value
located at slot
.
_setImplementationSigs
function _setImplementationSigs(address implementation_, bytes4[] sigs_) internal
Sets new implementation and adds mapping from implementation to sigs and sig to implementation.
_removeImplementationSigs
function _removeImplementationSigs(address implementation_) internal
Removes implementation and the mappings corresponding to it.
_getImplementationSigs
function _getImplementationSigs(address implementation_) internal view returns (bytes4[])
Returns bytes4 sigs from implementation address. If implemenatation is not registered then returns empty array.
_getSigImplementation
function _getSigImplementation(bytes4 sig_) internal view returns (address implementation_)
Returns implementation address from bytes4 sig. If sig is not registered then returns address(0).
_getAdmin
function _getAdmin() internal view returns (address)
Returns the current admin.
_getDummyImplementation
function _getDummyImplementation() internal view returns (address)
Returns the current dummy-implementation.
_setAdmin
function _setAdmin(address newAdmin_) internal
Stores a new address in the EIP1967 admin slot.
_setDummyImplementation
function _setDummyImplementation(address newDummyImplementation_) internal
Stores a new address in the EIP1967 implementation slot.
AdminInternals
onlyAdmin
modifier onlyAdmin()
Only admin guard
constructor
constructor(address admin_, address dummyImplementation_) public
setAdmin
function setAdmin(address newAdmin_) external
Sets new admin.
setDummyImplementation
function setDummyImplementation(address newDummyImplementation_) external
Sets new dummy-implementation.
addImplementation
function addImplementation(address implementation_, bytes4[] sigs_) external
Adds new implementation address.
removeImplementation
function removeImplementation(address implementation_) external
Removes an existing implementation address.
Proxy
This abstract contract provides a fallback function that delegates all calls to another contract using the EVM. It implements the Instadapp infinite-proxy: https://github.com/Instadapp/infinite-proxy
constructor
constructor(address admin_, address dummyImplementation_) internal
getAdmin
function getAdmin() external view returns (address)
Returns admin's address.
getDummyImplementation
function getDummyImplementation() external view returns (address)
Returns dummy-implementations's address.
getImplementationSigs
function getImplementationSigs(address impl_) external view returns (bytes4[])
Returns bytes4 sigs from implementation address If not registered then returns empty array.
getSigsImplementation
function getSigsImplementation(bytes4 sig_) external view returns (address)
Returns implementation address from bytes4 sig. If sig is not registered then returns address(0).
fallback
fallback() external payable
Fallback function that delegates calls to the address returned by Implementations registry.
receive
receive() external payable