Skip to content

Conversation

vitaliybezz
Copy link
Contributor

Adds 6 documentation files addressing Process Quality Review feedback:

Contract addresses & verification procedures
Administrative controls
Oracle integration
Security practices
Testing coverage
Monitoring

Copy link

## Deployed Addresses

### NEAR Mainnet
- **Registry**: `<TBD>`
Copy link
Collaborator

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>`
Copy link
Collaborator

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>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

## Getting Current Addresses

For deployed contract addresses, check:
- **Official Website**: [templarfi.org](https://templarfi.org/)
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peer2f00l is this correct?

Copy link
Collaborator

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>`
Copy link
Collaborator

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)
Copy link
Collaborator

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
Copy link
Collaborator

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

Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#### Market Data Analysis
Using available view functions:
- Total Value Locked calculations
- Utilization rate monitoring
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

@royalf00l royalf00l Sep 29, 2025

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`)
Copy link
Collaborator

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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


### Oracle Call Costs

<TBD>
Copy link
Collaborator

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Criminal Activity Monitoring

- **Access Control**: Monitor administrative function usage

#### Network Dependencies
- **NEAR Network Performance**: Monitor blockchain health and congestion
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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>
Copy link
Collaborator

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>`
Copy link
Collaborator

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.
Copy link
Collaborator

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

Copy link
Collaborator

@royalf00l royalf00l left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants