Boost _ Folks Finance 33684 - [Smart Contract - Critical] Lack of available liquidity check when sen
Description
Description
File: /contracts/hub/Hub.sol
function sendTokenToUser(
uint16 adapterId,
uint256 gasLimit,
bytes32 accountId,
bytes32 recipient,
SendToken memory sendToken
) internal {
// generate message to send token
IHubPool pool = loanManager.getPool(sendToken.poolId);
Messages.MessageToSend memory messageToSend = pool.getSendTokenMessage(
bridgeRouter,
adapterId,
gasLimit,
accountId,
sendToken.chainId,
sendToken.amount,
recipient
);
// send message (balance for user account already present in bridge router)
_sendMessage(messageToSend, 0);
}
File: /contracts/hub/HubPool.sol
function getSendTokenMessage(
IBridgeRouter bridgeRouter,
uint16 adapterId,
uint256 gasLimit,
bytes32 accountId,
uint16 chainId,
uint256 amount,
bytes32 recipient
) external override onlyRole(HUB_ROLE) nonReentrant returns (Messages.MessageToSend memory) {
// check chain is compatible
bytes32 spokeAddress = getChainSpoke(chainId);
// prepare message
Messages.MessageParams memory params = Messages.MessageParams({
adapterId: adapterId,
returnAdapterId: 0,
receiverValue: 0,
gasLimit: gasLimit,
returnGasLimit: 0
});
bytes memory extraArgs = _sendToken(bridgeRouter, spokeAddress, params, amount);
// construct message (will be sent from Hub)
return
Messages.MessageToSend({
params: params,
sender: Messages.convertEVMAddressToGenericAddress(msg.sender),
destinationChainId: chainId,
handler: spokeAddress,
payload: Messages.encodeMessagePayload(
Messages.MessagePayload({
action: Messages.Action.SendToken,
accountId: accountId,
userAddress: recipient,
data: abi.encodePacked(amount)
})
),
finalityLevel: 1, // finalised
extraArgs: extraArgs
});
}Impact
Recommended Mitigations
Proof of concept
Proof-of-Concept
PreviousBoost _ Folks Finance 33675 - [Smart Contract - Low] PythNodeprocess can revert because of incorrectNextBoost _ Folks Finance 33687 - [Smart Contract - Medium] Loan creation can be frontrun preventing the
Last updated
Was this helpful?