{"id":21820138,"url":"https://github.com/5afe/safe-core-protocol","last_synced_at":"2025-08-20T20:33:12.661Z","repository":{"id":175789544,"uuid":"654473533","full_name":"5afe/safe-core-protocol","owner":"5afe","description":"This project is an implementation of Safe{Core} Protocol specification","archived":false,"fork":false,"pushed_at":"2024-07-24T01:08:23.000Z","size":453,"stargazers_count":39,"open_issues_count":18,"forks_count":17,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-12-10T20:51:45.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5afe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-16T07:54:14.000Z","updated_at":"2024-11-14T23:41:54.000Z","dependencies_parsed_at":"2024-11-27T16:35:23.704Z","dependency_job_id":"74371843-c486-4308-985a-4c1a007a7962","html_url":"https://github.com/5afe/safe-core-protocol","commit_stats":null,"previous_names":["5afe/safe-protocol","5afe/safe-core-protocol","safe-global/safe-core-protocol"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5afe%2Fsafe-core-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5afe%2Fsafe-core-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5afe%2Fsafe-core-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5afe%2Fsafe-core-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5afe","download_url":"https://codeload.github.com/5afe/safe-core-protocol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230454430,"owners_count":18228392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T16:28:47.850Z","updated_at":"2024-12-19T15:10:11.414Z","avatar_url":"https://github.com/5afe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**:warning: This repository is not actively developed at the moment. :warning:**\n\n[![Coverage Status](https://coveralls.io/repos/github/safe-global/safe-core-protocol/badge.svg)](https://coveralls.io/github/safe-global/safe-core-protocol)\n\n# Safe{Core} Protocol\n\nThis project is an implementation of [Safe{Core} Protocol specification](https://github.com/safe-global/safe-core-protocol-specs)\n\n## Architecture\n\nSafe{Core} Protocol implementation consists of following main components:\n\n-   [SafeProtocolManager](./contracts/SafeProtocolManager.sol)\n-   [SafeProtocolRegistry](./contracts/SafeProtocolRegistry.sol)\n-   [Interfaces for Modules](./contracts/interfaces/Modules.sol)\n\nA high level overview of the architecture is as follows:\n\n```mermaid\ngraph TD\n    Account --\u003e|Execute transaction| Monitor\n    Account --\u003e|Manage Modules| Store\n    Account --\u003e|SafeProtocolManager handling fallback functionality| FunctionHandlerSupport\n    PluginInstance(Plugin Instance) --\u003e|Execute transaction from Plugin| Monitor\n    RegistryOwner(\"Registry Owner\") --\u003e Maintain\n    RegistryOwner(\"Registry Owner\") --\u003e Flag\n\nsubgraph SafeProtocolManager\n\tStore(Maintain Enabled Modules per Safe)\n    Monitor(Mediate Account transaction execution)\n    FunctionHandlerSupport(\"Provide additional functionality using Function Handler(s)\")\n    HooksSupport(\"Hooks for validating transaction execution\")\n    Monitor -.- HooksSupport\nend\n\nsubgraph SafeProtocolRegistry\n\tAllowQuery(Provide information about Modules)\n    Maintain(\"Maintain list of permitted Modules\")\n    Flag(\"Mark Module as Malicious\")\n    Monitor -...- AllowQuery\n    Store -...- AllowQuery\nend\n```\n\n### Modules\n\n```mermaid\ngraph TD\nstyle Modules font-size:20px;\nsubgraph Modules\n\tPlugin(Plugin)\n\tHooks(Hooks)\n\tFunctionHandler(Function Handler)\n\tSignatureValidator(Signature validator)\nend\n```\n\nCurrently implemented components of the Safe{Core} Protocol are:\n\n-   **SafeProtocolManager**\n-   **SafeProtocolRegistry**\n-   **Plugins**\n-   **Hooks**\n-   **Function Handler**\n-   Additionally a test version of registry **TestSafeProtocolRegistryUnrestricted** is also available.\n\n[Execution flows](./docs/execution_flows.md) give a high-level overview of the different flows for the Safe{Core} Protocol.\n\n## Deployments\n\nAll the deployed addresses of contracts are available in [deployments.ts](./deployments.ts) for each network along with contract abis. Alternatively, all the addresses are also available in a [markdown file](./docs/deployments.md)\n\n## Using solidity interfaces\n\nThe solidity interfaces for the Safe{Core} Protocol contracts are available in [interfaces](./contracts/interfaces) directory. These interfaces are available for import into solidity smart contracts via the npm artifact.\n\nTo install the npm package, run the following command:\n\n```bash\nnpm i @safe-global/safe-core-protocol\n```\n\nE.g. Create a plugin\n\n```solidity\nimport {ISafeProtocolPlugin} from \"@safe-global/safe-core-protocol/contracts/interfaces/Modules.sol\";\n\ncontract SamplePlugin is ISafeProtocolPlugin {\n\n    function name() external view returns (string memory name) {\n        ...\n    }\n\n    function version() external view returns (string memory version){\n        ...\n    }\n\n    function metadataProvider() external view returns (uint256 providerType, bytes memory location){\n        ...\n    }\n\n    function requiresPermissions() external view returns (uint8 permissions){\n        ...\n    }\n\n}\n```\n\nFor more examples and information on adding Module(s) to the Registry, refer to [Safe{Core} Protocol demo](https://github.com/safe-global/safe-core-protocol-demo/tree/main/contracts)\n\n## Useful commands\n\n### Install\n\n```bash\nyarn\n```\n\n### Compile\n\n```bash\nnpx hardhat compile\n```\n\n### Test\n\n```bash\nnpx hardhat test\n```\n\n### Deploy\n\n-   Deploy test contracts network to goerli.\n    -   [test registry](./contracts/test/TestSafeProtocolRegistryUnrestricted.sol)\n    -   [test manager](./contracts/test/TestSafeProtocolManager.sol)\n    ```bash\n    yarn hardhat deploy --network goerli --tags test-protocol --export-all deployments.ts\n    ```\n-   Deploy contracts with [SafeProtocolRegistry](./contracts/test/TestSafeProtocolRegistryUnrestricted.sol) registry network to goerli.\n    ```bash\n    yarn hardhat deploy --network goerli --tags protocol --export-all deployments.ts\n    ```\n\n### Other commands\n\n| Command                                                                                      | Description                                                                                                                          |\n| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| `yarn hardhat generate:deployments`                                                          | Generate deployments markdown in [./docs/deployments.md](./docs/deployments.md) from [./deployments.ts](./deployments.ts)            |\n| `yarn hardhat verify --network goerli \u003ccontract_address\u003e \u003cinitial_owner\u003e`                    | Verify Registry contract(s)\u003cbr/\u003e Applicable for\u003cbr/\u003e - SafeProtocolRegistry.sol\u003cbr/\u003e - TestSafeProtocolRegistryUnrestricted.sol\u003cbr/\u003e |\n| `yarn hardhat verify --network goerli \u003ccontract_address\u003e \u003cinitial_owner\u003e \u003cregistry_address\u003e` | Verify SafeProtocolManager.sol                                                                                                       |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5afe%2Fsafe-core-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5afe%2Fsafe-core-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5afe%2Fsafe-core-protocol/lists"}