Skip to content
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

Integration Test #17

Merged
merged 27 commits into from
Sep 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
75486a1
feat: incrementSalt.cjs
CarsonCase Aug 22, 2024
730e53d
feat: optional --sig run(string memory) configFile deployment script …
CarsonCase Aug 22, 2024
5d9f961
removed old live tests
CarsonCase Aug 22, 2024
d5e989b
Merge branch 'carson/dvm-script' into carson/deploy-testing
CarsonCase Aug 22, 2024
4bcbf6a
test: beginings of live tests. Passing
CarsonCase Aug 23, 2024
9bec840
test: included bulk withdrawal in test
CarsonCase Aug 23, 2024
7cf84b0
test: passing test for rate change
CarsonCase Aug 26, 2024
dba7e36
test: including rate change for non-base assets
CarsonCase Aug 27, 2024
1fa6eba
feat: makefile for checkL1 and checkL2
CarsonCase Aug 27, 2024
906e20e
test: LiveDeploy complete, working on RateMath
CarsonCase Aug 29, 2024
d6304bb
fix: live test now works with default
CarsonCase Aug 29, 2024
1dc1123
fix: removed testMath in teller test
CarsonCase Aug 29, 2024
a33b2f8
test: refactoring tests according to PR comments
CarsonCase Aug 29, 2024
1df9d53
chore: renamed math test file
CarsonCase Aug 29, 2024
6f1b314
chore: removed .working file and moved it to another branch
CarsonCase Aug 29, 2024
8b31ff5
fix: import error
CarsonCase Aug 29, 2024
37153f6
test: Work In Progress, for team to see
CarsonCase Aug 29, 2024
4bb9320
test: ERC20 check
CarsonCase Aug 30, 2024
9ffceab
test: jamie wbtc scenario
CarsonCase Aug 30, 2024
1954e86
test: jamie btc scenario changes
CarsonCase Aug 30, 2024
3d9635b
test: rate math
CarsonCase Sep 5, 2024
0364552
refactor: codespell
CarsonCase Sep 6, 2024
fcdf25d
refactor: removed the unused ignoreExisting flag for rate provider de…
CarsonCase Sep 6, 2024
fad49b2
refactor: moved CREATEX to env
CarsonCase Sep 6, 2024
b30e95e
refactor: moved deploy createx expected to env
CarsonCase Sep 6, 2024
4b3daa7
test: fuzz erc20
CarsonCase Sep 6, 2024
d0580a3
Merge pull request #18 from Ion-Protocol/carson/decimal-testing
CarsonCase Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: removed testMath in teller test
  • Loading branch information
CarsonCase committed Aug 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 1dc11230df0eff3433cacedcafdca8229ebe52ab
40 changes: 0 additions & 40 deletions test/TellerWithMultiAssetSupport.t.sol
Original file line number Diff line number Diff line change
@@ -110,46 +110,6 @@ contract TellerWithMultiAssetSupportTest is Test, MainnetAddresses {
accountant.setRateProviderData(WEETH, false, address(WEETH_RATE_PROVIDER));
}

function testMath(uint256 depositAmount, uint256 rateChange) external {
depositAmount = bound(depositAmount, 1, 1_000_000_000e18);
rateChange = bound(rateChange, 9998, 10_002);
// get the expected assets back after rate change
uint256 expectedAssetsBack = ((depositAmount).mulDivDown(rateChange, 10_000));

// get the shares back when depositing before rate change
uint256 accountantRateBefore = accountant.getRateInQuoteSafe(ERC20(WEETH));
assertNotEq(accountantRateBefore, 1e18, "accountantRateBefore for WEETH equal to 1");
uint256 depositShares = depositAmount.mulDivDown(ONE_SHARE, accountantRateBefore);
console.log("Shares * Rate:\t\t", depositShares * ONE_SHARE);
console.log("accountantRateBefore:\t\t", accountantRateBefore);

// todo- atomic
// change the rate
uint96 newRate = uint96(accountant.getRate().mulDivDown(uint96(rateChange), 10_000));
vm.warp(1 days + block.timestamp);
accountant.updateExchangeRate(newRate);

// calculate the assets out at the new rate
uint256 accountantRateAfter = accountant.getRateInQuoteSafe(ERC20(WEETH));
assertApproxEqAbs(
accountantRateBefore.mulDivDown(rateChange, 10_000),
accountantRateAfter,
1,
"accountantRateBefore not equal to after with rate applied"
);
console.log("Shares * Rate:\t", depositShares * accountantRateAfter);
console.log("one_share:\t\t", ONE_SHARE);
uint256 assetsOut = depositShares.mulDivDown(accountantRateAfter, (ONE_SHARE));

// print if the expected > out and assert they're the same
console.log("expectedAssetsBack >= realAssetsOut: ", expectedAssetsBack >= assetsOut);
console.log("expectedAssetsBack: ", expectedAssetsBack);
console.log("assetsOut: ", assetsOut);
// assertTrue(expectedAssetsBack >= assetsOut, "BIG PROBLEM, not in protocol's favor");
assertApproxEqAbs(expectedAssetsBack, assetsOut, 1, "deposit * rateChange != depositAmount with");
// getRateInQuoteSafe math");
}

function testDepositReverting(uint256 amount) external {
amount = bound(amount, 0.0001e18, 10_000e18);
// Turn on share lock period, and deposit reverting
Loading