@startuml

box "Mint User Flow APIs" #grey
participant "User" as user
participant "Trade/Mint/Redeem UI" as UI
participant "MetaMask" as MM
participant "Mettalex Vault" as MV

end box

note over user #pink: **User Token Balance**: \nX USDT \n0 LTK \n0 STK
note over MV #aqua: **Mettalex Vault Token Balance**:\nY USDT

user -> UI: Choose commodity and insert the amount to mint.
UI ->> MM: Send request to MetaMask.
...
MM //--\\ MV: Call Approve function: **approve(address spender, uint256 amount)**.
...
MM ->> UI: Wait for transaction receipt.
UI ->> MM: Send Mint request.
...
MM --// MV: Call Mint function of Mettalex Vault Smart Contract: **mintPositions(uint256 _quantityToMint)**.
...
MV --\\ MM: Long (i.e. L) and Short (i.e. S) Position token pairs will be minted.
MM ->> UI: Wait for transaction receipt. An updated amount will be visible in MetaMask.

note over user #pink: **User Token Balance**: \n0 USDT \nZ LTK \nZ STK
note over MV #aqua: **Mettalex Vault Token Balance**:\nX+Y USDT

group "other Mettalex Vault APIs"
MM //--\\ MV: **allowance(address owner, address spender)**
MM //--\\ MV: **balanceOf(address account)**
MM //--\\ MV: **increaseAllowance(address spender, uint256 addedValue)**
MM //--\\ MV: **decreaseAllowance(address spender, uint256 subtractedValue)**
MM //--\\ MV: **settlePositions()**
MM //--\\ MV: **bulkSettlePositions(address[] calldata _settlers)**
MM //--\\ MV: **totalSupply()**
MM //--\\ MV: **transfer(address recipient, uint256 amount)**
MM //--\\ MV: **transferFrom(address sender, address recipient, uint256 amount)**

end group


@enduml

