Initialize contract SVG code with placeholder base
This commit is contained in:
commit
482203529c
|
|
@ -26,7 +26,6 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
struct App {
|
struct App {
|
||||||
string name; // Name of the site
|
string name; // Name of the site
|
||||||
string description; // Description about the site
|
string description; // Description about the site
|
||||||
string image; // Preview Image IPFS Link
|
|
||||||
string externalURL; // Site URL
|
string externalURL; // Site URL
|
||||||
string ENS; // ENS ID
|
string ENS; // ENS ID
|
||||||
uint256 currentBuild; // The current build number (Increments by one with each change, starts at zero)
|
uint256 currentBuild; // The current build number (Increments by one with each change, starts at zero)
|
||||||
|
|
@ -57,6 +56,40 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Generates a SVG image.
|
||||||
|
*/
|
||||||
|
function _generateSVG(string memory name, string memory ENS) internal view returns (string memory) {
|
||||||
|
return (
|
||||||
|
string(
|
||||||
|
abi.encodePacked(
|
||||||
|
_baseURI(),
|
||||||
|
Base64.encode(
|
||||||
|
abi.encodePacked(
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="640" height="480" viewBox="0 0 640 480" xml:space="preserve">',
|
||||||
|
"<defs>",
|
||||||
|
"</defs>",
|
||||||
|
'<g transform="matrix(3.42 0 0 3.42 300.98 252.98)" >',
|
||||||
|
'<polygon style="stroke: rgb(0,0,0); stroke-width: 8; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(152,152,183); fill-rule: nonzero; opacity: 1;" vector-effect="non-scaling-stroke" points="-50,-50 -50,50 50,50 50,-50 " />',
|
||||||
|
"</g>",
|
||||||
|
'<g transform="matrix(1 0 0 1 303.5 115.67)" style="" >',
|
||||||
|
'<text xml:space="preserve" font-family="Open Sans" font-size="24" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-45.7" y="5.65" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">Fleek NFAs</tspan></text>',
|
||||||
|
"</g>",
|
||||||
|
'<g transform="matrix(1 0 0 1 302 261.47)" style="" >',
|
||||||
|
'<text xml:space="preserve" font-family="Open Sans" font-size="28" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-44.26" y="-6.14" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">',
|
||||||
|
name,
|
||||||
|
'</tspan><tspan x="-37.14" y="17.45" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">',
|
||||||
|
ENS,
|
||||||
|
"</tspan></text>",
|
||||||
|
"</g>",
|
||||||
|
"</svg>"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Mints a token and returns a tokenId.
|
* @dev Mints a token and returns a tokenId.
|
||||||
*
|
*
|
||||||
|
|
@ -71,7 +104,6 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
address to,
|
address to,
|
||||||
string memory name,
|
string memory name,
|
||||||
string memory description,
|
string memory description,
|
||||||
string memory image,
|
|
||||||
string memory externalURL,
|
string memory externalURL,
|
||||||
string memory ENS,
|
string memory ENS,
|
||||||
string memory commitHash,
|
string memory commitHash,
|
||||||
|
|
@ -84,7 +116,6 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
App storage app = _apps[tokenId];
|
App storage app = _apps[tokenId];
|
||||||
app.name = name;
|
app.name = name;
|
||||||
app.description = description;
|
app.description = description;
|
||||||
app.image = image;
|
|
||||||
app.externalURL = externalURL;
|
app.externalURL = externalURL;
|
||||||
app.ENS = ENS;
|
app.ENS = ENS;
|
||||||
|
|
||||||
|
|
@ -117,7 +148,7 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
'"description":"', app.description, '",',
|
'"description":"', app.description, '",',
|
||||||
'"owner":"', Strings.toHexString(uint160(owner), 20), '",',
|
'"owner":"', Strings.toHexString(uint160(owner), 20), '",',
|
||||||
'"external_url":"', app.externalURL, '",',
|
'"external_url":"', app.externalURL, '",',
|
||||||
'"image":"', app.image, '",',
|
'"image":"', _generateSVG(app.name, app.ENS), '",',
|
||||||
'"attributes": [',
|
'"attributes": [',
|
||||||
'{"trait_type": "ENS", "value":"', app.ENS,'"},',
|
'{"trait_type": "ENS", "value":"', app.ENS,'"},',
|
||||||
'{"trait_type": "Commit Hash", "value":"', app.builds[app.currentBuild].commitHash,'"},',
|
'{"trait_type": "Commit Hash", "value":"', app.builds[app.currentBuild].commitHash,'"},',
|
||||||
|
|
@ -247,26 +278,6 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
emit NewTokenDescription(tokenId, _tokenDescription, msg.sender);
|
emit NewTokenDescription(tokenId, _tokenDescription, msg.sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Updates the `image` metadata field of a minted `tokenId`.
|
|
||||||
*
|
|
||||||
* May emit a {NewTokenImage} event.
|
|
||||||
*
|
|
||||||
* Requirements:
|
|
||||||
*
|
|
||||||
* - the tokenId must be minted and valid.
|
|
||||||
* - the sender must have the `tokenController` role.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function setTokenImage(
|
|
||||||
uint256 tokenId,
|
|
||||||
string memory _tokenImage
|
|
||||||
) public virtual requireTokenRole(tokenId, Roles.Controller) {
|
|
||||||
_requireMinted(tokenId);
|
|
||||||
_apps[tokenId].image = _tokenImage;
|
|
||||||
emit NewTokenImage(tokenId, _tokenImage, msg.sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Adds a new build to a minted `tokenId`'s builds mapping.
|
* @dev Adds a new build to a minted `tokenId`'s builds mapping.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,17 @@ const config: HardhatUserConfig = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
solidity: {
|
solidity: {
|
||||||
compilers: [
|
version: '0.8.7',
|
||||||
{
|
settings: {
|
||||||
version: '0.8.7',
|
optimizer: {
|
||||||
|
enabled: true,
|
||||||
|
runs: 200,
|
||||||
|
details: {
|
||||||
|
yul: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
viaIR: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mocha: {
|
mocha: {
|
||||||
timeout: 200000, // 200 seconds max for running tests
|
timeout: 200000, // 200 seconds max for running tests
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ describe('FleekERC721', () => {
|
||||||
owner.address,
|
owner.address,
|
||||||
MINT_PARAMS.name,
|
MINT_PARAMS.name,
|
||||||
MINT_PARAMS.description,
|
MINT_PARAMS.description,
|
||||||
MINT_PARAMS.image,
|
|
||||||
MINT_PARAMS.externalUrl,
|
MINT_PARAMS.externalUrl,
|
||||||
MINT_PARAMS.ens,
|
MINT_PARAMS.ens,
|
||||||
MINT_PARAMS.commitHash,
|
MINT_PARAMS.commitHash,
|
||||||
|
|
@ -80,7 +79,6 @@ describe('FleekERC721', () => {
|
||||||
otherAccount.address,
|
otherAccount.address,
|
||||||
MINT_PARAMS.name,
|
MINT_PARAMS.name,
|
||||||
MINT_PARAMS.description,
|
MINT_PARAMS.description,
|
||||||
MINT_PARAMS.image,
|
|
||||||
MINT_PARAMS.externalUrl,
|
MINT_PARAMS.externalUrl,
|
||||||
MINT_PARAMS.ens,
|
MINT_PARAMS.ens,
|
||||||
MINT_PARAMS.commitHash,
|
MINT_PARAMS.commitHash,
|
||||||
|
|
@ -98,7 +96,6 @@ describe('FleekERC721', () => {
|
||||||
owner.address,
|
owner.address,
|
||||||
MINT_PARAMS.name,
|
MINT_PARAMS.name,
|
||||||
MINT_PARAMS.description,
|
MINT_PARAMS.description,
|
||||||
MINT_PARAMS.image,
|
|
||||||
MINT_PARAMS.externalUrl,
|
MINT_PARAMS.externalUrl,
|
||||||
MINT_PARAMS.ens,
|
MINT_PARAMS.ens,
|
||||||
MINT_PARAMS.commitHash,
|
MINT_PARAMS.commitHash,
|
||||||
|
|
@ -132,7 +129,6 @@ describe('FleekERC721', () => {
|
||||||
fixture.owner.address,
|
fixture.owner.address,
|
||||||
MINT_PARAMS.name,
|
MINT_PARAMS.name,
|
||||||
MINT_PARAMS.description,
|
MINT_PARAMS.description,
|
||||||
MINT_PARAMS.image,
|
|
||||||
MINT_PARAMS.externalUrl,
|
MINT_PARAMS.externalUrl,
|
||||||
MINT_PARAMS.ens,
|
MINT_PARAMS.ens,
|
||||||
MINT_PARAMS.commitHash,
|
MINT_PARAMS.commitHash,
|
||||||
|
|
@ -153,11 +149,35 @@ describe('FleekERC721', () => {
|
||||||
|
|
||||||
const parsedURI = JSON.parse(tokenURIDecoded);
|
const parsedURI = JSON.parse(tokenURIDecoded);
|
||||||
|
|
||||||
|
const imageDecoded = Buffer.from(
|
||||||
|
parsedURI.image.replace('data:application/json;base64,', ''),
|
||||||
|
'base64'
|
||||||
|
).toString('ascii');
|
||||||
|
|
||||||
|
parsedURI.image = imageDecoded;
|
||||||
|
|
||||||
expect(parsedURI).to.eql({
|
expect(parsedURI).to.eql({
|
||||||
owner: fixture.owner.address.toLowerCase(),
|
owner: fixture.owner.address.toLowerCase(),
|
||||||
name: MINT_PARAMS.name,
|
name: MINT_PARAMS.name,
|
||||||
description: MINT_PARAMS.description,
|
description: MINT_PARAMS.description,
|
||||||
image: MINT_PARAMS.image,
|
image:
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="640" height="480" viewBox="0 0 640 480" xml:space="preserve">' +
|
||||||
|
'<defs>' +
|
||||||
|
'</defs>' +
|
||||||
|
'<g transform="matrix(3.42 0 0 3.42 300.98 252.98)" >' +
|
||||||
|
'<polygon style="stroke: rgb(0,0,0); stroke-width: 8; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(152,152,183); fill-rule: nonzero; opacity: 1;" vector-effect="non-scaling-stroke" points="-50,-50 -50,50 50,50 50,-50 " />' +
|
||||||
|
'</g>' +
|
||||||
|
'<g transform="matrix(1 0 0 1 303.5 115.67)" style="" >' +
|
||||||
|
'<text xml:space="preserve" font-family="Open Sans" font-size="24" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-45.7" y="5.65" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">Fleek NFAs</tspan></text>' +
|
||||||
|
'</g>' +
|
||||||
|
'<g transform="matrix(1 0 0 1 302 261.47)" style="" >' +
|
||||||
|
'<text xml:space="preserve" font-family="Open Sans" font-size="28" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-44.26" y="-6.14" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">' +
|
||||||
|
MINT_PARAMS.name +
|
||||||
|
'</tspan><tspan x="-37.14" y="17.45" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">' +
|
||||||
|
MINT_PARAMS.ens +
|
||||||
|
'</tspan></text>' +
|
||||||
|
'</g>' +
|
||||||
|
'</svg>',
|
||||||
external_url: MINT_PARAMS.externalUrl,
|
external_url: MINT_PARAMS.externalUrl,
|
||||||
attributes: [
|
attributes: [
|
||||||
{
|
{
|
||||||
|
|
@ -193,7 +213,6 @@ describe('FleekERC721', () => {
|
||||||
fixture.owner.address,
|
fixture.owner.address,
|
||||||
MINT_PARAMS.name,
|
MINT_PARAMS.name,
|
||||||
MINT_PARAMS.description,
|
MINT_PARAMS.description,
|
||||||
MINT_PARAMS.image,
|
|
||||||
MINT_PARAMS.externalUrl,
|
MINT_PARAMS.externalUrl,
|
||||||
MINT_PARAMS.ens,
|
MINT_PARAMS.ens,
|
||||||
MINT_PARAMS.commitHash,
|
MINT_PARAMS.commitHash,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -41,7 +40,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -52,7 +50,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -68,7 +65,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -81,7 +77,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App 2",
|
"Foundry Test App 2",
|
||||||
"This is a test application submitted by foundry tests [2].",
|
"This is a test application submitted by foundry tests [2].",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -96,7 +91,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -109,7 +103,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App 2",
|
"Foundry Test App 2",
|
||||||
"This is a test application submitted by foundry tests[2].",
|
"This is a test application submitted by foundry tests[2].",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -118,14 +111,47 @@ contract FleekTest is Test {
|
||||||
assertEq(second_mint, 1);
|
assertEq(second_mint, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _generateSVG(string memory name, string memory ENS) internal pure returns (string memory) {
|
||||||
|
return (
|
||||||
|
string(
|
||||||
|
abi.encodePacked(
|
||||||
|
"data:application/json;base64,",
|
||||||
|
Base64.encode(
|
||||||
|
abi.encodePacked(
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="640" height="480" viewBox="0 0 640 480" xml:space="preserve">',
|
||||||
|
"<defs>",
|
||||||
|
"</defs>",
|
||||||
|
'<g transform="matrix(3.42 0 0 3.42 300.98 252.98)" >',
|
||||||
|
'<polygon style="stroke: rgb(0,0,0); stroke-width: 8; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(152,152,183); fill-rule: nonzero; opacity: 1;" vector-effect="non-scaling-stroke" points="-50,-50 -50,50 50,50 50,-50 " />',
|
||||||
|
"</g>",
|
||||||
|
'<g transform="matrix(1 0 0 1 303.5 115.67)" style="" >',
|
||||||
|
'<text xml:space="preserve" font-family="Open Sans" font-size="24" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-45.7" y="5.65" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">Fleek NFAs</tspan></text>',
|
||||||
|
"</g>",
|
||||||
|
'<g transform="matrix(1 0 0 1 302 261.47)" style="" >',
|
||||||
|
'<text xml:space="preserve" font-family="Open Sans" font-size="28" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-44.26" y="-6.14" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">',
|
||||||
|
name,
|
||||||
|
'</tspan><tspan x="-37.14" y="17.45" style="stroke-width: 1; font-family: "Open Sans", sans-serif; font-size: 18px; font-style: normal; font-weight: normal; fill: rgb(0,0,0); ">',
|
||||||
|
ENS,
|
||||||
|
"</tspan></text>",
|
||||||
|
"</g>",
|
||||||
|
"</svg>"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function testTokenURI() public {
|
function testTokenURI() public {
|
||||||
|
string memory name = "Foundry Test App";
|
||||||
|
string memory ens = "fleek_xyz";
|
||||||
|
|
||||||
uint256 mint = fleekContract.mint(
|
uint256 mint = fleekContract.mint(
|
||||||
DEPLOYER,
|
DEPLOYER,
|
||||||
"Foundry Test App",
|
name,
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
ens,
|
||||||
"fleek_xyz",
|
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
);
|
);
|
||||||
|
|
@ -136,15 +162,21 @@ contract FleekTest is Test {
|
||||||
|
|
||||||
bytes memory dataURI = abi.encodePacked(
|
bytes memory dataURI = abi.encodePacked(
|
||||||
"{",
|
"{",
|
||||||
'"name":"Foundry Test App",',
|
'"name":"',
|
||||||
|
name,
|
||||||
|
'",',
|
||||||
'"description":"This is a test application submitted by foundry tests.",',
|
'"description":"This is a test application submitted by foundry tests.",',
|
||||||
'"owner":"',
|
'"owner":"',
|
||||||
Strings.toHexString(uint160(DEPLOYER), 20),
|
Strings.toHexString(uint160(DEPLOYER), 20),
|
||||||
'",',
|
'",',
|
||||||
'"external_url":"https://fleek.xyz",',
|
'"external_url":"https://fleek.xyz",',
|
||||||
'"image":"https://fleek.xyz",',
|
'"image":"',
|
||||||
|
_generateSVG(name, ens),
|
||||||
|
'",',
|
||||||
'"attributes": [',
|
'"attributes": [',
|
||||||
'{"trait_type": "ENS", "value":"fleek_xyz"},',
|
'{"trait_type": "ENS", "value":"',
|
||||||
|
ens,
|
||||||
|
'"},',
|
||||||
'{"trait_type": "Commit Hash", "value":"afff3f6"},',
|
'{"trait_type": "Commit Hash", "value":"afff3f6"},',
|
||||||
'{"trait_type": "Repository", "value":"https://github.com/fleekxyz/non-fungible-apps"},',
|
'{"trait_type": "Repository", "value":"https://github.com/fleekxyz/non-fungible-apps"},',
|
||||||
'{"trait_type": "Version", "value":"0"}',
|
'{"trait_type": "Version", "value":"0"}',
|
||||||
|
|
@ -161,7 +193,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -171,7 +202,6 @@ contract FleekTest is Test {
|
||||||
|
|
||||||
fleekContract.setTokenName(mint, "Foundry Test App 2");
|
fleekContract.setTokenName(mint, "Foundry Test App 2");
|
||||||
fleekContract.setTokenDescription(mint, "This is a test application submitted by foundry tests. 2");
|
fleekContract.setTokenDescription(mint, "This is a test application submitted by foundry tests. 2");
|
||||||
fleekContract.setTokenImage(mint, "https://fleek2.xyz");
|
|
||||||
fleekContract.setTokenExternalURL(mint, "https://fleek2.xyz");
|
fleekContract.setTokenExternalURL(mint, "https://fleek2.xyz");
|
||||||
fleekContract.setTokenENS(mint, "fleek_xyz2");
|
fleekContract.setTokenENS(mint, "fleek_xyz2");
|
||||||
fleekContract.setTokenBuild(mint, "afff3f62", "https://github.com/fleekxyz/non-fungible-apps2");
|
fleekContract.setTokenBuild(mint, "afff3f62", "https://github.com/fleekxyz/non-fungible-apps2");
|
||||||
|
|
@ -186,7 +216,9 @@ contract FleekTest is Test {
|
||||||
Strings.toHexString(uint160(DEPLOYER), 20),
|
Strings.toHexString(uint160(DEPLOYER), 20),
|
||||||
'",',
|
'",',
|
||||||
'"external_url":"https://fleek2.xyz",',
|
'"external_url":"https://fleek2.xyz",',
|
||||||
'"image":"https://fleek2.xyz",',
|
'"image":"',
|
||||||
|
_generateSVG("Foundry Test App 2", "fleek_xyz2"),
|
||||||
|
'",',
|
||||||
'"attributes": [',
|
'"attributes": [',
|
||||||
'{"trait_type": "ENS", "value":"fleek_xyz2"},',
|
'{"trait_type": "ENS", "value":"fleek_xyz2"},',
|
||||||
'{"trait_type": "Commit Hash", "value":"afff3f62"},',
|
'{"trait_type": "Commit Hash", "value":"afff3f62"},',
|
||||||
|
|
@ -205,7 +237,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -217,7 +248,6 @@ contract FleekTest is Test {
|
||||||
|
|
||||||
fleekContract.setTokenName(mint, "Foundry Test App 2");
|
fleekContract.setTokenName(mint, "Foundry Test App 2");
|
||||||
fleekContract.setTokenDescription(mint, "This is a test application submitted by foundry tests. 2");
|
fleekContract.setTokenDescription(mint, "This is a test application submitted by foundry tests. 2");
|
||||||
fleekContract.setTokenImage(mint, "https://fleek2.xyz");
|
|
||||||
fleekContract.setTokenExternalURL(mint, "https://fleek2.xyz");
|
fleekContract.setTokenExternalURL(mint, "https://fleek2.xyz");
|
||||||
fleekContract.setTokenENS(mint, "fleek_xyz2");
|
fleekContract.setTokenENS(mint, "fleek_xyz2");
|
||||||
fleekContract.setTokenBuild(mint, "afff3f62", "https://github.com/fleekxyz/non-fungible-apps2");
|
fleekContract.setTokenBuild(mint, "afff3f62", "https://github.com/fleekxyz/non-fungible-apps2");
|
||||||
|
|
@ -232,7 +262,9 @@ contract FleekTest is Test {
|
||||||
Strings.toHexString(uint160(DEPLOYER), 20),
|
Strings.toHexString(uint160(DEPLOYER), 20),
|
||||||
'",',
|
'",',
|
||||||
'"external_url":"https://fleek2.xyz",',
|
'"external_url":"https://fleek2.xyz",',
|
||||||
'"image":"https://fleek2.xyz",',
|
'"image":"',
|
||||||
|
_generateSVG("Foundry Test App 2", "fleek_xyz2"),
|
||||||
|
'",',
|
||||||
'"attributes": [',
|
'"attributes": [',
|
||||||
'{"trait_type": "ENS", "value":"fleek_xyz2"},',
|
'{"trait_type": "ENS", "value":"fleek_xyz2"},',
|
||||||
'{"trait_type": "Commit Hash", "value":"afff3f62"},',
|
'{"trait_type": "Commit Hash", "value":"afff3f62"},',
|
||||||
|
|
@ -276,7 +308,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -297,7 +328,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -316,7 +346,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -341,7 +370,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -358,7 +386,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -377,7 +404,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -394,7 +420,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -407,49 +432,12 @@ contract FleekTest is Test {
|
||||||
fleekContract.setTokenDescription(mint, "NEW TOKEN NAME!");
|
fleekContract.setTokenDescription(mint, "NEW TOKEN NAME!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSetTokenImage() public {
|
|
||||||
uint256 mint = fleekContract.mint(
|
|
||||||
DEPLOYER,
|
|
||||||
"Foundry Test App",
|
|
||||||
"This is a test application submitted by foundry tests.",
|
|
||||||
"https://fleek.xyz",
|
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
|
||||||
"afff3f6",
|
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEq(mint, 0);
|
|
||||||
|
|
||||||
fleekContract.setTokenImage(mint, "https://ethereum.org");
|
|
||||||
}
|
|
||||||
|
|
||||||
function testFailSetTokenImageOnAnotherUsersTokenWithoutAccess() public {
|
|
||||||
uint256 mint = fleekContract.mint(
|
|
||||||
DEPLOYER,
|
|
||||||
"Foundry Test App",
|
|
||||||
"This is a test application submitted by foundry tests.",
|
|
||||||
"https://fleek.xyz",
|
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
|
||||||
"afff3f6",
|
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEq(mint, 0);
|
|
||||||
|
|
||||||
vm.prank(address(0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84));
|
|
||||||
|
|
||||||
fleekContract.setTokenImage(mint, "https://ethereum.org");
|
|
||||||
}
|
|
||||||
|
|
||||||
function testSetTokenExternalURL() public {
|
function testSetTokenExternalURL() public {
|
||||||
uint256 mint = fleekContract.mint(
|
uint256 mint = fleekContract.mint(
|
||||||
DEPLOYER,
|
DEPLOYER,
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -466,7 +454,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -485,7 +472,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -502,7 +488,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -521,7 +506,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -538,7 +522,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -557,7 +540,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -578,7 +560,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -601,7 +582,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -627,7 +607,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -653,7 +632,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -680,7 +658,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -711,7 +688,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -740,7 +716,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
@ -765,7 +740,6 @@ contract FleekTest is Test {
|
||||||
"Foundry Test App",
|
"Foundry Test App",
|
||||||
"This is a test application submitted by foundry tests.",
|
"This is a test application submitted by foundry tests.",
|
||||||
"https://fleek.xyz",
|
"https://fleek.xyz",
|
||||||
"https://fleek.xyz",
|
|
||||||
"fleek_xyz",
|
"fleek_xyz",
|
||||||
"afff3f6",
|
"afff3f6",
|
||||||
"https://github.com/fleekxyz/non-fungible-apps"
|
"https://github.com/fleekxyz/non-fungible-apps"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue