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 function to encode function call args #760

Closed
zoeyTM opened this issue May 15, 2024 · 0 comments · Fixed by #761
Closed

Add function to encode function call args #760

zoeyTM opened this issue May 15, 2024 · 0 comments · Fixed by #761
Assignees
Labels
status:ready This issue is ready to be worked on type:feature Fetaure request

Comments

@zoeyTM
Copy link
Contributor

zoeyTM commented May 15, 2024

m.encodeFunctionCall<
  ContractNameT extends string,
  FunctionNameT extends string
>(
  contract: CallableContractFuture<ContractNameT>,
  functionName: FunctionNameT,
  args: ArgumentType[]
): EncodeFunctionCallFuture

interface EncodeFunctionCallFuture<
  ContractNameT extends string,
  FunctionNameT extends string
> {
  type: FutureType.ENCODE_FUNCTION_CALL;
  id: string;
  module: IgnitionModule;
  dependencies: Set<Future>;
  contract: ContractFuture<ContractNameT>;
  functionName: FunctionNameT;
  args: ArgumentType[];
}

args should accept the same types as m.call

EncodeFunctionCallFuture should be able to be passed as an arg to:

  • contract constructors

  • m.call args

  • m.staticCall args

  • m.send data

Validations and reconciliations should be same as for m.call , minus things they don’t have in common like value and from

Usage:

example using proxy initialization function

const proxyAdminOwner = m.getAccount(0);

const contract = m.contract("Contract");

const data = m.encodeFunctionCall(contract, "initialize", [proxyAdminOwner])

const proxy = m.contract("TransparentUpgradeableProxy", [..., data]);

// etc.
@zoeyTM zoeyTM self-assigned this May 15, 2024
@zoeyTM zoeyTM added status:ready This issue is ready to be worked on type:feature Fetaure request and removed status:triaging labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on type:feature Fetaure request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant