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 0d1f6e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 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,10 @@ contract GenericMultiRewardsVault is ERC4626, Ownable {
/**
* Core Vault Functionality
*/
function totalAssets() public view override returns (uint256) {
return totalDeposited; // {qAsset}
}

function _convertToShares(uint256 assets, Math.Rounding) internal pure override returns (uint256) {
return assets;
}
Expand All @@ -49,6 +55,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 +66,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 0d1f6e6

Please sign in to comment.