From bee57f93d30b6b6c6a6599bdd0adbeaa5eedecd8 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 17 Oct 2023 12:34:03 +0100 Subject: [PATCH] All functions in RewardFacet now accept and emit an activityType --- src/facet/RewardsFacet.sol | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/facet/RewardsFacet.sol b/src/facet/RewardsFacet.sol index b3a06ab..96296c2 100644 --- a/src/facet/RewardsFacet.sol +++ b/src/facet/RewardsFacet.sol @@ -26,33 +26,40 @@ bytes32 constant ADMIN_ROLE = bytes32(uint256(0)); bytes32 constant MINTER_ROLE = bytes32(uint256(1)); contract RewardsFacet is Multicall, SafeOwnable { - event TokenMinted(address token, address to, uint256 amount, bytes32 id, string uri); - event TokenTransferred(address token, address to, uint256 amount, bytes32 id, string uri); - event BadgeMinted(address token, uint256 quantity, address to, bytes32 id, string uri); - event BadgeTransferred(address token, address to, uint256 tokenId, bytes32 id, string uri); + event TokenMinted(address token, address to, uint256 amount, bytes32 id, bytes32 activityType, string uri); + event TokenTransferred(address token, address to, uint256 amount, bytes32 id, bytes32 activityType, string uri); + event BadgeMinted(address token, uint256 quantity, address to, bytes32 id, bytes32 activityType, string uri); + event BadgeTransferred(address token, address to, uint256 tokenId, bytes32 id, bytes32 activityType, string uri); error RewardsFacet_NotAuthorized(); error RewardsFacet_InsufficientBalance(); - function mintERC20(address _token, address _to, uint256 _amount, bytes32 _id, string calldata _uri) public { + function mintERC20( + address _token, + address _to, + uint256 _amount, + bytes32 _id, + bytes32 _activityType, + string calldata _uri + ) public { if (!_canMint(_token)) { revert RewardsFacet_NotAuthorized(); } Token(_token).mintTo(_to, _amount); - emit TokenMinted(_token, _to, _amount, _id, _uri); + emit TokenMinted(_token, _to, _amount, _id, _activityType, _uri); } function transferERC20( - address _holder, address _token, address _to, uint256 _amount, bytes32 _id, + bytes32 _activityType, string calldata _uri ) public { Token(_token).transferFrom(msg.sender, _to, _amount); - emit TokenTransferred(_token, _to, _amount, _id, _uri); + emit TokenTransferred(_token, _to, _amount, _id, _activityType, _uri); } function mintERC721( @@ -61,6 +68,7 @@ contract RewardsFacet is Multicall, SafeOwnable { uint256 _quantity, string calldata _baseURI, bytes32 _id, + bytes32 _activityType, string calldata _uri ) public { if (!_canMint(_token)) { @@ -68,19 +76,19 @@ contract RewardsFacet is Multicall, SafeOwnable { } NFT(_token).batchMintTo(_to, _quantity, _baseURI); - emit BadgeMinted(_token, _quantity, _to, _id, _uri); + emit BadgeMinted(_token, _quantity, _to, _id, _activityType, _uri); } function transferERC721( address _token, - address _holder, address _to, uint256 _tokenId, bytes32 _id, + bytes32 _activityType, string calldata _uri ) public { NFT(_token).transferFrom(msg.sender, _to, _tokenId); - emit BadgeTransferred(_token, _to, _tokenId, _id, _uri); + emit BadgeTransferred(_token, _to, _tokenId, _id, _activityType, _uri); } function _canMint(address _token) internal virtual returns (bool) {