Closed wnz99 closed 6 years ago
buy and sell functions are absolutely identical in solidity, why do we have this behavior?
event BuyDrago(address indexed drago, address indexed from, address indexed to, uint256 amount, uint256 revenue);
event SellDrago(address indexed drago, address indexed from, address indexed to, uint256 amount, uint256 revenue);
the order of address from and address to in inverted as input in the function, need to spend a bit of time and understand what was the rationale and amend
this can be fixed by inverting the order of _who and msg.sender in
SellDrago(_targetDrago, msg.sender, _who, _amount, _revenue);
probably was to be able to display data in current ui
please let me know if there's other events that need to be modified, besides the sell event
inverted and fixed, on its way to deploy
This is an example of code to get all the transaction on a Vault or Drago:
This section sets the filters on topics (the code is not exactly as above, here we also have the created event):
The sell and create events have the user account address as 4th parameter, while the buy event has got it as 3rd.
Because of this reason, 2 separate RPC are required if we need to get both event types. With something like this:
It would be preferable that the account address parameter be uniform among the events, so that we can get all the events with a single RPC call and then sort them client side.
Topics can be set as follow:
[A,B]
equals toA AND B
, so we can set something like:This would return all buy and sell for that specific account.