- Created .gitignore to exclude sensitive files and directories. - Added API documentation in API_DOCUMENTATION.md. - Included deployment instructions in DEPLOYMENT.md. - Established project structure documentation in PROJECT_STRUCTURE.md. - Updated README.md with project status and team information. - Added recommendations and status tracking documents. - Introduced testing guidelines in TESTING.md. - Set up CI workflow in .github/workflows/ci.yml. - Created Dockerfile for backend and frontend setups. - Added various service and utility files for backend functionality. - Implemented frontend components and pages for user interface. - Included mobile app structure and services. - Established scripts for deployment across multiple chains.
40 lines
1.3 KiB
Solidity
40 lines
1.3 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.24;
|
|
|
|
import {IDiamondCut} from "../src/interfaces/IDiamondCut.sol";
|
|
|
|
/**
|
|
* @title FacetCutHelper
|
|
* @notice Helper contract to get function selectors from facet contracts
|
|
*/
|
|
library FacetCutHelper {
|
|
function getSelectors(address facet) internal view returns (bytes4[] memory) {
|
|
bytes memory facetCode = _getCreationCode(facet);
|
|
return _extractSelectors(facetCode);
|
|
}
|
|
|
|
function _getCreationCode(address contractAddress) internal view returns (bytes memory) {
|
|
uint256 size;
|
|
assembly {
|
|
size := extcodesize(contractAddress)
|
|
}
|
|
bytes memory code = new bytes(size);
|
|
assembly {
|
|
extcodecopy(contractAddress, add(code, 0x20), 0, size)
|
|
}
|
|
return code;
|
|
}
|
|
|
|
function _extractSelectors(bytes memory bytecode) internal pure returns (bytes4[] memory) {
|
|
// Simplified selector extraction - in production use proper parsing
|
|
// This is a placeholder - actual implementation would parse bytecode
|
|
bytes4[] memory selectors = new bytes4[](100); // Max selectors
|
|
uint256 count = 0;
|
|
|
|
// This is a simplified version - proper implementation would parse the bytecode
|
|
// For now, return empty and require manual selector lists
|
|
return new bytes4[](0);
|
|
}
|
|
}
|
|
|