Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

add deploy_tokens to ContractFactory #699

Merged
merged 1 commit into from
Dec 16, 2021

Conversation

joshieDo
Copy link
Contributor

@joshieDo joshieDo commented Dec 16, 2021

Motivation

It's more of a proposal, which i believe would ease things up when deploying from a ContractFactory.

Right now, deploy() seems to assume that the constructor_args passed are of the exact type that the constructor expects. So if one passes deploy((1, "string".to_string())) to a constructor that accepts constructor(uint256 a, string memory b), it will fail because it will tokenize 1 as Int instead of Uint.

This way, we maintain the method, but add a new one which receives an already ready Vec<Token>. Other libs have more freedom on doing their own parsing, and makes things easier if one requires to parse arguments from string. (eg. https://github.com/gakonst/foundry/blob/master/utils/src/lib.rs#L119-L125)

Another option would be to bring over the code from the above link, taking Vec<String as constructor_args, and parsing it internally.

Solution

Adds pub fn deploy_tokens(params: Vec<Token>)

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gakonst gakonst merged commit cf53924 into gakonst:master Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants