// SPDX-License-Identifier: CC0
/*
/$$$$$$$$ /$$$$$$$ /$$$$$$$$ /$$$$$$$$ /$$
| $$_____/| $$__ $$| $$_____/| $$_____/ /$$$$
| $$ | $$ \ $$| $$ | $$ |_ $$
| $$$$$ | $$$$$$$/| $$$$$ | $$$$$ | $$
| $$__/ | $$__ $$| $$__/ | $$__/ | $$
| $$ | $$ \ $$| $$ | $$ | $$
| $$ | $$ | $$| $$$$$$$$| $$$$$$$$ /$$$$$$
|__/ |__/ |__/|________/|________/ |______/
/$$
| $$
| $$$$$$$ /$$ /$$
| $$__ $$| $$ | $$
| $$ \ $$| $$ | $$
| $$ | $$| $$ | $$
| $$$$$$$/| $$$$$$$
|_______/ \____ $$
/$$ | $$
| $$$$$$/
\______/
/$$$$$$ /$$$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$$ /$$$$$$$
/$$__ $$|__ $$__/| $$_____/| $$ | $$|_ $$_/| $$_____/| $$__ $$
| $$ \__/ | $$ | $$ | $$ | $$ | $$ | $$ | $$ \ $$
| $$$$$$ | $$ | $$$$$ | $$ / $$/ | $$ | $$$$$ | $$$$$$$/
\____ $$ | $$ | $$__/ \ $$ $$/ | $$ | $$__/ | $$____/
/$$ \ $$ | $$ | $$ \ $$$/ | $$ | $$ | $$
| $$$$$$/ | $$ | $$$$$$$$ \ $/ /$$$$$$| $$$$$$$$| $$
\______/ |__/ |________/ \_/ |______/|________/|__/
CC0 2021
*/
pragma solidity ^0.8.11;
interface IFree {
function mint(uint256 collectionId, address to) external;
function ownerOf(uint256 tokenId) external returns (address owner);
function tokenIdToCollectionId(uint256 tokenId) external returns (uint256 collectionId);
function appendAttributeToToken(uint256 tokenId, string memory attrKey, string memory attrValue) external;
}
contract Free1 {
IFree public immutable free;
uint public mintCount;
mapping(uint256 => bool) public free0TokenIdUsed;
constructor(address freeAddr) {
free = IFree(freeAddr);
}
function claim(uint free0TokenId) public {
require(mintCount < 1000, 'Cannot mint more than 1000');
require(free.tokenIdToCollectionId(free0TokenId) == 0, 'Invalid Free0');
require(!free0TokenIdUsed[free0TokenId], 'This Free0 has already been used to mint a Free1');
require(free.ownerOf(free0TokenId) == msg.sender, 'You must be the owner of this Free0');
free0TokenIdUsed[free0TokenId] = true;
mintCount++;
free.appendAttributeToToken(free0TokenId, 'Used For Free1 Mint', 'true');
free.mint(1, msg.sender);
}
}
{
"compilationTarget": {
"contracts/Free1.sol": "Free1"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"freeAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"free0TokenId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"free","outputs":[{"internalType":"contract IFree","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"free0TokenIdUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]