-
Notifications
You must be signed in to change notification settings - Fork 1
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
Rocket Pool Vault #18
base: main
Are you sure you want to change the base?
Changes from 7 commits
4cd4e20
3f849f7
f0b50e4
6a18b22
2e9152e
6edefca
d676eea
f608078
f6d1280
210d35f
962ae49
7543bac
87920b3
2f39bbd
4cca37b
609ce9a
03bd301
dfa61c0
ba2a92d
d65f23d
8d364a5
9eeb1b7
6aa821f
4140092
99a0629
0bec6bd
17c9df2
ff5bfdf
559aac6
63c5039
e3e9c51
cda310b
a0e3fe2
6b3a1bf
c50c92d
f2c79eb
4f8ca96
f753bf5
713f2aa
a9e7089
d6268e9
766d4d9
f8082f6
2552e9f
6b9c84f
2c7d253
de0a184
da6db33
0934d39
51ca073
cbcbb49
756c841
5c22445
d86864f
1125200
49dcc9b
538d306
059e8c7
81fee31
1ea26d2
3ba4746
418e5fb
d8ce179
090ec87
d4bac30
953ab23
2da5cac
9d25759
d1d78a9
0c89801
0ca165f
c383576
beb594b
82ea2e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
// SPDX-License-Identifier: GPL-3.0-only | ||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Import {IERC20} from ... |
||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; | ||
|
||
interface RocketVaultInterface { | ||
function balanceOf(string memory _networkContractName) external view returns (uint256); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New lines in between each function |
||
function depositEther() external payable; | ||
function withdrawEther(uint256 _amount) external; | ||
function depositToken(string memory _networkContractName, IERC20 _tokenAddress, uint256 _amount) external; | ||
function withdrawToken(address _withdrawalAddress, IERC20 _tokenAddress, uint256 _amount) external; | ||
function balanceOfToken(string memory _networkContractName, IERC20 _tokenAddress) external view returns (uint256); | ||
function transferToken(string memory _networkContractName, IERC20 _tokenAddress, uint256 _amount) external; | ||
function burnToken(ERC20Burnable _tokenAddress, uint256 _amount) external; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,17 @@ require("hardhat-deploy-ethers"); | |
require("hardhat-gas-reporter"); | ||
require("dotenv").config(); | ||
|
||
const MAINNET_URL = process.env.MAINNET_URL ? process.env.MAINNET_URL : ""; | ||
|
||
module.exports = { | ||
networks: { | ||
hardhat: { | ||
forking: { | ||
url: MAINNET_URL, | ||
enabled: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this false by default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I merged main so this should be fixed |
||
}, | ||
}, | ||
}, | ||
solidity: { | ||
version: "0.8.4", | ||
settings: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const { ethers } = require("hardhat"); | ||
const { expect } = require("chai"); | ||
|
||
const { fixture } = require("../fixture"); | ||
|
||
describe("Rocket Vault", async () => { | ||
// fixture values | ||
let deployer, user; | ||
let vaultAccounting; | ||
let vaultManagement; | ||
let vaultNames; | ||
|
||
// vault parameters | ||
let depositAmount; | ||
let expectedEthAmount; | ||
let expectedLpToken; | ||
let expectedLpTokenAmount; | ||
let rocketVault; | ||
|
||
beforeEach(async () => { | ||
// initialize fixture values | ||
({ vaultAccounting, vaultManagement, vaultNames } = await fixture()); | ||
[deployer, user] = await ethers.getSigners(); | ||
|
||
// initialize vault parameters | ||
depositAmount = ethers.utils.parseEther("1.0"); | ||
expectedEthAmount = ethers.utils.parseEther("1.0"); | ||
expectedLpToken = "0xae78736Cd615f374D3085123A210448E74Fc6393"; // rETH token address | ||
rocketVault = await ethers.getContractAt("IVault", await vaultManagement.getVault(vaultNames.rocketVault)); | ||
expectedLpTokenAmount = await rocketVault.getAmountLpTokens(depositAmount); //gets rETH amount equivalent to 1 ETH | ||
}); | ||
|
||
it("Should reflect correct conversion from lp tokens to ETH", async () => { | ||
expect(await rocketVault.getAmountETH(expectedLpTokenAmount)).to.be.equal(expectedEthAmount); | ||
}); | ||
|
||
it("Should reflect correct conversion from ETH to lp tokens", async () => { | ||
expect(await rocketVault.getAmountLpTokens(expectedEthAmount)).to.be.equal(expectedLpTokenAmount); | ||
}); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goes above pragma solidity