Skip to content

Instantly share code, notes, and snippets.

@paulbellamy
Forked from JakeUrban/sep10-changes
Last active September 1, 2021 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulbellamy/39f246fe97ecea14c83808512cdf80f0 to your computer and use it in GitHub Desktop.
Save paulbellamy/39f246fe97ecea14c83808512cdf80f0 to your computer and use it in GitHub Desktop.
CAP-38 AMM Changes

We've just released v6.0.1, of the SDF Javascript base library.

It includes changes to implement CAP-38, supporting automated market makers.

These changes will be released with the protocol v18 upgrade.

There are some further notes on the changes API endpoints, with mock responses, on this APIary. Further notes on the API changes are available in this document.

  • Each SDK must update to enable depositing, and withdrawing from liquidity pools.
  • SDKs must also update to include the new effect types, as well as new fields on Accounts.
  • SDKs should also include methods to query liquidity pool information.

Because the order of the assets must be sorted in the pool ID, as well as in the depositing and withdrawing operations, SDKs should either:

  • error when creating a pool ID with assets in the wrong order
  • or, automatically sort the assets when generating a pool ID and structure the SDK to help users avoid making this mistake. For example, in the Go SDK, we pass in each asset and amount as a tuple, so that they are associated.

Asset ordering is determined by: Native < AlphaNum4 < AlphaNum12, then by Code, then by Issuer, using lexicographic ordering.

If your SDK has implemented and released these changes, reference the release in a closing comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment