Hot answers tagged

3

NFTs have a decimals value of 0. Conceptually you cannot split a simple non-fungible token in half (think of sending half a painting to a buyer). Only natural values. Technically, we can read in the ERC-721 that the standard requires the 0 decimals (amounts will only be integers >= 0): An implementation may also include a function decimals that returns ...


2

I was in the same situation - my credentials were stolen when i connected metamask to scam website that looked like legit one. ETH scavenger was eating all my ETH in wallet and my NFTs were stuck in there. Fortunately i was able to rescue them using Flashbot relay to frontrun bot writing my own script. Basically using flashbots you can create multiple ...


2

The transactions was reverted, which means that everything is rolled back and it's like the transactions never happened. Your account has received the Eth back (or, in fact, it never even left the account). If your wallet still shows the old balance, your wallet is not synchronized properly, or there's some problem with it. The blockchain has the right data, ...


2

Please specifically say which problems you are trying to solve. Fair randomization? Bot protection? Gas wars? I wrote https://github.com/AreaWorld/ethereum-contracts which solves many of these problems and is permissively licensed. I also host a public Community Service Hour to take questions live from the public on Twitch and walk through this contract and ...


2

You can use a merkle airdrop for it. Here is a starter kit which also includes links to other services which might help you do it.


1

It very much depends on how your contract is used. E.g. if you have a custom interface and expect that all interactions are done via that interface it is feasible to use the solution proposed by p0pps. When comparing your two approaches then approach 2 is cheaper in any case. If we look at setting the whitelist, then storing an array on the blockchain will ...


1

In mint functions, change code to this. for(uint256 i = 1; i <= _amount; i++){ _safeMint( msg.sender, supply + i ); }


1

It's often hard to answer why questions, but I try. A1. Mining difficulty depends on the amount of computational power invested into verifying transactions on the blockchain needed to keep it decentralized and "unhackable". No. The difficulty depends on an algorithm that aims to keep the block production to the frequency defined by design (...


1

The key to solving this (how we do it at least) is using array indexes. It's still tricky as in Solidity we are very limited in what we can do with arrays, there is no way to slice, flip etc. Here is a working approach. (Note: this assumes you fulfil randomness via chainlink or otherwise in the getRandomNum function. Modify accordingly.) // your array which ...


1

It's a trade-off between customizability and ease of use. If you just want to list some NFT using Opensea's contract, you can use the UI. If you want to add some special features or customise any part of the NFT contract, you can deploy your own solidity contract too. It all depends on the usecase.


1

If you know the address of the account you want to check and a the specific id of the token you can use the balanceOf or ownerOf method of the token standards. For ERC-1155 you would use the following code: const balance = await tokenContract.methods.balanceOf(address, tokenId).call() const hasToken = balance > 0 For ERC-721 you would use the following ...


1

Neither of them were popular enough at the time they were released. This is why they were not built to be compatible. Also there were no standards available at the time, so nobody had a specific direction to build towards. Of course ERC-721 fixed the standards part. And general awareness of the new techniques is fixing new projects to come.


1

Okay, i have solved it and i hope it will help to other newbies too like me. The tokenId exists in the rawLogs data. tx.then(t => t.receipt.rawLogs) [ { removed: false, logIndex: 0, transactionIndex: 0, transactionHash: '0x494f65b3c78455501d5a8950f77c0b8031e7591cebedc9afa5496647a9b6ce2b', blockHash: '...


1

Bulk minting ERC-721 is not costly. Although the implementation you are considering might be suboptimal. In fact, the very first ERC-721 NFT, Su Squares, minted 10,000 tokens in one transaction. The Su Squares smart contract is now open source, permissively licensed and is referenced in the ERC-721 document.


1

Each token in your ERC-1155 collection will have a unique ID. Could you elaborate more on the problem you're facing? Unless you're talking about nesting fungible or semi-fungible tokens as a 2nd-level structure? For example you can have ERC-1155 collection with IDs = 1, 2, 3 and then under each ID you can have 100 fractions which are fungible tokens ...


1

Yes. You could examine the headers from the webserver/IPFS server which will often indicate the type of the object in the stream. Alternatively you could use magic numbers


1

Here's an ERC 1155 implementation of EIP 2981 royalties--implemented by some exchanges, but not yet universal. Royalties aren't built into a contract's transfer functions, which would interfere with gifting and transfers between an owner's wallets (see explanation from the EIP 2981 abstract below). ...The royalty payment must be voluntary, as transfer ...


1

Just complementing navigaid's answer, some marketplaces are now supporting EIP-2981 (NFT Royalty Standard). The advantage of this approach is that you can implement optional royalty payments, that is, if the user is only transferring the NFT to another wallet (without selling it), he does not need to pay the royalty: Optional royalty payments It is ...


1

The simplest way is to send extra fees to the artist when an NFT is traded. A quick search on GitHub would give you many examples. For example, here is a smart contract template to support NFTs whereby the artist gets a royalty from all future transactions of the NFT. Disclaimer: I am not the author of the code mentioned above. I'm mentioning it here for ...


1

What you are going to want to do is implement the ERC-20 token as an ERC-777 token which is a backward-compatible version of the ERC-20 standard with a few extra features. One of these new features is the ability to notify recipients of their balance change events. With this trigger, inside the NFT contract, which is also of type ERC-777 Recipient, the ...


1

Here is a mock marketplace contract (please excuse errors): pragma solidity ^0.8.0; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {Vault} from "./Vault.sol"; contract Sale { // -------- ADDRESS -------- address public vault; // -------- UINT -------- uint public saleNonce; // --...


1

It isn't implemented automatically so it is only if the specific contract that created the nft implements it. You need the contract address that created the nft, then you can inspect the code to see if it has something like a tokenIdToOwner mapping.


1

The order matching information -- buy order, sell order -- is not saved or accessible on chain in a way that your contract can be read during transfers. There is some way to do what you are saying, but it is not necessarily what you want. You can disable all ERC-721 transfers in your contract unless they are initiated by your contract itself. So you create ...


1

I answered my question, seem that I had to declare that in my strut above struct AirDrop { ERC1155 token; // 20 bytes uint256 tokenId; uint64 expirationTimestamp; // 8 bytes bytes32 merkleRoot; uint256 amount; address creator; mapping(uint256 => uint256) claimedBitMap; }


1

You would have to use oracles to access such data. Here an example for such an oracle: https://blog.chain.link/fetch-ipfs-api-data-token-distribution/


1

This is not possible, because it would violate the deterministic principle of a blockchain. More information in this answer.


1

I think is because you must install the dependency first and then import like you are doing with Counter.sol. import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; Be sure that you run yarn add @openzeppelin/contracts or npm install @openzeppelin/contracts


1

There are two broad standards of tokens trading on OpenSea - ERC721s and ERC1155s ERC721 implements the ownerOf method – function ownerOf(uint256 _tokenId) external view returns (address); This suggests that an NFT can only be owned by one address. A nuance is that if this address points to a contract/multi-sig, one could argue that this NFT is owned by a ...


1

If you make an offer, you're allowing OpenSea to spend the chosen amount of ERC20 tokens on your behalf. Once the seller accepts the offer, OpenSea will charge your wallet and send the amount to the seller and you receive your NFT. Only thing you can do is cancel your offer before the seller accepts it.


1

I'd recommend building that flexibility into the smart contract via EIP 2981 like in this repo. For the time being, EIP 2981 isn't widely implemented by exchanges, but expect that to change this year. If you're lazy minting on OpenSea, you should be able to update royalties in the collection settings. That said, these changes only help the artist capture ...


Only top voted, non community-wiki answers of a minimum length are eligible