clearsync
clearsync copied to clipboard
feat(tradingapp): TradingApp nitro force move app
What about:
enum Action { OPEN, FUND, ORDER, TRADE, SETTLE, DEFUND, CLOSE }
struct Entry {
Action action;
uint256 timestamp; // The time the entry was created
bytes32 metadata; // The data/content of the entry
bytes32 parent; // Checksum of the previous entry
bytes32 current; // Checksum of the current entry
}
// current = keccak256(abi.encodePacked(action, timestamp, metadata, parent));
// Nitro validation:
// make a switch case on Action
// When OPEN: Verify both signed
// When FUND: Verify broker signed
// When ORDER: Verify Fund proof, and order is signed by Client
// When TRADE: Verify proof of order, verify parent is ORDER, signed by Broker
// When SETTLE: Verify proof of trade, verify parent is TRADE, signed by Both
Using Named structs:
struct Order {
bytes32 parent; // Parent Event, can be 0 if first order
bytes32 orderID; // tradeID
}
struct Trade {
bytes32 orderID; // orderID making the trade
bytes32 tradeID; // tradeID
}
struct Outcome {
address token;
uint256 amount;
}
struct Settle {
Outcome[] toVault;
Outcome[] fromVault;
bytes32 parent; // Likely the last TradeID
}