Skip to content

Commit

Permalink
fixed remaining conflicts and failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Jul 16, 2024
1 parent daaff85 commit bb139db
Show file tree
Hide file tree
Showing 8 changed files with 468 additions and 410 deletions.
2 changes: 0 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const config: HardhatUserConfig = {
networks: {
localhost: {
url: 'http://127.0.0.1:8545',
ledgerAccounts: [ledgerAccount],
},
sepolia: {
url: '',
Expand All @@ -54,7 +53,6 @@ const config: HardhatUserConfig = {
hardhat: {
chainId: 1337,
accounts: accounts.map((acct) => ({ privateKey: acct, balance })),
ledgerAccounts: [ledgerAccount],
mining: {
auto: true,
interval: 5000,
Expand Down
67 changes: 34 additions & 33 deletions test/core/priorityPool/priority-pool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,29 +228,29 @@ describe('PriorityPool', () => {
[2000, 1000]
)

await expect(pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])).to.be.revertedWith(
'InsufficientDepositRoom()'
)
await expect(
pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])
).to.be.revertedWithCustomError(pp, 'InsufficientDepositRoom()')
await strategy.setMaxDeposits(toEther(4900))
await expect(pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])).to.be.revertedWith(
'InsufficientQueuedTokens()'
)
await expect(
pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])
).to.be.revertedWithCustomError(pp, 'InsufficientQueuedTokens()')
await pp.deposit(toEther(199), true, ['0x'])
await strategy.setMaxDeposits(toEther(5000))
await expect(pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])).to.be.revertedWith(
'InsufficientQueuedTokens()'
)
await expect(
pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])
).to.be.revertedWithCustomError(pp, 'InsufficientQueuedTokens()')
await token.transfer(adrs.stakingPool, toEther(1))
await pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])

await pp.setPoolStatus(2)
await expect(pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])).to.be.revertedWith(
'DepositsDisabled()'
)
await expect(
pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])
).to.be.revertedWithCustomError(pp, 'DepositsDisabled()')
await pp.setPoolStatus(1)
await expect(pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])).to.be.revertedWith(
'DepositsDisabled()'
)
await expect(
pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])
).to.be.revertedWithCustomError(pp, 'DepositsDisabled()')
})

it('checkUpkeep should work correctly', async () => {
Expand All @@ -275,7 +275,7 @@ describe('PriorityPool', () => {
await pp.setPoolStatus(0)
assert.deepEqual(await pp.checkUpkeep('0x'), [
true,
ethers.utils.defaultAbiCoder.encode(['uint256'], [toEther(1001)]),
ethers.AbiCoder.defaultAbiCoder().encode(['uint256'], [toEther(1001)]),
])
})

Expand Down Expand Up @@ -337,27 +337,27 @@ describe('PriorityPool', () => {

await expect(
pp.performUpkeep(ethers.AbiCoder.defaultAbiCoder().encode(['bytes[]'], [['0x']]))
).to.be.revertedWith('InsufficientDepositRoom()')
).to.be.revertedWithCustomError(pp, 'InsufficientDepositRoom()')
await strategy.setMaxDeposits(toEther(4900))
await expect(
pp.performUpkeep(ethers.AbiCoder.defaultAbiCoder().encode(['bytes[]'], [['0x']]))
).to.be.revertedWith('InsufficientQueuedTokens()')
).to.be.revertedWithCustomError(pp, 'InsufficientQueuedTokens()')
await pp.deposit(toEther(199), true, ['0x'])
await strategy.setMaxDeposits(toEther(5000))
await expect(
pp.performUpkeep(ethers.AbiCoder.defaultAbiCoder().encode(['bytes[]'], [['0x']]))
).to.be.revertedWith('InsufficientQueuedTokens()')
).to.be.revertedWithCustomError(pp, 'InsufficientQueuedTokens()')
await token.transfer(adrs.stakingPool, toEther(1))
await pp.performUpkeep(ethers.AbiCoder.defaultAbiCoder().encode(['bytes[]'], [['0x']]))

await pp.setPoolStatus(2)
await expect(
pp.performUpkeep(ethers.AbiCoder.defaultAbiCoder().encode(['bytes[]'], [['0x']]))
).to.be.revertedWith('DepositsDisabled()')
).to.be.revertedWithCustomError(pp, 'DepositsDisabled()')
await pp.setPoolStatus(1)
await expect(
pp.performUpkeep(ethers.AbiCoder.defaultAbiCoder().encode(['bytes[]'], [['0x']]))
).to.be.revertedWith('DepositsDisabled()')
).to.be.revertedWithCustomError(pp, 'DepositsDisabled()')
})

it('getAccountData should work correctly', async () => {
Expand Down Expand Up @@ -481,16 +481,16 @@ describe('PriorityPool', () => {

await expect(
pp.claimLSDTokens(toEther(301), toEther(300), tree.getProof(1))
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')
await expect(
pp.claimLSDTokens(toEther(300), toEther(301), tree.getProof(1))
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')
await expect(
pp.claimLSDTokens(toEther(300), toEther(300), tree.getProof(2))
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')
await expect(
pp.connect(signers[1]).claimLSDTokens(toEther(300), toEther(300), tree.getProof(1))
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')

assert.equal(fromEther(await pp.getLSDTokens(accounts[0], data[1][2])), 300)
assert.equal(fromEther(await pp.getQueuedTokens(accounts[0], data[1][1])), 700)
Expand All @@ -510,7 +510,7 @@ describe('PriorityPool', () => {

await expect(
pp.connect(signers[1]).claimLSDTokens(toEther(150), toEther(150), tree.getProof(2))
).to.be.revertedWith('NothingToClaim()')
).to.be.revertedWithCustomError(pp, 'NothingToClaim()')
})

it('unqueueTokens should work correctly', async () => {
Expand All @@ -524,7 +524,8 @@ describe('PriorityPool', () => {
await strategy.setMaxDeposits(toEther(1500))
await pp.depositQueuedTokens(toEther(100), toEther(1000), ['0x'])

await expect(pp.unqueueTokens(toEther(1501), 0, 0, [])).to.be.revertedWith(
await expect(pp.unqueueTokens(toEther(1501), 0, 0, [])).to.be.revertedWithCustomError(
pp,
'InsufficientQueuedTokens()'
)

Expand Down Expand Up @@ -566,7 +567,7 @@ describe('PriorityPool', () => {
).to.be.revertedWithCustomError(pp, 'InvalidProof()')
await expect(
pp.unqueueTokens(toEther(50), toEther(150), toEther(150), tree.getProof(1))
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')

await pp
.connect(signers[1])
Expand All @@ -578,7 +579,7 @@ describe('PriorityPool', () => {

await expect(
pp.connect(signers[2]).unqueueTokens(toEther(500), toEther(50), toEther(50), tree.getProof(3))
).to.be.revertedWith('InsufficientBalance()')
).to.be.revertedWithCustomError(pp, 'InsufficientBalance()')

await pp
.connect(signers[2])
Expand Down Expand Up @@ -728,10 +729,10 @@ describe('PriorityPool', () => {
pp
.connect(signers[2])
.withdraw(toEther(150), toEther(100), toEther(100), tree.getProof(2), true, false, ['0x'])
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')
await expect(
pp.connect(signers[2]).withdraw(toEther(150), 0, 0, [], true, false, ['0x'])
).to.be.revertedWith('InvalidProof()')
).to.be.revertedWithCustomError(pp, 'InvalidProof()')
await stakingPool.transfer(accounts[2], toEther(100))
await pp
.connect(signers[2])
Expand Down Expand Up @@ -782,14 +783,14 @@ describe('PriorityPool', () => {
1000,
ethers.AbiCoder.defaultAbiCoder().encode(['bool', 'bytes[]'], [true, ['0x']])
)
).to.be.revertedWith('UnauthorizedToken()')
).to.be.revertedWithCustomError(pp, 'UnauthorizedToken()')
await expect(
token.transferAndCall(
adrs.pp,
0,
ethers.AbiCoder.defaultAbiCoder().encode(['bool', 'bytes[]'], [true, ['0x']])
)
).to.be.revertedWith('InvalidValue()')
).to.be.revertedWithCustomError(pp, 'InvalidValue()')

await token
.connect(signers[1])
Expand Down
Loading

0 comments on commit bb139db

Please sign in to comment.