From f046f071da601fc37a06793ef36a53f82cef86ac Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Wed, 11 Dec 2024 11:50:29 -0500 Subject: [PATCH] chore: `ChainPolicy` schema - rename `nobleContractAddress` to `attenuatedCttpBridgeAddress` - include jsdoc comments for `ChainPolicy` type - removed `chainType` from `ChainPolicy`. unused and should have been an enum. not needed for OCW currently --- .../fast-usdc/snapshots/fast-usdc.test.ts.md | 2 +- .../snapshots/fast-usdc.test.ts.snap | Bin 2150 -> 2198 bytes packages/fast-usdc/src/type-guards.js | 19 ++++++++---------- packages/fast-usdc/src/types.ts | 7 +++++-- packages/fast-usdc/src/utils/deploy-config.js | 10 +++++---- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md b/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md index 4b19508a1d9..f27a41da2c4 100644 --- a/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md +++ b/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md @@ -17,10 +17,10 @@ Generated by [AVA](https://avajs.dev). { chainPolicies: { Arbitrum: { + attenuatedCttpBridgeAddress: '0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347', cctpTokenMessengerAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A', chainId: 42161, confirmations: 2, - nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A', }, }, nobleAgoricChannelId: 'channel-21', diff --git a/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap b/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap index 0245ac610536e1cb1eb05b4dcbb3488a31497b0d..4647d12715fa8bbddbe4a9e3641aa8f369ea9e3a 100644 GIT binary patch literal 2198 zcmV;H2x<30RzVOlNz##;%&pE-_$~`z0tIc&O(OlZyz#A>t3=L{Ja}PX+Zj&*Owc z6(x2>6x9mApwK)W9Y8;dEa{L?W*UgsvDKE$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fb+EglgV%m_CXN-{;}1JugBx+K0_w zSlbScUwId6a&0wxRS&OqZ#dt+KeV$m z*^t+S;)yy`MSZ?2@viDb1NgtL%2hqHPWG8u=`M;K>*mrf+pYn&-7#BJinqwi!?bvy z{;rg0`}$}uLn)=FgyKhOA71-pb0HU<=EdfxX8M9!G|__Sh|#rUKd2Wd9@e<)F|{3) zvXIB5yu3w^HECjAgie*~J%A?y9eBfI^r6e1sy-PvJ)}E4s8{Ld93g8$9-57uXIoM} zyY8vEOR_oKyJ4>p*4R3iv>{!GGIt|7wDoK(KKA!JcA$NI1Qw=$n+jI(c z*;%r4`SMbZEi4{(mYsZ#IrehFUgBlP&F7bFcX4UStrW_Y#WK$ysZ ca;nO`kg82uWwOfU|8_(AAEU=jv>h7&0JuFVy#N3J diff --git a/packages/fast-usdc/src/type-guards.js b/packages/fast-usdc/src/type-guards.js index a645f90bae4..ebc50505267 100644 --- a/packages/fast-usdc/src/type-guards.js +++ b/packages/fast-usdc/src/type-guards.js @@ -94,16 +94,13 @@ export const PoolMetricsShape = { harden(PoolMetricsShape); /** @type {TypedPattern} */ -export const ChainPoliciesShape = M.splitRecord( - { - nobleContractAddress: EvmHashShape, - cctpTokenMessengerAddress: EvmHashShape, - confirmations: M.number(), - chainId: M.number(), - }, - { chainType: M.number() }, -); -harden(ChainPoliciesShape); +export const ChainPolicyShape = { + attenuatedCttpBridgeAddress: EvmHashShape, + cctpTokenMessengerAddress: EvmHashShape, + confirmations: M.number(), + chainId: M.number(), +}; +harden(ChainPolicyShape); /** * @type {TypedPattern} @@ -115,7 +112,7 @@ export const FeedPolicyShape = M.splitRecord( { nobleDomainId: M.number(), nobleAgoricChannelId: M.string(), - chainPolicies: M.recordOf(M.string(), ChainPoliciesShape), + chainPolicies: M.recordOf(M.string(), ChainPolicyShape), }, { eventFilter: M.string() }, ); diff --git a/packages/fast-usdc/src/types.ts b/packages/fast-usdc/src/types.ts index ee9a90efffd..2173b4e42e8 100644 --- a/packages/fast-usdc/src/types.ts +++ b/packages/fast-usdc/src/types.ts @@ -58,11 +58,14 @@ export interface PoolMetrics extends PoolStats { } export interface ChainPolicy { - nobleContractAddress: EvmHash; + /** `msg.sender` of DepositAndBurn to TokenMessenger must be an attenuated wrapper contract that does not contain `replaceDepositForBurn` */ + attenuatedCttpBridgeAddress: EvmHash; + /** @see {@link https://developers.circle.com/stablecoins/evm-smart-contracts} */ cctpTokenMessengerAddress: EvmHash; + /** the number of block confirmations to observe before reporting */ confirmations: number; + /** e.g., `1` for ETH mainnet 42161 for Arbitrum One. @see {@link https://chainlist.org/} */ chainId: EvmChainID; - chainType?: number; } export interface FeedPolicy { diff --git a/packages/fast-usdc/src/utils/deploy-config.js b/packages/fast-usdc/src/utils/deploy-config.js index 653d95ff293..7b160a7996c 100644 --- a/packages/fast-usdc/src/utils/deploy-config.js +++ b/packages/fast-usdc/src/utils/deploy-config.js @@ -64,11 +64,12 @@ export const configurations = { nobleDomainId: 4, chainPolicies: { Arbitrum: { + attenuatedCttpBridgeAddress: + '0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347', cctpTokenMessengerAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A', chainId: 42161, confirmations: 2, - nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A', }, }, }, @@ -92,11 +93,12 @@ export const configurations = { nobleDomainId: 4, chainPolicies: { Arbitrum: { + attenuatedCttpBridgeAddress: + '0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347', cctpTokenMessengerAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A', chainId: 42161, confirmations: 2, - nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A', }, }, }, @@ -118,10 +120,10 @@ export const configurations = { nobleDomainId: 4, chainPolicies: { Arbitrum: { + attenuatedCttpBridgeAddress: '0xTODO', cctpTokenMessengerAddress: '0xTODO', chainId: 421614, confirmations: 2, - nobleContractAddress: '0xTODO', }, }, }, @@ -140,10 +142,10 @@ export const configurations = { nobleDomainId: 4, chainPolicies: { Arbitrum: { + attenuatedCttpBridgeAddress: '0xTODO', cctpTokenMessengerAddress: '0xTODO', chainId: 421614, confirmations: 2, - nobleContractAddress: '0xTODO', }, }, },