Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
adding payoutUnitsPerPayinUnit field to quote (#336)
Browse files Browse the repository at this point in the history
* adding rate field to quote section of the protocol spec. adding rate field to quote json schema

* rate > payoutUnitsPerPayinUnit to be consistent with offering

* updating schema

* fixing example

Co-authored-by: Moe Jangda <[email protected]>
  • Loading branch information
Jiyoon Koo and mistermoe authored Jul 4, 2024
1 parent d4c9664 commit e62b69d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
6 changes: 5 additions & 1 deletion hosted/json-schemas/quote.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@
"type": "string",
"description": "When this quote expires. Expressed as ISO8601"
},
"payoutUnitsPerPayinUnit": {
"type": "string",
"description": "The exchange rate to convert from payin currency to payout currency. Expressed as an unrounded decimal string."
},
"payin": {
"$ref": "#/definitions/QuoteDetails"
},
"payout": {
"$ref": "#/definitions/QuoteDetails"
}
},
"required": ["expiresAt", "payin", "payout"]
"required": ["expiresAt", "payoutUnitsPerPayinUnit", "payin", "payout"]
}
28 changes: 15 additions & 13 deletions specs/protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ An `Offering` is a resource created by a PFI to define requirements for a given

> PFI -> world: "Here are the currency pairs i have to offer. These are the constraints of my offer in terms of how much you can buy, what credentials I need from you, and what payment methods you can use to pay me the payin currency, and what payment methods I can use to pay you the payout currency."
| field | data type | required | description |
| ------------------------- | -------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------- |
| `description` | string | Y | Brief description of what is being offered. |
| `payoutUnitsPerPayinUnit` | [`DecimalString`](#decimalstring) | Y | Number of payout units alice would get for 1 payin unit |
| `payin` | [`PayinDetails`](#payindetails) | Y | Details and options associated to the _payin_ currency |
| `payout` | [`PayoutDetails`](#payoutdetails) | Y | Details and options associated to the _payout_ currency |
| `requiredClaims` | [`PresentationDefinitionV2`](https://identity.foundation/presentation-exchange/#presentation-definition) | N | Claim(s) required when submitting an RFQ for this offering. |
| field | data type | required | description |
| ------------------------- | -------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------- |
| `description` | string | Y | Brief description of what is being offered. |
| `payoutUnitsPerPayinUnit` | [`DecimalString`](#decimalstring) | Y | Number of payout units alice would get for 1 payin unit. An indicative rate. |
| `payin` | [`PayinDetails`](#payindetails) | Y | Details and options associated to the _payin_ currency |
| `payout` | [`PayoutDetails`](#payoutdetails) | Y | Details and options associated to the _payout_ currency |
| `requiredClaims` | [`PresentationDefinitionV2`](https://identity.foundation/presentation-exchange/#presentation-definition) | N | Claim(s) required when submitting an RFQ for this offering. |

#### `PayinDetails`
| field | data type | required | description |
Expand Down Expand Up @@ -164,7 +164,7 @@ An `Offering` is a resource created by a PFI to define requirements for a given
| `estimatedSettlementTime` | uint | Y | estimated time taken to settle an order. expressed in seconds |
| `name` | string | N | Payment Method name. Expected to be rendered on screen. |
| `description` | string | N | Blurb containing helpful information about the payment method. Expected to be rendered on screen. e.g. "segwit addresses only" |
| `group` | string | N | The category for which the given method belongs to e.g. Mobile Money vs. Direct Bank Deposit |
| `group` | string | N | The category for which the given method belongs to e.g. Mobile Money vs. Direct Bank Deposit |
| `requiredPaymentDetails` | [JSON Schema](https://json-schema.org/) | N | A JSON Schema containing the fields that need to be collected in the RFQ's selected payment methods in order to use this payment method. |
| `fee` | [`DecimalString`](#decimalstring) | N | Fee charged to use this payment method. absence of this field implies that there is no _additional_ fee associated to the respective payment method |
| `min` | [`DecimalString`](#decimalstring) | N | minimum amount required to use this payment method. |
Expand Down Expand Up @@ -542,11 +542,12 @@ A `Close` can be sent by Alice _or_ the PFI at any point during the exchange, bu
### `Quote`
> PFI -> Alice: "OK, here's your Quote that describes how much BTC you will receive based on your RFQ. Here's the total fee in USD associated with the payment methods you selected. Here's how to pay us, and how to let us pay you, when you're ready to execute the Quote. This quote expires at X time."
| field | data type | required | description |
| ----------- | ------------------------------- | -------- | -------------------------------------------------------- |
| `expiresAt` | datetime | Y | When this quote expires. Expressed as ISO8601 |
| `payin` | [`QuoteDetails`](#quotedetails) | Y | the amount of _payin_ currency that the PFI will receive |
| `payout` | [`QuoteDetails`](#quotedetails) | Y | the amount of _payout_ currency that Alice will receive |
| field | data type | required | description |
| ------------------------- | ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| `expiresAt` | datetime | Y | When this quote expires. Expressed as ISO8601 |
| `payoutUnitsPerPayinUnit` | string | Y | The exchange rate to convert from payin currency to payout currency. Expressed as an unrounded decimal string |
| `payin` | [`QuoteDetails`](#quotedetails) | Y | the amount of _payin_ currency that the PFI will receive |
| `payout` | [`QuoteDetails`](#quotedetails) | Y | the amount of _payout_ currency that Alice will receive |


#### `QuoteDetails`
Expand Down Expand Up @@ -577,6 +578,7 @@ A `Close` can be sent by Alice _or_ the PFI at any point during the exchange, bu
},
"data": {
"expiresAt": "2023-09-13T23:11:17.315Z",
"payoutUnitsPerPayinUnit": "16.654345",
"payin": {
"link": "http://cash.app/pfi?currency=usd&amount=50"
},
Expand Down

0 comments on commit e62b69d

Please sign in to comment.