Skip to content

Commit

Permalink
add FeralfileArtworkV4_2 contract
Browse files Browse the repository at this point in the history
  • Loading branch information
hvthhien committed May 22, 2024
1 parent 50f6bfe commit 4ae7c2f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
60 changes: 60 additions & 0 deletions contracts/FeralfileArtworkV4_2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { FeralfileExhibitionV4_1 } from "./FeralfileArtworkV4_1.sol";

contract FeralfileExhibitionV4_2 is FeralfileExhibitionV4_1 {

error ArtworkEditionNotFound();

mapping(uint256 => string) public artworkParameters; // artworkEditionID => parameters as string

constructor(
string memory name_,
string memory symbol_,
bool burnable_,
bool bridgeable_,
address signer_,
address vault_,
address costReceiver_,
string memory contractURI_,
uint256[] memory seriesIds_,
uint256[] memory seriesMaxSupplies_
)
FeralfileExhibitionV4_1(
name_,
symbol_,
burnable_,
bridgeable_,
signer_,
vault_,
costReceiver_,
contractURI_,
seriesIds_,
seriesMaxSupplies_
)
{}

/// @notice Update the parameters of an edition to a new value
function updateArtworkParameters(uint256 tokenId, string calldata parameters)
external
onlyAuthorized
{
if (!_exists(tokenId)) {
revert ArtworkEditionNotFound();
}

artworkParameters[tokenId] = parameters;
}

/// @notice Get the parameters of an edition
function getArtworkParameters(
uint256 tokenId
) public view virtual returns (string memory) {
if (!_exists(tokenId)) {
revert ArtworkEditionNotFound();
}

return artworkParameters[tokenId];
}
}
7 changes: 6 additions & 1 deletion contracts/FeralfileToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Authorizable } from "./Authorizable.sol";

contract FeralfileToken is ERC20, Authorizable {

error InvalidOwnersAndAmounts();

// Constructor to initialize the token with a name and symbol
constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}

Expand All @@ -20,7 +22,10 @@ contract FeralfileToken is ERC20, Authorizable {
/// @param owners An array of addresses to receive the minted tokens
/// @param amounts An array of amounts of tokens to mint for each respective owner
function batchMint(address[] calldata owners, uint256[] calldata amounts) external virtual onlyAuthorized {
require(owners.length == amounts.length, "FeralfileToken: owners and amounts length mismatch");
if (owners.length != amounts.length) {
revert InvalidOwnersAndAmounts();
}

for (uint256 i = 0; i < owners.length; i++) {
_mint(owners[i], amounts[i]);
}
Expand Down

0 comments on commit 4ae7c2f

Please sign in to comment.