New answers tagged

0

holder Token holder. The holder can “authorize” and “revoke” operators which can send tokens on their behalf. These operators are intended to be verified contracts such as an exchange, a cheque processor or an automatic charging system. operator An operator is an address which is allowed to send and burn tokens on behalf of some holder. from docs: The ...


0

who decides the supply of tokens and when these tokens are generated? This question varies wildly from token to token. When people call Ethereum programmable money, it's because there is a massive level of programmability that can be done to something as simple as a token. Would you like to create a token that can be minted indefinitely by an admin? You ...


0

Welcome! Some good news - based on what you've described, it does not sound like the tokens are lost. We'll try to give a quick explanation, and then go into a bit more detail. Short Answer If you can see the ERC777s in MEW, that means they're in your account/address, no matter whether you usually access your funds through a Ledger or otherwise. The most ...


0

The problem is that you are sending the transfer message to the token recipient address. To execute a function from a contract the transaction has to target the contract address. const token = new web3.eth.Contract(abi, My_Contract.networks[4].address) const txObject = { .. to: '0x153ed6D60AcaE6E915907233F10663462FF67622', // <--- Recipient ....


0

Anyone who has the private key can move funds out from the address. It does not matter where and how the bot is being run.


2

Here are the key topics and keywords to search for: Generally: "Whitelist" the tokens you DO accept. Use the "approve and transferFrom" pattern. Decide if your token list will be static or changeable and consider the "Ownable" pattern to control access to the maintenance function if the latter. Otherwise, consider populating ...


2

There are various approaches, each requiring different amounts of trust: Transfer your tokens directly to another wallet and trust (hope) that they send other tokens to you Approve another wallet to withdraw tokens from your wallet. Very similar trust issues as in the previous Use a middleman contract which handles the trade for you. Eliminates the need ...


1

The only benefit is having everything in the same place. ERC-1155 is orders of magnitude more gas efficient, as deploying an ERC-20 contract is costly with current Ethereum gas prices.


2

ERC-1155 tends to be more useful for things such as games that need both fundable (In-game gold) and non-fungible(land) tokens.


0

If anyone's dealing with the same problem, I just checked with the Chainlink team & alarm clock functionality isn't working with v0.7 and v0.8 at the time of writing. If you want to use alarmClock and ERC-20, the easiest option is to downgrade OZ contracts with cmd : npm install @openzeppelin/contracts@3.0.0


1

All functions interacting with the network return promises. You must wrap everything in an async function and await them. E.g. var Tx = require('ethereumjs-tx'); var Web3 = require('web3'); const {ethers} = require('ethers'); (async () => { ... // get transaction count, later will used as nonce var count = await web3.eth.getTransactionCount(...


1

If I understand your question correctly you could use ERC-1155. a novel standard for multi-tokens, allowing for a single contract to represent multiple fungible and non-fungible tokens, along with batched operations for increased gas efficiency. There's an OpenZeppelin template, see https://docs.openzeppelin.com/contracts/3.x/erc1155


0

An important distinction here is "an NFT" versus "a unique digital representation of an artwork." Like Lauri says, each NFT is technically unique. But we don't yet have a way to ensure there is only one NFT issued against a piece of art. Someone could issue multiple NFTs against the piece of art on the same smart contract, or across ...


0

If you send tokens or ether to an address, only the owner of that address can send it back. If this address belongs to binance, ask them to send the tokens back to you. If it does not belong to binance and you don't know who the owner is, you lost your tokens permanently.


1

Is there anything, anywhere, that talks about whether or not different values can be returned when decimals() is called? No, but in practice, your token would not be listed on any exchange if you do something like this, because it would break a lot of assumptions that are not in the standard.


3

The standard doesn't say anything about how the contract needs to be implemented. It only says which function signatures need to be implemented. So, in theory, you can write a fully standard compatible contract which only reverts with each function, for example. So you can add any sort of custom logic in the decimals() function, as long as the signature ...


0

In the function that allows purchasing tokens (probably mint()), simply include a require check along those lines: require((balanceOf(msg.sender) + _mintAmount) <= maximumLimit, "Cannot exceed limit");


2

As you mentioned, ERC777 has send/receive hooks. These hooks allow for a number of neat features, however they open the door for reentrancy attacks. This is the same type of attack that drained the DAO (using ETH). I believe the reason ERC777 is not widely used is because some smart contract developers do not defend against token reentrancy. Most contracts ...


0

It is mandatory to invoke approve() for a contract if it uses transferFrom(). Some tokens support a special value of token.approve(spender, uint256(-1)) to indicate approval for every operation. There's a draft EIP 2612 - permit – 712-signed approvals the introduces permit() which is a sort of approve that can be combined with transferFrom() in a single call....


1

You are asking why the total supply of you contract is wrong. It's not. In solidity, there are no decimals. Numbers are always represented as integer. To compensate for this, the ERC-20 standard (BEP-20 is the same) provide that you have to specify how much decimals your token has. You then divide the amount of token an address has by 10 to the power of this ...


1

There are many possibles reasons that this happened and I will try to list them all. First of all, the problematic transaction called the transfer() function on the POLS token contract, not the transferFrom() function. It means that this fraud has nothing to do with the approval you made earlier to Uniswap. The transaction must have been signed either by ...


0

This is the approve function from the OpenZeppelin ERC20 contract (link): function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } The OP's question could be interpreted in two ways, either that the staking contract has a token (is itself an ERC20 ...


0

For importing an existing token, you need to import the token's contract which should be available publically. You can refer to their documentation or GitHub to find that contract, directly import that, and start using it. For example, for using DAI token in your contract, refer to this: https://github.com/makerdao/developerguides/blob/master/dai/dai-token/...


0

Welcome! As you stated, a contract can only transfer tokens from a user if the user has already approved the contract to spend the tokens. It is important to recognize that the user will call approve() on the token contract before interacting with your contract. In practice, a dapp will usually ask a user to perform two transactions: tokenContract.approve(...


2

The transaction ran out of gas. The gas limit was set to 22000, which is not enough for ERC20 transfers. In most cases those will consume 50-100k gas.


2

As for the fees, I'm not entirely sure whether they are calculated in the transfer-network token, or in the original token: The fee is given in either the native currency of the associated network, or, for token transfers, the token itself. Anything marked as ERC20 is an ERC-20 token on the Ethereum main net. Fees are paid in that token. Anything marked as ...


1

It's because of your oldest version of ethereum privatenet blockchain. Update and upgrade your geth,go and truffle versions.


1

createPair takes two ERC20 contract addresses as input, and returns the address of this pair. This address is deterministically calculated using the CREATE2 opcode. Therefore all information is inherently available and no addresses need to be hardcoded. getPair gets dynamically populated with pair addresses.


1

You need to make a transfer for the explorer to register that data.


0

I agree with @Lauri's answer and actually have been wondering the same questions during this NFT hype. However, just to extend the topic, NFTs are not new and can be used for a number of different use-cases besides collectible jpg's that anyone can download from a public IPFS. Below are just 3 examples: A gaming platform can trade with NFTs representing ...


0

Strictly speaking, an NFT is a unique ID inside a unique NFT contract address. And yes, they are assigned to owners very similarly compared to ERC20. The NFT contract has a certain address in a certain blockchain. In theory the same address can be generated in another blockchain, but to be precise, you should talk about for example Ethereum NFTs. Inside the ...


0

Because of security reasons. Having the variable private allows you to lock it down behind requirements. Such as, only the owner of a token can call the tranfer() function on that token. (You can also set another account as an "operator" of your tokens, thereby giving that "operator" account permission to call the transfer() function on ...


Top 50 recent answers are included