Skip to content

Commit

Permalink
price to create a playlist set in the factory constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
tempe-techie committed Jul 1, 2024
1 parent 623b304 commit cd12adc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions contracts/DegenRadioFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ interface IDegenRadioPlaylistNft {
contract DegenRadioFactory {
address public immutable playlistNftAddress; // address of the playlist NFT contract (DegenRadioPlaylistNft.sol)
address public owner; // owner of the factory
uint256 public price = 0; // price to create a playlist
uint256 public price; // price to create a playlist

// CONSTRUCTOR
constructor(address playlistNftAddress_) {
constructor(address playlistNftAddress_, uint256 price_) {
owner = msg.sender;
playlistNftAddress = playlistNftAddress_;
price = price_;
}

// MODIFIERS
Expand Down
8 changes: 5 additions & 3 deletions scripts/4_DegenRadioFactory.deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const pauseLength = 4000; // in milliseconds

// TODO:
const constructorArgs = [
"0xbb6fca36B0d0107773a410103e9f1f459C3eb95e" // Playlist NFT contract address
"0xbb6fca36B0d0107773a410103e9f1f459C3eb95e", // Playlist NFT contract address
ethers.utils.parseEther("69"), // Price to create a playlist
];

async function main() {
Expand All @@ -18,7 +19,8 @@ async function main() {
const contract = await ethers.getContractFactory(contractName);
const instance = await contract.deploy(
// TODO:
constructorArgs[0]
constructorArgs[0],
constructorArgs[1]
);
await instance.deployed();

Expand Down Expand Up @@ -47,7 +49,7 @@ async function main() {
} finally {
console.log("If automated verification did not succeed, try to verify the smart contract manually by running this command:");
// TODO:
console.log("npx hardhat verify --network " + network.name + " " + instance.address + ' ' + constructorArgs[0]);
console.log("npx hardhat verify --network " + network.name + " " + instance.address + ' ' + constructorArgs[0] + ' "' + constructorArgs[1] + '"');
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/degenRadio.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ describe("Degen Radio test", function () {
await playlistNftContract.setMetadataAddress(metadataContract.address);

const DegenRadioFactory = await ethers.getContractFactory("DegenRadioFactory");
factoryContract = await DegenRadioFactory.deploy(playlistNftContract.address);
factoryContract = await DegenRadioFactory.deploy(
playlistNftContract.address,
ethers.utils.parseEther("0") // price to create a playlist
);
await factoryContract.deployed();

// Add factory as writer to playlistNftContract
Expand Down

0 comments on commit cd12adc

Please sign in to comment.