Merge pull request #2697 from chriseth/sol_fix_clone

Fix clone with regards to value transfer.
This commit is contained in:
chriseth 2015-08-05 18:13:42 +02:00
commit f1fa2734d0

View File

@ -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;