Skip to content

Commit

Permalink
add events to builders
Browse files Browse the repository at this point in the history
  • Loading branch information
YouStillAlive committed Apr 11, 2024
1 parent 6f6965b commit 58f6d0f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/Builder/BuilderState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import "@poolzfinance/poolz-helper-v2/contracts/interfaces/ILockDealNFT.sol";
contract BuilderState {
ILockDealNFT public immutable lockDealNFT;

event MassPoolsCreated(address indexed token, IProvider indexed provider, uint256 firstPoolId, uint256 userLength);

constructor(ILockDealNFT _lockDealNFT) {
require(address(_lockDealNFT) != address(0), "BuilderState: lockDealNFT zero address");
lockDealNFT = _lockDealNFT;
Expand Down
1 change: 1 addition & 0 deletions contracts/SimpleBuilder/SimpleBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ contract SimpleBuilder is ERC721Holder, BuilderInternal, FirewallConsumer {
}
}
assert(locals.totalAmount == 0);
emit MassPoolsCreated(locals.token, locals.provider, locals.poolId, userData.userPools.length);
}
}
10 changes: 10 additions & 0 deletions contracts/SimpleRefundBuilder/SimpleRefundBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
contract SimpleRefundBuilder is RefundBuilderInternal, IERC721Receiver {
using CalcUtils for uint256;

event MassPoolsRebuilded(
address indexed token,
IProvider indexed provider,
uint256 collateralPoolId,
uint256 firstPoolId,
uint256 userLength
);

constructor(
ILockDealNFT _lockDealNFT,
IProvider _refund,
Expand Down Expand Up @@ -43,6 +51,7 @@ contract SimpleRefundBuilder is RefundBuilderInternal, IERC721Receiver {
_buildMassPools(locals);
// // transfer back the NFT to the user
lockDealNFT.transferFrom(address(this), user, collateralPoolId);
emit MassPoolsRebuilded(locals.paramsData.token, locals.paramsData.provider, collateralPoolId, locals.tokenPoolId, locals.userData.userPools.length);
}
return this.onERC721Received.selector;
}
Expand Down Expand Up @@ -71,5 +80,6 @@ contract SimpleRefundBuilder is RefundBuilderInternal, IERC721Receiver {
locals.tokenPoolId = _createFirstNFT(locals);
locals.paramsData.refundParams = _finalizeFirstNFT(locals, params[0][1]);
_buildMassPools(locals);
emit MassPoolsCreated(locals.paramsData.token, locals.paramsData.provider, locals.tokenPoolId, userData.userPools.length);
}
}

0 comments on commit 58f6d0f

Please sign in to comment.