From a2bce5523aac207795f5660b072a72cb7c5f2c7d Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:33:26 -0600 Subject: [PATCH] update contract doc comments --- solidity/src/MaybeMintERC721.sol | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/solidity/src/MaybeMintERC721.sol b/solidity/src/MaybeMintERC721.sol index 80011e0..563bea0 100644 --- a/solidity/src/MaybeMintERC721.sol +++ b/solidity/src/MaybeMintERC721.sol @@ -6,12 +6,14 @@ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; /** * @title MaybeMintERC721 - * @dev Mint ERC721 tokens for a fee in ERC20 tokens + * @dev Mint ERC721 tokens for a fee in ERC20 tokens. As this simple token is intended for + * demonstration of batched EVM calls on Flow EVM using a single Cadence transaction, the + * minting process is random and has some chance of failure. */ contract MaybeMintERC721 is ERC721, Ownable { IERC20 public denomination; uint256 public mintCost; - address beneficiary; + address public beneficiary; uint256 public totalSupply; event MintCostUpdated(uint256 newCost); @@ -33,11 +35,17 @@ contract MaybeMintERC721 is ERC721, Ownable { } /** - * @dev Mint a new ERC721 token to the caller. This contract must be approved to transfer mintCost amount from the caller - * before minting the ERC721 to pay for mint + * @dev Mint a new ERC721 token to the caller with some chance of failure. This is for + * demonstration purposes, intended to showcase how a single Cadence transaction can batch + * multiple EVM calls and condition final execution based on the result of any individual + * EVM call. + * + * NOTE: This contract address must be approved to transfer mintCost amount from the caller + * to the beneficiary before minting the ERC721 to pay for mint */ function mint() external { // TODO: Get a random number to determine if the mint is successful + // TODO: Set token URI totalSupply++; // increment the total supply denomination.transferFrom(msg.sender, beneficiary, mintCost); // take payment for mint _mint(msg.sender, totalSupply); // mint the token, assigning the next tokenId @@ -45,7 +53,7 @@ contract MaybeMintERC721 is ERC721, Ownable { /** * @dev Set the cost to mint a new ERC721 token - * @param _mintCost The new cost to mint a token in the denomination ERC20 token + * @param _mintCost The new cost to mint a token in the denomination IERC20 token */ function setMintCost(uint256 _mintCost) external onlyOwner { mintCost = _mintCost; @@ -53,8 +61,8 @@ contract MaybeMintERC721 is ERC721, Ownable { } /** - * @dev Set the ERC20 token to use as the denomination - * @param _denomination The address of the ERC20 token to use as the denomination + * @dev Set the IERC20 contract to use as the denomination + * @param _denomination The IERC20 contract address to use as the denomination for mint fee */ function setDenomination(address _denomination) external onlyOwner { require(_denomination != address(0), "Denomination cannot be the zero address"); @@ -64,7 +72,7 @@ contract MaybeMintERC721 is ERC721, Ownable { } /** - * @dev Set the address to receive the minting fees + * @dev Set the address to receive the IERC20 token paid for minting fees * @param _beneficiary The address to receive the minting fees */ function setBeneficiary(address _beneficiary) external onlyOwner {