Skip to content

Commit

Permalink
chore: ChainPolicy schema
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
0xpatrickdev committed Dec 11, 2024
1 parent 8f9f075 commit f046f07
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Binary file modified packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap
Binary file not shown.
19 changes: 8 additions & 11 deletions packages/fast-usdc/src/type-guards.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,13 @@ export const PoolMetricsShape = {
harden(PoolMetricsShape);

/** @type {TypedPattern<ChainPolicy>} */
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<FeedPolicy>}
Expand All @@ -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() },
);
Expand Down
7 changes: 5 additions & 2 deletions packages/fast-usdc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 6 additions & 4 deletions packages/fast-usdc/src/utils/deploy-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ export const configurations = {
nobleDomainId: 4,
chainPolicies: {
Arbitrum: {
attenuatedCttpBridgeAddress:
'0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347',
cctpTokenMessengerAddress:
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
chainId: 42161,
confirmations: 2,
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
},
},
},
Expand All @@ -92,11 +93,12 @@ export const configurations = {
nobleDomainId: 4,
chainPolicies: {
Arbitrum: {
attenuatedCttpBridgeAddress:
'0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347',
cctpTokenMessengerAddress:
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
chainId: 42161,
confirmations: 2,
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
},
},
},
Expand All @@ -118,10 +120,10 @@ export const configurations = {
nobleDomainId: 4,
chainPolicies: {
Arbitrum: {
attenuatedCttpBridgeAddress: '0xTODO',
cctpTokenMessengerAddress: '0xTODO',
chainId: 421614,
confirmations: 2,
nobleContractAddress: '0xTODO',
},
},
},
Expand All @@ -140,10 +142,10 @@ export const configurations = {
nobleDomainId: 4,
chainPolicies: {
Arbitrum: {
attenuatedCttpBridgeAddress: '0xTODO',
cctpTokenMessengerAddress: '0xTODO',
chainId: 421614,
confirmations: 2,
nobleContractAddress: '0xTODO',
},
},
},
Expand Down

0 comments on commit f046f07

Please sign in to comment.