8000 Add to documentation by chris-ricketts · Pull Request #117 · securesecrets/shade · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add to documentation #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 78 additions & 17 deletions contracts/oracle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,37 @@ The oracle contract is used to query the price of different currencies
# Sections

## Init

##### Request

|Name |Type |Description | optional |
|----------|----------|-------------------------------------------------------------------------------------------------------------------|----------|
|owner | string | New contract owner; SHOULD be a valid bech32 address, but contracts may use a different naming scheme as well | yes |
|band | Contract | Band protocol contract | no |
|band | Contract | Band protocol contract | no |

##User
## User

### Messages

#### UpdateConfig
Updates the given values

##### Request

|Name |Type |Description | optional |
|----------|----------|-------------------------------------------------------------------------------------------------------------------|----------|
|owner | string | New contract owner; SHOULD be a valid bech32 address, but contracts may use a different naming scheme as well | yes |
|silk | Contract | Silk contract | no |
|oracle | Contract | Oracle contract | no |

##### Response

|Name |Type |Description | optional |
|----------|----------|-------------------------------------------------------------------------------------------------------------------|----------|
|status | string | Always 'success' | no |

###### Example

```json
{
"update_config": {
Expand All @@ -38,38 +50,87 @@ Updates the given values
}
```

#### RegisterSswapPair
Registers a Secret Swap pair that can then be queried

##### Request

|Name |Type |Description | optional |
|----------|----------|-------------------------------------------------------------------------------------------------------------------|----------|
|pair | Contract | A Secret Swap Pair contract where one of the tokens must be sSCRT | no |

##### Response

|Name |Type |Description | optional |
|----------|----------|-------------------------------------------------------------------------------------------------------------------|----------|
|status | string | Always 'success' | no |

###### Example

```json
{
"register_sswap_pair": {
"status": "success"
}
}
```

### Queries

#### GetPrice
Get asset price according to band protocol.
Get asset price according to band protocol or a registered SecretSwap pair

##### Request

|Name |Type |Description | optional |
|------------|--------|-----------------------------------------------------------------------------------------------------------------------|----------|
|symbol | string | asset abbreviation e.g. BTC/ETH/SCRT; | no |
|symbol | string | Asset abbreviation e.g. BTC/ETH/SCRT; | no |

##### Response

|Name |Type |Description | optional |
|-------------------|--------|----------------------------------------------------------------------------------------------------------------|----------|
|rate | u128 | The exchange rate of the asset against USD | no |
|last_updated_base | u64 | UNIX timestamp of when the base asset price was last updated (0 for SecretSwap pairs) | no |
|last_updated_quote | u64 | UNIX timestamp of when the quote asset price was last updated (0 for SecretSwap pairs) | no |

###### Example

```json
{
{
"rate": "1470000000000000000",
"last_updated_base": 1628569146,
"last_updated_quote": 3377610
}
"rate": 1470000000000000000,
"last_updated_base": 1628569146,
"last_updated_quote": 3377610
}
```
#### GetReferenceData
Get base asset price relative to quote asset according to band protocol.

#### GetConfig
Get the current config

##### Request

|Name |Type |Description | optional |
|------------|--------|-----------------------------------------------------------------------------------------------------------------------|----------|
|base_symbol | string | asset abbreviation e.g. BTC/ETH/SCRT; | no |
|quote_symbol| string | asset abbreviation e.g. BTC/ETH/SCRT; | no |

##### Response

|Name |Type |Description | optional |
|----------|----------|-------------------------------------------------------------------------------------------------------------------|----------|
|owner | string | Contract owner | no |
|band | Contract | Band contract | no |
|sscrt | Contract | sSCRT contract | no |

###### Example

Addresses are fictional.

```json
{
{
"rate": "1470000000000000000",
"last_updated_base": 1628569146,
"last_updated_quote": 3377610
"config": {
"owner": "secret1k0jntykt7e4g3y88ltc60czgjhjsd74c9e8fzek",
"band": "secret1k0hdtykt7e4hs6588ltc60czgjhjsd78xse7bsgfe",
"sscrt": "secret1k0hdtyjs75fhs6588ltc60czgjhjsd78xse87hdk",
}
}
```

0