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

onDeploy does not work for predicates and scripts in fuels deploy #3356

Open
luisburigo opened this issue Oct 23, 2024 · 0 comments
Open

onDeploy does not work for predicates and scripts in fuels deploy #3356

luisburigo opened this issue Oct 23, 2024 · 0 comments

Comments

@luisburigo
Copy link
Contributor

It would be interesting to implement this for predicates and scripts to enable some automations. Currently,onDeploy is executed after contracts are deployed.

export async function deploy(config: FuelsConfig) {
/**
* Deploy contract and save their IDs to JSON file.
*/
const contractIds = await deployContracts(config);
await saveContractIds(contractIds, config.output);
config.onDeploy?.(config, contractIds);

My suggestion would be to implement something like this:

export async function deploy(config: FuelsConfig) {
  /**
   * Deploy contract and save their IDs to JSON file.
   */
  const contractIds = await deployContracts(config);
  await saveContractIds(contractIds, config.output);

  /**
   * Deploy scripts and save deployed files to disk.
   */
  const scripts = await deployScripts(config);
  saveScriptFiles(scripts, config);

  /**
   * Deploy predicates and save deployed files to disk.
   */
  const predicates = await deployPredicates(config);
  savePredicateFiles(predicates, config);
  
  config.onDeploy?.(config, {
    scripts,
    predicates,
    contracts: contractIds,
  });

  /**
   * After deploying scripts/predicates, we need to
   * re-generate factory classe with the loader coee
   */
  await generateTypes(config);

  return contractIds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant