Skip to content

Commit

Permalink
Merge pull request #108 from open-format/feature/batch-mint-in-reward…
Browse files Browse the repository at this point in the history
…s-facet

Feature:  mintERC721 function in RewardsFacet now uses batchMint
  • Loading branch information
tinypell3ts authored Oct 17, 2023
2 parents effcafb + b1784c2 commit 4c2bd6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions deployed/80001.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"address": "0x265A242Bcf4CFd9021A666B427e2d4dce2F5eF54"
},
"RewardFacet": {
"address": "0x79a414D9778F5b2353943a9E6b6e3B3026ec932B",
"startBlock": 38765629
"startBlock": 40828433,
"address": "0xaCC7A3782DFb20c0e08b58D3420662B9805D76AE"
}
}
18 changes: 12 additions & 6 deletions src/facet/RewardsFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {Multicall} from "@solidstate/contracts/utils/Multicall.sol";

interface NFT {
function mintTo(address to, string memory tokenURI) external;
function batchMintTo(address to, uint256 quantity, string memory baseURI) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function ownerOf(uint256 tokenId) external returns (address);
}
Expand All @@ -27,7 +28,7 @@ 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, address to, 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);

error RewardsFacet_NotAuthorized();
Expand All @@ -54,15 +55,20 @@ contract RewardsFacet is Multicall, SafeOwnable {
emit TokenTransferred(_token, _to, _amount, _id, _uri);
}

function mintERC721(address _token, address _to, string calldata _tokenURI, bytes32 _id, string calldata _uri)
public
{
function mintERC721(
address _token,
address _to,
uint256 _quantity,
string calldata _baseURI,
bytes32 _id,
string calldata _uri
) public {
if (!_canMint(_token)) {
revert RewardsFacet_NotAuthorized();
}

NFT(_token).mintTo(_to, _tokenURI);
emit BadgeMinted(_token, _to, _id, _uri);
NFT(_token).batchMintTo(_to, _quantity, _baseURI);
emit BadgeMinted(_token, _quantity, _to, _id, _uri);
}

function transferERC721(
Expand Down

0 comments on commit 4c2bd6c

Please sign in to comment.