TWAMM Research: November 2021

In the past two months, we have been researching TWAMM, and here’s what we’ve done so far.

We were relatively new to smart-contract development, despite having worked with blockchain data and all matter of computing environments from FPGA silicon to the browser.

As it stands, our current goal is to continue to further our understanding of TWAMM's operational parameters and the edge cases that present problems.

After devising solutions to those problems, the next step will be to optimize gas consumption. At that point the contract may be ready for formal deployment, however, alternately we may consider integrating concentrated liquidity features as well.

Unanswered Questions

  • Get a better sense of edge case operational scenarios and any ideas for mitigation strategies for them.
  • Iterate further on the plan of execution towards a finalized product, see more under the rapid development section below.

Infrastructure Exploration

  • Learned solidity and various aspects of smart contract development
  • Investigated multiple smart contract development environments (brownie, hardhat, dapptools)
    • ported Frankie's JS tests to Solidity tests for DappTools exploration
  • Created multiple TS models of TWAMM
    1. A typescript model of Dave White's TWAMM python notebook
    2. A typescript model of FrankieIsLost's TWAMM contract (80% complete as of this writing)
  • Deployed and tested the FrankieIsLost TWAMM contract to both hardhat and dapptools
    • Developed a methodology to profile that contract's gas usage (beyond top-level public functions)

Testing Exploration

Our strategy in creating the typescript models was not only to become more familiar with the currently proposed TWAMM implementation but to leverage them for:

  • Comparative test benching (i.e. sanity checks with double precision and larger fixed precision models)
    • It's one thing to have 2-10 trades and to know the expected result, quite another thing to introduce 1000s of randomized trades to check for edge condition handling, etc. in the presence of more conventional trades.
  • Rapid development of related ideas:
    • long term trade fees
    • finite precision stability issues and arithmetic re-ordering and modifications to accommodate those issues
    • concentrated liquidity
Subscribe to 0x70626a
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.