The fee to transfer to the CCIP router to send a message is calculated with a hardcoded amount of 1000 wstLink
tokens. However, a user can send any amount of tokens.
That leads to either the user providing more tokens than needed and the WrappedTokenBridge
getting the refunded tokens, or not sufficient amount of tokens for the fee and the user not being able to send such big amount of tokens.
Inside WrappedTokenBridge
we can see the following function to obtain the fee needed to pay to the CCIP router to send a message:
Here the user can encounter 2 different situations:
The amount of wstLink
that the user wants to bridge requires LESS amount of CCIP fee
In this situation the following will happen.
- The user will initiate the transfer via transferAndCall()
on the stLink
token
- The contract will wrap the transfered tokens into wstLink
- The contract will compute the fee to transfer to the router in order to execute the CCIP transfer taking into account 1000 tokens
- The contract will transfer the computed amount from the user to the router
- Since the real CCIP message needed less amount of fee than the computed, the router will refund the remaining linkToken
to the contract
The result will be the user having paid more than needed to transfer his tokens
The amount of wstLink
that the user wants to bridge requires MORE amount of CCIP fee
In this situation the following will happen.
- The user will initiate the transfer via transferAndCall()
on the stLink
token
- The contract will wrap the transfered tokens into wstLink
- The contract will compute the fee to transfer to the router in order to execute the CCIP transfer taking into account 1000 tokens
- The contract will transfer the computed amount from the user to the router
- Since the real CCIP message requires more funds to execute the message, the CCIP call will fail because of not providing enough funds to pay the fee
The result will be the user getting his transaction reverted
Medium
Manual review
Compute the fee to send the CCIP message with the real amount of tokens to transfer.
To do that we need a function that simulates the wrapping of the tokens in order to know the real amount to transfer and then calculate the fee.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.