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

Updateable reserveRatio for GNS #515

Closed
wants to merge 9 commits into from
Closed

Conversation

jona
Copy link

@jona jona commented Oct 13, 2021

Summary

We currently have no way to set reserveRatio in the GNS contract through governance.

Solution

Add a setReserveRatio function that allows us to set reserverRatio

@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #515 (f8503f0) into dev (6962037) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #515      +/-   ##
==========================================
+ Coverage   91.91%   91.96%   +0.04%     
==========================================
  Files          33       33              
  Lines        1658     1667       +9     
  Branches      282      284       +2     
==========================================
+ Hits         1524     1533       +9     
  Misses        134      134              
Flag Coverage Δ
unittests 91.96% <100.00%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
contracts/discovery/GNS.sol 99.30% <100.00%> (+0.04%) ⬆️

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

@abarmat abarmat added the GIP label Oct 14, 2021
Copy link
Contributor

@abarmat abarmat left a comment

Choose a reason for hiding this comment

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

I've left some comments

)

const pool = await gns.nameSignals(me.address, 0)
const reserveRatio = pool[3]
Copy link
Contributor

Choose a reason for hiding this comment

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

gns.nameSignals(me.address, 0) returns an object that lets you access attributes by both position and key:

[
  BigNumber { _hex: '0x858ffc3f497c9112', _isBigNumber: true },
  BigNumber { _hex: '0x874391d0dd1fdf42', _isBigNumber: true },
  '0x71a94176484d9e0d2ff853a92e162a0493fafa1823a0841400c054769bd895a1',
  10,
  false,
  BigNumber { _hex: '0x00', _isBigNumber: true },
  vSignal: BigNumber { _hex: '0x858ffc3f497c9112', _isBigNumber: true },
  nSignal: BigNumber { _hex: '0x874391d0dd1fdf42', _isBigNumber: true },
  subgraphDeploymentID: '0x71a94176484d9e0d2ff853a92e162a0493fafa1823a0841400c054769bd895a1',
  reserveRatio: 10,
  disabled: false,
  withdrawableGRT: BigNumber { _hex: '0x00', _isBigNumber: true }
]

You should be able to do something like:
expect(pool.reserveRatio).eq(value)

Copy link
Author

Choose a reason for hiding this comment

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

I was following the pattern used here: https://github.com/graphprotocol/contracts/blob/dev/test/gns.test.ts#L157-L159

Wanted to make sure to edit and mutate as little as possible with this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand. I moved away from using positional arguments on a refactor I did for this PR #497

We can use the old pattern here and then eventually when audit passes on #497 and if governance decides to move forward with that upgrade we can rebase/merge.

@abarmat abarmat changed the title set reserveRatio for GNS Updateable reserveRatio for GNS Dec 8, 2021
@tmigone tmigone closed this Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants