Skip to content

Commit

Permalink
updated fund flow controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Jun 17, 2024
1 parent bf6c75a commit 6a03f24
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions test/linkStaking/fund-flow-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('FundFlowController', () => {
curGroupVaultsToUnbond: number[],
nextGroupVaultsTotalUnbonded: number
) {
return await fundFlowController.executeUpdate(
return await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[], 0, curGroupVaultsToUnbond, toEther(nextGroupVaultsTotalUnbonded)]
Expand Down Expand Up @@ -245,10 +245,10 @@ describe('FundFlowController', () => {
])
})

it('checkUpdate should work correctly', async () => {
it('checkUpkeep should work correctly', async () => {
assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -262,7 +262,7 @@ describe('FundFlowController', () => {

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -274,13 +274,13 @@ describe('FundFlowController', () => {

await updateVaultGroups([0, 5, 10], 0)

assert.deepEqual(await fundFlowController.checkUpdate(), [false, '0x'])
assert.deepEqual(await fundFlowController.checkUpkeep('0x'), [false, '0x'])

await time.increase(claimPeriod + 10)

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -299,7 +299,7 @@ describe('FundFlowController', () => {

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand Down Expand Up @@ -327,7 +327,7 @@ describe('FundFlowController', () => {

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -341,7 +341,7 @@ describe('FundFlowController', () => {

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -362,7 +362,7 @@ describe('FundFlowController', () => {

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -376,7 +376,7 @@ describe('FundFlowController', () => {

assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -387,7 +387,7 @@ describe('FundFlowController', () => {
)
})

it('executeUpdate should work correctly', async () => {
it('performUpkeep should work correctly', async () => {
await comStrategy.deposit(toEther(1200), encodeVaults([]))

await updateVaultGroups([0, 5, 10], 0)
Expand All @@ -400,7 +400,7 @@ describe('FundFlowController', () => {
assert.equal((await comStrategy.globalVaultState())[1].toNumber(), 1)

await expect(
fundFlowController.executeUpdate(
fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[], 0, [1, 6, 11], toEther(0)]
Expand Down Expand Up @@ -480,35 +480,35 @@ describe('FundFlowController', () => {

assert.deepEqual(decodeData(await fundFlowController.getDepositData(toEther(150))), [[], []])

await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[0, 5], toEther(0), [0, 5, 10], toEther(0)]
)
)
await time.increase(claimPeriod)
await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[1], toEther(0), [1, 6, 11], toEther(0)]
)
)
await time.increase(claimPeriod)
await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[2], toEther(0), [2, 7], toEther(0)]
)
)
await time.increase(claimPeriod)
await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[3], toEther(0), [3, 8], toEther(0)]
)
)
await time.increase(claimPeriod)
await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[4], toEther(200), [4, 9], toEther(300)]
Expand All @@ -517,15 +517,15 @@ describe('FundFlowController', () => {
await comStrategy.withdraw(toEther(50), encodeVaults([0, 5]))
await opStrategy.withdraw(toEther(100), encodeVaults([0, 5]))
await time.increase(claimPeriod)
await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[0, 5], toEther(100), [0, 5, 10], toEther(300)]
)
)
await comStrategy.withdraw(toEther(270), encodeVaults([1, 6, 11]))
await time.increase(claimPeriod)
await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[1], toEther(100), [1, 6, 11], toEther(200)]
Expand All @@ -541,7 +541,7 @@ describe('FundFlowController', () => {
await time.increase(claimPeriod + 10)
assert.deepEqual(
await fundFlowController
.checkUpdate()
.checkUpkeep('0x')
.then((res) => [
res[0],
ethers.utils.defaultAbiCoder
Expand All @@ -551,7 +551,7 @@ describe('FundFlowController', () => {
[true, [[2], 100, [2, 7], 200]]
)

await fundFlowController.executeUpdate(
await fundFlowController.performUpkeep(
ethers.utils.defaultAbiCoder.encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[[2], toEther(100), [2, 7], toEther(200)]
Expand Down

0 comments on commit 6a03f24

Please sign in to comment.