-
Notifications
You must be signed in to change notification settings - Fork 5
docs: Add protocol documentation for PQR compliance #229
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
base: dev
Are you sure you want to change the base?
Conversation
|
## Deployed Addresses | ||
|
||
### NEAR Mainnet | ||
- **Registry**: `<TBD>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### NEAR Mainnet | ||
- **Registry**: `<TBD>` | ||
- **Pyth Oracle**: `<TBD>` | ||
- **LST Oracle Adapter**: `<TBD>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
### NEAR Mainnet | ||
- **Registry**: `<TBD>` | ||
- **Pyth Oracle**: `<TBD>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyth-oracle.near with asset ids from: https://insights.pyth.network/price-feeds
## Getting Current Addresses | ||
|
||
For deployed contract addresses, check: | ||
- **Official Website**: [templarfi.org](https://templarfi.org/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For registry, it's the same contract as https://github.com/Templar-Protocol/contracts/pull/229/files#r2389013228
For markets, we don't list them on the website, discord, or telegram. A solution is needed to list all subaccounts (individual markets) of v1.tmplr.near
## Contract Upgradeability | ||
|
||
### Registry Contract | ||
- **Upgrade Status**: Upgradeable through owner account |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peer2f00l is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no upgrade mechanism on the registry contract.
### Public Visibility | ||
- **Source Code**: All code publicly available on GitHub | ||
- **Deployment History**: Registry maintains deployment records via `list_deployments()` | ||
- **Audit Reports**: `<TBD>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
### Primary Oracle Provider | ||
- **Pyth Network**: Primary price feed provider | ||
- **Oracle Contract**: <TBD> (mainnet) / `pyth-oracle.testnet` (testnet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyth-oracle.near for mainnet
#### Protocol Health Checks | ||
Regular checks can be performed using: | ||
|
||
1. **Market Status**: Query market configurations and states |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include near-cli command to check on market configs and state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
near-cli-rs
commands, to be specific. Please do not use the JS-based CLI.
Regular checks can be performed using: | ||
|
||
1. **Market Status**: Query market configurations and states | ||
2. **Oracle Health**: Verify price feed freshness and accuracy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include near-cli command or link to https://insights.pyth.network/price-feeds to check status of price feed
|
||
1. **Market Status**: Query market configurations and states | ||
2. **Oracle Health**: Verify price feed freshness and accuracy | ||
3. **Liquidation Activity**: Monitor liquidation frequency and success rates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs to be tracked by an indexer. Don't believe there's a CLI command for querying RPC state
1. **Market Status**: Query market configurations and states | ||
2. **Oracle Health**: Verify price feed freshness and accuracy | ||
3. **Liquidation Activity**: Monitor liquidation frequency and success rates | ||
4. **Gas Efficiency**: Track transaction costs and optimize operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include command to perform
|
||
#### Market Data Analysis | ||
Using available view functions: | ||
- Total Value Locked calculations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include defillama link: https://defillama.com/protocol/tvl/templar-protocol
#### Market Data Analysis | ||
Using available view functions: | ||
- Total Value Locked calculations | ||
- Utilization rate monitoring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include command or link
Using available view functions: | ||
- Total Value Locked calculations | ||
- Utilization rate monitoring | ||
- Interest rate analysis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
historical interest rates need to be tracked by an indexer
- Total Value Locked calculations | ||
- Utilization rate monitoring | ||
- Interest rate analysis | ||
- Position health assessment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be viewable on frontend under "account" tab of app.templarfi.org
|
||
## Additional Resources | ||
|
||
- **[API Documentation](../../target/doc/templar_common/index.html)** - Technical API reference (generated by `cargo doc`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link will not work on the deployed website, as there is no target
directory.
### LST Oracle Adapter | ||
For Liquid Staking Tokens (LSTs), Templar uses a custom oracle adapter: | ||
- **Purpose**: Transforms underlying asset prices using redemption rates | ||
- **Contract**: <TBD> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
### Oracle Call Costs | ||
|
||
<TBD> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view calls are free on the NEAR network
- **Oracle Integration**: Multiple validation layers for price feeds | ||
- **Liquidation Incentives**: Economic incentives for timely liquidations | ||
- **Interest Rate Models**: Dynamic models responding to market conditions | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Criminal Activity Monitoring
- SEVERE account label: Telegram notification of SEVERE accounts interacting with Templar contract. Details in repository: https://github.com/Templar-Protocol/templar-monitoring
- **Access Control**: Monitor administrative function usage | ||
|
||
#### Network Dependencies | ||
- **NEAR Network Performance**: Monitor blockchain health and congestion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
### Operational Monitoring | ||
|
||
#### Smart Contract Health |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section seems redundant. Include links to relevant sections
#### Network Dependencies | ||
- **NEAR Network Performance**: Monitor blockchain health and congestion | ||
- **Oracle Provider Status**: Track Pyth Network reliability | ||
- **RPC Node Health**: Monitor API responsiveness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
#### Network Dependencies | ||
- **NEAR Network Performance**: Monitor blockchain health and congestion | ||
- **Oracle Provider Status**: Track Pyth Network reliability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
#### Available Analysis Tools | ||
- **Market Configuration Review**: Analyze MCR ratios and interest rate models | ||
- **Oracle Price Monitoring**: Track price volatility and feed reliability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://insights.pyth.network/price-feeds for individual feeds, https://status.pyth.network/ for pyth oracle overall
#### Available Analysis Tools | ||
- **Market Configuration Review**: Analyze MCR ratios and interest rate models | ||
- **Oracle Price Monitoring**: Track price volatility and feed reliability | ||
- **Liquidation Efficiency**: Monitor liquidation success rates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark as TODO get data from liquidator
- **Market Configuration Review**: Analyze MCR ratios and interest rate models | ||
- **Oracle Price Monitoring**: Track price volatility and feed reliability | ||
- **Liquidation Efficiency**: Monitor liquidation success rates | ||
- **Position Analysis**: Assess individual and aggregate position health |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Individual position health can be viewed on the "My Account" page: https://app.templarfi.org/borrow-supply/my-account. Aggregate position health needs to be created from the data
### Economic Risk Assessment | ||
|
||
#### Available Analysis Tools | ||
- **Market Configuration Review**: Analyze MCR ratios and interest rate models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO get parameters from each market deployed
|
||
## Compliance and Auditing | ||
|
||
<TBD> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
## Audit Information | ||
|
||
- **Current Status**: `<TBD>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open coverage-report/index.html | ||
``` | ||
|
||
**Note**: Coverage reporting tools are not integrated into the CI pipeline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's integrate a code coverage tool into the CI/CD pipeline so it's easily viewable on github
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the specific comments, as a general rule if we state that something is being done, link to the proof it's being done or a location where the reader can verify themselves
Adds 6 documentation files addressing Process Quality Review feedback:
Contract addresses & verification procedures
Administrative controls
Oracle integration
Security practices
Testing coverage
Monitoring