Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8 from meemproject/feature/errors
Browse files Browse the repository at this point in the history
latest
  • Loading branch information
kengoldfarb authored Apr 13, 2022
2 parents c47434f + 515a358 commit ca38c1d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .diamond/4.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion contracts/Meem/libraries/LibERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {LibAppStorage} from '../storage/LibAppStorage.sol';
import {LibArray} from '../libraries/LibArray.sol';
import {LibMeem} from '../libraries/LibMeem.sol';
import {LibAccessControl} from '../libraries/LibAccessControl.sol';
import {Meem, MeemType} from '../interfaces/MeemStandard.sol';
import {Meem, MeemType, URISource} from '../interfaces/MeemStandard.sol';
import {NotTokenOwner, InvalidZeroAddressQuery, IndexOutOfRange, TokenNotFound, NotApproved, NoApproveSelf, ERC721ReceiverNotImplemented, TokenAlreadyExists, ToAddressInvalid, NoTransferWrappedNFT, MeemNotVerified, NotTokenAdmin} from '../libraries/Errors.sol';
import '../interfaces/IERC721TokenReceiver.sol';

Expand Down Expand Up @@ -159,6 +159,10 @@ library LibERC721 {
revert TokenNotFound(tokenId);
}

if (s.meems[tokenId].uriSource == URISource.Data) {
return s.meems[tokenId].data;
}

return s.tokenURIs[tokenId];
}

Expand Down
1 change: 1 addition & 0 deletions contracts/Meem/libraries/LibMeem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ library LibMeem {
s.meems[tokenId].mintedAt = block.timestamp;
s.meems[tokenId].data = params.data;
s.meems[tokenId].reactionTypes = params.reactionTypes;
s.meems[tokenId].uriSource = params.uriSource;

if (
params.mintedBy != address(0) &&
Expand Down
37 changes: 37 additions & 0 deletions test/childMeem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,41 @@ describe('Child Meem Minting', function Test() {
)
)
})

it('Can mint with locked URI', async () => {
const mintData = {
...meemMintData,
splits: [
...meemMintData.splits,
{
toAddress: signers[1].address,
amount: 100,
lockedBy: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
},
{
toAddress: signers[2].address,
amount: 100,
lockedBy: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
}
]
}

await meemFacet.connect(signers[2]).mint(
{
to: signers[4].address,
tokenURI: ipfsURL,
parentChain: Chain.Polygon,
parent: contractAddress,
parentTokenId: token0,
meemType: MeemType.Remix,
data: '',
isURILocked: true,
reactionTypes: [],
uriSource: UriSource.TokenUri,
mintedBy: signers[0].address
},
mintData,
mintData
)
})
})

0 comments on commit ca38c1d

Please sign in to comment.