Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed May 22, 2024
1 parent 7bf49e5 commit 4a56b0c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions examples/tx-observability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# tx observability

Opt into a standardized set of events ([TBD](https://github.com/flashbots/suave-std/pull/85)) to enable interoperability with other SUAPPS, block-builders, L2 networks, etc.

Events are defined in an abstract contract (ideally in suave-std):

```solidity
abstract contract ObservableOrderflow {
event SentTransaction(bytes32 txHash);
}
```

Then SUAPP developers import and emit those events in their own callbacks:

```solidity
contract Suapp is ObservableOrderflow {
event MySuappEvent(uint256 x);
modifier confidential() {
require(Suave.isConfidential(), "must be called confidentially");
_;
}
function didSomething(bytes32[] memory txHashes, uint256 x) public confidential {
emit MySuappEvent(x);
emit SentTransactions(txHashes);
}
function doSomething() public confidential returns (bytes memory) {
// pretend these are tx hashes that we're handling in our SUAPP
bytes32[] memory txHashes = new bytes32[](3);
for (uint256 i = 0; i < txHashes.length; i++) {
txHashes[i] = keccak256(abi.encode("tx", i));
}
return abi.encodeWithSelector(this.didSomethingWithTxs.selector, txHashes, 9001);
}
}
```

0 comments on commit 4a56b0c

Please sign in to comment.