Skip to content

Conversation

abarmat
Copy link
Contributor

@abarmat abarmat commented Jul 20, 2020

Goal:

To have Curation Signal as a transferrable ERC20 token that can be used as a primitive to create more complex use cases on top.

IMPORTANT:

  • There is one GST (Graph Signal Token) per Subgraph Deployment.
  • The interface is backward compatible to the previous version of the Curation contract.

Implements:

  • When signal on a Subgraph Deployment is minted for the first time it deploys an ERC20 token contract for that particular signal.
  • Every time new tokens are added to a Curation Pool new ERC20 tokens for that pool are minted.
  • When GST is returned to the Curation contract, they are burned and the user get backs GRT tokens in the reserve according to the bonding curve.
  • The Curation contract is the only one allowed to mint GST.
  • The Curation contract is the only one allowed to burn GST.
  • A user holding GST can do anything that an ERC20 can do, except for burning it as it can only be done in the Curation contract.

Remember:

  • There is one independent GST token per Subgraph Deployment, for example:
GST-0x4d31d21d389263c98d1e83a031e8fed17cdcef15bd62ee8153f34188a83c7b1c
GST-0x123abcd...
GST-0x321aadd...

@abarmat abarmat requested a review from davekay100 July 20, 2020 21:00
@abarmat abarmat changed the base branch from master to ariel/unbonding-delegation-period July 20, 2020 21:04
Base automatically changed from ariel/unbonding-delegation-period to master July 21, 2020 18:07
@abarmat abarmat force-pushed the ariel/curation-erc20 branch from a74eb13 to 49ac90c Compare July 21, 2020 20:22
@abarmat
Copy link
Contributor Author

abarmat commented Jul 21, 2020

Rebased

Copy link
Contributor

@davekay100 davekay100 left a comment

Choose a reason for hiding this comment

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

looks good overall

_mint(_to, _amount);
}

function burn(uint256 amount) public onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

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

this and burnFrom could use comments like @dev and @param

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, will add the natspec.

_mint(_to, _amount);
}

function burn(uint256 amount) public onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

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

also, does burn() ever get used? It looks like just burnFrom() is used. Not sure if we have a future use case for burn() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will remove the method. I initially was using ERC20Burnable and overriding the methods like burn and burnFrom to only be called by the Curation contract. Then I decided to just extend the plain ERC20 contract and implement the functions.

@davekay100
Copy link
Contributor

Lets merge 252, then 250, then 254, then 253, then 255. This order will work the best as far as i can tell

@abarmat
Copy link
Contributor Author

abarmat commented Jul 21, 2020

Removed burn() and added many more comments to explain how this works on the natspec.

@abarmat
Copy link
Contributor Author

abarmat commented Jul 21, 2020

I'll merge this one and keep reviewing 250 so we merge in that order: #252, then #250, then #254, then #253

This one #255 could be merged independently as it only changes specific parts of the Staking contract.

@davekay100
Copy link
Contributor

looks good, you can merge

@abarmat abarmat merged commit 44be3f0 into master Jul 21, 2020
@abarmat abarmat deleted the ariel/curation-erc20 branch July 21, 2020 22:45
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