{"_id":"@boz14676/truffle-upgrades","_rev":"1-1a41ecf849232769602865c90368734d","name":"@boz14676/truffle-upgrades","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@boz14676/truffle-upgrades","version":"1.0.0","license":"MIT","_id":"@boz14676/truffle-upgrades@1.0.0","maintainers":[{"name":"boz14676","email":"boz14676@gmail.com"}],"bin":{"migrate-oz-cli-project":"dist/scripts/migrate-oz-cli-project.js"},"dist":{"shasum":"6ec5f07d4f277a0e8d8c7897e73a870440775f16","tarball":"https://registry.npmjs.org/@boz14676/truffle-upgrades/-/truffle-upgrades-1.0.0.tgz","fileCount":61,"integrity":"sha512-g1piRwwkMo2hZT5S0wXdqxaJnChZ2//k5hIMzSEiVuVV9POh95QplY9NdmygF/BnF47IV0wFSsyxrAk6UvyWFQ==","signatures":[{"sig":"MEUCIQCNk9OTWEvH9tPqMMINN/dmuq2LVN+Dmgr4demT+HhNDQIgFBYUMG/aIEV8GTj3D982MjxMxD2aF7gTqfgKLqE85CM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":107853},"main":"dist/index.js","scripts":{"test":"yarn compile && bash test.sh","clean":"rimraf dist *.tsbuildinfo","compile":"tsc -b","prepare":"yarn clean && yarn compile","version":"node ../../scripts/bump-changelog.js"},"_npmUser":{"name":"boz14676","email":"boz14676@gmail.com"},"_npmVersion":"10.2.3","description":"> **Warning** > This package is deprecated. The recommended alternative is to use [Hardhat](https://hardhat.org/) along with the [Hardhat Upgrades](https://docs.openzeppelin.com/upgrades-plugins/hardhat-upgrades) plugin.","directories":{},"_nodeVersion":"20.10.0","dependencies":{"chalk":"^4.1.0","debug":"^4.1.1","@truffle/contract":"^4.3.26"},"_hasShrinkwrap":false,"devDependencies":{"bn.js":"^5.2.1","rimraf":"^5.0.0","@types/debug":"^4.1.12","solidity-ast":"^0.4.56","@openzeppelin/upgrades-core":"^1.35.1"},"peerDependencies":{"truffle":"^5.1.35"},"_npmOperationalInternal":{"tmp":"tmp/truffle-upgrades_1.0.0_1724126297539_0.6040942432115002","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@boz14676/truffle-upgrades","version":"1.0.1","description":"> **Warning** > This package is deprecated. The recommended alternative is to use [Hardhat](https://hardhat.org/) along with the [Hardhat Upgrades](https://docs.openzeppelin.com/upgrades-plugins/hardhat-upgrades) plugin.","license":"MIT","main":"dist/index.js","bin":{"migrate-oz-cli-project":"dist/scripts/migrate-oz-cli-project.js"},"scripts":{"clean":"rimraf dist *.tsbuildinfo","compile":"tsc -b","prepare":"yarn clean && yarn compile","test":"yarn compile && bash test.sh","version":"node ../../scripts/bump-changelog.js"},"devDependencies":{"@openzeppelin/upgrades-core":"^1.35.1","@types/debug":"^4.1.12","bn.js":"^5.2.1","rimraf":"^5.0.0","solidity-ast":"^0.4.56"},"dependencies":{"@truffle/contract":"^4.3.26","chalk":"^4.1.0","debug":"^4.1.1"},"peerDependencies":{"truffle":"^5.1.35"},"_id":"@boz14676/truffle-upgrades@1.0.1","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-It7k6qM8zFYH06Y2ARqQAwA9qLbWBZiIQ3mYm1NQ5i/Ol2wjDb30xdQMh9YvCkqNKikHVXeLp/njSaiJOyD6ww==","shasum":"d7ad6eb048c239a252f5c4f4c63dd6bf9aa4d00d","tarball":"https://registry.npmjs.org/@boz14676/truffle-upgrades/-/truffle-upgrades-1.0.1.tgz","fileCount":61,"unpackedSize":107737,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHJYNHNfo19HDaTbiQhbBt5Bx7mNKqqy++wIC2y8Fge9AiEAjExYLGrxNLZrwWHtOJRNtqoHuqN6z/b0h4oICk7EsVw="}]},"_npmUser":{"name":"boz14676","email":"boz14676@gmail.com"},"directories":{},"maintainers":[{"name":"boz14676","email":"boz14676@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/truffle-upgrades_1.0.1_1724142525369_0.9323487308903646"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-20T03:58:17.429Z","modified":"2024-08-20T08:28:45.734Z","1.0.0":"2024-08-20T03:58:17.779Z","1.0.1":"2024-08-20T08:28:45.573Z"},"license":"MIT","description":"> **Warning** > This package is deprecated. The recommended alternative is to use [Hardhat](https://hardhat.org/) along with the [Hardhat Upgrades](https://docs.openzeppelin.com/upgrades-plugins/hardhat-upgrades) plugin.","maintainers":[{"name":"boz14676","email":"boz14676@gmail.com"}],"readme":"# OpenZeppelin Truffle Upgrades\n\n> **Warning**\n> This package is deprecated. The recommended alternative is to use [Hardhat](https://hardhat.org/) along with the [Hardhat Upgrades](https://docs.openzeppelin.com/upgrades-plugins/hardhat-upgrades) plugin.\n\n[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://docs.openzeppelin.com/upgrades-plugins/truffle-upgrades)\n[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/truffle-upgrades.svg)](https://www.npmjs.org/package/@openzeppelin/truffle-upgrades)\n\n**Truffle package for deploying and managing upgradeable contracts.** This package adds functions to your Truffle migrations and tests so you can deploy and upgrade proxies for your contracts.\n\n> Note: Usage from [Truffle external scripts](https://www.trufflesuite.com/docs/truffle/getting-started/writing-external-scripts) is not yet supported.\n\n## Installation\n\n```\nnpm install --save-dev @openzeppelin/truffle-upgrades\n```\n\nThis package requires Truffle [version 5.1.35](https://github.com/trufflesuite/truffle/releases/tag/v5.1.35) or greater.\n\n## Usage in migrations\n\n### Proxies\n\nTo deploy an upgradeable instance of one of your contracts in your migrations, use the `deployProxy` function:\n\n```js\n// migrations/NN_deploy_upgradeable_box.js\nconst { deployProxy } = require('@openzeppelin/truffle-upgrades');\n\nconst Box = artifacts.require('Box');\n\nmodule.exports = async function (deployer) {\n  const instance = await deployProxy(Box, [42], { deployer });\n  console.log('Deployed', instance.address);\n};\n```\n\nThis will automatically check that the `Box` contract is upgrade-safe, set up a proxy admin (if needed), deploy an implementation contract for the `Box` contract (unless there is one already from a previous deployment), create a proxy, and initialize it by calling `initialize(42)`.\n\nThen, in a future migration, you can use the `upgradeProxy` function to upgrade the deployed instance to a new version. The new version can be a different contract (such as `BoxV2`), or you can just modify the existing `Box` contract and recompile it - the plugin will note it changed.\n\n```js\n// migrations/MM_upgrade_box_contract.js\nconst { upgradeProxy } = require('@openzeppelin/truffle-upgrades');\n\nconst Box = artifacts.require('Box');\nconst BoxV2 = artifacts.require('BoxV2');\n\nmodule.exports = async function (deployer) {\n  const existing = await Box.deployed();\n  const instance = await upgradeProxy(existing.address, BoxV2, { deployer });\n  console.log(\"Upgraded\", instance.address);\n};\n```\n\nThe plugin will take care of comparing `BoxV2` to the previous one to ensure they are compatible for the upgrade, deploy the new `BoxV2` implementation contract (unless there is one already from a previous deployment), and upgrade the existing proxy to the new implementation.\n\n### Beacon proxies\n\nYou can also use this plugin to deploy an upgradable beacon for your contract with the `deployBeacon` function, then deploy one or more beacon proxies that point to it by using the `deployBeaconProxy` function.\n\n```js\n// migrations/NN_deploy_upgradeable_box.js\nconst { deployBeacon, deployBeaconProxy } = require('@openzeppelin/truffle-upgrades');\n\nconst Box = artifacts.require('Box');\n\nmodule.exports = async function (deployer) {\n  const beacon = await deployBeacon(Box);\n  console.log('Beacon deployed', beacon.address);\n\n  const instance = await deployBeaconProxy(beacon, Box, [42], { deployer });\n  console.log('Box deployed', instance.address);\n};\n```\n\nIn a future migration, you can use the `erc1967.getBeaconAddress` function to get the beacon address from a deployed beacon proxy instance, then call the `upgradeBeacon` function to upgrade that beacon to a new version. When the beacon is upgraded, all of the beacon proxies that point to it will use the new contract implementation.\n\n```js\n// migrations/MM_upgrade_box_contract.js\nconst { erc1967, upgradeBeacon } = require('@openzeppelin/truffle-upgrades');\n\nconst Box = artifacts.require('Box');\nconst BoxV2 = artifacts.require('BoxV2');\n\nmodule.exports = async function (deployer) {\n  const existing = await Box.deployed();\n\n  const beaconAddress = await erc1967.getBeaconAddress(existing.address);\n  await upgradeBeacon(beaconAddress, BoxV2, { deployer });\n  console.log(\"Beacon upgraded\", beaconAddress);\n\n  const instance = await BoxV2.at(existing.address);\n};\n```\n\n## Usage in tests\n\nYou can also use the plugin's functions from your Truffle tests, in case you want to add tests for upgrading your contracts (which you should!). The API is the same as in the migrations, only that without a `deployer` parameter.\n\n### Proxies\n\n```js\nconst { deployProxy, upgradeProxy } = require('@openzeppelin/truffle-upgrades');\n\nconst Box = artifacts.require('Box');\nconst BoxV2 = artifacts.require('BoxV2');\n\ndescribe('upgrades', () => {\n  it('works', async () => {\n    const box = await deployProxy(Box, [42]);\n    const box2 = await upgradeProxy(box.address, BoxV2);\n\n    const value = await box2.value();\n    assert.equal(value.toString(), '42');\n  });\n});\n```\n\n### Beacon proxies\n\n```js\nconst { deployBeacon, deployBeaconProxy, upgradeBeacon } = require('@openzeppelin/truffle-upgrades');\n\nconst Box = artifacts.require('Box');\nconst BoxV2 = artifacts.require('BoxV2');\n\ndescribe('upgrades', () => {\n  it('works', async () => {\n    const beacon = await deployBeacon(Box);\n    const box = await deployBeaconProxy(beacon, Box, [42]);\n\n    await upgradeBeacon(beacon, BoxV2);\n    const box2 = await BoxV2.at(box.address);\n\n    const value = await box2.value();\n    assert.equal(value.toString(), '42');\n  });\n});\n```\n\n## Learn more\n* Refer to the [API documentation](https://docs.openzeppelin.com/upgrades-plugins/api-truffle-upgrades).\n* Also see the [main documentation](https://docs.openzeppelin.com/upgrades-plugins) for more info.\n","readmeFilename":"README.md"}