Skip to content

Commit

Permalink
chore: fusdc ChainPolicy schema (#10679)
Browse files Browse the repository at this point in the history
## Description
- rename `nobleContractAddress` to `attenuatedCttpBridgeAddress` as it better captures the functionality in FUSDC.
  - the contract deployed to this address must be an attenuated wrapper around Circle's TokenMessenger that does not contain `replaceDepositForBurn` . The Oracle Nodes must only report transactions where `depositor` for `DepositForBurn` is this value.
- include jsdoc comments for `ChainPolicy` type

### Security Considerations
None

### Scaling Considerations
None

### Documentation Considerations
Improves docs via jsdoc annotations

### Testing Considerations
None

### Upgrade Considerations
None, unreleased code
  • Loading branch information
mergify[bot] authored Dec 12, 2024
2 parents 8f9f075 + 8955990 commit bdf5c17
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 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
9 changes: 6 additions & 3 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;
confirmations: number;
/** e.g., `1` for ETH mainnet 42161 for Arbitrum One. @see {@link https://chainlist.org/} */
chainId: EvmChainID;
chainType?: number;
/** the number of block confirmations to observe before reporting */
confirmations: 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 bdf5c17

Please sign in to comment.