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

Warp route deployer should derive scale factor from decimal config #5296

Open
yorhodes opened this issue Jan 25, 2025 · 0 comments
Open

Warp route deployer should derive scale factor from decimal config #5296

yorhodes opened this issue Jan 25, 2025 · 0 comments

Comments

@yorhodes
Copy link
Member

yorhodes commented Jan 25, 2025

Problem

#5233 introduces scaling to fungible warp routes.

There is an optional scale field on the TokenMetadataSchema for configuring this value (default is 1).

When a warp route is configured with non-uniform decimals, the scale value should be validated and derived to ensure that the warp route is correctly scaled.

Solution

Given some config

chainA:
    ...
    decimals: 18
chainB:
    ...
    decimals: 6

The scale value should be derived as follows:

const messageDecimals = Math.max(chainA.decimals, chainB.decimals); // 18
const scaleA = 10 ** (messageDecimals - chainA.decimals); // 10^0 = 1
const scaleB = 10 ** (messageDecimals - chainB.decimals); // 10^12
@yorhodes yorhodes added the sdk label Jan 25, 2025
yorhodes added a commit that referenced this issue Jan 27, 2025
### Description

- Adopt scale across warp route contracts
- Remove native scaled and support scaled everywhere
- Update SDK deployer code to use new constructors

### Related issues

- opens #5296

### Backward compatibility

SDK/CLI yes, core no

### Testing

Unit Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants