i browsed stackexchange and someone recommended to set gas for a network, localhost in my case, yet it still throws this error
this is what I have set for config.networks.hardhat:
chainId: 1337, // TO WORK WITH METAMASK
gas: 8000000,
gasPrice: 1,
blockGasLimit: 6721975
i restarted the local node and it still rhrows this error
Jul 24, 2021, 9:44 AM
and I run local node with pnpx hardhat node
now getting another error
rror: VM Exception while processing transaction: reverted with reason string 'Ether value sent is below the price'
bc of this
require(
msg.value >= price.mul(tokens),
"Ether value sent is below the price"
);
require(
msg.value >= price.mul(tokens),
"Ether value sent is below the price"
);
msg.value is 0 for some reason π€
ohhh i forgot to pass the value my bad
this func breaks
// Change token URI
function setBaseURI(string memory baseURI) public onlyOwner {
setBaseURI(baseURI);
}
// Change token URI
function setBaseURI(string memory baseURI) public onlyOwner {
setBaseURI(baseURI);
}
should i call it within mint prob π€
(sorry i'm noob at solidity trying to figure stuff out)
oh ok i'm a dumbass i didn't make a contract prop for baseuri lol
okkk i now figured it out
setBaseURI recursively called itself lmaooo
hmmm
ERC721 seems to already have this property?
Jul 24, 2021, 9:55 AM
check if you have it declared somewhere else
just do ctrl+f
and then write _baseURI
Jul 24, 2021, 9:56 AM
yeah i jsut did, in erc721 it looks like it's declared and it's empty?
openzeppelin source:
Jul 24, 2021, 9:57 AM
then just set remove the old declaratiion
Jul 24, 2021, 9:57 AM
got it thx
Jul 24, 2021, 9:57 AM
No
don't
openzeppelin already did all the job for you
Jul 24, 2021, 9:57 AM
ok i unddi
then why it throws π€
Jul 24, 2021, 9:57 AM
function _baseURI returns an empty string
make a new string
and make that _baseURI function return that
string private baseURI_;
function _baseURI() internal view virtual returns (string memory) {
return baseURI_;
}
return baseURI_;
}
like that
and in setBaseUri change baseURI_
or, remove the _baseURI function
and make _baseURI a string
@talentless_guy
Jul 24, 2021, 10:01 AM
gotchu thx
i did this
is it a right hting to do?
Jul 24, 2021, 10:01 AM
that works
Jul 24, 2021, 10:01 AM
thanks bro
omg omg it deployed
yaaay
Jul 24, 2021, 10:04 AM
if you want to change major aspects of a contract
and with a function like this:
function migrate() external {
uint256 balance = oldToken.balanceOf(_msgSender());
oldToken.burn(balance);
_mint(_msgSender(), balance);
}
function migrate() external {
uint256 balance = oldToken.balanceOf(_msgSender());
oldToken.burn(balance);
_mint(_msgSender(), balance);
}
like that
well, if you want to change major aspects of a contract
and can't make another, then you can't
not uniswaps
Uniswap is a masterpiece :P
and you can sell tokens now, and mint the same amount you sold in v3
and then add LP with tokens you sold + those tokens minted
and then tell people to go to V3
and now everyone will think you rugged V2 but.. thats not the point
lol
contract.doFunction(param1, param2, {gasLimit: 250e3})
like that
Jul 24, 2021, 10:20 AM
where should i use this
Jul 24, 2021, 10:20 AM
when you do the function
in the front end
Jul 24, 2021, 10:20 AM
1 sec
but there is no functions for that?
Jul 24, 2021, 10:21 AM
lol
then how do you interact with the contract?
@begin_solidity
Jul 24, 2021, 10:23 AM
but thats not a contratc
a full private blockchain
ethereum
Jul 24, 2021, 10:23 AM
you can't set the default gas limit / gas price from the contract
if thats what you mean
when you interact with the contract, you do it from JS
Jul 24, 2021, 10:24 AM
a fork of ethereum to test smart contracts
Jul 24, 2021, 10:24 AM
in that JS, you can gas limit and gas price
Jul 24, 2021, 10:25 AM
yes but i dont knowhow to do it
Jul 24, 2021, 10:25 AM
lets say you have a button that executes a contract function
Jul 24, 2021, 10:25 AM
{
"name": "DemoPoA",
"engine": {
"authorityRound": {
"params": {
"stepDuration": "5",
"validators" : {
"multi": {
"0": {
"list": ["0x78cb4881d6176dca842a705326eb123efacee594"]
}
}
}
}
}
},
"params": {
"gasLimitBoundDivisor": "0x400",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x266B",
"eip155Transition": 0,
"validateChainIdTransition": 0,
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0x2fefd8"
},
"accounts": {
"0x0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0x0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0x78cb4881d6176dca842a705326eb123efacee594": { "balance": "10000000000000000000000000000"}
}
}
"name": "DemoPoA",
"engine": {
"authorityRound": {
"params": {
"stepDuration": "5",
"validators" : {
"multi": {
"0": {
"list": ["0x78cb4881d6176dca842a705326eb123efacee594"]
}
}
}
}
}
},
"params": {
"gasLimitBoundDivisor": "0x400",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x266B",
"eip155Transition": 0,
"validateChainIdTransition": 0,
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0x2fefd8"
},
"accounts": {
"0x0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0x0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0x78cb4881d6176dca842a705326eb123efacee594": { "balance": "10000000000000000000000000000"}
}
}
this is the file
Jul 24, 2021, 10:26 AM
whats that for?
Jul 24, 2021, 10:26 AM
this is the chain spec file to run the private blockchain/
Jul 24, 2021, 10:27 AM
you want to set the block gas limit on your private blockchain?
Jul 24, 2021, 10:27 AM
i want to set a transaction fee one like ethereum\
Jul 24, 2021, 10:28 AM
why not just use ganachee?
Jul 24, 2021, 10:29 AM
because if i transact any amount it doesnt asks for transaction fee
iam not familiAR WITH THATπ
Jul 24, 2021, 10:29 AM
then gas price is 0?
Jul 24, 2021, 10:30 AM
yes
Jul 24, 2021, 10:30 AM
general question for NFTs
is it better to set token URI within a mint function or better call it separately?
is it better to set token URI within a mint function or better call it separately?
Jul 24, 2021, 10:30 AM
I would recommend to go with the first one.
Jul 24, 2021, 10:41 AM
thanks, i will change my contract a bit then
Jul 24, 2021, 10:41 AM
By the way, I just wanted to say thank you as you stopped reading PM haha, but your input was great
Jul 24, 2021, 10:46 AM
make it higher
and you'll pay gas
Jul 24, 2021, 10:50 AM
thats what how?
Jul 24, 2021, 10:50 AM
from the test scripts you have?
Jul 24, 2021, 10:50 AM
another generic question
if i build a limited collection nft, with only 1 token ID, should use token ids at all?
if i build a limited collection nft, with only 1 token ID, should use token ids at all?
I tried to read WeirdWhales and Voxies contracts, none of them use tokenIDs, they use stuff like totalSupply() + 1 instead for _safeMint func
here they set with token ids / counters
https://github.com/ranadeep47/NFT-hardhat-IPFS-Polygon/blob/main/contracts/NFT.sol#L52-L61
here with totalSupply():
https://etherscan.io/address/0xe3435edbf54b5126e817363900234adfee5b3cee#code#L1948
what's the best preferred way nowadays?
https://github.com/ranadeep47/NFT-hardhat-IPFS-Polygon/blob/main/contracts/NFT.sol#L52-L61
here with totalSupply():
https://etherscan.io/address/0xe3435edbf54b5126e817363900234adfee5b3cee#code#L1948
what's the best preferred way nowadays?
I have fixed supply btw
Jul 24, 2021, 10:57 AM
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol
Jul 24, 2021, 10:57 AM
i'm already using ERC721... should i switch to ERC1155?
Jul 24, 2021, 10:57 AM
ERC1155 is what you're looking for
Jul 24, 2021, 10:57 AM
oh thanks
do you know any public NFTs that use ERC1155?
Jul 24, 2021, 10:59 AM
rarible, opensea
most of them are erc1155
Jul 24, 2021, 10:59 AM
got it
yay found https://github.com/ProjectOpenSea/opensea-erc1155
Jul 24, 2021, 11:00 AM
I would just use the openzeppelin one imo
Jul 24, 2021, 11:00 AM
well i ok i will use it
Jul 24, 2021, 11:01 AM
those use sol 0.5
Jul 24, 2021, 11:01 AM
opensea seems to use their own ERC1155
Jul 24, 2021, 11:01 AM
any erc1155 works with opensea
Jul 24, 2021, 11:02 AM
isn't an ERC1155 an overkill in my situation tho? i'm not building the whole marketplace π€
i'm planning to mint all the tokens myself and then set them on sale
i'm planning to mint all the tokens myself and then set them on sale
Jul 24, 2021, 11:14 AM
wdym overkill?
Jul 24, 2021, 11:14 AM
too much functionality i don't need mb? idk
Jul 24, 2021, 11:14 AM
you're not building a marketplace with an ERC1155 LOL
Jul 24, 2021, 11:14 AM
hm maybe i'm reading it too fast lol
rarible seem to be using their a custom wrapper for lazy minting... is there... uhm... a simpler example with pure ERC1155? to understand it better first
Jul 24, 2021, 11:27 AM
openzeppelin
Jul 24, 2021, 11:28 AM
well the example they have is for multi-token... I am looking for an NFT example with fixed supply
Jul 24, 2021, 11:28 AM
you can just make it so you don't mint more
and only once
as you'll be minting only once anyways
Jul 24, 2021, 11:29 AM
not sure what you mean >_<
Jul 24, 2021, 11:30 AM
well, it'll be fixed supply because you'll only mint once
right?
Jul 24, 2021, 11:31 AM
yes
only 50 NFTs in total
Jul 24, 2021, 11:31 AM
then if you mint once, inside the constructor for example
it can't be done again
so it'll be fixed supply
Jul 24, 2021, 11:32 AM
gotchu
rn I have this:
and idk how to set a price / totalsupply here :(
and idk how to set a price / totalsupply here :(
do u know any community-made nfts on top of erc1155?
github is empty with those
maybe I don't even need to declare MAX_TOKENS and just map thru my assets and mint 50 nfts?
Jul 24, 2021, 11:44 AM