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

Use a minimal proxy for the curation shares ERC20 #505

Merged
merged 5 commits into from
Nov 29, 2021

Conversation

abarmat
Copy link
Contributor

@abarmat abarmat commented Sep 23, 2021

Description

Signal on a subgraph deployment is represented by a subgraph-specific ERC20 token. When signal is minted for a subgraph deployment for the first time, the Curation contract deploys a new ERC20 token. This is costly, about 1.2M gas.

Solution

Use a Minimal Proxy to clone the Signal-ERC20 based on an implementation. First mint goes from 1,230,118 gas to 432,840

@abarmat abarmat added the GIP label Sep 23, 2021
@codecov
Copy link

codecov bot commented Sep 23, 2021

Codecov Report

Merging #505 (1a2a89b) into dev (6962037) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 1a2a89b differs from pull request most recent head d7b9f35. Consider uploading reports for the commit d7b9f35 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #505      +/-   ##
==========================================
+ Coverage   91.91%   91.95%   +0.03%     
==========================================
  Files          33       33              
  Lines        1658     1666       +8     
  Branches      282      279       -3     
==========================================
+ Hits         1524     1532       +8     
  Misses        134      134              
Flag Coverage Δ
unittests 91.95% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
contracts/curation/Curation.sol 100.00% <100.00%> (ø)
contracts/curation/GraphCurationToken.sol 100.00% <100.00%> (ø)

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 6962037...d7b9f35. Read the comment docs.

@abarmat abarmat force-pushed the ariel/curation-token-minimal-proxy branch from ff07ea6 to 40b1da3 Compare October 6, 2021 23:06
@abarmat
Copy link
Contributor Author

abarmat commented Oct 6, 2021

Rebased

@abarmat abarmat force-pushed the ariel/curation-token-minimal-proxy branch from 40b1da3 to 1a2a89b Compare October 14, 2021 18:18
@abarmat abarmat merged commit 2e84093 into dev Nov 29, 2021
@abarmat abarmat deleted the ariel/curation-token-minimal-proxy branch November 29, 2021 00:33
@kajpust
Copy link

kajpust commented Nov 29, 2021

Great job

jona pushed a commit that referenced this pull request Dec 3, 2021
* curation: use a minimal proxy to save gas when minting for first time
* curation: use token utils for transfers
* tests: remove unnecessary block advance in test
* curation: add external function to set token master copy and avoid re-deploy the clone on minting reset
* chore: add graph curation master copy token to deployment config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants