Skip to content

feat: prices automation support for chainlink v2.3 - #69

Open
imollov wants to merge 10 commits into
mainfrom
feat/prices-automation-v2.3
Open

feat: prices automation support for chainlink v2.3#69
imollov wants to merge 10 commits into
mainfrom
feat/prices-automation-v2.3

Conversation

@imollov

@imollov imollov commented May 20, 2025

Copy link
Copy Markdown
Contributor

Resovles #59

Depends on #55

@imollov
imollov force-pushed the feat/prices-automation-v2.3 branch from 0645250 to 7fa70d1 Compare May 20, 2025 12:42
@imollov

imollov commented May 21, 2025

Copy link
Copy Markdown
Contributor Author

Report from live testing on Base Sepolia

1. Run the setup script

Deploying contracts...
VoterMock deployed to: 0x238C37e5A1eEB9D967606C69d387e8B11e5EA5df
PricesMock deployed to: 0x5960dbaA2F00f68891852F1F701d1D33c28d1ACd
UpkeepBalanceMonitor deployed to: 0x5478960493e1946469A97b3d718dBa36a2b7013F
TokenUpkeepManager deployed to: 0x9fbE602d26A22dcdc62bb25Ea898Ff4d5B202854
TokenUpkeepManager granted watchlist manager role
Transferred 3000000000000000000 LINK tokens to TokenUpkeepManager
Registering log upkeeps...
Approved LINK token for AutomationRegistrar 7000000000000000000
Registered whitelist token log upkeep 16830208584775088516581846403374475268890615838368039531193037280565763014791
Set trusted forwarder for TokenUpkeepManager
Registering fake tokens...
Registered fake tokens with TokenUpkeepManager [
  '0xD5e593862db037B2B3a946894aA83F9Db9DFaBe5',
  '0x8A80B898ADad760F2EEE037CE97229379068aDb5',
  '0x3D455F9910349112F13763a64B835d5FD5eD3D9A',
  '0xE9363915Ded90e43035893F3bEadA9B1fE197d94',
  '0x78866BA484E7895c5f7C6BB84A331534D98d09CB',
  '0xb36BE36EF9D09a532a9aCF1496FA17d4492e5B03',
  '0xfB42C8641476256a96CCB8E8b81B840807a0a197',
  '0x666a6c7973Aa7A183e62e9250E697c3276D94029',
  '0xddac44a7cf1044C9fE76359519d6881ED678f558',
  '0x2136126f4Cb4b8ECDBb3cb6b09C58B35BB9708CD'
]
Registered fake tokens with TokenUpkeepManager [
  '0x67889d7e0d35d0Ad25DdAa8e3187E8C423df9021',
  '0x3c5EBB148d3cB70554dD29B32321DC66b7A8F2FE',
  '0x20382E7493178Ce0926A1a8A73623e6169Ea3aF9',
  '0xded112A3aE3e39F87e6aD656553070aE85B41E47',
  '0x6A2670fDCF3Da54550c4e20FFe45Ce5030D7fCDC',
  '0xF2c9d24F02f842f17e1eA4ac5Fc6172B1AE3f0c5',
  '0x3Cf05e17acF956a7b2B79ce6b229d12eA0dA88Dc',
  '0x73eA374Dd6C1bC95d3FA0C0506aBF6c25d1DAc62',
  '0x6F14481e69Ad0E6fc6338165DDDe782a4776ec5A',
  '0xDF40944D9512a9aAa16083A1b0aC61474537338c'
]
Registered fake tokens with TokenUpkeepManager [
  '0x6A159b9778D390716265B3f61D8bB7789EB9AAbc',
  '0x172CF761072884f0047d59F82055c37219a090E5',
  '0xdE9e381473695d3d0c2880952d43036e51D8Fb54',
  '0xEdC6D89E3C9DbA324385bf991FD452B0b01831d4',
  '0xe6FAEb019Ba4257a525123CF4788eF14694b3eE4',
  '0xa528ad04aaA7DB8eC13e5dBAcAdc9B79B9081611',
  '0x5EaaEB862D8DcCde6C758EB91047c0de75e2e0A4',
  '0x3F511d9d3d967Fd51487fa2F989a1e64087ca2aA',
  '0x14a2c05ABDb85464f2a6DdAE1c24c0A4715f2806',
  '0xE8534d3A421aEc71B3917277339DE80b6E3217cE'
]
Triggering log upkeeps...
Triggered whitelist token log upkeep with fake token 0x9ddA5BA5aF92872145460AC8b60c41219cCdE4E3
Triggered remove token log upkeep with fake token 0x9ddA5BA5aF92872145460AC8b60c41219cCdE4E3

2. Manual checks

3. Manual steps

Performance results

  • Time to process 30 tokens: ~3mins

@imollov
imollov requested a review from airtoonricardo May 27, 2025 14:08

@airtoonricardo airtoonricardo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are overall looking good to me, just left some cleanup comments.

Comment thread package.json
"test:fork:v2_3": "FORK_ENABLED=true FORK_CHAIN=base BLOCK_NUMBER=27557816 npx hardhat test test/emissions/fork/v2_3/GaugeUpkeepManagerV2_3.test.ts",
"test:fork:prices": "FORK_ENABLED=true FORK_CHAIN=optimism BLOCK_NUMBER=135890825 npx hardhat test test/prices/fork/TokenUpkeepManager.test.ts",
"test:fork:prices": "FORK_ENABLED=true FORK_CHAIN=optimism BLOCK_NUMBER=135890825 npx hardhat test test/prices/fork/v2_1/TokenUpkeepManagerV2_1.test.ts",
"test:fork:prices:v2_3": "FORK_ENABLED=true FORK_CHAIN=base BLOCK_NUMBER=30517684 npx hardhat test test/prices/fork/v2_3/TokenUpkeepManagerV2_3.test.ts",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will likely have some conflicts with the changes in #55, so once that's merged this file should be updated accordingly (i.e.: test:fork should run all fork tests, etc)

import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {StableEnumerableSet} from "./libraries/StableEnumerableSet.sol";
import {StableEnumerableSet} from "../libraries/StableEnumerableSet.sol";
import {Log} from "@chainlink/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol";

@airtoonricardo airtoonricardo May 27, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we move the Log import above the StableEnumerableSet import? We usually try to separate external imports from internal ones.

uint8 private constant CONDITIONAL_TRIGGER_TYPE = 0;
string private constant UPKEEP_NAME = "Token upkeep";
uint256 internal constant TOKENS_PER_UPKEEP = 100;
uint256 internal constant UPKEEP_CANCEL_BUFFER = 20;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Think the UPKEEPP_CANCEL_BUFFER can remain as private, right? Since it is only used here

@@ -2,7 +2,7 @@
pragma solidity 0.8.6;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can also move the TokenUpkeep contract into the common folder

Comment thread scripts/prices/test/v2_3/deploy_live_test.ts
automationRegistrar: AutomationRegistrar2_3,
eventSignature: string,
voterAddress: string,
gaugeUpkeepManagerAddress: string,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should refactor the instances of gaugeUpkeepManagerAddress in this file to tokenUpkeepManagerAddress


uint256 private constant TOKENS_PER_UPKEEP = 100;
uint256 internal constant TOKENS_PER_UPKEEP = 100;
uint256 private constant UPKEEP_CANCEL_BUFFER = 20;

@airtoonricardo airtoonricardo May 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit: Can we move the private constant below the internal ones now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants