I have two contracts :
// contract #1
contract eXample {
// intizializer
function eXample{
.....
}
//creating the Event
event MyEvent(uint x,uint y,uint z);
function doSomething{
.....
// calling the event inside doSomething function
MyEvent(x,y,z);
}
}
contract contractCaller {
....
// creating an instance of contract #1
eXample instance = eXample(address)
// calling fonction from contract #1 inside contract #2 method.
function exampleFunction{
instance.doSomething
}
// everytjing inside eXamplefunction is working. Everything inside instance.doSomething IS working. Only issue is the Event not triggering.
....
}
I'm using function from "eXample" in "contractCaller" everything works fine but one thing. When calling instance.doSomething from the 2nd contract i'm not returned any Event from the 1st contract in either mix/ on the blockchain.Obviously i have watchers,etc.
Is it normal ? Should i make custom Events on my 2nd contract for functions on the first contract ?
How do you guys usually proceed ?
Edit better example since i messed up the first one :
contract metaCoin {
mapping (address => uint) public balances;
function metaCoin() {
balances[msg.sender] = 10000;
}
event ExampleEvent(uint x);
function sendToken(address receiver, uint amount) returns(bool successful){
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
ExampleEvent(balances[receiver]);
return false;
}
}
contract coinCaller{
function sendCoin(address coinContractAddress, address receiver, uint amount){
metaCoin m = metaCoin(coinContractAddress);
m.sendToken(receiver, amount);
}
}
When calling CoinCaller.Sendcoin. ExampleEvent won't trigger even with a watcher on the MetaCoin Contract.