{"id":27185273,"url":"https://github.com/toniomacaronio/proxy-contracts-solidity","last_synced_at":"2025-10-07T00:08:58.963Z","repository":{"id":44004142,"uuid":"237833088","full_name":"TonioMacaronio/proxy-contracts-solidity","owner":"TonioMacaronio","description":"Solidity upgradeable contracts proxy based on unstructured storage pattern","archived":false,"fork":false,"pushed_at":"2024-11-20T13:56:56.000Z","size":2485,"stargazers_count":16,"open_issues_count":16,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-11T07:39:07.175Z","etag":null,"topics":["blockchain","ethereum","openzeppelin","openzeppelin-solidity","proxy","proxy-contract","solidity","solidity-contracts","upgrade-tool","upgradeable"],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TonioMacaronio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2020-02-02T20:37:46.000Z","updated_at":"2024-07-10T16:38:34.000Z","dependencies_parsed_at":"2024-11-03T13:32:16.438Z","dependency_job_id":"7963d018-cb03-4813-af84-9d144c2b87da","html_url":"https://github.com/TonioMacaronio/proxy-contracts-solidity","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.09090909090909094,"last_synced_commit":"decd7e2900b727ad966b4addd03844449bbef328"},"previous_names":["baldyash/upgradeable-contracts-solidity","toniomacaronio/proxy-contracts-solidity","baldyash/proxy-contracts-solidity"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TonioMacaronio/proxy-contracts-solidity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TonioMacaronio%2Fproxy-contracts-solidity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TonioMacaronio%2Fproxy-contracts-solidity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TonioMacaronio%2Fproxy-contracts-solidity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TonioMacaronio%2Fproxy-contracts-solidity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TonioMacaronio","download_url":"https://codeload.github.com/TonioMacaronio/proxy-contracts-solidity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TonioMacaronio%2Fproxy-contracts-solidity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278699043,"owners_count":26030442,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["blockchain","ethereum","openzeppelin","openzeppelin-solidity","proxy","proxy-contract","solidity","solidity-contracts","upgrade-tool","upgradeable"],"created_at":"2025-04-09T17:14:53.550Z","updated_at":"2025-10-07T00:08:58.929Z","avatar_url":"https://github.com/TonioMacaronio.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proxy Contracts Solidity\n\nSolidity proxy contracts based on unstructured storage pattern. Upgrade your contracts safely.\n\nRead more about proxy patterns from [OpenZeppelin article](https://blog.openzeppelin.com/proxy-patterns/).\n\nI chose this pattern for implementation because it is the most convenient in its further support. So, no implementation of a proxied contract should know about the proxy contract storage structure. However, all implementations must inherit all of the storage variables that were declared in their ancestors.\n\nThe address of the current implementation is stored in a constant pseudorandom slot of the contract proxy contract (slot number obtained as a result of hashing a certain message), the probability of rewriting which is almost zero.\n\nIf you want to set the initial implementation state, use a separate initialize function for it, which will essentially be the \"constructor\" of the contract. This is due to the fact that the proxy does not reflect in any way the changes that you make in the constructor of the contract, therefore it can be considered useless.\n\nWhen creating a contract, the sender of this transaction will be assigned as its owner. The address of the owner is stored in a manner similar to the implementation address.\n\nYou can change the owner using the following function:\n```solidity\n/// @notice The owner can transfer control of the contract to the new owner\n/// @param _newOwner New proxy owner\nfunction transferOwnership(address _newOwner) external\n```\n\nYou can change current implementation after its deployment using the following function:\n```solidity\n/// @notice Sets new implementation of contract as current\n/// @param _newImplementation New contract implementation address\nfunction setImplementation(address _newImplementation) public\n```\nOr if you want to set some initial state for it use the following function:\n```solidity\n/// @notice Sets new implementation and call new implementation to initialize what is needed on it\n/// @dev New implementation call is a low level delegatecall\n/// @param _newImplementation representing the address of the new implementation to be set.\n/// @param _newImplementaionCallData represents the msg.data to bet sent in the low level call. This parameter may include the function\n/// signature of the implementation to be called with the needed payload\nfunction setImplementationAndCall(address _newImplementation, bytes calldata _newImplementaionCallData) external payable\n```\n\nYou can use any function of the implementation contract as usual, however, the address should be the address of its proxy contract. This is because the implementation functions will be called using the delegate call from the context of the proxy contract using the fallback function.\n\n## Install and use\n\n### Copy/paste\n\nJust copy .sol files from contracts folder and use them with your contracts\n\n### Yarn\n\n1. Install [node.js](https://nodejs.org/en/download/) and [yarn](https://yarnpkg.com/getting-started/install) if you haven't yet\n2. Install package\n```sh\nyarn add upgradeable-contracts-solidity\n```\n3. There are 2 ways\n    1. Deploy proxy using bytecode from this file:\n      ```sh\n      ../node_modules/upgradeable-contracts-solidity/build/Proxy.json\n      ```\n    2. Import Proxy.sol into your NewProxy.sol file, inherit from Proxy contract, save and deploy it. Feel free to add your functionality (DO NOT add storage variables if you don't completely understand how it works) \n    ```solidity\n    pragma solidity ^0.5.0;\n\n    import \"../node_modules/upgradeable-contracts-solidity/contracts/Proxy.sol\";\n\n    contract YoursContract is Proxy {}\n    ```\n4. Deploy and set implementation as described above\n\n## Build and test\n1. Install [node.js](https://nodejs.org/en/download/) and [yarn](https://yarnpkg.com/getting-started/install) if you haven't yet\n2. Clone repo\n```sh\ngit clone https://github.com/BaldyAsh/upgradeable-contracts-solidity\n```\n3. Go to downloaded folder and install dependencies\n```sh\nyarn\n```\n4. Compile contracts and run tests\n```sh\nyarn test\n```\n\n## Credits\n\nAnton Grigorev, [@baldyash](https://github.com/BaldyAsh)\n\n## Contribute\n\n- If you **need help**, [open an issue](https://github.com/BaldyAsh/upgradeable-contracts-solidity/issues).\n- If you **found a bug or security vulnerability**, [open an issue](https://github.com/BaldyAsh/upgradeable-contracts-solidity/issues).\n- If you **have a feature request**, [open an issue](https://github.com/BaldyAsh/upgradeable-contracts-solidity/issues).\n- If you **want to contribute**, [submit a pull request](https://github.com/BaldyAsh/upgradeable-contracts-solidity/pulls).\n- Donations on my Ether wallet address: 0x4fd693F57e63714591A07A73A4D7AD84e5cCdE10\n\n![Donate](http://qrcoder.ru/code/?0x4fd693F57e63714591A07A73A4D7AD84e5cCdE10\u00264\u00260)\n\n## License\n\nThis project is available under the MIT license. See the [LICENSE](https://github.com/BaldyAsh/upgradeable-contracts-solidity/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoniomacaronio%2Fproxy-contracts-solidity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoniomacaronio%2Fproxy-contracts-solidity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoniomacaronio%2Fproxy-contracts-solidity/lists"}