Skip to content

Conversation

@nialexsan
Copy link
Contributor

No description provided.

Comment on lines 529 to 545
access(self) fun _toCadenceOut(
_ amt: UInt256,
erc20Address: EVM.EVMAddress
): UFix64 {
// Bridge utils already floors when going UInt256 -> UFix64
return FlowEVMBridgeUtils.convertERC20AmountToCadenceAmount(
amt,
erc20Address: erc20Address
)
}

/// IN amounts: round up to the next UFix64 such that the ERC20 conversion
/// (via ufix64ToUInt256) is >= the original UInt256 amount.
access(self) fun _toCadenceIn(
_ amt: UInt256,
erc20Address: EVM.EVMAddress
): UFix64 {
Copy link
Collaborator

@sisyphusSmiling sisyphusSmiling Dec 12, 2025

Choose a reason for hiding this comment

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

IMO we should add test cases & ensure cases across extremes are covered since rounding is a common failure point. Will likely require exposing _toCadenceIn() these methods as access(all)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added tests and moved the methods to the contract level for convenience

@Kay-Zee Kay-Zee merged commit 95005ee into main Dec 14, 2025
3 checks passed
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.

3 participants