Skip to content

Commit b86ae27

Browse files
authored
Merge pull request #15 from thirdweb-dev/yash/fix-event-issues
Emit developer fee in event without extra var
2 parents 56a736e + 55faed0 commit b86ae27

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/UniversalBridgeV1.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ contract UniversalBridgeV1 is EIP712, Initializable, UUPSUpgradeable, OwnableRol
196196
uint256 contractEthBalanceBefore = address(this).balance - msg.value;
197197

198198
// distribute fees
199-
(uint256 totalFeeAmount, uint256 protocolFee, uint256 developerFee) = _distributeFees(
199+
(uint256 protocolFee, uint256 developerFee) = _distributeFees(
200200
req.tokenAddress,
201201
req.tokenAmount,
202202
req.developerFeeRecipient,
203203
req.developerFeeBps
204204
);
205205

206206
if (_isNativeToken(req.tokenAddress)) {
207-
uint256 sendValue = msg.value - totalFeeAmount;
207+
uint256 sendValue = msg.value - protocolFee - developerFee; // subtract total fee amount from sent value
208208

209209
if (sendValue < req.tokenAmount) {
210210
revert UniversalBridgeMismatchedValue(req.tokenAmount, sendValue);
@@ -320,13 +320,12 @@ contract UniversalBridgeV1 is EIP712, Initializable, UUPSUpgradeable, OwnableRol
320320
uint256 tokenAmount,
321321
address developerFeeRecipient,
322322
uint256 developerFeeBps
323-
) private returns (uint256, uint256, uint256) {
323+
) private returns (uint256, uint256) {
324324
address protocolFeeRecipient = _universalBridgeStorage().protocolFeeRecipient;
325325
uint256 protocolFeeBps = _universalBridgeStorage().protocolFeeBps;
326326

327327
uint256 protocolFee = (tokenAmount * protocolFeeBps) / 10_000;
328328
uint256 developerFee = (tokenAmount * developerFeeBps) / 10_000;
329-
uint256 totalFeeAmount = protocolFee + developerFee;
330329

331330
if (_isNativeToken(tokenAddress)) {
332331
if (protocolFee != 0) {
@@ -346,7 +345,7 @@ contract UniversalBridgeV1 is EIP712, Initializable, UUPSUpgradeable, OwnableRol
346345
}
347346
}
348347

349-
return (totalFeeAmount, protocolFee, developerFee);
348+
return (protocolFee, developerFee);
350349
}
351350

352351
function _domainNameAndVersion() internal pure override returns (string memory name, string memory version) {

0 commit comments

Comments
 (0)