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 Jul 16, 2024
1 parent b42960c commit daaff85
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 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
2 changes: 1 addition & 1 deletion test/linkStaking/pp-keeper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('PPKeeper', () => {
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
2 changes: 1 addition & 1 deletion test/linkStaking/vault-controller-strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('VaultControllerStrategy', () => {
curGroupVaultsToUnbond: number[],
nextGroupVaultsTotalUnbonded: number
) {
return await fundFlowController.executeUpdate(
return await fundFlowController.performUpkeep(
ethers.AbiCoder.defaultAbiCoder().encode(
['uint256[]', 'uint256', 'uint256[]', 'uint256'],
[curGroupVaultsToUnbond, toEther(nextGroupVaultsTotalUnbonded), [], 0]
Expand Down

0 comments on commit daaff85

Please sign in to comment.