How It Works

What is District Finance?

District Finance is a DeFi centric application and smart transaction protocol.

The application enables users to sign and broadcast DeFi based trading intents.

The protocol is a set of smart contracts that allow users to express complex intent conditions. Instead of crafting a transaction with explicit function calls, the user can craft a transaction intent, which contain conditions and rules that must be met for the transaction to be executed.

📜 Smart Transactions

Smart transactions are distinct from normal transactions.

Normal transactions are signed payloads broadcast in real-time.

Smart transactions are signed intents that can be broadcast now or in the future.

A smart transaction can read current and historic state of a blockchain before being executed. Greatly expanding the rules and conditions governing for when a transaction becomes valid i.e. executable.

For example a user can sign a transaction that is conditional on the price of ETH being above $2,500. Or if the average price of ETH over the last 30 days is below $2,500 using zero knowledge proofs.

Smart transaction have conditions and rules. Written directly in the data structure.

🔐 Intent Modules

At the heart of Smart Transactions are intent modules.

Intent modules are smart contracts that constrain a smart transaction.

Intent Module Examples

  • Aave Leverage Long
  • Block Number Range
  • Chainlink Data Feed
  • ERC20 Limit Order
  • ERC20 Rebalance
  • ERC20 Swap Spot Price (Buy/Sell)
  • ERC20 Tip
  • ETH Tip
  • Timestamp Range
  • Uniswap3 Time-Weighted Average Balance
  • Uniswap3 Historical Time-Weighted Average Balance

Each intent module limits a specific set of rules and conditions. And can be combined with other intent modules to create complex smart transactions.

For example the TimestampRangeIntent and ERC20LimitOrderIntent intent modules can be combined to create a limit order that is only valid between a specific time range.

Or UniswapV3HistoricalTwapPercentageChange and ERC20SwapSpotPriceExactTokenOut intent modules used to implement an automatic Mean Reversion trading strategy.

Player vs GameTimestampRangeIntent.sol Example Code

💳 Smart Wallet

District Finance extends the Safe Multisig Wallet with the Intentify module.

Do NOT install the Intentify module on existing Safe Multisig Wallet. The smart contracts are an ALPHA release. And should not be used with funds you're not willing to lose.

The Intentify allows an owner of a Safe Multisig Wallet to sign and broadcast smart transactions. While using the Safe Multisig Wallet to store funds and manage owners.