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

Adds a view method for getting current chi. #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MicahZoltu
Copy link

This change makes it so a contract with a view function can know what chi would be in this block. This is useful for contracts that have view functions that need to return values denominated in DAI when looking at DSR balances.

An example use case for this is a token contract (DAI-GoUp) that wraps DAI held in DSR. The balanceOf function of such a contract (which is view) needs to be able to calculate the current balance of an account denominated in DAI. In order to do this, it must calculate what chi would be if drip was called this block, but without actually calling drip (because that is not a view function).

@MicahZoltu
Copy link
Author

Open to whatever changes to function/variable naming you all want.

This change makes it so a contract with a `view` function can know what `chi` would be in this block.  This is useful for contracts that have view functions that need to return values denominated in DAI when looking at DSR balances.

An example use case for this is a token contract (DAI-GoUp) that wraps DAI held in DSR.  The `balanceOf` function of such a contract (which is `view`) needs to be able to calculate the current balance of an account denominated in DAI.  In order to do this, it must calculate what `chi` _would_ be if `drip` was called this block, but without actually calling `drip` (because that is not a view function).
@MicahZoltu
Copy link
Author

We could change this method to public and use it in drip(), but the style in this repository appears to prefer duplication over having public methods so I went with that in an attempt to follow the style found here. Can change if desired.

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