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

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpawlowski committed Mar 6, 2023
1 parent 1485020 commit 37d392d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions test/permitFork.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ et.testSet({
], },
{ send: 'eTokens.eUSDC.deposit', args: [0, et.units(10, 6)], },
], },
{ call: 'eTokens.eUSDC.balanceOfUnderlying', args: [ctx.wallet.address], assertEql: et.units(10, 6), },
{ call: 'eTokens.eUSDC.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.units(10, 6), et.formatUnits(et.DefaultReserve)], },
{ call: 'tokens.USDC.allowance', args: [ctx.wallet.address, ctx.contracts.euler.address], assertEql: 0, },
],
})
Expand Down Expand Up @@ -90,7 +90,7 @@ et.testSet({
], },
{ send: 'eTokens.eGRT.deposit', args: [0, et.eth(10)], },
], },
{ call: 'eTokens.eGRT.balanceOfUnderlying', args: [ctx.wallet.address], assertEql: et.eth(10), },
{ call: 'eTokens.eGRT.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.eth(10), et.formatUnits(et.DefaultReserve)], },
{ call: 'tokens.GRT.allowance', args: [ctx.wallet.address, ctx.contracts.euler.address], assertEql: 0, },
],
})
Expand All @@ -117,7 +117,7 @@ et.testSet({
], },
{ send: 'eTokens.eDAI.deposit', args: [0, et.eth(10)], },
], },
{ call: 'eTokens.eDAI.balanceOfUnderlying', args: [ctx.wallet.address], assertEql: et.eth(10), },
{ call: 'eTokens.eDAI.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.eth(10), et.formatUnits(et.DefaultReserve)], },

// remove allowance
{ action: 'signPermit', token: 'DAI', signer: ctx.wallet, spender: ctx.contracts.euler.address, value: false, deadline: et.MaxUint256,
Expand Down
48 changes: 24 additions & 24 deletions test/swap1inch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ et.testSet({
payload: getPayload('BAT-USDT', ctx.contracts.euler.address),
}]},
// total supply
{ call: 'eTokens.eBAT.totalSupply', assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eBAT.totalSupplyUnderlying', assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eUSDT.totalSupply', equals: [et.eth('29921.938245')] },
{ call: 'eTokens.eUSDT.totalSupplyUnderlying', equals: [et.units('29921.938245', 6)] },
{ call: 'eTokens.eBAT.totalSupply', equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eBAT.totalSupplyUnderlying', equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eUSDT.totalSupply', equals: [et.eth('29921.938245'), 1e-6], },
{ call: 'eTokens.eUSDT.totalSupplyUnderlying', equals: [et.units('29921.938245', 6), 1e-6], },
// account balances
{ call: 'eTokens.eBAT.balanceOf', args: [ctx.wallet.address], assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eBAT.balanceOfUnderlying', args: [ctx.wallet.address], assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eUSDT.balanceOf', args: [ctx.wallet.address], equals: [et.eth('29921.938245')] },
{ call: 'eTokens.eUSDT.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.units('29921.938245', 6)]},
{ call: 'eTokens.eBAT.balanceOf', args: [ctx.wallet.address], equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eBAT.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eUSDT.balanceOf', args: [ctx.wallet.address], equals: [et.eth('29921.938245'), 1e-6], },
{ call: 'eTokens.eUSDT.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.units('29921.938245', 6), 1e-6], },
],
})

Expand Down Expand Up @@ -79,15 +79,15 @@ et.testSet({
payload: getPayload('BAT-USDT', ctx.contracts.euler.address)
}]},
// total supply
{ call: 'eTokens.eBAT.totalSupply', assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eBAT.totalSupplyUnderlying', assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eUSDT.totalSupply', equals: [et.eth('29921.938245')] },
{ call: 'eTokens.eUSDT.totalSupplyUnderlying', equals: [et.units('29921.938245', 6)] },
{ call: 'eTokens.eBAT.totalSupply', equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eBAT.totalSupplyUnderlying', equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eUSDT.totalSupply', equals: [et.eth('29921.938245'), 1e-6], },
{ call: 'eTokens.eUSDT.totalSupplyUnderlying', equals: [et.units('29921.938245', 6), 1e-6], },
// account balances
{ call: 'eTokens.eBAT.balanceOf', args: [et.getSubAccount(ctx.wallet.address, 0)], assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eBAT.balanceOfUnderlying', args: [et.getSubAccount(ctx.wallet.address, 0)], assertEql: et.eth(100_000).sub(et.eth('25048.11267549')), },
{ call: 'eTokens.eUSDT.balanceOf', args: [et.getSubAccount(ctx.wallet.address, 1)], equals: [et.eth('29921.938245')] },
{ call: 'eTokens.eUSDT.balanceOfUnderlying', args: [et.getSubAccount(ctx.wallet.address, 1)], equals: [et.units('29921.938245', 6)] },
{ call: 'eTokens.eBAT.balanceOf', args: [et.getSubAccount(ctx.wallet.address, 0)], equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eBAT.balanceOfUnderlying', args: [et.getSubAccount(ctx.wallet.address, 0)], equals: [et.eth(100_000).sub(et.eth('25048.11267549')), 1e-6], },
{ call: 'eTokens.eUSDT.balanceOf', args: [et.getSubAccount(ctx.wallet.address, 1)], equals: [et.eth('29921.938245'), 1e-6], },
{ call: 'eTokens.eUSDT.balanceOfUnderlying', args: [et.getSubAccount(ctx.wallet.address, 1)], equals: [et.units('29921.938245', 6), 1e-6], },
],
})

Expand All @@ -106,16 +106,16 @@ et.testSet({
payload: getPayload('USDC-RGT', ctx.contracts.euler.address),
}]},
// total supply
{ call: 'eTokens.eUSDC.totalSupply', assertEql: et.eth(100_000).sub(et.eth('50000')), },
{ call: 'eTokens.eUSDC.totalSupplyUnderlying', assertEql: et.units(100_000, 6).sub(et.units('50000', 6)) },
{ call: 'eTokens.eRGT.totalSupply', equals: ['1263.349469909703714654', 1] },
{ call: 'eTokens.eRGT.totalSupplyUnderlying', equals: ['1263.349469909703714654', 1] },
{ call: 'eTokens.eUSDC.totalSupply', equals: [et.eth(100_000).sub(et.eth('50000')), 1e-6], },
{ call: 'eTokens.eUSDC.totalSupplyUnderlying', equals: [et.units(100_000, 6).sub(et.units('50000', 6)), 1e-6], },
{ call: 'eTokens.eRGT.totalSupply', equals: ['1263.349469909703714654', 1e-6], },
{ call: 'eTokens.eRGT.totalSupplyUnderlying', equals: ['1263.349469909703714654', 1e-6], },
// account balances
{ call: 'eTokens.eUSDC.balanceOf', args: [ctx.wallet.address], assertEql: et.eth(100_000).sub(et.eth('50000')) },
{ call: 'eTokens.eUSDC.balanceOfUnderlying', args: [ctx.wallet.address], assertEql: et.units(100_000, 6).sub(et.units('50000', 6)) },
{ call: 'eTokens.eUSDC.balanceOf', args: [ctx.wallet.address], equals: [et.eth(100_000).sub(et.eth('50000')), 1e-6], },
{ call: 'eTokens.eUSDC.balanceOfUnderlying', args: [ctx.wallet.address], equals: [et.units(100_000, 6).sub(et.units('50000', 6)), 1e-6], },

{ call: 'eTokens.eRGT.balanceOf', args: [ctx.wallet.address], equals: ['1263.349469909703714654', 1] },
{ call: 'eTokens.eRGT.balanceOfUnderlying', args: [ctx.wallet.address], equals: ['1263.349469909703714654', 1] },
{ call: 'eTokens.eRGT.balanceOf', args: [ctx.wallet.address], equals: ['1263.349469909703714654', 1e-6], },
{ call: 'eTokens.eRGT.balanceOfUnderlying', args: [ctx.wallet.address], equals: ['1263.349469909703714654', 1e-6], },
],
})

Expand Down
2 changes: 1 addition & 1 deletion test/uniswap-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let tests = et.testSet({
// Uniswap pool has been created, but not init'ed

{ action: 'getPrice', underlying: 'TST', expectError: 'e/market-not-activated', },
{ send: 'markets.activateMarket', args: [ctx.contracts.tokens.TST.address], expectError: 'e/risk/uniswap-pool-not-inited', },
{ send: 'markets.activateMarket', args: [ctx.contracts.tokens.TST.address], expectError: 'e/markets/pricing-type-invalid', },

// Init uniswap pool, euler pool still not activated

Expand Down

0 comments on commit 37d392d

Please sign in to comment.