Skip to content

Conversation

@tbwebb22
Copy link

@tbwebb22 tbwebb22 commented Oct 16, 2025

Cleans up functionality around decimal conversion and EVM <> Core bridging dust calculations
Adds spotPx function for getting spot market price

@tbwebb22 tbwebb22 changed the base branch from master to audit-oct-20 October 16, 2025 21:35
);

if (amounts.evm != 0) {
(uint256 _amountEVMToSend, uint64 _amountCoreToReceive) = maximumEVMSendAmountToAmounts(amountEVM, decimalDiff);
Copy link
Author

Choose a reason for hiding this comment

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

do we even want to modify the EVM send amount here? or rely on the higher level contract to do this?

// Transfer the tokens to this contract's address on HyperCore
IERC20(erc20EVMAddress).safeTransfer(toAssetBridgeAddress(erc20CoreIndex), amounts.evm);
) internal returns (uint256 amountEVMSent, uint64 amountCoreToReceive) {
(uint256 _amountEVMToSend, uint64 _amountCoreToReceive) = maximumEVMSendAmountToAmounts(amountEVM, decimalDiff);
Copy link
Author

Choose a reason for hiding this comment

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

do we even want to modify the EVM send amount here? or rely on the higher level contract to do this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly would expect the higher level caller to always use the maximumEVMSendAmountToAmounts themselves when sending.

If they don't, they're risking making an error in accounting. And then the maximumEVMSendAmountToAmounts won't save them anyway?

Actually, if we do leave these in, we can assert the returned values against the actual amounts that we're sending. This costs a bit of gas and is kind of a "hidden execution flow", but I'm leaning we leave these here I guess.

@tbwebb22 tbwebb22 marked this pull request as ready for review October 16, 2025 23:24
@grasphoper
Copy link
Contributor

This PR is great, adds just what we need!

@grasphoper grasphoper merged commit 54607f3 into audit-oct-20 Oct 17, 2025
9 of 10 checks passed
@grasphoper grasphoper deleted the hypercorelib-fixes branch October 17, 2025 03:12
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