Skip to content

Commit d1906fa

Browse files
committed
Polygon Testnet Deployment
1 parent 224ce66 commit d1906fa

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

CreatifyArguments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = ["Creatify", "CRFTY", "", "0x604860eFB014242c5a49f7ee4095A9527F7BE575"];

MarketplaceArguments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = [30];

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ npx solhint 'contracts/**/*.sol' --fix
3030

3131
# Etherscan verification
3232

33-
To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.
33+
To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as maticmum.
3434

35-
In this project, copy the .env.template file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:
35+
In this project, copy the .env.template file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your maticmum node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:
3636

3737
```shell
38-
hardhat run --network ropsten scripts/deploy.js
38+
hardhat run --network maticmum scripts/deploy.js --constructor-args contractConstructorArguments.js DEPLOYED_CONTRACT_ADDRESS
3939
```
4040

4141
Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command:
4242

4343
```shell
44-
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"
44+
npx hardhat verify --network maticmum DEPLOYED_CONTRACT_ADDRESS --constructor-args "Constructor Argument"
4545
```
4646

4747
# Next App

config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const marketplaceAddress = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
2-
export const creatifyAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
1+
export const marketplaceAddress = "0x604860eFB014242c5a49f7ee4095A9527F7BE575"
2+
export const creatifyAddress = "0x588F2d9EA0043Ff77343AaB23df5B5FfD49eA6B7"

contracts/Marketplace.sol

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ contract Marketplace is Context, AccessControlEnumerable, ReentrancyGuard {
2323
}
2424

2525
address public owner;
26-
uint96 public platformFeeBasisPoint = 300;
26+
uint96 public platformFeeBasisPoint = 30;
2727

2828
struct MarketItem {
2929
uint256 itemId;
@@ -68,8 +68,9 @@ contract Marketplace is Context, AccessControlEnumerable, ReentrancyGuard {
6868

6969
// Calculate Payouts between seller and platform
7070
uint256 amountReceived = msg.value;
71-
uint256 amountToSeller = (amountReceived * (1000 - platformFeeBasisPoint)) / 1000;
71+
7272
uint256 amountToMarketplace = (amountReceived * platformFeeBasisPoint) / 1000;
73+
uint256 amountToSeller = amountReceived - amountToMarketplace;
7374

7475
idToMarketItem[itemId].seller.transfer(amountToSeller);
7576
payable(address(owner)).transfer(amountToMarketplace);
@@ -87,12 +88,12 @@ contract Marketplace is Context, AccessControlEnumerable, ReentrancyGuard {
8788

8889
MarketItem[] memory items = new MarketItem[](unsoldItemCount);
8990
for (uint256 i = 0; i < itemCount; i++) {
90-
if (idToMarketItem[i + 1].owner == address(0)) {
91-
uint256 currentId = i + 1;
92-
MarketItem storage currentItem = idToMarketItem[currentId];
93-
items[currentIndex] = currentItem;
94-
currentIndex += 1;
95-
}
91+
if (idToMarketItem[i + 1].owner == address(0)) {
92+
uint256 currentId = i + 1;
93+
MarketItem storage currentItem = idToMarketItem[currentId];
94+
items[currentIndex] = currentItem;
95+
currentIndex += 1;
96+
}
9697
}
9798
return items;
9899
}

pages/create-artifacts.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export default function CreateItem() {
6060

6161
/* next, create the item */
6262
let contract = new ethers.Contract(creatifyAddress, Creatify.abi, signer)
63-
console.log(url);
64-
let transaction = await contract.createArtifact(ipfsHash);
63+
console.log("ipfs://"+ipfsHash);
64+
let transaction = await contract.createArtifact(url);
6565
let tx = await transaction.wait();
6666
let event = tx.events[0]
6767
let value = event.args[2]
@@ -71,10 +71,11 @@ export default function CreateItem() {
7171

7272
/* then list the item for sale on the marketplace */
7373
contract = new ethers.Contract(marketplaceAddress, Marketplace.abi, signer)
74-
let listingPrice = await contract.getListingPrice()
75-
listingPrice = listingPrice.toString()
74+
// let listingPrice = await contract.getListingPrice()
75+
// listingPrice = listingPrice.toString()
7676

77-
transaction = await contract.createMarketItem(creatifyAddress, tokenId, price, { value: listingPrice })
77+
// transaction = await contract.createMarketItem(creatifyAddress, tokenId, price, { value: listingPrice })
78+
transaction = await contract.createMarketItem(creatifyAddress, tokenId, price)
7879
await transaction.wait()
7980
router.push('/')
8081
}

pages/my-artifacts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default function MyAssets() {
4343
}
4444
return item
4545
}))
46+
console.log(items)
4647
setNfts(items)
4748
setLoadingState('loaded')
4849
}

scripts/deploy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ async function main() {
1515

1616
// We get the contract to deploy
1717
const Marketplace = await hre.ethers.getContractFactory("Marketplace");
18-
const marketplace = await Marketplace.deploy(300);
18+
const marketplace = await Marketplace.deploy(30);
1919
await marketplace.deployed();
2020
console.log("Marketplace Deployed to: ", marketplace.address);
2121

2222
const Creatify = await hre.ethers.getContractFactory("Creatify");
23-
const creatify = await Creatify.deploy("Creatify", "CRFTY", "https://localhost:9080/creatify/artifacts/", marketplace.address);
23+
const creatify = await Creatify.deploy("Creatify", "CRFTY", "", marketplace.address);
2424
await creatify.deployed();
2525
console.log("Creatify Deployed to:", creatify.address);
2626
}

test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("Creatify Marketplace Contract", function () {
2323
creator = accounts[1];
2424
buyer = accounts[2];
2525
marketplace = await Marketplace.new(300);
26-
creatify = await Creatify.new("Creatify", "CRFTY", "https://ipfs.infura.io/ipfs/", marketplace.address);
26+
creatify = await Creatify.new("Creatify", "CRFTY", "", marketplace.address);
2727
});
2828

2929
it("Should return the right name and symbol of the token once Creatify is deployed", async function() {
@@ -45,8 +45,8 @@ describe("Creatify Marketplace Contract", function () {
4545
const salePrice = ethers.utils.parseUnits("1", "ether");
4646

4747
/* create two tokens */
48-
await creatify.createArtifact("QmbXvKra8Re7sxCMAEpquWJEq5qmSqis5VPCvo9uTA7AcF");
49-
await creatify.createArtifact("QmbXvKra8Re7sxCMAEpquWJEq5qmSqis5VPCvo9uTA7AcF");
48+
await creatify.createArtifact("https://ipfs.infura.io/ipfs/QmbXvKra8Re7sxCMAEpquWJEq5qmSqis5VPCvo9uTA7AcF");
49+
await creatify.createArtifact("https://ipfs.infura.io/ipfs/QmbXvKra8Re7sxCMAEpquWJEq5qmSqis5VPCvo9uTA7AcF");
5050

5151
console.log(await creatify.tokenURI(1));
5252

0 commit comments

Comments
 (0)