Home
Itamar Reif edited this page Nov 12, 2021
·
1 revision
This project is the implementation of Compound Protocol on Tezos chain using SmartPy language.
The diagram demonstrates relations between contracts
The platform consists of the following contracts
- Governance - admin contract that has the ability to change parameters in Comptroller and CTokens. The first version of Tezfin has a centralized Governance that works as an admin proxy
- Comptroller - the risk management layer. It determines how much collateral a user is required to maintain, and whether (and by how much) a user can be liquidated. Each time a user interacts with a cToken, the Comptroller is asked to approve or deny the transaction
- Price oracle - third-party contract that provides price data. Used by Comptroller for liquidity calculation
- CToken - Tezfin market for the underlying token
- Interest Rate Model - specifies rules of acquiring interest rate and borrow rate
- Underlying token - the contract of the actual asset. Tezfin supports both FA1.2 and FA2 tokens
SmartPy CLI is required to interact with contracts. For installation please refer to https://smartpy.io/cli/
Code is organized in the following structure
-
contracts - contains SmartPy code of smart contracts
- interfaces - smart contracts interfaces with description of external entry points
- utils - smart contracts extensions with utility functions
-
tests - unit tests
- mock - mock contracts for test purposes
- utils - unit tests utility functions
- CTokenTest.py - unit tests for generic CToken code
- CFA12Test.py - unit tests for FA1.2 CToken template
- CFA2Test.py - unit tests for FA2 CToken template
- CXTZTest.py - unit tests for XTZ CToken implementation
- InterestRateModelTest.py - unit tests for interest rate model
- ComptrollerTest.py - unit tests for Comptroller
- GovernanceTest.py - unit tests for Governance
- InterestRateModel.py - interest rate model, calculates supply and borrow rate for CToken instance
- CToken.py - CToken generic code
- CFA12.py - FA1.2 CToken template
- CFA2.py - FA2 CToken template
- CXTZ.py - XTZ CToken implementation
- Comptroller.py - The risk model contract
- Governance.py - Performs control over the protocol
- docs - materials for documentation
-
deploy - contains scipts for compilation and deployment
- test_data - additional contracts for deploment on testnet
-
compile_targets - contains description of compilation targets
- Config.json - contracts compilation configuration
-
deploy_script
- config.json - deploy configuration with secret data
- deploy.js - conseiljs deployment script
- shell_scripts - shell scripts to compile and deploy contracts in one command
How to run Unit-tests
How to Compile and Deploy contracts
The description of error codes returned by the contracts: Error-codes
Basic usage description: Usage
CToken description: CToken
Comptroller description: Comptroller
General information
Code description