Payload with PR
Background
We have been researching & developing TWAMMs built on top of Balancer as a custom pool. Balancer grants DAO has been extremely supportive of our endeavor and we’re excited to launch next month. You can learn more about the project here:
Motivation
TWAMMs and Balancer pools in general are complicated to interact with in absence of a UX. We are building a dedicated relayer that abstracts the complexity from the end-user and provides safety in terms of slippage protection and error handling.
We want to do this all from a smart contract thus maintaining the advantages of a fully on-chain protocol: permissionless, composability, & decentralization. Additionally, we don’t want our protocol to be restricted by hostile regulatory regimes that target Web UX.
Interactions
Below are the two ways to interact with the core TWAMM contracts today via Gnosis Safe or Etherscan. Without a dedicated UX, the user would have to know how to set slippage, handle errors, etc themselves.
Unsafe + complex: interact through Vault
A user would have to create tuples
and be knowledgeable of Balancer’s Vault infrastructure. Furthermore, they would have to abi.encode
data specific to TWAMM like intervals, swap type, etc.
Safe + intuitive: relayer/periphery contract
Here the user would specify very simple inputs (similar to in a UX) in order to execute a long-term swap.
Development
We will create our Relayer, similar to Balancer Relayer (https://github.com/balancer/balancer-v2-monorepo/blob/master/pkg/standalone-utils/contracts/relayer/BalancerRelayer.sol), but with added abstractions for the following functions:
function longTermSwap
function shortTermSwap
function partnerSwap
function join
function exit
function withdraw
function cancel
Security
- The core contracts have been fully audited by SpearbitDAO: https://github.com/spearbit/portfolio/blob/master/pdfs/CronFinance-Spearbit-Security-Review.pdf
- The periphery contract will be audited by SpearbitDAO as well.
- Users of this relay will have to explicitly approve the relayer before using it.
- Relayer actions will be scoped to:
join, exit, swap
- We will scope the relay to only interact with TWAMM pools recognized by our Factory contract:
Tradeoffs
Balancer
⛔️ Attack vectors: addressed in the security section
✅ Ease of use for a new pool type
✅ Expand Balancer pool interaction to fully on-chain
✅ Exploring & developing the Relayer ecosystem for other teams, integrators
Cron
⛔️ Increase of attack surface
✅ Vastly improved on-chain UX
✅ Moat against copycats, vampire forks
✅ Simplified onboarding of different user personas: whales, protocols, 3rd party front-ends
Users, integrators
⛔️ Additional gas costs of the periphery
✅ Interact directly without UX/3rd party
✅ Ease of use and integration
✅ Safety and slippage checks are done by the periphery
✅ Abstract TWAMM complexity
Governance
We would like governance to approve this relayer so we can onboard users faster, improve user experience, and reduce the complexity to interact with TWAMMs.
Relayer Information:
Balancer’s architecture requires governance approval for CronFi: Relayer
for these actions:
Vault Actions:
-
"joinPool(bytes32,address,address,(address[],uint256[],bytes,bool))": "0x78ad1b68d148c070372f8643c4648efbb63c6a8a338f3c24714868e791367653”
-
"exitPool(bytes32,address,address,(address[],uint256[],bytes,bool))": "0xc149e88b59429ded7f601ab52ecd62331cac006ae07c16543439ed138dcb8d34"
-
"swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)": "0x7b8a1d293670124924a0f532213753b89db10bde737249d4540e9a03657d1aff”