Skip to content

Commit

Permalink
[SubGraph] Add and modify events
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKim20 committed Feb 21, 2024
1 parent ece8689 commit 4cbe04e
Show file tree
Hide file tree
Showing 19 changed files with 545 additions and 7,070 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dms-osx-lib",
"version": "2.7.3",
"version": "2.7.5",
"description": "",
"main": "dist/bundle-cjs.js",
"module": "dist/bundle-esm.js",
Expand Down
15 changes: 10 additions & 5 deletions packages/contracts/contracts/controllers/LoyaltyBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import "../interfaces/ILedger.sol";
import "./LoyaltyBridgeStorage.sol";

contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgradeable, IBridge {
event BridgeDeposited(bytes32 depositId, address account, uint256 amount);
event BridgeWithdrawn(bytes32 withdrawId, address account, uint256 amount);
event BridgeDeposited(bytes32 depositId, address account, uint256 amount, uint256 balance);
event BridgeWithdrawn(bytes32 withdrawId, address account, uint256 amount, uint256 balance);

function initialize(address _validatorAddress) external initializer {
__UUPSUpgradeable_init();
Expand Down Expand Up @@ -97,7 +97,7 @@ contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeabl

DepositData memory data = DepositData({ account: _account, amount: _amount });
deposits[_depositId] = data;
emit BridgeDeposited(_depositId, _account, _amount);
emit BridgeDeposited(_depositId, _account, _amount, ledgerContract.tokenBalanceOf(_account));
}

/// @notice 브리지에서 자금을 인출합니다. 검증자들의 합의가 완료되면 인출이 됩니다.
Expand All @@ -124,7 +124,7 @@ contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeabl
ledgerContract.transferToken(address(this), _account, withdrawalAmount);
ledgerContract.transferToken(address(this), feeAccount, fee);
withdraws[_withdrawId].executed = true;
emit BridgeWithdrawn(_withdrawId, _account, withdrawalAmount);
emit BridgeWithdrawn(_withdrawId, _account, withdrawalAmount, ledgerContract.tokenBalanceOf(_account));
}
}
}
Expand All @@ -139,7 +139,12 @@ contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeabl
ledgerContract.transferToken(address(this), withdraws[_withdrawId].account, withdrawalAmount);
ledgerContract.transferToken(address(this), feeAccount, fee);
withdraws[_withdrawId].executed = true;
emit BridgeWithdrawn(_withdrawId, withdraws[_withdrawId].account, withdrawalAmount);
emit BridgeWithdrawn(
_withdrawId,
withdraws[_withdrawId].account,
withdrawalAmount,
ledgerContract.tokenBalanceOf(withdraws[_withdrawId].account)
);
}
}
}
Expand Down
12 changes: 8 additions & 4 deletions packages/contracts/contracts/controllers/LoyaltyBurner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ contract LoyaltyBurner is LoyaltyBurnerStorage, Initializable, OwnableUpgradeabl
uint256 amount;
}

event BurnedUnPayablePoint(bytes32 phone, uint256 amount);
event BurnedPoint(address account, uint256 amount);
event BurnedUnPayablePoint(bytes32 phone, uint256 amount, uint256 balance);
event BurnedPoint(address account, uint256 amount, uint256 balance);

function initialize(address _validatorAddress, address _linkAddress) external initializer {
__UUPSUpgradeable_init();
Expand Down Expand Up @@ -111,7 +111,11 @@ contract LoyaltyBurner is LoyaltyBurnerStorage, Initializable, OwnableUpgradeabl
}
if (burnAmount > 0) {
ledgerContract.burnUnPayablePoint(data.phone, burnAmount);
emit BurnedUnPayablePoint(data.phone, burnAmount);
emit BurnedUnPayablePoint(
data.phone,
burnAmount,
ledgerContract.unPayablePointBalanceOf(data.phone)
);
}
} else if (data.pointType == 1) {
uint256 balance = ledgerContract.pointBalanceOf(data.account);
Expand All @@ -125,7 +129,7 @@ contract LoyaltyBurner is LoyaltyBurnerStorage, Initializable, OwnableUpgradeabl
}
if (burnAmount > 0) {
ledgerContract.burnPoint(data.account, burnAmount);
emit BurnedPoint(data.account, burnAmount);
emit BurnedPoint(data.account, burnAmount, ledgerContract.pointBalanceOf(data.account));
}
}
}
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": "dms-osx-artifacts",
"version": "2.7.3",
"version": "2.7.5",
"description": "Smart contracts that decentralized point systems",
"files": [
"**/*.sol"
Expand Down
2 changes: 1 addition & 1 deletion packages/faker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"axios": "^1.6.7",
"chai": "^4.3.7",
"del-osx-artifacts": "^2.2.0",
"dms-osx-artifacts": "^2.7.3",
"dms-osx-artifacts": "^2.7.5",
"dotenv": "^10.0.0",
"ethereum-waffle": "^4.0.10",
"ethers": "npm:boa-ethers2@^5.7.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/relay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"chai-http": "^4.3.7",
"cors": "^2.8.5",
"del-osx-artifacts": "^2.2.0",
"dms-osx-artifacts": "^2.7.3",
"dms-osx-artifacts": "^2.7.5",
"dotenv": "^10.0.0",
"ethereum-waffle": "^4.0.10",
"ethereumjs-util": "^7.1.5",
Expand Down
2 changes: 2 additions & 0 deletions packages/subgraph/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
subgraph.yaml
generated/
build/
Loading

0 comments on commit 4cbe04e

Please sign in to comment.