Pisa Fees

Pisa Fees is a smart contract solution for multi-asset transaction fees.

How it Works

Pisa Fees can be seen as a micro-DEX specialized in providing transaction fee for other target token. Any liquidity provider can create a position with target exchange rate; any user of Pisa Fees can use one of the liquidity position to buy enough Ada to cover for transaction.

Since Pisa Fees is a single smart contract and offchain-side tooling, it does not require changes to the Cardano node and consensus protocol. The Cardano node does not require fees to be paid from the user’s wallet; it only verifies the correct difference between inputs and outputs in the transaction, which is taken as the fee. Hence, Ada unlocked from Pisa Fees script can be used as fee to transaction when balanced correctly. Pisa Fees scripts support three main workflows: Creation, Modification, and Feeswap.

Pisa Fee Creation

Any user can create a Pisa Fee position by simply sending an Ada amount and a datum specifying the owner and desired exchange rates to the Pisa Fee script. Each UTxO generated by a Pisa Fees script is a unique fee swap position, and creating a position requires no script validation to keep Pisa Fees efficient. To prevent denial-of-service attacks through invalid positions, any UTxO locked with invalid datum can be immediately liquidated by anyone. An example of a Pisa Fees datum is shown below:

Constr 0
  [ B "<..owner pkh..>"
  , Map [ (Constr 0 [B "Asset1Symbol",B "Asset1Name"],I 10)
        , (Constr 0 [B "Asset2Symbol",B "Asset2Name"],I <Rate in Lovelace / Target Asset, 12 place fixed decimal>)
        , ... More target assets and exchange rates ...
        ]

Modifying and Closing Positions

Once a Pisa Fee position exists, its owner can modify or close it at any time. The only validation required is the presence of the owner’s signature in the datum. Modification involves simply spending the UTxO and sending a new datum to the same Pisa Fees script, while closing the position is effectively the same as modifying it from the script’s perspective.

Fee Swap

The core function of Pisa Fees is the fee swap, which follows these validations:

  1. One Pisa Fees script input and output must exist.
  2. The input script’s data must remain unchanged in the output.
  3. Only Ada is unlocked from the script.
  4. The Ada value of non-Ada assets must equal or exceed the unlocked Ada amount (converted using exchange rates from the datum).

Following these rules, users can unlock an Ada amount for transaction fees by depositing a specified amount of another token accepted by the Pisa Fee position.

Integration

Currently, Atlas integration is under development, which allow automatic selection of available Pisa Fee positions and transaction balancing using non-Ada token as transaction fee. However, simple interface and light weight construction of Pisa Fee smart contract makes integrating Pisa Fees easy.

Anyone can make position by sending Ada amount and correct datum to this address addr_test1wq2gjr3m2qkpnvp40wxa6zmcg95z607rlyzfr7t20hj62cq5paa9l to make positions and use one of UTxO under the address to make a feeswap.

For currently available public APIs see public API page.

For integration details see Pisa API integration guide.