aboutsummaryrefslogtreecommitdiffstats
path: root/Compiler.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-08-04 20:05:20 +0800
committerchriseth <c@ethdev.com>2015-08-04 20:06:25 +0800
commiteab9585ea15f61fdf3076ed8da867c740bde51c7 (patch)
tree10ca2e2948c418919877cd157d94e2908bc78be1 /Compiler.cpp
parent6daa27622a06ec7b8a4d67e4d8a1e2dcaa1be982 (diff)
downloaddexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.tar
dexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.tar.gz
dexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.tar.bz2
dexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.tar.lz
dexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.tar.xz
dexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.tar.zst
dexon-solidity-eab9585ea15f61fdf3076ed8da867c740bde51c7.zip
Fix clone with regards to value transfer.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r--Compiler.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Compiler.cpp b/Compiler.cpp
index eadfc204..f0d1b38e 100644
--- a/Compiler.cpp
+++ b/Compiler.cpp
@@ -712,11 +712,13 @@ eth::Assembly Compiler::getCloneRuntime()
a << u256(0) << eth::Instruction::DUP1 << eth::Instruction::CALLDATACOPY;
//@todo adjust for larger return values, make this dynamic.
a << u256(0x20) << u256(0) << eth::Instruction::CALLDATASIZE;
- a << u256(0) << eth::Instruction::DUP1;
+ // unfortunately, we have to send the value again, so that CALLVALUE returns the correct value
+ // in the callcoded contract.
+ a << u256(0) << eth::Instruction::CALLVALUE;
// this is the address which has to be substituted by the linker.
//@todo implement as special "marker" AssemblyItem.
a << u256("0xcafecafecafecafecafecafecafecafecafecafe");
- a << u256(eth::c_callGas + 10) << eth::Instruction::GAS << eth::Instruction::SUB;
+ a << u256(eth::c_callGas + eth::c_callValueTransferGas + 10) << eth::Instruction::GAS << eth::Instruction::SUB;
a << eth::Instruction::CALLCODE;
//@todo adjust for larger return values, make this dynamic.
a << u256(0x20) << u256(0) << eth::Instruction::RETURN;