Skip to content

Commit

Permalink
add some validations
Browse files Browse the repository at this point in the history
  • Loading branch information
jollyjoker992 committed Jun 27, 2023
1 parent 8b8ef33 commit 083f1f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
20 changes: 14 additions & 6 deletions contracts/FeralfileArtworkV4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ contract FeralfileExhibitionV4 is
constructor(
string memory name_,
string memory symbol_,
address signer_,
bool burnable_,
bool bridgeable_,
address signer_,
address vault_,
address costReceiver_,
string memory tokenBaseURI_,
Expand Down Expand Up @@ -195,7 +195,7 @@ contract FeralfileExhibitionV4 is
}

/// @notice Set vault contract
/// @dev don't allow to set signer as zero address
/// @dev don't allow to set vault as zero address
function setVault(address vault_) external onlyOwner {
require(
vault_ != address(0),
Expand All @@ -217,13 +217,13 @@ contract FeralfileExhibitionV4 is
);
}

/// @notice Start token selling
/// @notice Start token sale
function startSale() external onlyOwner {
mintable = false;
resumeSale();
}

/// @notice Resume token selling
/// @notice Resume token sale
function resumeSale() public onlyOwner {
require(
!mintable,
Expand Down Expand Up @@ -251,7 +251,7 @@ contract FeralfileExhibitionV4 is
_selling = false;
}

/// @notice Stop token selling and burn remaining tokens
/// @notice Stop token sale and burn remaining tokens
function stopSaleAndBurn() external onlyOwner {
pauseSale();

Expand Down Expand Up @@ -288,7 +288,7 @@ contract FeralfileExhibitionV4 is
for (uint16 j = 0; j < seriesIds.length; j++) {
if (artwork.seriesId == seriesIds[j]) {
address to = recipientAddresses[j];
_transfer(from, to, tokenId);
_safeTransfer(from, to, tokenId, "");
break;
}
}
Expand Down Expand Up @@ -373,12 +373,20 @@ contract FeralfileExhibitionV4 is

/// @notice Update the base URI for all tokens
function setTokenBaseURI(string memory baseURI_) external onlyOwner {
require(
bytes(tokenBaseURI).length > 0,
"ERC721Metadata: baseURI_ is empty"
);
tokenBaseURI = baseURI_;
}

/// @notice the cost receiver address
/// @param costReceiver_ - the address of cost receiver
function setCostReceiver(address costReceiver_) external onlyOwner {
require(
costReceiver_ != address(0),
"FeralfileExhibitionV4: costReceiver_ is zero address"
);
costReceiver = costReceiver_;
}

Expand Down
26 changes: 12 additions & 14 deletions migrations/301_feralfile_exhibition_v4_0.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
var FeralfileExhibitionV4 = artifacts.require('FeralfileExhibitionV4');
var FeralfileExhibitionV4 = artifacts.require("FeralfileExhibitionV4");

const argv = require('minimist')(process.argv.slice(2), {
string: ['exhibition_curator'],
const argv = require("minimist")(process.argv.slice(2), {
string: ["exhibition_curator"],
});

module.exports = function (deployer) {
let exhibition_name = argv.exhibition_name || 'FFV4 Test';
let exhibition_symbol = argv.exhibition_symbol || 'FeralfileExhibitionV4';
let exhibition_name = argv.exhibition_name || "FFV4 Test";
let exhibition_symbol = argv.exhibition_symbol || "FeralfileExhibitionV4";
let exhibition_signer =
argv.exhibition_signer ||
'0x6732389c6d47d01487dcDc96e2Cc6BAf108452f2';
argv.exhibition_signer || "0x6732389c6d47d01487dcDc96e2Cc6BAf108452f2";
let exhibition_vault =
argv.exhibition_vault ||
'0x0c51e8becb17ba3203cd04d3fc31fcb90de412a1';
argv.exhibition_vault || "0x0c51e8becb17ba3203cd04d3fc31fcb90de412a1";
let exhibition_cost_receiver =
argv.exhibition_cost_receiver ||
'0x6732389c6d47d01487dcDc96e2Cc6BAf108452f2';
"0x6732389c6d47d01487dcDc96e2Cc6BAf108452f2";
let burnable = argv.burnable || true;
let bridgeable = argv.bridgeable || true;

deployer.deploy(
FeralfileExhibitionV4,
exhibition_name,
exhibition_symbol,
exhibition_signer,
burnable,
bridgeable,
exhibition_signer,
exhibition_vault,
exhibition_cost_receiver,
'https://ipfs.bitmark.com/ipfs/QmaQegRqExfFx8zuR6yscxzUwQJUc96LuNNQiAMK9BsUQe',
'https://ipfs.bitmark.com/ipfs/QmaQegRqExfFx8zuR6yscxzUwQJUc96LuNNQiAMK9BsUQe',
"https://ipfs.bitmark.com/ipfs/QmaQegRqExfFx8zuR6yscxzUwQJUc96LuNNQiAMK9BsUQe",
"https://ipfs.bitmark.com/ipfs/QmaQegRqExfFx8zuR6yscxzUwQJUc96LuNNQiAMK9BsUQe",
[1, 2, 3, 4],
[1000, 1000, 1000, 1000],
[1000, 1000, 1000, 1000]
);
};
2 changes: 1 addition & 1 deletion test/feralfile_exhibition_v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ contract("FeralfileExhibitionV4_0", async (accounts) => {
let contract = await FeralfileExhibitionV4.new(
"Feral File V4 Test",
"FFv4",
this.signer,
true,
true,
this.signer,
this.vault.address,
COST_RECEIVER,
TOKEN_BASE_URI,
Expand Down

0 comments on commit 083f1f4

Please sign in to comment.