Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
shileiwill committed Feb 6, 2024
1 parent 70b6447 commit 315e107
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 336 deletions.
234 changes: 69 additions & 165 deletions contracts/test/v0.8/automation/AutomationRegistry2_2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,41 +953,27 @@ describe('AutomationRegistry2_2', () => {
.transfer(await admin.getAddress(), toWei('1000'))
let tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
upkeepId = await getUpkeepID(tx)

autoFunderUpkeep = await upkeepAutoFunderFactory
.connect(owner)
.deploy(linkToken.address, registry.address)
tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
autoFunderUpkeep.address,
performGas,
autoFunderUpkeep.address,
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](autoFunderUpkeep.address, performGas, autoFunderUpkeep.address, randomBytes, '0x')
afUpkeepId = await getUpkeepID(tx)

ltUpkeep = await deployMockContract(owner, ILogAutomationactory.abi)
tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)'](
ltUpkeep.address,
performGas,
await admin.getAddress(),
Trigger.LOG,
'0x',
logTriggerConfig,
emptyBytes,
)
[
'registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)'
](ltUpkeep.address, performGas, await admin.getAddress(), Trigger.LOG, '0x', logTriggerConfig, emptyBytes)
logUpkeepId = await getUpkeepID(tx)

await autoFunderUpkeep.setUpkeepId(afUpkeepId)
Expand All @@ -998,13 +984,9 @@ describe('AutomationRegistry2_2', () => {

tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
streamsLookupUpkeep.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](streamsLookupUpkeep.address, performGas, await admin.getAddress(), randomBytes, '0x')
streamsLookupUpkeepId = await getUpkeepID(tx)
}

Expand All @@ -1022,13 +1004,9 @@ describe('AutomationRegistry2_2', () => {
await mock.setPerformGasToBurn(BigNumber.from('0'))
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const condUpkeepId = await getUpkeepID(tx)
passingConditionalUpkeepIds.push(condUpkeepId)

Expand All @@ -1041,15 +1019,9 @@ describe('AutomationRegistry2_2', () => {
await mock.setPerformGasToBurn(BigNumber.from('0'))
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
Trigger.LOG,
'0x',
logTriggerConfig,
emptyBytes,
)
[
'registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), Trigger.LOG, '0x', logTriggerConfig, emptyBytes)
const logUpkeepId = await getUpkeepID(tx)
passingLogUpkeepIds.push(logUpkeepId)

Expand All @@ -1062,13 +1034,9 @@ describe('AutomationRegistry2_2', () => {
await mock.setPerformGasToBurn(BigNumber.from('0'))
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const failingUpkeepId = await getUpkeepID(tx)
failingUpkeepIds.push(failingUpkeepId)
}
Expand Down Expand Up @@ -1550,13 +1518,9 @@ describe('AutomationRegistry2_2', () => {

let tx = await arbRegistry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const testUpkeepId = await getUpkeepID(tx)
await arbRegistry.connect(owner).addFunds(testUpkeepId, toWei('100'))

Expand Down Expand Up @@ -2528,13 +2492,9 @@ describe('AutomationRegistry2_2', () => {
const mock = await upkeepMockFactory.deploy()
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const testUpkeepId = await getUpkeepID(tx)
upkeepIds.push(testUpkeepId)

Expand Down Expand Up @@ -2569,13 +2529,9 @@ describe('AutomationRegistry2_2', () => {
const mock = await upkeepMockFactory.deploy()
const tx = await arbRegistry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const testUpkeepId = await getUpkeepID(tx)
upkeepIds.push(testUpkeepId)

Expand Down Expand Up @@ -2632,13 +2588,9 @@ describe('AutomationRegistry2_2', () => {
// add funds to upkeep 1 and perform and withdraw some payment
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
emptyBytes,
emptyBytes,
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), emptyBytes, emptyBytes)

const id1 = await getUpkeepID(tx)
await registry.connect(admin).addFunds(id1, toWei('5'))
Expand All @@ -2660,13 +2612,9 @@ describe('AutomationRegistry2_2', () => {
// add funds to upkeep 2 and perform and withdraw some payment
const tx2 = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
emptyBytes,
emptyBytes,
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), emptyBytes, emptyBytes)
const id2 = await getUpkeepID(tx2)
await registry.connect(admin).addFunds(id2, toWei('5'))

Expand Down Expand Up @@ -2744,23 +2692,15 @@ describe('AutomationRegistry2_2', () => {
it('uses maxPerformData size in checkUpkeep but actual performDataSize in transmit', async () => {
const tx1 = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const upkeepID1 = await getUpkeepID(tx1)
const tx2 = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
const upkeepID2 = await getUpkeepID(tx2)
await mock.setCanCheck(true)
await mock.setCanPerform(true)
Expand Down Expand Up @@ -2823,13 +2763,9 @@ describe('AutomationRegistry2_2', () => {
beforeEach(async () => {
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
randomBytes,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), randomBytes, '0x')
upkeepId2 = await getUpkeepID(tx)

await registry.connect(admin).addFunds(upkeepId, toWei('100'))
Expand Down Expand Up @@ -3970,13 +3906,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
emptyBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'),
'RegistryPaused()',
)
})
Expand All @@ -3985,13 +3917,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
zeroAddress,
performGas,
await admin.getAddress(),
emptyBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](zeroAddress, performGas, await admin.getAddress(), emptyBytes, '0x'),
'NotAContract()',
)
})
Expand All @@ -4000,13 +3928,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(keeper1)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
emptyBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'),
'OnlyCallableByOwnerOrRegistrar()',
)
})
Expand All @@ -4015,13 +3939,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
2299,
await admin.getAddress(),
emptyBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, 2299, await admin.getAddress(), emptyBytes, '0x'),
'GasLimitOutsideRange()',
)
})
Expand All @@ -4030,13 +3950,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
5000001,
await admin.getAddress(),
emptyBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, 5000001, await admin.getAddress(), emptyBytes, '0x'),
'GasLimitOutsideRange()',
)
})
Expand All @@ -4049,13 +3965,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
longBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), longBytes, '0x'),
'CheckDataExceedsLimit()',
)
})
Expand All @@ -4070,13 +3982,9 @@ describe('AutomationRegistry2_2', () => {
const checkData = checkDatas[kdx]
const tx = await registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
checkData,
'0x',
)
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), checkData, '0x')

//confirm the upkeep details and verify emitted events
const testUpkeepId = await getUpkeepID(tx)
Expand Down Expand Up @@ -4738,13 +4646,9 @@ describe('AutomationRegistry2_2', () => {
await evmRevert(
registry
.connect(owner)
['registerUpkeep(address,uint32,address,bytes,bytes)'](
mock.address,
performGas,
await admin.getAddress(),
emptyBytes,
'0x',
),
[
'registerUpkeep(address,uint32,address,bytes,bytes)'
](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'),
'RegistryPaused()',
)
})
Expand Down
Loading

0 comments on commit 315e107

Please sign in to comment.