Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deploy function to generated Contract type #4

Open
glihm opened this issue Dec 19, 2023 · 0 comments
Open

Add deploy function to generated Contract type #4

glihm opened this issue Dec 19, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@glihm
Copy link
Collaborator

glihm commented Dec 19, 2023

To ease the deployment of a contract instance, the generated Contract type may expose a deploy function.

abigen!(MyContract, "/path/sierra.json");

fn main() {
    // init provider and account

    let contract_address = MyContract::deploy(...args).await?;
}

The deploy arguments are automatically generated based on the constructor of the contract.

To deploy, we need the class hash. It can be computed compiling the Sierra class, or by taking the Casm class as optional argument.

The deployment is done by the UDC (we may name this function deploy_udc actually), and the parameters of the UDC may be exposed.

The fees must be configurable.
We also want to check if the class hash is already declared. If not, we can skip the deploy with an error.

In the code, this is located in the rs crate here where a new file may be added for this, to be expanded in the contract type here.

@glihm glihm changed the title Add deploy function to Contract type Add deploy function to generated Contract type Dec 19, 2023
@glihm glihm added the help wanted Extra attention is needed label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant