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 factory decorator #2918

Closed

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jun 16, 2022

this will make it easier to deploy factory contracts and verify them on etherscan

also implements a portion of #2891

What I did

add factory decorator to init functions

How I did it

add it to function type metadata; in the codegen, if init function is marked as factory, wrap it in another deploy operation. this generates the correct initcode.

How to verify it

check code for this contract

FOO: immutable(uint256)

@external
@factory
def __init__(arg: uint256):
    FOO = arg

@external
def foo() -> uint256:
    return FOO

tests tbd

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

image

this will make it easier to verify factory contracts on etherscan
@codecov-commenter
Copy link

codecov-commenter commented Jun 16, 2022

Codecov Report

Merging #2918 (e8a50ab) into master (58a5ae5) will decrease coverage by 0.06%.
The diff coverage is 11.11%.

❗ Current head e8a50ab differs from pull request most recent head 5a73748. Consider uploading reports for the commit 5a73748 to get more accurate results

@@            Coverage Diff             @@
##           master    #2918      +/-   ##
==========================================
- Coverage   88.16%   88.09%   -0.07%     
==========================================
  Files          95       95              
  Lines       10579    10588       +9     
  Branches     2533     2536       +3     
==========================================
+ Hits         9327     9328       +1     
- Misses        792      798       +6     
- Partials      460      462       +2     
Impacted Files Coverage Δ
vyper/codegen/module.py 91.81% <0.00%> (-2.58%) ⬇️
vyper/semantics/types/function.py 85.55% <16.66%> (-1.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58a5ae5...5a73748. Read the comment docs.

if initcode is going to be deployed as runtime code, we need to try to
optimize the codesize.
@charles-cooper charles-cooper mentioned this pull request Jun 17, 2022
4 tasks
@charles-cooper
Copy link
Member Author

meeting notes: punt until after v0.3.4

@charles-cooper
Copy link
Member Author

closing because this is probably better left to tooling, especially given that users probably want to deploy factories with custom prefixes - see #2930

@charles-cooper
Copy link
Member Author

the initcode optimization portion of this PR was moved to #2933.

@charles-cooper charles-cooper mentioned this pull request Jul 17, 2022
7 tasks
@charles-cooper
Copy link
Member Author

meeting notes: add -f bytecode_blueprint output format

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

Successfully merging this pull request may close these issues.

2 participants