Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
WIP: test yield contract
Browse files Browse the repository at this point in the history
  • Loading branch information
fiando committed Nov 15, 2024
1 parent 8a8cc95 commit dbc8428
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 45 deletions.
9 changes: 4 additions & 5 deletions src/Eduena.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/interfaces/IERC4626.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./interfaces/IUSDe.sol";
import "./interfaces/ISUSDe.sol";
import "forge-std/console.sol"; //NOTE: testing only

error InsufficientBalance();
Expand All @@ -20,7 +19,7 @@ contract Eduena is ERC20, ReentrancyGuard {
using SafeERC20 for IERC20;

address public owner;
IERC4626 public sUSDe;
ISUSDe public sUSDe;
IERC20 public USDe;
uint256 public lastAssetValueInUSDe;
uint256 public totalUnclaimedYieldInUSDe;
Expand All @@ -33,7 +32,7 @@ contract Eduena is ERC20, ReentrancyGuard {
constructor(address _USDe, address _sUSDe) ERC20("Eduena", "EDN") {
owner = msg.sender;
USDe = IERC20(_USDe);
sUSDe = IERC4626(_sUSDe);
sUSDe = ISUSDe(_sUSDe);
}

function deposit(uint256 amount) external nonReentrant {
Expand All @@ -46,7 +45,7 @@ contract Eduena is ERC20, ReentrancyGuard {
emit Deposit(msg.sender, amount);

if (lastAssetValueInUSDe == 0) {
lastAssetValueInUSDe = sUSDe.convertToAssets(sUSDe.balanceOf(address(this)));
lastAssetValueInUSDe = sUSDe.previewRedeem(sUSDe.balanceOf(address(this)));
}

if (lastAssetValueInUSDe > 0) {
Expand Down
Loading

0 comments on commit dbc8428

Please sign in to comment.