Hello everyone!
Can anyone explain me how to use “create” opcode from assembly to create new contract in solidity?
Nov 22, 2017, 11:22 AM
No one knows?
Hello everyone!
Can anyone explain me how to use “create” opcode from assembly to create new contract in solidity?
Can anyone explain me how to use “create” opcode from assembly to create new contract in solidity?
Nov 22, 2017, 11:50 AM
mb you need this op code - create(v, p, s)
create new contract with code mem[p..(p+s)) and send v wei and return the new address
function create(bytes code) returns (address addr){
assembly {
addr := create(0,add(code,0x20), mload(code))
jumpi(invalidJumpLabel,iszero(extcodesize(addr)))
}
}
assembly {
addr := create(0,add(code,0x20), mload(code))
jumpi(invalidJumpLabel,iszero(extcodesize(addr)))
}
}
you need to pass bytecode of the contract which need to deploy
Nov 22, 2017, 12:24 PM