Me gustaría probar el modificador a continuación
modifier isNotAContract(){
require (msg.sender == tx.origin, 'Contracts are not allowed to interact.');
_;
}
¿Cómo puedo invocar una función usando este modificador por un contrato?
¡Se prefiere la sintaxis de Javascript!
Contratos:
contract A {
modifier isNotAContract(){
require (msg.sender == tx.origin, 'Contracts are not allowed to interact.');
_;
}
function f() public isNotAContract {
// ...
}
}
contract B {
A a = new A();
function f() public {
a.f();
}
}
En Trufa:
var b = await B.new()
await b.f(); // should fail
Iteración 122442
senju
await a.buy( {value: 5000000, from: contract_two});
sin realmente escribir e implementar un contrato?henk