Greetings,
I am trying to call a method query:
payable stateful entrypoint query(args: string) : bytes(32) =
if(Map.lookup(Call.caller, state.reqc) == None)
put(state{reqc[Call.caller] = 0})
put(state{reqc[Call.caller] = state.reqc[Call.caller] + 1})
// Required, so queries can be mapped with unique key
let uniq_id : bytes(32) = Crypto.sha3(String.concat(String.concat(Address.to_str(Contract.address), Address.to_str(Call.caller)), Int.to_str(state.reqc[Call.caller])))
require(state.base_fee =< Call.value, "insufficient value for qfee")
put(state{queries[uniq_id] = Oracle.query(state.source_oracle, args, state.base_fee, RelativeTTL(state.qttl), RelativeTTL(state.rttl))})
Chain.event(QueryCreated(state.source_oracle, uniq_id, Chain.timestamp, args))
uniq_id
If I call it directly, It emits an event that I can listen to with a WebSocket connection.
connection.send(JSON.stringify({
op: "Subscribe",
payload: "Object",
target: contract_address.replace(/^.{2}/g, 'ok')
}));
But if I try to call query
from another contract then it do gives bytes(32) in the end but there are no events emitting in this case and further, I don’t see any call that is done from a contract but I did many calls to query
and it successfully gave the results from another contract: https://testnet.aeternity.io/middleware/contracts/transactions/address/ct_2Br7hTDyfgemSF4Jj12bkvdZPx9L237H8LJgu25h3y1j2Z7RFE