Skip to content

Instantly share code, notes, and snippets.

@cryptonomicon46
Last active May 31, 2022 15:20
Show Gist options
  • Save cryptonomicon46/2d1f32d3aee5ed55d66b320d16582397 to your computer and use it in GitHub Desktop.
Save cryptonomicon46/2d1f32d3aee5ed55d66b320d16582397 to your computer and use it in GitHub Desktop.
InputsToERC1155
constructor(
uint[] memory ids_,
uint[] memory prices_,
uint[] memory maxAmounts_,
address beneficiary_,
address devAddress_
)
ERC1155(_baseURI)
payable
{
owner = payable(msg.sender);
prices = prices_;
ids = ids_;
maxAmounts = maxAmounts_;
beneficiary = beneficiary_;
devAddress = devAddress_;
require(ids.length == prices.length && ids.length == maxAmounts.length,"TokenIDs, TokenPrices and TokenAmounts should be of the same length");
for(uint i =0; i< ids.length; i++) {
_idToidx[ids[i]] = i;
nftInfo.push(NFTInfo({
id: ids[i],
price: prices[i],
reserves: maxAmounts[i]
}));
_tokenURI[ids[i]] = string.concat(_baseURI,Strings.toString(ids[i]),baseExtension);
}
startedAt = block.timestamp;
endAt = startedAt + DURATION;
}
//Example inputs for debug
address devAddress;
//= 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
address beneficiary;
//= 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db;
mapping (address => uint ) pendingWithdrawal;
uint256[] ids;
//= [46,93];
uint256[] prices;
// = [1 ether, 0.5 ether];
//If using Remix, use the following format for price inputs
//["1000000000000000000","500000000000000000"]
uint256[] maxAmounts;
//= [10,20];
uint maxMintAmount = 100;
//Token URI variables
string _baseURI = "https://ipfs.io/ipfs/QmcDRWwXCE1LjvdESNZsmc75syTJP2zA8WW9SHEaCwEmkc/";
mapping (uint256=> string) _tokenURI; //TokenId to tokenURI mapping
string baseExtension = ".json";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment