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 ba19ac0 commit db22887
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
3 changes: 2 additions & 1 deletion multichain-testing/test/fast-usdc/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export const makeFeedPolicy = (nobleAgoricChannelId: IBCChannelID) => {
nobleDomainId: 4,
chainPolicies: {
Arbitrum: {
attenuatedCttpBridgeAddress:
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
cctpTokenMessengerAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
chainId: 42161,
confirmations: 2,
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
},
},
};
Expand Down
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: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
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 @@ -68,7 +68,8 @@ export const configurations = {
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
chainId: 42161,
confirmations: 2,
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
attenuatedCttpBridgeAddress:
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
},
},
},
Expand Down Expand Up @@ -96,7 +97,8 @@ export const configurations = {
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
chainId: 42161,
confirmations: 2,
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
attenuatedCttpBridgeAddress:
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
},
},
},
Expand All @@ -121,7 +123,7 @@ export const configurations = {
cctpTokenMessengerAddress: '0xTODO',
chainId: 421614,
confirmations: 2,
nobleContractAddress: '0xTODO',
attenuatedCttpBridgeAddress: '0xTODO',
},
},
},
Expand All @@ -143,7 +145,7 @@ export const configurations = {
cctpTokenMessengerAddress: '0xTODO',
chainId: 421614,
confirmations: 2,
nobleContractAddress: '0xTODO',
attenuatedCttpBridgeAddress: '0xTODO',
},
},
},
Expand Down

0 comments on commit db22887

Please sign in to comment.