# Mainnet Warehouse Pledge/Paydown Process
## Warehous Process Overview
_See Pre-Conditions below._
### Pledge Process
1. Warehouse Provider and Originator both setup Provenance Keys
1. Warehouse Provider sets up Omnibus Bank account & deposits $ (receives coin)
1. Originator shares BC data with PM by granting custody of their loan pool Makers.
2. Originator shares P8e data with PM by permissioning their public key through P8e
1. Originator creates a Facility agreement -
1. Initiate a new facility contract. Providing the originator + warehouse addresses and advance rate
5. Originator creates a loan pool which reflects a marker
6. Originator proposes the pool to the Facility -
1. Execute the first step of a pledge in the contract. Provide the assets to encumber and requested $ amount for advancement
1. Contract establishes a new marker for the provided assets and has full custody
2. Contract deposits denom of the new marker to the originator
8. Warehouse logs into PM and accepts the proposal -
1. Execute the acceptance step of the contract
1. Contract escrows requested advance amount in stablecoin from the warehouse account
10. Originator confirms transaction.
1. Execute the match step of the contract.
1. Contract deposits escrowed stablecoin to the originator's account
13. Originator may redeem coin to fiat by requesting cash out (Omnibus Bank will wire funds to destination)
## Initial State
### Originator Account (Originator)
```
address: originator_address
coins:
- denom: pm.pool.op
amount: "1"
- denom: stablecoin
amount: "10,000,000"
```
### Originator Pool (OP)
```
{
"baseAccount": {
"address": "pool_address",
"accountNumber": "1678"
},
"accessControl": [
{
"address": "pm_address",
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pm.pool.op",
"supply": "1",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
### Warehouse Account (Warehouse)
```
address: warehouse_address
coins:
- denom: stablecoin
amount: "50,000,000"
```
### Facility Smart Contract (FSM1)
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "5"
```
### Facility Marker (FM)
```
{
"baseAccount": {
"address": "fm_address",
"accountNumber": "1672"
},
"accessControl": [
{
"address": "facility_address",
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pb.fm.1",
"supply": "5",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
## Setup
```mermaid
stateDiagram-v2
Originator --> MarkerContract: 1a. Create Pool OP
MarkerContract --> Originator: 1c. OP
state MarkerContract {
[*] --> Marker: 1b. Mint
}
Originator --> FSM1: 2a. Instantiate Facility Contract (FSM1)
```
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op
amount: "1"
- denom: stablecoin
amount: "10,000,000"
- denom: pb.fm.1
amount: "1" <-- 20% of Facility
```
### Warehouse Account
```
address: warehouse_address
coins:
- denom: stablecoin
amount: "50,000,000"
- denom: pb.fm.1
amount: "4" <-- 80% of Facility
```
## Pledge
```mermaid
stateDiagram-v2
Originator --> FSM1: 1a. Propose Pledge Assets @ $90
state FSM1 {
[*] --> OP1: 1b. Create Marker containing proposed assets
OP1 --> Originator_Account: 1c. Deposit ownership
OP1 --> FM: 1b. Custody
}
```
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op
amount: "1"
- denom: pm.pool.op1
amount: "1"
- denom: pb.fm.1
amount: "1"
- denom: stablecoin
amount: "10,000,000"
```
### Originator Pool OP1
```
{
"baseAccount": {
"address": "pool_address",
"accountNumber": "1678"
},
"accessControl": [
{
"address": "facility_address", <-- Notice change of control
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pm.pool.op1",
"supply": "1",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
## Accept
```mermaid
stateDiagram-v2
Warehouse --> FSM1: 2a. Accept and Send Stablecoin
state FSM1 {
Warehouse_Account --> FM: 2b. Escrow Coin
}
```
### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
- denom: stablecoin
amount: "9,000,000" <-- Escrow of advance
```
### Warehouse Account
```
address: warehouse_address
coins:
- denom: pb.fm.1
amount: "4"
- denom: stablecoin
amount: "41,000,000" <-- Delta
```
## Confirm
```mermaid
stateDiagram-v2
Originator --> FSM1: 3a. Confirm and Execute Match
state FSM1 {
FM --> Originator_Account: 3b. Deposit Coin
}
```
## End State
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op
amount: "1"
- denom: pm.pool.op1
amount: "1"
- denom: pb.fm.1
amount: "1"
- denom: stablecoin
amount: "19,000,000"
```
### Warehouse Account
```
address: warehouse_address
coins:
- denom: stablecoin
amount: "41,000,000"
- denom: pb.fm.1
amount: "4"
```
### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
```
### Facility Marker (FM)
```
{
"baseAccount": {
"address": "fm_address",
"accountNumber": "1672"
},
"accessControl": [
{
"address": "facility_address",
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pb.fm.1",
"supply": "5",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
# Warehous Process Overview
_See Pre-Conditions below._
### Paydown Process
1. Originator requests paydown of encumbered assets -
1. Execute the first step of a paydown in the contract. Provide the assets to unencumber and requested $ amount for unencumbrance [and amount of sale]
1. Contract establishes a new marker for the provided assets and has full custody
2. Contract removes assets to be paid off from original pledged marker
3. Contract deposits denom of the new marker to the originator
4. If paydown is more than sell request, contract escrows requested advance amount in stablecoin from the originator account
2. Warehouse accepts the paydown request -
1. Execute warehouse acceptance step of the contract
2. If applicable, Investor accepts exchange proposal
1. Execute investor acceptance step of the contract
1. Facility escrows coin of agreed sale from investor account
4. Originator confirms transaction.
1. Execute the match step of the contract.
1. Contract deposits escrowed paydown to warehouse's account
2. Contract deposits remaining amount to originator's account
3. Contract transfers coin of the new pool from originator to the investor's account
5. Originator/Sarehouse may redeem coin to fiat by requesting cash out (Omnibus Bank will wire funds to destination)
## Paydown
```mermaid
stateDiagram-v2
Originator --> FSM1: 1a. Propose Paydown OP1 @ $100 and Send Stablecoin
state FSM1 {
Originator_Account --> FM: 2b. Escrow Coin
}
```
### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
- denom: stablecoin
amount: "10,000,000" <-- Escrow of Paydown
```
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op
amount: "1"
- denom: pm.pool.op1
amount: "1"
- denom: stablecoin
amount: "9,000,000" <-- Delta
```
## Accept
```mermaid
stateDiagram-v2
Warehouse --> FSM1: 2a. Accept
```
## Confirm
```mermaid
stateDiagram-v2
Originator --> FSM1: 3a. Confirm and Execute Match
state FSM1 {
FM --> Warehouse_Account: 3b. Deposit Coin
FM --> PM_Account: 3c. Transfer Custody of OP1
}
```
## End State
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op1
amount: "1"
- denom: pb.fm.1
amount: "1"
- denom: stablecoin
amount: "9,000,000"
```
### Originator Pool OP1
```
{
"baseAccount": {
"address": "pool_address",
"accountNumber": "1678"
},
"accessControl": [
{
"address": "pm_address",
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pm.pool.op1",
"supply": "1",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
### Warehouse Account
```
address: warehouse_address
coins:
- denom: stablecoin
amount: "51,000,000"
- denom: pb.fm.1
amount: "4"
```
### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
```
## Paydown with Investor
```mermaid
stateDiagram-v2
Originator --> FSM1: 1a. Propose Assets to paydown @ $100, sell @ $110, and Buyer info
state FSM1 {
OP1 --> OP2: 2b. Establish new marker of proposed assets
OP1 --> OP1: 2c. Remove proposed assets
Originator_Account --> FM: 2d. Escrow of paydown - sell
}
```
### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
```
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op1
amount: "1"
- denom: pm.pool.op2
amount: "1"
- denom: stablecoin
amount: "9,000,000"
```
### Investor Account
```
address: investor_address
coins:
- denom: stablecoin
amount: "11,000,000"
```
## Accept
### Warehouse Accept
```mermaid
stateDiagram-v2
Warehouse --> FSM1: 2a. Accept
```
### Investor Accept
```mermaid
stateDiagram-v2
Investor --> FSM1: 2a. Accept and send required payment
state FSM1 {
Investor_Account --> FM: 2b. Escrow Coin
}
```
#### Investor Account
```
address: investor_address
coins:
- denom: stablecoin
amount: "0"
```
#### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
- denom: stablecoin
amount: "11,000,000"
```
## Originator Confirm
```mermaid
stateDiagram-v2
Originator --> FSM1: 3a. Confirm and Execute Match
state FSM1 {
FM --> Warehouse_Account: 3b. Deposit Paydown Coin
FM --> Originator_Account: 3c. Deposit Coin of Buy - Paydown
FM --> Bilateral_Contract: 3d. Transfer OP2 coin from Originator to Investor
FM --> PM_Account: 3e. Transfer Custody of OP2
}
```
## End State
### Originator Account
```
address: originator_address
coins:
- denom: pm.pool.op1
amount: "1"
- denom: pb.fm.1
amount: "1"
- denom: stablecoin
amount: "10,000,000"
```
### Originator Pool
```
{
"baseAccount": {
"address": "pool2_address",
"accountNumber": "1678"
},
"accessControl": [
{
"address": "pm_address",
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pm.pool.op1",
"supply": "1",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
### Warehouse Account
```
address: warehouse_address
coins:
- denom: stablecoin
amount: "51,000,000"
- denom: pb.fm.1
amount: "4"
```
### Investor Account
```
address: warehouse_address
coins:
- denom: stablecoin
amount: "0"
- denom: pm.pool.op2
amount: "1"
```
### Facility Smart Contract
```
address: facility_address
originator_address: originator_address
warehouse_address: warehouse_address
advance_rate: 80%
coins:
- denom: pb.fm.1
amount: "0"
```
### Facility Marker (FM)
```
{
"baseAccount": {
"address": "fm_address",
"accountNumber": "1672"
},
"accessControl": [
{
"address": "facility_address",
"permissions": [
"ACCESS_MINT",
"ACCESS_BURN",
"ACCESS_DEPOSIT",
"ACCESS_WITHDRAW",
"ACCESS_DELETE",
"ACCESS_ADMIN",
"ACCESS_TRANSFER"
]
}
],
"status": "MARKER_STATUS_ACTIVE",
"denom": "pb.fm.1",
"supply": "5",
"markerType": "MARKER_TYPE_RESTRICTED",
"allowGovernanceControl": true
}
```
## Pre-Conditions:
Loan-onboarding needs to establish a Marker (POOL) per loan type per originator. Each loan onbarded must be added to the appropriate Pool Marker. PM must be added as a custodian on the pool with rights to `mint, burn, and grant`. This action is how we will data share between originator and PM. (P8e data sharing through key permission will still be required as well.)
The Pool for the Warehouse Facility will be created by drawing assets out of the originator's initial pool.