12

With respect to the ".value(...)" is deprecated. Use "{value: ...}" warning: You can use the following pattern to remove the warning: (bool success, ) = recipient.call{value:amt}(""); require(success, "Transfer failed."); solidity.readthedocs.io , solidity dotsyntax 0.7.0 => The following syntax is deprecated: ...


3

The contract can't prompt the user for any input. It has to be the frontend code which asks the user for input. So in your frontend you need to ask the user to input the amount of Ether to send and then you can use that amount in the value field for the transaction. Examples can be seen here: https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#id86


2

transact() asks the node to sign your transaction using eth_sendTransaction. Infura can't do that, because they don't have your keys. Instead, you can use the contract object to create an unsigned transaction like: contract_call = contract.functions.transfer(destination_address, value) unsigned_txn = contract_call.buildTransaction({'chainId': 1, 'gasPrice': ...


2

That is an outdated error message. I assume you are using ethlint as linter which means you can silence this warning by creating a .soliumrc.json in your repository with the following content: { "extends": "solium:recommended", "plugins": ["security"], "rules": { "no-call-value": "off" } } See the Github issue and further explanations on how to ...


2

10 transactions from an EOA will cost 210,000 gas. The most efficient way to do this would be to deploy a contract that accepts funds in the constructor and subsequently distributes the funds to 10 different addresses. This will cost the initial 21,000 gas, plus the cost of the transfers, which is maybe ~100,000.


2

To send funds in a function call to another contract you can use something like this: contract X { function transfer(address dest, uint amount) public { ... } } contract Y { function take() public payable { // Reference an existing contract at an address X ref = X(addressOfX); // or if creating a new instance at a new address: X ref = new X();...


2

The logic is simple, You transfer the amounts of the token described by the contract this function is part of, to the addresses specified in the entry data. The only different logic here is how are the address and amount encoded. here they are expected to be encoded in an uint256 format with specific bits set for the address and the rest for the amount. The ...


2

Directly, there is no way to use the "to" field of a transaction as block.coinbase. The to field needs to be an address (or 0 for creating a contract). But the miner will get your transaction fee. So instead of using to and value, you can simply increase your gas price. You have to be careful when you do that because you pay the gas price wei ...


2

One way you could achieve that is by: Creating a whitelist of addresses that will be the only ones to transfer your local currency Overriding transfer() to restrict transfers from/to users within the whitelist. In any case, you need an external procedure (off-chain) to determine which users belong to your region, or in other words, you need a centralised ...


2

Think I found the answer actually: Call a smart contract payable function sending erc20 token User/me first needs to call the approve function in the LINK contract then my Remix contract can transfer tokens from msg.sender to itself itself using LINK's transferFrom function.


1

It is leftover ETH that was returned to your wallet as a change. For more detail, you chose to swap by specifying the exact output amount (Doge Reload), so the web calculated the ETH input needed (~0.092 ETH) which was a little more than actual use (~0.089 ETH). So the router returned ~0.002 ETH. Read more: https://uniswap.org/docs/v2/smart-contracts/...


1

Currently Ethereum does not support using any other token as a gas currency except ETH. Some custom wallets are working to support gas station network that would allow middleman to pay ETH on behalf of you. But in this case you end up paying the middleman the market rate of currency conversion.


1

I would suspect the token contract itself. There are a bunch of transactions with the same problem and, although this is no definitive indicator, some negative comments. Personally I don't think it is reasonable to continue to pour time into this.


1

TLDR; Not all ERC20 transfers cost the same. There are mostly four cases of ERC20 transfers which influence the gas costs. Most of the time you're better of with passing a high value for gasLimit. But if you really want to minimize that, you can try your best to figure out the senario. Firstly, to even have the function execute properly I need to pass the ...


1

Events can be thought of as logs written in the blocks. It is useful for off-chain services that can subscribe to these events and take action. As they modify the storage, events increase (slightly) the gas cost of the transaction (more info here : How do events influence a transaction's gas?). A burn usually emits a Transfer event with the recipient ...


1

To be clear, there is no required "standard" approach to implement what you like. This was intentionally excluded from the standard so that you could decide the best approach for you. A very popular approach is to have a buy(...) function for buying available inventory or a bid(...) to make a competitive offer, if this will be an asynchronous ...


1

That is creating a reference to an existing instance of the contract. The tokenAddress is an address which holds a contract. The interface says what kind of functionality the address supports (supposedly). So once you create this kind of reference, you have type-safe access to the functionality defined in the interface. Bear in mind that you can write ...


1

A contract only has access to its own funds. (bool success, ) = owner.call.value(100)(""); This code send 100 wei from the contract's balance to owner address. If no units is given solidity assumes it is wei, 1 ether = 10^18 wei. In order to make a function accept ether payments it has to be declared as payable, then msg.value will contain the ...


1

It is a warning, Etherscan is looking for the Transfer(sender,recipient,amount) event and it can't find it because ERC223 uses slightly different event Transfer(sender,recipient,amount,data). It shouldn't be a problem. Perhaps a wallet that is not aware of ERC223 tokens will not update the balance correctly, but the balance should be correct on the ...


1

Contract cannot take ethers from wallet address and transfer it, you need to pass the amount you wish to transfer as VALUE. Then your code should look like this: function sendEther(address payable recipient) public payable { recipient.transfer(msg.value); } Then if you want to transfer only exact one ether you can have the following condition in your ...


1

Using keystore files (and private keys, mnemonic phrases, etc.) on websites is discouraged because there's a higher risk of them being stolen. The DNS servers of the website could be hacked (which happened multiple times on MEW), or you could be on a fake website without realising it. A relatively safe way to use keystore files is through MyCrypto's desktop ...


1

This depends on the staking contract, but most likely the answer is no. The answer is no UNLESS the staking contract specifically allows for this, which is unlikely.


1

Using account A in order to execute transferFrom(source, target, amount) requires both: source holds at least amount of the given token A has been approved by source to transfer from it at least amount of the given token Using account A in order to execute transfer(target, amount) requires only: A holds at least amount of the given token Your question is ...


1

Some exchanges, such as the one you posted, require you to trade a minimum amount of ETH (or tokens). In this case, you are trying to send 0.00003111... WETH, but the exchange says you need to send a minimum of 0.001. In order to fix this, you will need to send more WETH to your account.


1

What is usually done (you can see such cases on decentralized exchanges) is to approve a very large number of tokens (greater than the total supply). A library such as bignumber.js can help you to work with this kind of numbers in javascript. Note that this approach may involve security concerns. If the smart contract has a weakness and is "hacked",...


1

Sure, but the flow is a little counter-intuitive and takes some getting used to. You can send ETH and/or data to a contract function. The data can instruct a contract function to seize a certain amount of a token from someone, usually the msg.sender (but not necessarily). Your contract would use the ERC20, transferFrom(<funder>, <amount>) ...


1

Only from the smart contract based wallets that are designed for this. ERC-20 tokens on normal Ethereum accounts cannot do this.


1

When you use a command in a form like: ax1.pay.sendTransaction(<address>,{from:<address>, value:<value>, gas:<...>, gasPrice:<...>}) you should define the sender's address in field from: , otherwise, accounts[0] in Ganache accounts will be considered as the sender and its balance will be decreased. Now, if your sender is a ...


1

It is because of MAX_SAFE_INTEGER of JavaScript. As you can see here ,the MAX_SAFE_INTEGER constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). The reasoning behind that number is that JavaScript uses double-precision floating-point format numbers. It can only safely represent integers between -(2^53 - 1) and (2^53 - 1). ...


1

All transactions in the Ethereum blockchain require some Ether to pay for the transaction. So you simply need to have Ethers in your wallet to pay for the transaction (its gas costs).


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