Skip to content

Commit

Permalink
Revert "Remove the balance in the event"
Browse files Browse the repository at this point in the history
This reverts commit 819893f.
  • Loading branch information
danial303065 authored and MichaelKim20 committed Aug 6, 2024
1 parent 9df9158 commit f0e48ac
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions packages/contracts/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ contract Bridge is BridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgrade

DepositData memory data = DepositData({ tokenId: _tokenId, account: msg.sender, amount: msg.value });
deposits[_depositId] = data;
emit BridgeDeposited(_tokenId, _depositId, data.account, data.amount);
emit BridgeDeposited(_tokenId, _depositId, data.account, data.amount, 0);
} else {
require(_amount % 1 gwei == 0, "1030");
require(_amount > tokenInfos[_tokenId].fee, "1031");
Expand All @@ -123,7 +123,7 @@ contract Bridge is BridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgrade
if (token.delegatedTransfer(_account, address(this), _amount, _expiry, _signature)) {
DepositData memory data = DepositData({ tokenId: _tokenId, account: _account, amount: _amount });
deposits[_depositId] = data;
emit BridgeDeposited(_tokenId, _depositId, data.account, data.amount);
emit BridgeDeposited(_tokenId, _depositId, data.account, data.amount, 0);
}
}
}
Expand Down Expand Up @@ -160,7 +160,7 @@ contract Bridge is BridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgrade
payable(_account).transfer(withdrawalAmount);
payable(protocolFeeAccount).transfer(tokenInfos[_tokenId].fee);
withdraws[_withdrawId].executed = true;
emit BridgeWithdrawn(_tokenId, _withdrawId, _account, withdrawalAmount);
emit BridgeWithdrawn(_tokenId, _withdrawId, _account, withdrawalAmount, 0);
}
}
} else {
Expand Down Expand Up @@ -188,7 +188,7 @@ contract Bridge is BridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgrade
token.transfer(_account, withdrawalAmount);
token.transfer(protocolFeeAccount, tokenInfos[_tokenId].fee);
withdraws[_withdrawId].executed = true;
emit BridgeWithdrawn(_tokenId, _withdrawId, _account, withdrawalAmount);
emit BridgeWithdrawn(_tokenId, _withdrawId, _account, withdrawalAmount, 0);
}
}
}
Expand All @@ -208,15 +208,15 @@ contract Bridge is BridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgrade
payable(withdraws[_withdrawId].account).transfer(withdrawalAmount);
payable(protocolFeeAccount).transfer(tokenInfos[tokenId].fee);
withdraws[_withdrawId].executed = true;
emit BridgeWithdrawn(tokenId, _withdrawId, withdraws[_withdrawId].account, withdrawalAmount);
emit BridgeWithdrawn(tokenId, _withdrawId, withdraws[_withdrawId].account, withdrawalAmount, 0);
}
} else {
BIP20DelegatedTransfer token = tokenInfos[tokenId].token;
if (token.balanceOf(address(this)) >= withdraws[_withdrawId].amount) {
token.transfer(withdraws[_withdrawId].account, withdrawalAmount);
token.transfer(protocolFeeAccount, tokenInfos[tokenId].fee);
withdraws[_withdrawId].executed = true;
emit BridgeWithdrawn(tokenId, _withdrawId, withdraws[_withdrawId].account, withdrawalAmount);
emit BridgeWithdrawn(tokenId, _withdrawId, withdraws[_withdrawId].account, withdrawalAmount, 0);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/contracts/interfaces/IBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
pragma solidity ^0.8.2;

interface IBridge {
event BridgeDeposited(bytes32 tokenId, bytes32 depositId, address account, uint256 amount);
event BridgeWithdrawn(bytes32 tokenId, bytes32 withdrawId, address account, uint256 amount);
event BridgeDeposited(bytes32 tokenId, bytes32 depositId, address account, uint256 amount, uint256 balance);
event BridgeWithdrawn(bytes32 tokenId, bytes32 withdrawId, address account, uint256 amount, uint256 balance);

struct DepositData {
bytes32 tokenId;
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acc-bridge-contracts-v2",
"version": "2.4.0",
"version": "2.3.1",
"description": "Bridge smart contracts of for decentralized loyalty systems",
"files": [
"**/*.sol"
Expand Down
2 changes: 1 addition & 1 deletion packages/library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acc-bridge-contracts-lib-v2",
"version": "2.4.0",
"version": "2.3.0",
"description": "",
"main": "dist/bundle-cjs.js",
"module": "dist/bundle-esm.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@types/urijs": "^1.19.12"
},
"dependencies": {
"acc-bridge-contracts-v2": "~2.4.0",
"acc-bridge-contracts-v2": "~2.3.1",
"argparse": "^2.0.1",
"assert": "^2.0.0",
"axios": "^1.6.7",
Expand Down

0 comments on commit f0e48ac

Please sign in to comment.