Skip to content

XLS‐30 AMM FAQ

Elliot. edited this page Apr 11, 2025 · 2 revisions

account addresses

After a test network reset, you can re-create settings and data. AMM accounts may not use the same addresses after the reset.

Q: How are AMM account addresses generated?

A: It's based on a hash of the two assets (currency + issuer) plus a counter / nonce in case of collision. It's effectively deterministic if there are no collisions, but non-deterministic if there are.

LP Token value

To figure out how much a given amount of LP Tokens is worth, in terms of the two assets in an AMM's pool:

Call amm_info and then do some calculations on amount/amount2 and lp_token.

Suppose I hold an amount of LP Tokens equal to N. Pseudo-code:

var asset  // first asset of the AMM pool
var asset2 // second asset of the AMM pool
var N      // number of LP Tokens I hold

amm_result = get amm_info(asset, asset2)

// Calculate what fraction of total LPT I hold
my_share = N / amm_result.amm.lp_token.value

my_asset1 = amm_result.amm.amount.value * my_share
my_asset2 = amm_result.amm.amount2.value * my_share

print("My share of the AMM's pool is worth:")
print(my_asset1, amm_result.amm.amount.currency)
print("and")
print(my_asset2, amm_result.amm.amount2.currency)

amm withdraw all would wrap your LPTokens for the underlying assets.

If you own 5% of all LPT, then that means you can theoretically withdraw for 5% each of both assets in the pool.

Old amm-testnet details

You could use this information to connect your own rippled instance to the amm-testnet.

validators.txt

[validator_list_keys]
EDC573E4064B6F53409E722CC1F1BD3C8BDDA0691571ABE10D30FF90E6A23332DF

[validator_list_sites]
https://vlamm.devnet.rippletest.net/

rippled.cfg

[ips_fixed]
52.13.104.109 2459
52.12.89.46 2459
34.217.45.134 2459
35.91.233.23 2459
54.68.101.13 2459
[network_id]
25
# needs these features enabled
[features]
AMM
fixUniversalNumber

Here is the entire config file. Modify the paths to somewhere the user running rippled has write permission and the validators.txt file is the same as what is named in the config.

[network_id]
25
[server]
port_rpc_admin_local
port_peer
port_ws_admin_local
[port_rpc_admin_local]
port = 51234
ip = 127.0.0.1
admin=[0.0.0.0]
protocol = http
[port_peer]
port = 51235
ip = 127.0.0.1
protocol = peer
[port_ws_admin_local]
port = 6015
ip = 127.0.0.1
admin=[0.0.0.0]
protocol = ws
[port_grpc]
port = 50061
ip = 0.0.0.0
secure_gateway = 127.0.0.1
[node_size]
huge
[node_db]
type=NuDB
path=/home/rippled/rippled-data/amm/db/nudb
open_files=2000
filter_bits=12
cache_mb=256
file_size_mb=8
file_size_mult=2
earliest_seq=5
[ledger_history]
full
[database_path]
/home/rippled/rippled-data/amm/db
[debug_logfile]
/home/rippled/rippled-data/amm/log/debug.log
[sntp_servers]
time.windows.com
time.apple.com
time.nist.gov
pool.ntp.org
[ips_fixed]
52.13.104.109 2459
52.12.89.46 2459
34.217.45.134 2459
35.91.233.23 2459
54.68.101.13 2459
[validators_file]
amm-validators.txt
[rpc_startup]
{ "command": "log_level", "severity": "debug" }
[ssl_verify]
1
[compression]
0
[voting]
# reference_fee = 10
account_reserve = 10000000
owner_reserve = 2000000
[fee_account_reserve]
10000000
[fee_owner_reserve]
2000000
[features]
AMM
#FlowCross
fixUniversalNumber
#DeletableAccounts
#NonFungibleTokensV1_1
#fixNFTokenNegOffer
[peers_max]
20
[peer_private]
0
[signing_support]
true
Clone this wiki locally