Actualmente estoy tratando de desarrollar más mi conocimiento en llamadas de nivel inferior como DELEGATECALL.
Me encuentro continuamente cuando trato de usar .delegatecall():
RunTime Error: out of gas
Gas Usage: 0xe07e44(Decimal = 14712388)
contrato de llamada delegada:
pragma solidity ^0.4.4;
import "delegateReceiever.sol";
contract delegateCall{
uint public testInt;
address public sender;
function delegateCall(){
testInt = 1;
}
function delegateCallC(address _c, uint _testInt){
if(_c.delegatecall(bytes4(sha3("setTestInt(uint")),_testInt ))
throw;
}
}
Contrato del receptor del delegado:
pragma solidity ^0.4.4;
contract delegateReceiever{
uint public testInt;
function delegateReceiever(){
testInt = 2;
}
function setTestInt(uint _testInt){
testInt = _testInt;
}
}
Despliegue de trufa editado para aumentar el gas así:
deployer.deploy(contract,{gas:114712388})
Se editó el saldo de la cuenta inicial de testrpc a:
1e+167
Archivo truffle.js editado para incluir gas:
rpc:{
host: "localhost",
port: 8545,
gas: 114712388
}
¿Hay algún otro método para garantizar que no se acabe el gas? Por ejemplo, ¿hay algún parámetro de revelador que no requiera gas, etc.?
delegatecall
rendimientos true
del éxito, por lo que
if(_c.delegatecall(bytes4(sha3("setTestInt(uint")),_testInt ))
throw
lanzará si la llamada es exitosa.
Probar
if(!_c.delegatecall(bytes4(sha3("setTestInt(uint")),_testInt ))
miguel mota
"setTestInt(uint"
falta un paréntesis de cierre a propósito?