Skip to content

Always use default addresses for constructor inputs #485

@lydiagarms

Description

@lydiagarms

Overview

In Starlight, in some cases for addresses that are input to the constructor (but are not contract imports) instead of making the user input these, we use a default address, i.e. msg.sender. Generally, this is useful when there is a contract admin, from a usability point of view. There is an log explaining to the user that this has happend and they can change this by changing the deployment file.

However, currently this does not happen if there any imported contracts that are also included in the constructor inputs, or if there is a cnstrctr.mjs file.

Tasks

  • In prepareMigrationsFile in src/codeGenerators/orchestration/files/toOrchestration.ts allow for default addresses even if there is a cnstrctr.mjs file or there are also imported addresses.
  • When the user is prompted to supply inputs to the constructor, there is already an option to use "NA" if they want to use a default contract import, do the same for a default account address.
  • Ensure that the default address is being used correctly in cnstrctr.mjs, and that there is no clash of variables being declared twice in migration.
  • Ensure that this does not cause issues when there are also imported addresses.
  • Consider and test for addresses that are secret/ public/ public that interact. Also test with a wide range of other constructor inputs.

Definition of done

When is this task complete?
Whenever an address is input to the constructor we should use a default address unless the user specifies otherwise. Testing should have been done to ensure this doesn't cause any bugs for a wide range of contracts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions