Questions tagged [address.transfer]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
51
votes
4answers
38k views

<address>.send vs <address>.transfer best practice usage?

I noticed that address's offer two member functions that perform the transfer of ether to the specified address. send returns false upon failure and transfer raises an exception. In the Solidity ...
4
votes
1answer
359 views

Search in Address[] if exist the same address sender

I want to check if the Address sender is already in Address[]. If true, then do not allow this address to make the payment. Contract Hello { address[] internal Pool; function () public payable { ...
3
votes
2answers
69 views

Regular address turns into a contract after receiving a transfer?

To accept payments in ether myself, I first tried how others have implemented it. So I bought an item in a store that uses Coinbase Commerce to accept crypto payments and paid for my item with ether. ...
3
votes
2answers
625 views

Explain working of address.send function in solidity

I have been trying to get documentation for address.send() function, but i am unable to do so. Can someone please explain how address.send() function works, and how it can be used to send currency ...
3
votes
1answer
2k views

How to monitor all your addresses and send payments out immediately to a main address

Say I have separate addresses for ethereum that are getting regular payments through different channels. How do I monitor these and immediately send balances to the main account and leave all the ...
3
votes
2answers
2k views

Solidity: “send” and “transfer” are only available for objects of type “address payable”, not “address” [duplicate]

I'm trying to compile my smart contract with the solidity version 0.5.0. with the code below: function unbond(address wallet, bytes32 specifier, uint quantity) internal { bondage = ...
3
votes
1answer
267 views

Transfer function gives infinite gas warning in remix

If I use this simple payout contract in remix, it gives me a warning that the gas costs is infinite. Is this an intended behaviour? contract Payout { function payout() public { msg.sender....
3
votes
4answers
825 views

Can't transfer value from mapping inside mapping

The title of this issue might seem strange because I can't figure out exactly what the problem is. But here is what is happening: pragma solidity ^0.4.13; contract Escrow { address public owner; ...
3
votes
1answer
441 views

How can I instantiate a contract from a factory and, in the same call, send msg.value to it?

WHAT I WANT TO DO: call another contract's constructor function, instantiate that contract, and subsequently send Ether to it in the same function. WHAT HAPPENS: an instance of the other contract ...
3
votes
1answer
204 views

Communicating between a Sidechain and a Mainchain

Side chains (see linked question ) can be seen as a blockchain attached to a "parent" blockchain using a "two way" peg. Smart contract addresses are generated deterministically(HD wallet style), but ...
2
votes
2answers
2k views

address payable type - store address and send later using Solidity 0.5.0

Solidity 0.5.0 has separated the "address" type into two types: address payable and address. Only address payable have the address.transfer method. I don't want to use the withdrawal mechanism. When ...
2
votes
1answer
262 views

0x0000000000000000000000000000000000000000 address behaviour

I have a question about the possibly strange behaviours of address: 0x0000000000000000000000000000000000000000 We know that: ETH + ERC20 tokens sent there are burnt Upon creation of a new smart ...
2
votes
2answers
2k views

How to create unique addresses for custom ERC20 tokens

We can create ERC20 tokens using solidity or even metamask.. but how to create unique address to transfer them? I mean token like Gold reward or coins like Bitconnect has it's own pattern of address ...
2
votes
2answers
867 views

Using “.value(…)” is deprecated. Use “{value: …}” instead

This works fine in Remix but when trying to work in VSCode (for compiling purposes; DApp course, trying to build .json through compile.js ) it throws the error Using ".value(....
2
votes
1answer
84 views

Gas cost tests: Sending a transaction to a new address is more expensive?

A friend and I were thinking about transaction costs, is there any attached cost to send a transfer to a new address that has not been stored on chain before? So we started digging. First off we ...
2
votes
1answer
38 views

safeTransferFrom is undefined in buidler test

I have started using buidler for testing/compiling my contracts. In one test i have setup a scenario that a owner attempts to transfer a token to another wallet address. My contract is inheriting from ...
2
votes
2answers
120 views

Instantiating a contract with ether

I have a factory contract that I need to be able to deploy with some ETH. I'm getting an error TypeError: Member "transfer" not found or not visible after argument-dependent lookup in address. I ...
2
votes
1answer
141 views

tx.origin for factory

I want to use a factory so that people can create a standardized contract. People should be able to transfer money directly by this creation which led me to the problem of the msg.sender during the ...
2
votes
2answers
370 views

Can a fee in Ether be added to ERC20 Token transfers

New to Solidity... Is it possible to have a fee for transfers of an ERC20 Token in Ether? The fee would be 0.000001 Ether per transfer. Each time the ERC20 Token is sent to another user, the fee in ...
2
votes
1answer
403 views

Transferring ethers using a “for loop” in a smart contract

I am trying to send funds to the users who deposited ethers to my contract. I am currently achieving this by having the list of address and looping through them sending those addresses ethers. Right ...
2
votes
1answer
97 views

Why use returns(bool) in a transfer function?

function transfer(address _to, uint256 _value) public returns (bool) { require(balanceOf[msg.sender] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); ...
2
votes
1answer
440 views

Cannot transfer ERC20 token, “Bad instruction” error

I'm trying to transfer an ERC20 token from account A to account B. Account A deployed the contract and owns all tokens. Looks like I'm missing something very obvious. Every time I try to transfer ...
2
votes
2answers
171 views

Does ether transfer consume all gas in case of exception?

If addr.transfer() fails, does it use a revert- or throw-style exception? In other words, does a failed transfer consume all provided gas?
2
votes
0answers
61 views

Out of gas while using transfer function

I simply want the transaction to occur in integral ethers. I wish to refund the balance amount. I am using the following function in my contract for that. I am getting out of gas while running this ...
2
votes
0answers
265 views

withdraw eth from contract

I have contract and function which accepts ether. How can I transfer ether from contract to any other wallet? I'm using ganache-cli. Function work, and I spent 10 eth on contract(private network). ...
2
votes
0answers
34 views

Ethereum Exchanges compatibility matrix? <- concerns due to warnings regarding “smartcontract deposits”

Is there a "exchanges compatibility" features list/matrix, so I know between which I can move Ether directly? Context+example use case: I've tried to move Ether between exchanges, however warnings ...
1
vote
2answers
1k views

Who pays transaction fee ? Payer or Recipient of the ETH?

When we call address.transfer() or address.send() to transfer ETH, who has to pay transaction fee ? Payer or Recipient of the ETH? And is there any option to choose payer of the fee or gas? Updating ...
1
vote
2answers
175 views

UPDATED : How to determine “payer address” in “address.transfer(amount)”?

Consider we a function as follows : address public recipient; function settlement(uint256 amount) public { recipient = msg.sender; recipient.transfer(amount); } Then the ...
1
vote
1answer
37 views

Request a transaction amount in a function

I'm trying to have a function generate a request such that it pops up a Metamask request. I know I can do: require(msg.value == amount); to require the function call has a certain value. But this ...
1
vote
1answer
4k views

Transaction revert in Remix

Here is my contract pragma solidity ^0.4.14; contract Sample { address private receiver; uint public amount; function pay(address _receiver, uint _amount) payable public returns (bool) { ...
1
vote
1answer
788 views

Why there are 'OUT' token transfers from the zero (0x00…) address?

There are no 'OUT' transactions with ether (link), but there are a lot of token transfers (link). In my understanding, most likely no one has a private key for this address, so where do these ...
1
vote
2answers
774 views

Does `address.transfer` forward all gas (suceptible to re-entrancy)?

From the Solidity documentation I do not understand if the recently introduced address.transfer forwards all gas to the target contract or just gives a minimal gas stipend. I.e.: Would it facilitate ...
1
vote
1answer
40 views

tracing new address on new wallet in Ethereum [closed]

I am just wondering how the new addresses are anonymous in Ethereum. Suppose that I have a wallet A including many addresses on it. Then I have a new wallet, say wallet B, and opening new address on ...
1
vote
1answer
48 views

6 transfer functions result to out of gas

I have a function that in first call just counts values and in next calls transfer some amount of ETH. It's like: function() public { ... if (val !=0) { address1.transfer(val.mul(part1).div(...
1
vote
1answer
204 views

Transfer X% of Eth. sent to smart contract, to contract owner on buy function call

I use this "buy" function in a smart contract, to receive Eth. for a token. I would like to extend the function, so if the Eth amount in a transaction is higher than X Eth. then send Y% to smart ...
1
vote
1answer
87 views

How can I transfer half mining award to an address?

Creating a dapp, which requires half allocated mining fee should go to an address. I managed to cut down the mining as well as the block reward: consensus.go // Accumulate the rewards for the ...
1
vote
1answer
393 views

How to write a function that is automatically called when a contract receives an ERC20 token?

Fallback functions only work when a contract receives ether. Is there a way to write a fallback-style function that is automatically called when a contract receives an ERC20 token?
1
vote
2answers
368 views

Contract transfer between two address, pay gas from third address

The scenario is to transfer from Address B to Address C, deducting the transaction fee from Address. Here A will have some ether amount, which should be used to deduct the gas. The ERC20 Token ...
1
vote
1answer
934 views

How do I get the transaction hash and boolean return value? [duplicate]

I'm making a simple time-lock contract in Solidity. In my funds withdraw function I have: function withdraw_funds() public returns (bool) { if (getAccounts[msg.sender].amount > 0) { ...
1
vote
1answer
20 views

How to deposit to WETH in Solidity 0.6 and above?

Solidity 0.6.0 introduced a breaking change in how ETH transfers are performed. The following doesn't work anymore: weth.deposit.value(amount)(); What is the latest syntax for depositing ETH into the ...
1
vote
1answer
63 views

How can I send ether [duplicate]

Hey guys I am a beginer on Solidity. I write a function and try to send ether on remix accounts and check balances this accounts. But I can't connect accounts I think because when I check balance of ...
1
vote
1answer
208 views

Is it possible for send() in Solidity to fail if value is sent to a valid external account?

I want to use something like the following as a fallback for failed transfers: if (!recipientAddress.send(amount)) { ownerBalance += amount; } After reading about using transfer versus send, it ...
1
vote
1answer
171 views

Why can't we use Transfer() to get a fallback from a contract?

Does this discussion imply that we cannot call transfer() to some contract and call its fallback function and can only do the same by using call() and setting gas?
1
vote
1answer
207 views

Converting an address type variable to payable address type throws me error [duplicate]

I am trying to convert an address to payable address but I'm not able to do it. please find my code below: address a = destinationAddress; address dest = address(uint160(a)); dest.transfer(amount);
1
vote
1answer
465 views

ParserError: Expected identifier but got 'payable'

function getWinners() public onlyOwner { require (now > endQuiztime, 'Quiz did not end '); require (isReveal, "You didnt reveal Questions"); // calculate winner for each ques based on ...
1
vote
2answers
67 views

Will a transfer go through on a testnet transaction on meta mask to luno

What if you sent your ETH on the Ropsten testnet via Metamask to an ETH platform gateway like Luno (https://www.luno.com) ? Will you receive your Ether and will it reflect on that account? I've done ...
1
vote
1answer
153 views

Difference between transfer to ethereum account or to smart contract?

Is there a difference between sending ether to a user account or to a smart contract. E.g.: contract ThisIsAContract{ function() public payable {} } Now I call (pseudocode) ...
1
vote
2answers
686 views

Internal Token Transfer without ETH fee

Need to move all token from one address to another address(Internal) without fees. Could you please help me to solve this?
1
vote
1answer
776 views

How might you identify eth addresses with the same owner?

Given an ethereum address, how might you identify (or make a good guess) as to which other ethereum addresses belong to the same owner? Note: I'd come across some content that somewhat answers this ...
1
vote
1answer
2k views

Transfer ERC20 Tokens from my wallet to another wallet

before I start just wanted to say that I started a few time ago with solidity and I'm still noob, but I've been reading and researching about this and can't get it working. I'm using ethereum wallet ...