File size: 2,239 Bytes
f998fcd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
{
"language": "Solidity",
"sources": {
"contracts/AccountProxy.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {OperationCenterInterface} from \"./interfaces/IOperationCenter.sol\";\n\ncontract AccountProxy {\n\n // auth is shared storage with AccountProxy and any OpCode.\n mapping(address => bool) internal _auth;\n\n address internal immutable opCenterAddress;\n\n constructor(address _opCenterAddress) {\n opCenterAddress = _opCenterAddress;\n }\n\n fallback() external payable {\n delegate(msg.sig);\n }\n\n receive() external payable {\n if (msg.sig != 0x00000000) {\n delegate(msg.sig);\n }\n }\n\n function delegate(bytes4 _sig) internal {\n address _opCodeAddress = OperationCenterInterface(opCenterAddress)\n .getOpCodeAddress(_sig);\n require(_opCodeAddress != address(0), \"CHFRY Account: Not found OpCode\");\n assembly {\n calldatacopy(0, 0, calldatasize())\n let result := delegatecall(gas(), _opCodeAddress, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n}\n"
},
"contracts/interfaces/IOperationCenter.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface OperationCenterInterface {\n function eventCenterAddress() external view returns (address);\n function connectorCenterAddress() external view returns (address);\n function tokenCenterAddress() external view returns (address);\n function protocolCenterAddress() external view returns (address);\n function getOpCodeAddress(bytes4 _sig) external view returns (address);\n}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
} |