Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAT-237: finalize td606 contract implementation #4

Merged
merged 2 commits into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Address: `0xDD382e505E92cA8d8575B01593e510Baf74B7566`
| Contract | Address | Etherscan |
| ----------------- |:------------------------------------------:| ---------------------------------------------------------------------------------------------:|
| TD606 Proxy | 0x849880398BD686031Ccb44c2cd00FaC129654b55 | [link](https://rinkeby.etherscan.io/address/0x849880398BD686031Ccb44c2cd00FaC129654b55) |
| V2 Implementation | 0xab4ae1640757980FA31A1EB66dEdc5a3A8716FAb | [link](https://rinkeby.etherscan.io/address/0xab4ae1640757980FA31A1EB66dEdc5a3A8716FAb) |
| V1 Implementation | 0xc0F076ED4865E95a19A1EF176508944063b66E84 | [link](https://rinkeby.etherscan.io/address/0xc0F076ED4865E95a19A1EF176508944063b66E84) |
| ProxyAdmin | 0xBEa50aa9a19671E50304B43C2E2AEaAB069870e9 | [link](https://rinkeby.etherscan.io/address/0xBEa50aa9a19671E50304B43C2E2AEaAB069870e9) |

Expand Down
9 changes: 2 additions & 7 deletions contracts/catalog/TD606.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ooooooooooooo oooooooooo. .ooo .oooo. .ooo
888 888 d88' `Y88 88P `88b d88' `Y88 88P
o888o o888bood8P' `88bod8' `Y8bd8P' `88bod8'

v1
v2

************************************************
LEGAL DISCLAIMER:
Expand Down Expand Up @@ -280,12 +280,7 @@ contract TD606 is
override
returns (address receiver, uint256 royaltyAmount) {

/// Don't give royalties to a bottomless pit lol.
if(owner() == address(0x0)) {
return (owner(), 0);
}

return (owner(), (_salePrice * tokenData[_tokenId].royaltyBPS) / 10_000);
return (tokenData[_tokenId].royaltyPayout, (_salePrice * tokenData[_tokenId].royaltyBPS) / 10_000);
}


Expand Down
7 changes: 1 addition & 6 deletions contracts/catalog/TD606V2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,7 @@ contract TD606_v2 is
override
returns (address receiver, uint256 royaltyAmount) {

/// Don't give royalties to a bottomless pit lol.
if(owner() == address(0x0)) {
return (owner(), 0);
}

return (owner(), (_salePrice * tokenData[_tokenId].royaltyBPS) / 10_000);
return (tokenData[_tokenId].royaltyPayout, (_salePrice * tokenData[_tokenId].royaltyBPS) / 10_000);
}


Expand Down
13 changes: 13 additions & 0 deletions data/abi/contracts/Angela.sol/Angela.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x45f2d53f",
"type": "bytes32"
}
],
"name": "c_0x45f2d53f",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
Expand Down
13 changes: 13 additions & 0 deletions data/abi/contracts/AngelaList.sol/AngelaList.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@
"name": "merkleRootUpdated",
"type": "event"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x0923cf13",
"type": "bytes32"
}
],
"name": "c_0x0923cf13",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "merkleRoot",
Expand Down
13 changes: 13 additions & 0 deletions data/abi/contracts/CLG20.sol/CLG20.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0xbcd919f5",
"type": "bytes32"
}
],
"name": "c_0xbcd919f5",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
Expand Down
13 changes: 13 additions & 0 deletions data/abi/contracts/Royalties.sol/Royalties.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
"name": "RoyaltyUpdated",
"type": "event"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x02837ec4",
"type": "bytes32"
}
],
"name": "c_0x02837ec4",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
Expand Down
26 changes: 26 additions & 0 deletions data/abi/contracts/catalog/TD606.sol/TD606.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,32 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x0923cf13",
"type": "bytes32"
}
],
"name": "c_0x0923cf13",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x8c7628f3",
"type": "bytes32"
}
],
"name": "c_0x8c7628f3",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
Expand Down
26 changes: 26 additions & 0 deletions data/abi/contracts/catalog/TD606V2.sol/TD606_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,32 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x0923cf13",
"type": "bytes32"
}
],
"name": "c_0x0923cf13",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0xcb69b6f9",
"type": "bytes32"
}
],
"name": "c_0xcb69b6f9",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
Expand Down
13 changes: 13 additions & 0 deletions data/abi/contracts/zora/CatalogNFT.sol/CatalogNFT.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "c__0x2909c01c",
"type": "bytes32"
}
],
"name": "c_0x2909c01c",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
Expand Down
28 changes: 14 additions & 14 deletions data/deployments/rinkeby/TD606_Implementation.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deploy/001_deploy_td606.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
log: true,
autoMine: true, // speeds deployment on local network. no effect on testnet/mainnet
skipIfAlreadyDeployed: true
// skipIfAlreadyDeployed: true
});

if ( deployTD606 && deployTD606.newlyDeployed) {
Expand Down
113 changes: 113 additions & 0 deletions test/TD606Test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,118 @@ describe("TD606 Test Suite v2", () => {
)
});

// 07
it('returns the correct token contentURI', async () => {

const { users, deployer, multisig, merkletree, TD606 } = await setup();

//mint token
const proof = merkletree.getHexProof(hashAddress(users[4].address));
const inputData: TokenData = {
metadataURI: "https://catalog.works/content/metadata",
contentURI: "http://catalog.works/content/uri/pee",
creator: users[4].address,
royaltyPayout: users[4].address,
royaltyBPS: 2000,
};

const mint = await users[4].TD606.mint(
inputData,
proof,
);


// transfer token
await users[4].TD606.transferFrom(users[4].address, users[3].address, 1);

await expect(
(await TD606.tokenContentURI(1)).toString()
).to.equal(
"http://catalog.works/content/uri/pee",
)
});

// 08
it('returns the correct creator address of the token', async () => {

const { users, deployer, multisig, merkletree, TD606 } = await setup();
const proof = merkletree.getHexProof(hashAddress(users[3].address));
const inputData: TokenData = {
metadataURI: "https://catalog.works/content/metadata",
contentURI: "http://catalog.works/content/uri",
creator: users[3].address,
royaltyPayout: users[3].address,
royaltyBPS: 5000,
};

const mint = await users[3].TD606.mint(
inputData,
proof,
);

await expect(
(await TD606.creator(1)).toString()
).to.equal(
users[3].address,
)
});

// 09
it('can have contentURI updated by admin', async () => {
const { users, deployer, multisig, merkletree, TD606 } = await setup();
const proof = merkletree.getHexProof(hashAddress(users[3].address));
const inputData: TokenData = {
metadataURI: "https://catalog.works/content/metadata",
contentURI: "http://catalog.works/content/uri",
creator: users[3].address,
royaltyPayout: users[3].address,
royaltyBPS: 8000,
};

const mint = await users[3].TD606.mint(
inputData,
proof,
);

await expect(
(await TD606.tokenContentURI(1)).toString()
).to.equal(
"http://catalog.works/content/uri",
)

// update contentURI
await deployer.TD606.updateContentURI(1, "poopinandpeeinyeahyeah");

await expect(
(await TD606.tokenContentURI(1)).toString()
).to.equal(
"poopinandpeeinyeahyeah",
)
});


// 10
it('returns correct royalty for EIP2981', async () => {
const { users, deployer, multisig, merkletree, TD606 } = await setup();
const proof = merkletree.getHexProof(hashAddress(users[3].address));
const inputData: TokenData = {
metadataURI: "https://catalog.works/content/metadata",
contentURI: "http://catalog.works/content/uri",
creator: users[3].address,
royaltyPayout: users[3].address,
royaltyBPS: 8000,
};

const mint = await users[3].TD606.mint(
inputData,
proof,
);

await expect(
(await TD606.royaltyInfo(1, 10)).toString()
).to.equal(
[users[3].address, 8].toString()
)
});

});