Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .github/workflows/cadence_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CI

on: pull_request
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
tests:
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "DeFiBlocks"]
path = DeFiBlocks
url = git@github.com:onflow/DeFiBlocks.git
[submodule "DeFiActions"]
path = DeFiActions
url = git@github.com:onflow/DeFiActions.git
4 changes: 2 additions & 2 deletions AUTO_BORROWING_PROPOSAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ While `pushToDrawDownSink=false` works, it's not immediately obvious to users th
```cadence
access(all) fun openPositionWithoutAutoBorrow(
collateral: @{FungibleToken.Vault},
issuanceSink: {DFB.Sink},
repaymentSource: {DFB.Source}?
issuanceSink: {DeFiActions.Sink},
repaymentSource: {DeFiActions.Source}?
): Position {
// Always use pushToDrawDownSink=false to prevent auto-borrowing
return self.openPosition(
Expand Down
1 change: 1 addition & 0 deletions DeFiActions
Submodule DeFiActions added at 932f7d
1 change: 0 additions & 1 deletion DeFiBlocks
Submodule DeFiBlocks deleted from a2dcbd
2 changes: 1 addition & 1 deletion PUSH_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
### 4. Contract Improvements ✅
- Added `createPool()` function that accepts token type
- Fixed `reserveBalance()` to handle empty reserves
- Updated DFB Sink/Source implementations
- Updated DFA Sink/Source implementations
- Improved error messages for deprecated functions

## 📊 Test Results
Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@
- **Tests**: ✅ 100% Passing (22/22 tests)
- **Coverage**: ✅ 89.7%
- **Documentation**: ✅ Complete
- **Standards**: ✅ FungibleToken & DeFi Blocks Compatible
- **Standards**: ✅ FungibleToken & DeFi Actions Compatible
- **FlowVault Removal**: ✅ Complete (Ready for Tidal Integration)

## 🎯 Tidal Integration Milestones

### Current Status (Tracer Bullet Phase)
- ✅ **Smart Contract Integration**: TidalProtocol provides sink/source interfaces for token swapping
- ✅ **Development & Testing**: Automated testing framework for TidalProtocol and DefiBlocks
- ✅ **Repository Structure**: TidalProtocol code in private repo, DefiBlocks in public repo
- ✅ **Development & Testing**: Automated testing framework for TidalProtocol and DefiActions
- ✅ **Repository Structure**: TidalProtocol code in private repo, DefiActions in public repo
- 💛 **Test Coverage**: Working towards comprehensive test suite for Tidal functionality
- 👌 **AMM Integration**: Currently using dummy swapper, real AMM deployment planned

### Upcoming (Limited Beta)
- ✅ **Documentation**: First pass documentation of TidalProtocol (this README)
- ✅ **Testing**: Extensive test suite for TidalProtocol and DefiBlocks
- 💛 **Sample Code**: DefiBlocks sample code and tutorials needed
- ✅ **Testing**: Extensive test suite for TidalProtocol and DefiActions
- 💛 **Sample Code**: DefiActions sample code and tutorials needed
- 👌 **Advanced Features**: Per-user limits and controlled testing capabilities

### Future (Open Beta)
- ✅ **Open Access**: Full public access to TidalProtocol and DefiBlocks
- ✅ **Open Access**: Full public access to TidalProtocol and DefiActions
- 💛 **Documentation**: Improved documentation and tutorials
- ✅ **Sample Code**: Complete tutorials for DefiBlocks integration
- ✅ **Sample Code**: Complete tutorials for DefiActions integration

## 🏦 About TidalProtocol

TidalProtocol is a decentralized lending and borrowing protocol built on the Flow blockchain. It implements the Flow FungibleToken standard and integrates with DeFi Blocks for composability.
TidalProtocol is a decentralized lending and borrowing protocol built on the Flow blockchain. It implements the Flow FungibleToken standard and integrates with DeFi Actions for composability.

### Key Features

- **FungibleToken Standard**: Full compatibility with Flow wallets and DEXs
- **DeFi Blocks Integration**: Composable with other DeFi protocols via Sink/Source interfaces
- **DeFi Actions Integration**: Composable with other DeFi protocols via Sink/Source interfaces
- **Vault Operations**: Secure deposit and withdraw functionality
- **Position Management**: Create and manage lending/borrowing positions
- **Interest Mechanics**: Compound interest calculations with configurable rates
Expand All @@ -47,7 +47,7 @@ TidalProtocol is a decentralized lending and borrowing protocol built on the Flo
### Technical Highlights

- Implements `FungibleToken.Vault` interface for standard token operations
- Provides `DFB.Sink` and `DFB.Source` for DeFi composability
- Provides `DeFiActions.Sink` and `DeFiActions.Source` for DeFi composability
- Uses scaled balance tracking for efficient interest accrual
- Supports multiple positions per pool with independent tracking
- Includes comprehensive metadata views for wallet integration
Expand Down Expand Up @@ -121,20 +121,20 @@ flow project deploy --network=emulator
TidalProtocol/
├── cadence/
│ ├── contracts/
│ │ └── TidalProtocol.cdc # Main lending protocol contract
│ │ └── TidalProtocol.cdc # Main lending protocol contract
│ ├── tests/
│ │ ├── test_helpers.cdc # Shared test utilities
│ │ ├── core_vault_test.cdc # Vault operation tests
│ │ ├── interest_mechanics_test.cdc # Interest calculation tests
│ │ └── ... # Other test files
│ ├── transactions/ # Transaction templates (coming soon)
│ └── scripts/ # Query scripts (coming soon)
├── DeFiBlocks/
│ │ ├── test_helpers.cdc # Shared test utilities
│ │ ├── core_vault_test.cdc # Vault operation tests
│ │ ├── interest_mechanics_test.cdc # Interest calculation tests
│ │ └── ... # Other test files
│ ├── transactions/ # Transaction templates (coming soon)
│ └── scripts/ # Query scripts (coming soon)
├── DeFiActions/
│ └── cadence/contracts/interfaces/
│ └── DFB.cdc # DeFi Blocks interface
├── imports/ # Flow standard contracts
├── flow.json # Flow configuration
└── README.md # This file
│ └── DeFiActions.cdc # DeFi Actions interface
├── imports/ # Flow standard contracts
├── flow.json # Flow configuration
└── README.md # This file
```

## 🔧 Contract Architecture
Expand All @@ -144,14 +144,14 @@ TidalProtocol/
1. **Pool**: Main lending pool managing positions and reserves
2. **Position**: User positions tracking deposits and borrows
3. **TokenState**: Per-token state including interest indices
4. **TidalProtocolSink/Source**: DeFi Blocks integration for composability
4. **TidalProtocolSink/Source**: DeFi Actions integration for composability

### Key Interfaces

- `FungibleToken.Vault`: Standard token operations
- `ViewResolver`: Metadata views for wallets
- `Burner.Burnable`: Token burning capability
- `DFB.Sink/Source`: DeFi protocol composability
- `DeFiActions.Sink/Source`: DeFi protocol composability

## 🛠️ Development

Expand Down Expand Up @@ -207,7 +207,7 @@ This project is licensed under the MIT License.
- [Flow Documentation](https://developers.flow.com/)
- [Cadence Language](https://cadence-lang.org/)
- [FungibleToken Standard](https://github.com/onflow/flow-ft)
- [DeFi Blocks](https://github.com/onflow/defi-blocks)
- [DeFi Actions](https://github.com/onflow/defiactions)
- [Flow Discord](https://discord.gg/flow)

## Note
Expand Down
2 changes: 1 addition & 1 deletion TestSuiteComparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Key Differences
| Layer | Current branch | Legacy branch |
|-------|----------------|---------------|
| Helper file | `test_helpers.cdc` (≈150 LOC, concise) | `test_helpers.cdc` (≈300 LOC, bespoke utilities) |
| Account/Vault utils | Uses real `FlowTokenStack` & on-chain vault paths; leans on DeFiBlocks connectors. | Manufactures an in-memory `resource MockVault` to mimic FlowToken; therefore never validates interactions with real vault APIs. |
| Account/Vault utils | Uses real `FlowTokenStack` & on-chain vault paths; leans on DeFiActions connectors. | Manufactures an in-memory `resource MockVault` to mimic FlowToken; therefore never validates interactions with real vault APIs. |
| Oracle mocks | Separate `MockOracle` contract deployed once during `setup()`. | Builds a string-concat Cadence script at runtime (`createDummyOracle`) and executes it every time a price oracle is needed → fragile and slow. |
| State control | Snapshot + `Test.reset(to:)` isolates cases. | No snapshot/reset; each test implicitly assumes fresh emulator or isolated file. |
| Failure asserts | "`beFailed` flag" pattern allows a single helper to test success & expected-failure flows. | Success only (almost no negative-path coverage). |
Expand Down
2 changes: 1 addition & 1 deletion TestingCompletionSummary.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Successfully restructured and fixed the TidalProtocol test suite to match the ac
- Updated `createTestPool()` to panic and direct users to use `createPool()` with explicit token type
- Added `createPool()` function that accepts token type as parameter
- Fixed pool initialization to not create empty vaults - vaults are created on first deposit
- Updated DFB Sink/Source implementations to be token-agnostic
- Updated DFA Sink/Source implementations to be token-agnostic
- Fixed `reserveBalance()` to handle case where no vault exists yet (returns 0.0)

## Test Results
Expand Down
20 changes: 10 additions & 10 deletions TidalMilestones.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- ✅ Frontend connects to Flow wallet, allows a user to create and view the details of at least one Tide. It will support a single collateral type (a crypto, not a stable), and a single investment type (i.e. yield token).
- 👌 Multiple Tides per account.
- ✅ Frontend provides accurate details about the Tide, compiled using event data. (i.e. a backend). For this milestone, the details can be minimal (i.e. number of trades), just to show that we are tracking on-chain events.
- ✅ Frontend constructs a transaction that "glues together" TidalProtocol with DefiBlocks to create the Tide. Signed and submitted by Flow Wallet.
- ✅ Frontend constructs a transaction that "glues together" TidalProtocol with DefiActions to create the Tide. Signed and submitted by Flow Wallet.
- ✅ Frontend adds the initial collateral tokens to the position during setup and triggers a rebalance to kick off the initial purchase of yield tokens.
- 👌 Frontend allows deposit/withdrawal to adjust the size of a Tide.

Expand All @@ -34,10 +34,10 @@

### Development & Testing
- ✅ The tracer bullet can run on emulator or testnet, with a soft preference for emulator (to keep eyes off of our secret sauce until we're ready to announce).
- ✅ Automated testing framework for TidalProtocol and DefiBlocks.
- ✅ Automated testing framework for TidalProtocol and DefiActions.
- 💛 Test suite that covers the functionality required for Tidal.
- ✅ Tidal and TidalProtocol code in a private repo.
- ✅ DefiBlocks code in a public repo.
- ✅ DefiActions code in a public repo.

## Limited Beta

Expand Down Expand Up @@ -73,10 +73,10 @@

### Documentation & Testing
- ✅ First pass documentation of TidalProtocol.
- ✅ DefiBlocks available to all devs.
- ✅ First pass documentation of DefiBlocks.
- 💛 Sample code for DefiBlocks.
- ✅ Extensive test suite for TidalProtocol, DefiBlocks, and any Tidal-specific smart contracts.
- ✅ DefiActions available to all devs.
- ✅ First pass documentation of DefiActions.
- 💛 Sample code for DefiActions.
- ✅ Extensive test suite for TidalProtocol, DefiActions, and any Tidal-specific smart contracts.
- 💛 Test suites should be available, with instructions, for anyone to run locally with minimal effort.
- ✅ All code (including Tidal) in public repos.

Expand All @@ -89,7 +89,7 @@
All MUSTs from above, except those related to gated access.

### Access & Availability
- ✅ Open access to Tidal, TidalProtocol, and DefiBlocks.
- ✅ Open access to Tidal, TidalProtocol, and DefiActions.

### Asset Support
- ✅ Support BTC, ETH as collateral.
Expand All @@ -101,6 +101,6 @@ All MUSTs from above, except those related to gated access.
- 👌 Rebalances/accumulation are triggered manually by a daemon process.

### Documentation
- 💛 Improved documentation for Tidal, TidalProtocol, and DefiBlocks.
- ✅ Sample code and tutorials for DefiBlocks.
- 💛 Improved documentation for Tidal, TidalProtocol, and DefiActions.
- ✅ Sample code and tutorials for DefiActions.

Loading
Loading