-
Notifications
You must be signed in to change notification settings - Fork 95
CR oracle deploy #245
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
Merged
Merged
CR oracle deploy #245
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6d546a5
Revert "remove pt 2 and 3"
a9ab2cc
CR oracle
9317eea
add comments + 28/31
bf6bfa4
make admin guardian
0d2d350
lint
637ea90
erc20 wrapper
cb84354
lint
c48e2e9
all in dao, add validation
bd1f591
Merge pull request #247 from fei-protocol/feat/ERC20PCVDepositWrapper
f8e0de5
lint and prettier and fix typescript casting
xklob 0874f7d
remove .only
9c84ecb
Merge branch 'feat/CR-Oracle-Deploy' of github.com:fei-protocol/fei-p…
33bbd99
Merge branch 'develop' into feat/CR-Oracle-Deploy
Joeysantoro 14f3e8e
erc20Wrapper
b8ffb19
Merge branch 'feat/CR-Oracle-Deploy' of github.com:fei-protocol/fei-p…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| pragma solidity ^0.8.4; | ||
|
|
||
| import "../IPCVDepositBalances.sol"; | ||
| import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
|
||
| /** | ||
| @notice a lightweight contract to wrap ERC20 holding PCV contracts | ||
| @author Fei Protocol | ||
| When upgrading the PCVDeposit interface, there are many old contracts which do not support it. | ||
| The main use case for the new interface is to add read methods for the Collateralization Oracle. | ||
| Most PCVDeposits resistant balance method is simply returning the balance as a pass-through | ||
| If the PCVDeposit holds FEI it may be considered as protocol FEI | ||
|
|
||
| This wrapper can be used in the CR oracle which reduces the number of contract upgrades and reduces the complexity and risk of the upgrade | ||
| */ | ||
| contract ERC20PCVDepositWrapper is IPCVDepositBalances { | ||
|
|
||
| /// @notice the referenced token deposit | ||
| address public tokenDeposit; | ||
|
|
||
| /// @notice the balance reported in token | ||
| IERC20 public token; | ||
|
|
||
| /// @notice a flag for whether to report the balance as protocol owned FEI | ||
| bool public isProtocolFeiDeposit; | ||
|
|
||
| constructor(address _tokenDeposit, IERC20 _token, bool _isProtocolFeiDeposit) { | ||
| tokenDeposit = _tokenDeposit; | ||
| token = _token; | ||
| isProtocolFeiDeposit = _isProtocolFeiDeposit; | ||
| } | ||
|
|
||
| /// @notice returns total balance of PCV in the Deposit | ||
| function balance() public view override returns (uint256) { | ||
| return token.balanceOf(tokenDeposit); | ||
| } | ||
|
|
||
| /// @notice returns the resistant balance and FEI in the deposit | ||
| function resistantBalanceAndFei() public view override returns (uint256, uint256) { | ||
| uint256 resistantBalance = balance(); | ||
| uint256 reistantFei = isProtocolFeiDeposit ? resistantBalance : 0; | ||
| return (resistantBalance, reistantFei); | ||
| } | ||
|
|
||
| /// @notice display the related token of the balance reported | ||
| function balanceReportedIn() public view override returns (address) { | ||
| return address(token); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.