Skip to content

Commit

Permalink
ERC4626 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatmittal committed May 7, 2024
1 parent dacc928 commit d8a38ed
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/rewards/GenericMultiRewardsVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { RewardInfo, Errors, Events, SCALAR } from "./definitions.sol";
* - {s} = Seconds
*/
contract GenericMultiRewardsVault is ERC4626, Ownable {
uint256 private totalDeposited; // {qAsset}

constructor(
string memory _name,
string memory _symbol,
Expand All @@ -34,6 +36,11 @@ contract GenericMultiRewardsVault is ERC4626, Ownable {
/**
* Core Vault Functionality
*/
function totalAssets() public view override returns (uint256) {
// {qAsset} = {qAsset} + {qAsset}
return totalDeposited;
}

function _convertToShares(uint256 assets, Math.Rounding) internal pure override returns (uint256) {
return assets;
}
Expand All @@ -49,6 +56,7 @@ contract GenericMultiRewardsVault is ERC4626, Ownable {
uint256 shares
) internal override accrueRewards(caller, receiver) {
super._deposit(caller, receiver, assets, shares);
totalDeposited += assets;
}

function _withdraw(
Expand All @@ -59,6 +67,7 @@ contract GenericMultiRewardsVault is ERC4626, Ownable {
uint256 shares
) internal override accrueRewards(owner_, receiver) {
super._withdraw(caller, receiver, owner_, assets, shares);
totalDeposited -= assets;
}

/**
Expand Down

0 comments on commit d8a38ed

Please sign in to comment.