Skip to content

Commit

Permalink
Highlight TN based swap
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Nov 14, 2024
1 parent 0db5bfa commit 6914104
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions doc/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@ sequenceDiagram
participant FRCA as FROM Coin App
participant DS as Device Screen
activate EA
EA-->>EA: Check if previous cycle
EA-->>DS: if previous cycle
activate DS
DS-->>DS: display sign status
DS-->>EA:
deactivate DS
LL->>EA: START_NEW_TRANSACTION (0x03)
activate EA
activate EA
EA-->>EA: Create a nonce for the transaction
EA-->>LL: Device Transaction ID (nonce)
deactivate EA
Expand All @@ -36,7 +29,7 @@ sequenceDiagram
LL->>EA: PROCESS_TRANSACTION_RESPONSE (0x06)
activate EA
EA-->>EA: Receive the transaction proposal from the exchange partner
EA-->>EA: Receive and parse the transaction proposal from the exchange partner
EA-->>LL: return
deactivate EA
Expand All @@ -47,7 +40,7 @@ sequenceDiagram
deactivate EA
rect rgb(200, 200, 200)
note right of LL: SPL Token swap
note right of LL: Trusted Name based swap
LL->>+EA: SEND_PKI_CERTIFICATE
EA->>EA: Validate Certificate
EA->>EA: Save Certificate
Expand All @@ -59,22 +52,36 @@ sequenceDiagram
EA-->>EA: Verify if descriptor key_id is equald to certificate key id
EA-->>EA: Verify if certificate key usage is equal to trusted_name (0x04)
EA-->>EA: Verify descriptor signature
EA-->>EA: Save descriptor in memory (payout_address's owner or refund_address's owner)
EA-->>EA: Save descriptor in memory (e.g. for SPL token, token account's owner = address from TAG_ADDRESS)
EA-->>-LL: OK
end
LL->>+EA: CHECK_PAYOUT_ADDRESS (0x08)
alt Trusted Name swap
rect rgb(200, 200, 200)
note right of EA: Trusted Name based swap
EA->>+TOCA: os_lib_call(CHECK_ADDRESS, address, derivation_path)
end
else
EA->>+TOCA: os_lib_call(CHECK_ADDRESS, payout_address, derivation_path)
TOCA-->>TOCA: Check that the payout address belongs to the device
end
TOCA-->>TOCA: Check that the [payout] address is owned by the device
TOCA-->>-EA: os_lib_end(): Result
EA->>+TOCA: os_lib_call(GET_PRINTABLE_AMOUNT)
TOCA-->>TOCA: Format the receiving amount
TOCA-->>-EA: os_lib_end(): Formatted amount
EA-->>-LL: return
LL->>+EA: CHECK_REFUND_ADDRESS_NO_DISPLAY (0x0C)
alt Trusted Name swap
rect rgb(200, 200, 200)
note right of EA: Trusted Name based swap
EA->>+TOCA: os_lib_call(CHECK_ADDRESS, address, derivation_path)
end
else
EA->>+FRCA: os_lib_call(CHECK_ADDRESS, refund_address, derivation_path)
FRCA-->>FRCA: Check that the refund address belongs to the device
end
FRCA-->>FRCA: Check that the [refund] address belongs to the device
FRCA-->>-EA: os_lib_end(): Result
EA->>+FRCA: os_lib_call(GET_PRINTABLE_AMOUNT)
FRCA-->>FRCA: Format the sending amount
Expand All @@ -86,7 +93,7 @@ sequenceDiagram
LL->>+EA: PROMPT_UI_DISPLAY (0x0F)
rect rgb(200, 200, 200)
note right of LL: SPL Token swap
note right of LL: Trusted Name based swap
EA-->>EA: Use descriptor info to display token account owner address in addition to payout or refund address
end
EA->>+DS: Request UI validation
Expand All @@ -107,6 +114,12 @@ sequenceDiagram
FRCA-->>EA: os_lib_end()
deactivate FRCA
EA-->>EA: Save last cycle data: Coin appname + sign status
EA-->>EA: Check if previous cycle
EA-->>DS: if previous cycle
activate DS
DS-->>DS: display sign status
DS-->>EA:
deactivate DS
deactivate EA
```

0 comments on commit 6914104

Please sign in to comment.