Skip to content
Verified contractPartialGPL-3.0

IdentityProxy

Address0x0db7d03e69c77edf9e8bdc18b942786c7a7c2a98
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.17

 

Same code

3 more contracts

 

Details

Compiler
solc 0.8.17+commit.8df45f5f
Language
solidity
Optimization
No
EVM version
london
License
GPL-3.0
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,032,163
Creation transaction
0xc7cf27ae3f…afe162ff06

@onchain-id/solidity/contracts/proxy/IdentityProxy.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.17;

import "../interface/IImplementationAuthority.sol";

contract IdentityProxy {

    /**
     *  @dev constructor of the proxy Identity contract
     *  @param _implementationAuthority the implementation Authority contract address
     *  @param initialManagementKey the management key at deployment
     *  the proxy is going to use the logic deployed on the implementation contract
     *  deployed at an address listed in the ImplementationAuthority contract
     */
    constructor(address _implementationAuthority, address initialManagementKey) {
        require(_implementationAuthority != address(0), "invalid argument - zero address");
        require(initialManagementKey != address(0), "invalid argument - zero address");

        // solhint-disable-next-line no-inline-assembly
        assembly {
            sstore(0x821f3e4d3d679f19eacc940c87acf846ea6eae24a63058ea750304437a62aafc, _implementationAuthority)
        }

        address logic = IImplementationAuthority(_implementationAuthority).getImplementation();

        // solhint-disable-next-line avoid-low-level-calls
        (bool success,) = logic.delegatecall(abi.encodeWithSignature("initialize(address)", initialManagementKey));
        require(success, "Initialization failed.");
    }

    /**
     *  @dev fallback proxy function used for any transaction call that is made using
     *  the Identity contract ABI and called on the proxy contract
     *  The proxy will update its local storage depending on the behaviour requested
     *  by the implementation contract given by the Implementation Authority
     */
    // solhint-disable-next-line no-complex-fallback
    fallback() external payable {
        address logic = IImplementationAuthority(implementationAuthority()).getImplementation();

        // solhint-disable-next-line no-inline-assembly
        assembly {
        calldatacopy(0x0, 0x0, calldatasize())
        let success := delegatecall(sub(gas(), 10000), logic, 0x0, calldatasize(), 0, 0)
        let retSz := returndatasize()
        returndatacopy(0, 0, retSz)
        switch success
            case 0 {
                revert(0, retSz)
            }
            default {
                return(0, retSz)
            }
        }
    }

    function implementationAuthority() public view returns(address) {
        address implemAuth;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            implemAuth := sload(0x821f3e4d3d679f19eacc940c87acf846ea6eae24a63058ea750304437a62aafc)
        }
        return implemAuth;
    }
}

@onchain-id/solidity/contracts/interface/IImplementationAuthority.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.17;

interface IImplementationAuthority {

    // event emitted when the implementation contract is updated
    event UpdatedImplementation(address newAddress);

    /**
     * @dev updates the address used as implementation by the proxies linked
     * to this ImplementationAuthority contract
     * @param _newImplementation the address of the new implementation contract
     * only Owner can call
     */
    function updateImplementation(address _newImplementation) external;

    /**
     * @dev returns the address of the implementation
     */
    function getImplementation() external view returns(address);
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "london",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.