ava-labs / teleporter-token-bridge

Token bridging cross-chain built on top of Teleporter
Other
10 stars 5 forks source link

Separate fees #109

Closed minghinmatthewlam closed 1 month ago

minghinmatthewlam commented 1 month ago

Why this should be merged

Adds support for specifying an asset to be used to pay for optional Teleporter message fees that is different than the asset being bridged.

Also, fixes a bug in which the optional secondaryFee for multi-hop messages was not properly scaled to the denomination of the source chain that the fee is paid on.

How this works

The asset to be used to add an optional Teleporter message fee is specified in the SendTokensInput struct. The fee amount is no longer deduct from the amount being bridged, since it may not be the same asset.

For multi-hop transfer, the optional secondaryFee for the second message is still always paid in-kind of the asset being bridged. We think this provides the best user experience because otherwise the asset to be used for the second message would need to be approved for spending by the bridge contracts on the intermediate/source chain by the user, which at best would require an interaction on that chain which is not otherwise required.

How this was tested

Unit tests and CI

How is this documented

TODO (README update and in line comments)

Fixes #102

openzeppelin-code[bot] commented 1 month ago

Separate fees

Generated at commit: d13282359039eaeefa1ccdcf833c549db66d63b8

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
0
0
2
14
17
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector