mirror of
https://github.com/luxfi/erc-3643.git
synced 2026-10-30 16:58:28 +00:00
59 lines
1.7 KiB
Solidity
59 lines
1.7 KiB
Solidity
// SPDX-License-Identifier: GPL-3.0
|
|
|
|
pragma solidity ^0.8.17;
|
|
|
|
interface IImplementationAuthorityLegacy {
|
|
function getImplementation() external view returns (address);
|
|
}
|
|
|
|
contract LegacyProxy {
|
|
address public implementationAuthority;
|
|
|
|
constructor(
|
|
address _implementationAuthority,
|
|
address _identityRegistry,
|
|
address _compliance,
|
|
string memory _name,
|
|
string memory _symbol,
|
|
uint8 _decimals,
|
|
address _onchainID
|
|
) {
|
|
implementationAuthority = _implementationAuthority;
|
|
|
|
address logic = IImplementationAuthorityLegacy(implementationAuthority).getImplementation();
|
|
|
|
// solhint-disable-next-line avoid-low-level-calls
|
|
(bool success, ) =
|
|
logic.delegatecall(
|
|
abi.encodeWithSignature(
|
|
'init(address,address,string,string,uint8,address)',
|
|
_identityRegistry,
|
|
_compliance,
|
|
_name,
|
|
_symbol,
|
|
_decimals,
|
|
_onchainID
|
|
)
|
|
);
|
|
require(success, 'Initialization failed.');
|
|
}
|
|
|
|
fallback() external payable {
|
|
address logic = IImplementationAuthorityLegacy(implementationAuthority).getImplementation();
|
|
|
|
assembly {
|
|
// solium-disable-line
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
} |