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();...
1
The first option is close.
Before execution the transaction gasLimit * gasPrice are removed from the sender account
Transaction is executed
unusedGas * gasPrice is returned to sender
usedGas * gasPrice is send to miner
The state changes in 1, 3 and 4 are unusual in that there's only one part involved.
See here https://github.com/ethereum/go-ethereum/blob/...
1
You can use an emoji directly in a string literal in Solidity versions 0.6.12 and earlier. You cannot do so with version 0.7.0 or later.
Solidity version 0.7.0 updated the parser to disallow non-printable characters in string literals. Instead, they introduced the concept of Unicode string literals, such as unicode"😃", which allows you to use ...
1
There's a cap to the maximum refundable gas. Only half of the total used gas can be refunded. (*)
In the example at most you can refund (21000 + 5000) / 2 = 13000 gas.
So it will be at 21000 + 5000 - min(13000, 15000) = 26000 - 13000 = 13000. Very close to the measured amount.
(*) The exact details are in Ethereum's Yellow Paper Section 6.2 Execution.
1
__$de3f906ec3d3531c3d498f8b283d7f02e6$__ is a placeholder for library address.
The deployment process of smart contracts look somewhat like this
Library is compiled
Library is deployed, gets an address
Contract using library is compiled
Contract is "linked" - all placeholders in the bytecode are replaced with the library address
Contract is ...
1
From the solidity compiler they are completely different functions.
At runtime functions are identified by their 4 bytes selector. The function selector is calculated from the function name and the parameter types (Function Selector). If the function name remains the same but the parameters change it is very likely the selector will be different.
The virtual ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
contract-development × 3442solidity × 1835
contract-design × 900
remix × 331
go-ethereum × 321
contract-invocation × 302
contract-deployment × 289
web3js × 277
tokens × 276
contract-debugging × 220
truffle × 198
transactions × 182
erc-20 × 166
blockchain × 159
ether × 111
gas × 102
dapp-development × 90
security × 67
dapps × 59
evm × 59
storage × 58
events × 56
arrays × 56
addresses × 53
ico × 53