Skip to content

Fetch offchain data aptos #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

RodrigoAD
Copy link
Member

@RodrigoAD RodrigoAD commented Mar 17, 2025

  • Abstracts Events into a more chain agnostic type
  • Create translators from the common event type to EVM and Aptos
  • Abstract attestations clients

TODO in other PR

  • Create Aptos specific USDC and LBTC event identifiers

Copy link
Member Author

@RodrigoAD RodrigoAD left a comment

Choose a reason for hiding this comment

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

@andrevmatos I would really appreciate an initial look to validate the approach

@@ -257,3 +268,134 @@ export async function fetchOffchainTokenData(
}
return offchainTokenData
}

// ----- Logic Replication using a chain agnostic input -----
export type FetchOffchainTokenDataInput = {
Copy link
Member Author

Choose a reason for hiding this comment

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

New type for the fetchOffchainTokenData function that abstracts events part in a common type, ChainEvent, that each chain specific event can adapt to

tokenAmounts: TokenAmounts
}

export async function fetchOffchainTokenDataV2(
Copy link
Member Author

Choose a reason for hiding this comment

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

Replication of fetchOffchainTokenData function to validate refactor

messageHash: string
}

export interface AttestationClient {
Copy link
Member Author

Choose a reason for hiding this comment

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

Small abstraction over the atts. clients, in case more come in

@RodrigoAD RodrigoAD force-pushed the fetch-offchain-data-aptos branch from 5a32779 to 7c7549a Compare March 25, 2025 10:51
Copy link

github-actions bot commented Mar 25, 2025

Coverage Report

--------------------------------|---------|----------|---------|---------|---------------------------------------------------
File                            | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                                 
--------------------------------|---------|----------|---------|---------|---------------------------------------------------
All files                       |   91.92 |    78.76 |   88.76 |   93.33 |                                                   
 abi                            |     100 |      100 |     100 |     100 |                                                   
  BurnMintERC677Token.ts        |     100 |      100 |     100 |     100 |                                                   
  BurnMintTokenPool_1_5_1.ts    |     100 |      100 |     100 |     100 |                                                   
  CommitStore_1_2.ts            |     100 |      100 |     100 |     100 |                                                   
  CommitStore_1_5.ts            |     100 |      100 |     100 |     100 |                                                   
  FeeQuoter_1_6.ts              |     100 |      100 |     100 |     100 |                                                   
  LockReleaseTokenPool_1_5_1.ts |     100 |      100 |     100 |     100 |                                                   
  OffRamp_1_2.ts                |     100 |      100 |     100 |     100 |                                                   
  OffRamp_1_5.ts                |     100 |      100 |     100 |     100 |                                                   
  OffRamp_1_6.ts                |     100 |      100 |     100 |     100 |                                                   
  OnRamp_1_2.ts                 |     100 |      100 |     100 |     100 |                                                   
  OnRamp_1_5.ts                 |     100 |      100 |     100 |     100 |                                                   
  OnRamp_1_6.ts                 |     100 |      100 |     100 |     100 |                                                   
  Router.ts                     |     100 |      100 |     100 |     100 |                                                   
  TokenAdminRegistry_1_5.ts     |     100 |      100 |     100 |     100 |                                                   
 lib                            |   91.81 |    81.26 |   94.11 |    94.1 |                                                   
  commits.ts                    |    92.1 |    70.37 |     100 |   97.05 | 92                                                
  errors.ts                     |   94.25 |    87.23 |     100 |   96.25 | 169,188,196                                       
  execution.ts                  |   84.14 |    70.17 |      76 |   87.67 | 65-67,137-144,209-210,231-232,282,344-359,392,401 
  gas.ts                        |   91.66 |    63.63 |     100 |   94.28 | 69,81                                             
  offchain.ts                   |   97.87 |    93.75 |   96.15 |   97.77 | 29,162,256                                        
  requests.ts                   |   91.66 |    81.39 |     100 |   94.11 | 60-65,137,350,384                                 
  selectors.ts                  |     100 |      100 |     100 |     100 |                                                   
  types.ts                      |     100 |      100 |     100 |     100 |                                                   
  utils.ts                      |   90.34 |    79.66 |     100 |   93.23 | 54,67,74-75,189-191,210,241                       
 lib/attestation                |    90.9 |    73.33 |     100 |   90.62 |                                                   
  index.ts                      |     100 |      100 |     100 |     100 |                                                   
  lbtc.ts                       |   94.44 |    77.77 |     100 |   94.11 | 40                                                
  usdc.ts                       |   83.33 |    66.66 |     100 |   83.33 | 28,37                                             
 lib/events                     |   88.73 |        0 |      65 |   84.61 |                                                   
  aptos.ts                      |   66.66 |      100 |       0 |      50 | 18,29,33,37,41,45                                 
  events.ts                     |     100 |      100 |     100 |     100 |                                                   
  evm.ts                        |   93.54 |        0 |     100 |      92 | 47,50                                             
  index.ts                      |     100 |      100 |      50 |     100 |                                                   
 lib/hasher                     |   93.19 |       65 |   81.25 |   92.65 |                                                   
  aptos.ts                      |    92.3 |      100 |   71.42 |   91.66 | 11-12                                             
  common.ts                     |     100 |      100 |     100 |     100 |                                                   
  evm.ts                        |     100 |      100 |     100 |     100 |                                                   
  hasher.ts                     |    90.9 |       80 |     100 |    90.9 | 28                                                
  index.ts                      |     100 |      100 |   42.85 |     100 |                                                   
  merklemulti.ts                |   91.15 |    61.76 |     100 |   90.74 | 52,147,210,229,233,239,243,248,295,304            
--------------------------------|---------|----------|---------|---------|---------------------------------------------------

@RodrigoAD RodrigoAD marked this pull request as ready for review March 25, 2025 12:51
@RodrigoAD RodrigoAD requested a review from a team as a code owner March 25, 2025 12:51
@RodrigoAD RodrigoAD requested a review from andrevmatos March 25, 2025 12:52
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