onyx-protocol

所属分类:特征抽取
开发工具:Solidity
文件大小:0KB
下载次数:0
上传日期:2024-03-07 14:44:47
上 传 者sh-1993
说明:  Onyx协议是一种去中心化的流动性协议,支持以太、代币和NFT等数字资产。
(Onyx Protocol is a decentralized liquidity protocol that supports digital assets such as Ether, tokens and NFTs.)

文件列表:
contracts/
migrations/
scenario/
script/
spec/scenario/
test/
tests/
.dockerignore
.solcover.js
.soliumignore
.soliumrc.json
Dockerfile
compiler_config.json
gasCosts.json
jest.config.js
package.json
reporterConfig.json
saddle.config.js
truffle-config.js
yarn.lock

Onyx Protocol ================= The Onyx Protocol is an Ethereum smart contract for supplying or borrowing assets. Through the oToken contracts, accounts on the blockchain *supply* capital (Ether or ERC-20 tokens) to receive oTokens or *borrow* assets from the protocol (holding other assets as collateral). The Onyx oToken contracts track these balances and algorithmically set interest rates for borrowers. Contracts ========= We detail a few of the core contracts in the Onyx protocol.
OToken, OErc20 and OEther
The Onyx oTokens, which are self-contained borrowing and lending contracts. OToken contains the core logic and OErc20 and OEther add public interfaces for Erc20 tokens and ether, respectively. Each OToken is assigned an interest rate and risk model (see InterestRateModel and Comptroller sections), and allows accounts to *mint* (supply capital), *redeem* (withdraw capital), *borrow* and *repay a borrow*. Each OToken is an ERC-20 compliant token where balances represent ownership of the market.
Comptroller
The risk model contract, which validates permissible user actions and disallows actions if they do not fit certain risk parameters. For instance, the Comptroller enforces that each borrowing user must maintain a sufficient collateral balance across all oTokens.
    Updating the Comptroller
  • Follow the existing naming schema (ControllerGX)
  • Update the scenario runner in scenario/src/Builder/ComptrollerImplBuilder.ts
  • Create unit tests and fork simulations as necessary
  • Call npx saddle deploy Comptroller -n mainnet to deploy to mainnet and generate new ABI
    • The ABI can also be generated by deploying to mainnet in a fork simulation
  • Call node script/comptroller-abi to merge the new Comptroller ABI with the Unitroller ABI
  • Ensure that commit contains new generated Comptroller ABI
InterestRateModel
Contracts which define interest rate models. These models algorithmically determine interest rates based on the current utilization of a given market (that is, how much of the supplied assets are liquid versus borrowed).
Careful Math
Library for safe math operations.
ErrorReporter
Library for tracking error codes and failure conditions.
Exponential
Library for handling fixed-point decimal numbers.
SafeToken
Library for safely handling Erc20 interaction.
WhitePaperInterestRateModel
Initial interest rate model, as defined in the Whitepaper. This contract accepts a base rate and slope parameter in its constructor.
Installation ------------ To run onyx, pull the repository from GitHub and install its dependencies. You will need [yarn](https://yarnpkg.com/lang/en/docs/install/) or [npm](https://docs.npmjs.com/cli/install) installed. git clone https://github.com/onyx-finance/onyx-protocol cd onyx-protocol yarn install --lock-file # or `npm install` REPL ---- The Onyx Protocol has a simple scenario evaluation tool to test and evaluate scenarios which could occur on the blockchain. This is primarily used for constructing high-level integration tests. The tool also has a REPL to interact with local the Onyx Protocol (similar to `truffle console`). yarn repl -n development yarn repl -n rinkeby > Read OToken oBAT Address Command: Read OToken oBAT Address AddressV You can read more about the scenario runner in the [Scenario Docs](https://github.com/onyx-finance/onyx-protocol/tree/master/scenario/SCENARIO.md) on steps for using the repl. Testing ------- Jest contract tests are defined under the [tests directory](https://github.com/onyx-finance/onyx-protocol/tree/master/tests). To run the tests run: yarn test Integration Specs ----------------- There are additional tests under the [spec/scenario](https://github.com/onyx-finance/onyx-protocol/tree/master/spec/scenario) folder. These are high-level integration tests based on the scenario runner depicted above. The aim of these tests is to be highly literate and have high coverage in the interaction of contracts. Code Coverage ------------- To run code coverage, run: yarn coverage Linting ------- To lint the code, run: yarn lint _ Copyright 2022, Onyx Protocol

近期下载者

相关文件


收藏者