Skip to content

Conversation

@nksazonov
Copy link
Contributor

No description provided.

@mod
Copy link
Contributor

mod commented Nov 22, 2024

image

TODO:

  • Implement the architecture in the PoC#01 drawing
  • Keep the implementation of Simple Vault, IVault and IAuthorize interface for now
  • Create an Interface ISettle executing the array of outcomes, you can use nitro types.
  • Create a nitro App with the described protocol (Fund > order > trade > settle)
  • Settle must require a valid Nitro Settle State

More details about our protocol rules, use the proofs to validate transitions for example

  1. An order require a proof of margin deposit
  2. A trade requres a proof of margin and order
  3. A settlement requires a proof of at least margin, order, trade (TBC)

@nksazonov
Copy link
Contributor Author

nksazonov commented Nov 25, 2024

Needs clarifying:

  • Do you want the Adjudicator to have the Vault interface, e.g. "deposit" and "withdraw", so that users don't need to transfer funds to the Adjudicator on each channel opening?
  • And generally, what is the role of $YellowVault if user funds are stored in the Adjudicator?
  • Also, if you want to follow the nitro protocol rules, for that we need to have both parties to sign states. Do we plan to ask a user in a TradingApp to sign states?

@mod
Copy link
Contributor

mod commented Nov 25, 2024

  1. At this stage we don't need to optimize funding and defunding on Retail2Broker as it's a very rare event to fund your margin account, (once a month, once a year, only when you change broker or want to change amount of margin)

But on Broker2broker we might want to pre-fund multiple channels to accelerate the latency for accepting incoming broker connections, and here I think the key is Ledger Channels rather than anything else in the smart-contract, because broker need to lock his fund dedicated to a channel and doing it offline would be ideal, but this requires R&D.

  1. YellowVault we need to find a good name is only a storage of $YELLOW token that the elected panel can slash in case of malicious behavior. Broker cheating may loose their locked YELLOW Token, slash is applied using a quorum of anonymous signers, but this is not part of the scope of POC#01, this is a good work around complex watch towers.

@nksazonov
Copy link
Contributor Author

At this stage we don't need to optimize funding and defunding on Retail2Broker as it's a very rare event to fund your margin account, (once a month, once a year, only when you change broker or want to change amount of margin)

So, for PoC 1 we just go with the NitroAdjudicator?

@mod
Copy link
Contributor

mod commented Nov 25, 2024

NitroAdjudicator for margin
Vault for settlements

@mod
Copy link
Contributor

mod commented Nov 25, 2024

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ITrade {

    enum Side { BUY, SELL }

    struct Order {
        Side side;
        string ticker;
        uint256 amount;
        address sender;
        uint256 ts;        // timestamp in milliseconds
    }

    // bytes32 orderId = keccak256( abi.encode( Order ) );

    struct Trade {
        bytes32 orderId;
        bytes32 tradeId;
        uint256 amount;    // amount executed
        uint256 ts;        // timestamp in milliseconds
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants