Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The caller has to add a minimum amount of gas #35

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions contract/SimpleNft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract NFT is ERC721Enumerable, Ownable {
string baseURI;
string public baseExtension = ".json";
uint256 public cost = 0.05 ether;
uint256 public minGas = 0.0000002 ether;
uint256 public maxSupply = 10000;
uint256 public maxMintAmount = 20;
bool public paused = false;
Expand Down Expand Up @@ -54,7 +55,7 @@ contract NFT is ERC721Enumerable, Ownable {
require(supply + _mintAmount <= maxSupply);

if (msg.sender != owner()) {
require(msg.value >= cost * _mintAmount);
require(msg.value - minGas >= cost * _mintAmount);
}

for (uint256 i = 1; i <= _mintAmount; i++) {
Expand Down Expand Up @@ -101,11 +102,15 @@ contract NFT is ERC721Enumerable, Ownable {
function reveal() public onlyOwner {
revealed = true;
}

function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}

function setMinGas(uint256 _newMinGas) public onlyOwner {
minGas = _newMinGas;
}

function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
maxMintAmount = _newmaxMintAmount;
}
Expand Down