nile-upgrades


Namenile-upgrades JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/OpenZeppelin/openzeppelin-nile-upgrades
SummaryNile plugin to deploy and manage upgradeable smart contracts on StarkNet
upload_time2023-02-06 17:40:10
maintainer
docs_urlNone
authorEric Lau
requires_python>=3.8,<3.10
licenseMIT
keywords cairo nile
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OpenZeppelin Nile Upgrades

Plugin for [Nile](https://github.com/OpenZeppelin/nile) to deploy and manage [upgradeable smart contracts](https://docs.openzeppelin.com/contracts-cairo/proxies) on StarkNet.

> ## ⚠️ WARNING! ⚠️
>
> This plugin does not currently validate contracts for upgrade safety (see [issue 34](https://github.com/OpenZeppelin/openzeppelin-nile-upgrades/issues/34)).
**Review your contracts for upgrade safety before performing any deployments or upgrades.**

> ## ⚠️ WARNING! ⚠️
>
> This repo contains highly experimental code.
> Expect rapid iteration.
> **Use at your own risk.**

## Installation

```
pip install nile-upgrades
```

## Usage

Run the following functions from scripts with the `NileRuntimeEnvironment`.

### `deploy_proxy`

Deploy an upgradeable proxy for an implementation contract.

Returns a Nile Transaction instance representing the proxy deployment.

```
async def deploy_proxy(
    nre,
    account,
    contract_name,
    initializer_args,
    initializer='initializer',
    salt=0,
    unique=True,
    alias=None,
    max_fee_declare_impl=None,
    max_fee_declare_proxy=None,
    max_fee_deploy_proxy=None,
)
```

- `nre` - the `NileRuntimeEnvironment` object.

- `account` - the Account to use.

- `contract_name` - the name of the implementation contract.

- `initializer_args` - array of arguments for the initializer function.

- `initializer` - initializer function name. Defaults to `'initializer'`.

- `salt` - the salt for proxy address generation. Defaults to `0`.

- `unique` - whether the account address should be taken into account for proxy address generation. Defaults to `True`.

- `alias` - Unique identifier for your proxy. Defaults to `None`.

- `max_fee_declare_impl` - Maximum fee for declaring the implementation contract. Defaults to `None`.

- `max_fee_declare_proxy` - Maximum fee for declaring the proxy contract. Defaults to `None`.

- `max_fee_deploy_proxy` - Maximum fee for deploying the proxy contract. Defaults to `None`.

Example usage:
```
tx = await nre.deploy_proxy(nre, account, "my_contract_v1", 123, True, ["arg for initializer"])
tx_status, proxy_address, abi = await tx.execute(watch_mode="track")
```

### `upgrade_proxy`  

Upgrade a proxy to a different implementation contract.

Returns a Nile Transaction instance representing the upgrade operation.

```
async def upgrade_proxy(
    nre,
    account,
    proxy_address_or_alias,
    contract_name,
    max_fee_declare_impl=None,
    max_fee_upgrade_proxy=None,
)
```

- `nre` - the `NileRuntimeEnvironment` object.

- `account` - the Account to use.

- `proxy_address_or_alias` - the proxy address or alias.

- `contract_name` - the name of the implementation contract to upgrade to.

- `max_fee_declare_impl` - Maximum fee for declaring the new implementation contract. Defaults to `None`.

- `max_fee_upgrade_proxy` - Maximum fee for upgrading the proxy to the new implementation. Defaults to `None`.

Example usage:
```
tx = await nre.upgrade_proxy(nre, account, proxy_address, "my_contract_v2")
tx_status = await tx.execute(watch_mode="track")
```

## Contribute

### Setup

#### Using the latest Nile release supported by this plugin

1. Install [Poetry](https://python-poetry.org/docs/#installation)
2. Clone this project.
3. From this project's root, create a virtualenv, activate it, and install dependencies:
```
python3.9 -m venv env
source env/bin/activate
pip install -U pip setuptools
poetry install
pip install -e .
poetry run compile
```

**or**

#### Using current Nile source code

1. Install [Poetry](https://python-poetry.org/docs/#installation)
2. Clone https://github.com/OpenZeppelin/nile
3. Clone this project.
4. From this project's root, create a virtualenv, activate it, and install dependencies:
```
python3.9 -m venv env
source env/bin/activate
pip install -U pip setuptools
poetry install
pip install -e <your_path_to_nile_repo_from_step_2>
pip install -e .
poetry run compile
```

### Testing

`poetry run pytest tests`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OpenZeppelin/openzeppelin-nile-upgrades",
    "name": "nile-upgrades",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.10",
    "maintainer_email": "",
    "keywords": "cairo,nile",
    "author": "Eric Lau",
    "author_email": "ericglau@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/3a/97/ad29cf53f4b6f08375e76c4067a44f0e839dbb64e5a30e34884276c486f7/nile_upgrades-0.0.3.tar.gz",
    "platform": null,
    "description": "# OpenZeppelin Nile Upgrades\n\nPlugin for [Nile](https://github.com/OpenZeppelin/nile) to deploy and manage [upgradeable smart contracts](https://docs.openzeppelin.com/contracts-cairo/proxies) on StarkNet.\n\n> ## \u26a0\ufe0f WARNING! \u26a0\ufe0f\n>\n> This plugin does not currently validate contracts for upgrade safety (see [issue 34](https://github.com/OpenZeppelin/openzeppelin-nile-upgrades/issues/34)).\n**Review your contracts for upgrade safety before performing any deployments or upgrades.**\n\n> ## \u26a0\ufe0f WARNING! \u26a0\ufe0f\n>\n> This repo contains highly experimental code.\n> Expect rapid iteration.\n> **Use at your own risk.**\n\n## Installation\n\n```\npip install nile-upgrades\n```\n\n## Usage\n\nRun the following functions from scripts with the `NileRuntimeEnvironment`.\n\n### `deploy_proxy`\n\nDeploy an upgradeable proxy for an implementation contract.\n\nReturns a Nile Transaction instance representing the proxy deployment.\n\n```\nasync def deploy_proxy(\n    nre,\n    account,\n    contract_name,\n    initializer_args,\n    initializer='initializer',\n    salt=0,\n    unique=True,\n    alias=None,\n    max_fee_declare_impl=None,\n    max_fee_declare_proxy=None,\n    max_fee_deploy_proxy=None,\n)\n```\n\n- `nre` - the `NileRuntimeEnvironment` object.\n\n- `account` - the Account to use.\n\n- `contract_name` - the name of the implementation contract.\n\n- `initializer_args` - array of arguments for the initializer function.\n\n- `initializer` - initializer function name. Defaults to `'initializer'`.\n\n- `salt` - the salt for proxy address generation. Defaults to `0`.\n\n- `unique` - whether the account address should be taken into account for proxy address generation. Defaults to `True`.\n\n- `alias` - Unique identifier for your proxy. Defaults to `None`.\n\n- `max_fee_declare_impl` - Maximum fee for declaring the implementation contract. Defaults to `None`.\n\n- `max_fee_declare_proxy` - Maximum fee for declaring the proxy contract. Defaults to `None`.\n\n- `max_fee_deploy_proxy` - Maximum fee for deploying the proxy contract. Defaults to `None`.\n\nExample usage:\n```\ntx = await nre.deploy_proxy(nre, account, \"my_contract_v1\", 123, True, [\"arg for initializer\"])\ntx_status, proxy_address, abi = await tx.execute(watch_mode=\"track\")\n```\n\n### `upgrade_proxy`  \n\nUpgrade a proxy to a different implementation contract.\n\nReturns a Nile Transaction instance representing the upgrade operation.\n\n```\nasync def upgrade_proxy(\n    nre,\n    account,\n    proxy_address_or_alias,\n    contract_name,\n    max_fee_declare_impl=None,\n    max_fee_upgrade_proxy=None,\n)\n```\n\n- `nre` - the `NileRuntimeEnvironment` object.\n\n- `account` - the Account to use.\n\n- `proxy_address_or_alias` - the proxy address or alias.\n\n- `contract_name` - the name of the implementation contract to upgrade to.\n\n- `max_fee_declare_impl` - Maximum fee for declaring the new implementation contract. Defaults to `None`.\n\n- `max_fee_upgrade_proxy` - Maximum fee for upgrading the proxy to the new implementation. Defaults to `None`.\n\nExample usage:\n```\ntx = await nre.upgrade_proxy(nre, account, proxy_address, \"my_contract_v2\")\ntx_status = await tx.execute(watch_mode=\"track\")\n```\n\n## Contribute\n\n### Setup\n\n#### Using the latest Nile release supported by this plugin\n\n1. Install [Poetry](https://python-poetry.org/docs/#installation)\n2. Clone this project.\n3. From this project's root, create a virtualenv, activate it, and install dependencies:\n```\npython3.9 -m venv env\nsource env/bin/activate\npip install -U pip setuptools\npoetry install\npip install -e .\npoetry run compile\n```\n\n**or**\n\n#### Using current Nile source code\n\n1. Install [Poetry](https://python-poetry.org/docs/#installation)\n2. Clone https://github.com/OpenZeppelin/nile\n3. Clone this project.\n4. From this project's root, create a virtualenv, activate it, and install dependencies:\n```\npython3.9 -m venv env\nsource env/bin/activate\npip install -U pip setuptools\npoetry install\npip install -e <your_path_to_nile_repo_from_step_2>\npip install -e .\npoetry run compile\n```\n\n### Testing\n\n`poetry run pytest tests`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Nile plugin to deploy and manage upgradeable smart contracts on StarkNet",
    "version": "0.0.3",
    "split_keywords": [
        "cairo",
        "nile"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1431f948d9436a63af864db7b27b76058717e0ce5383baba526de5685008e7d2",
                "md5": "2000fc6a62a12b4511b1268501fc3d70",
                "sha256": "ecf5dc60e1f3018dd87b4379793c1af6157ad62e9778e91145b423c65b74e8e4"
            },
            "downloads": -1,
            "filename": "nile_upgrades-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2000fc6a62a12b4511b1268501fc3d70",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.10",
            "size": 27423,
            "upload_time": "2023-02-06T17:40:08",
            "upload_time_iso_8601": "2023-02-06T17:40:08.825810Z",
            "url": "https://files.pythonhosted.org/packages/14/31/f948d9436a63af864db7b27b76058717e0ce5383baba526de5685008e7d2/nile_upgrades-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a97ad29cf53f4b6f08375e76c4067a44f0e839dbb64e5a30e34884276c486f7",
                "md5": "7975274a224973aabd7c50b163d65d34",
                "sha256": "32a8ec85a5b6495f8c4a64457ae2c420e1b2554e398e3c13deb4123994dcd1e3"
            },
            "downloads": -1,
            "filename": "nile_upgrades-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7975274a224973aabd7c50b163d65d34",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.10",
            "size": 25666,
            "upload_time": "2023-02-06T17:40:10",
            "upload_time_iso_8601": "2023-02-06T17:40:10.321743Z",
            "url": "https://files.pythonhosted.org/packages/3a/97/ad29cf53f4b6f08375e76c4067a44f0e839dbb64e5a30e34884276c486f7/nile_upgrades-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-06 17:40:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "OpenZeppelin",
    "github_project": "openzeppelin-nile-upgrades",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nile-upgrades"
}
        
Elapsed time: 0.03881s