Skip to content
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

Translate capdata into flat JSON #5878

Closed
gibson042 opened this issue Aug 2, 2022 · 1 comment · Fixed by #5880
Closed

Translate capdata into flat JSON #5878

gibson042 opened this issue Aug 2, 2022 · 1 comment · Fixed by #5880
Assignees
Labels
enhancement New feature or request Inter-protocol Overarching Inter Protocol

Comments

@gibson042
Copy link
Member

gibson042 commented Aug 2, 2022

What is the Problem Being Solved?

External consumers should not be expected to work with complex structured data, especially when that structure is @qclass-heavy capdata.

Description of the Design

Create a utility for converting capdata into flat JSON, e.g. from

{
  centralAmount: {
    brand: { '@qclass': 'slot', iface: 'Alleged: RUN brand', index: 0 },
    value: { '@qclass': 'bigint', digits: '1859152806' }
  },
  liquidityTokens: {
    brand: {
      '@qclass': 'slot',
      iface: 'Alleged: BLDPoolLiquidity brand',
      index: 1
    },
    value: { '@qclass': 'bigint', digits: '4455322155' }
  },
  secondaryAmount: {
    brand: { '@qclass': 'slot', iface: 'Alleged: BLD brand', index: 2 },
    value: { '@qclass': 'bigint', digits: '2159517880' }
  }
}

to

{ "central": "1859152806", "centralBrandBoardId": "board0425", "centralBrandAllegedName": "RUN", "liquidity": "4455322155", "liquidityBrandBoardId": "board03125", "liquidityBrandAllegedName": "BLDPoolLiquidity", "secondary": "2159517880", "secondaryBrandBoardId": "board03523", "secondaryBrandAllegedName": "BLD" }

Security Considerations

The utility should be written such that adopting it does not risk a significant increase to potentially vulnerable surface area (e.g. by installing a complex executable).

Test Plan

TBD

@gibson042 gibson042 added enhancement New feature or request MUST-HAVE labels Aug 2, 2022
@gibson042 gibson042 self-assigned this Aug 2, 2022
@dckc
Copy link
Member

dckc commented Aug 2, 2022

How does this integrate with the rest of the system? Does it get added to each contract?

Oh! it's a completely outboard, post-processing widget? OK.

@dckc dckc added the Inter-protocol Overarching Inter Protocol label Aug 2, 2022
gibson042 added a commit that referenced this issue Aug 2, 2022
turadg pushed a commit that referenced this issue Aug 7, 2022
@mergify mergify bot closed this as completed in #5880 Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Inter-protocol Overarching Inter Protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants