amm_config

class algofipy.amm.v1.amm_config.AMMEndpoints

Bases: object

AMM_LP_TOKENS = 'https://api.algofi.org/ammLPTokens'
ASSETS = 'https://api.algofi.org/assets'
POOLS = 'https://api.algofi.org/pools'
class algofipy.amm.v1.amm_config.MANAGER_STRINGS

Bases: object

admin = 'a'
contract_update_delay = 'cud'
contract_update_time = 'cut'
flash_loan_fee = 'flf'
increase_contract_update_delay = 'icud'
initialize_pool = 'ip'
max_flash_loan_ratio = 'mflr'
pool_hash_prefix = 'ph_'
registered_asset_1_id = 'a1'
registered_asset_2_id = 'a2'
registered_pool_id = 'p'
reserve_factor = 'rf'
schedule_contract_update = 'scu'
set_flash_loan_fee = 'sflf'
set_max_flash_loan_ratio = 'smflr'
set_reserve_factor = 'srf'
set_validator = 'sv'
validator_index = 'vi'
class algofipy.amm.v1.amm_config.POOL_STRINGS

Bases: object

admin = 'a'
asset1_id = 'a1'
asset1_reserve = 'a1r'
asset2_id = 'a2'
asset2_reserve = 'a2r'
asset_1_to_asset_2_exchange = 'e'
balance_1 = 'b1'
balance_2 = 'b2'
burn_asset1_out = 'ba1o'
burn_asset2_out = 'ba2o'
contract_update_delay = 'cud'
contract_update_time = 'cut'
cumsum_fees_asset1 = 'cf1'
cumsum_fees_asset2 = 'cf2'
cumsum_time_weighted_asset1_to_asset2_price = 'ct12'
cumsum_time_weighted_asset2_to_asset1_price = 'ct21'
cumsum_volume_asset1 = 'cv1'
cumsum_volume_asset2 = 'cv2'
cumsum_volume_weighted_asset1_to_asset2_price = 'cv12'
cumsum_volume_weighted_asset2_to_asset1_price = 'cv21'
flash_loan = 'fl'
flash_loan_fee = 'flf'
future_amplification_factor = 'faf'
future_amplification_factor_time = 'fat'
increase_contract_update_delay = 'icud'
initial_amplification_factor = 'iaf'
initial_amplification_factor_time = 'iat'
initialize_pool = 'ip'
initialized = 'i'
latest_time = 'lt'
lp_circulation = 'lc'
lp_id = 'l'
manager = 'm'
manager_app_id_var = 'ma'
max_flash_loan_ratio = 'mflr'
opt_into_assets = 'o'
pool = 'p'
ramp_amplification_factor = 'raf'
redeem_pool_asset1_residual = 'rpa1r'
redeem_pool_asset2_residual = 'rpa2r'
redeem_swap_residual = 'rsr'
remove_reserves = 'rr'
reserve_factor = 'rf'
schedule_contract_update = 'scu'
swap_exact_for = 'sef'
swap_fee_pct_scaled_var = 'sfp'
swap_for_exact = 'sfe'
validator_index = 'vi'
class algofipy.amm.v1.amm_config.PoolStatus(value)

Bases: Enum

Pool status enum

ACTIVE = 1
UNINITIALIZED = 0
class algofipy.amm.v1.amm_config.PoolType(value)

Bases: Enum

Pool type enum

CONSTANT_PRODUCT_100BP_FEE = 4
CONSTANT_PRODUCT_25BP_FEE = 1
CONSTANT_PRODUCT_25BP_FEE_LENDING_POOL = 7
CONSTANT_PRODUCT_30BP_FEE = 2
CONSTANT_PRODUCT_75BP_FEE = 3
NANOSWAP = 5
NANOSWAP_LENDING_POOL = 6
algofipy.amm.v1.amm_config.get_approval_program_by_pool_type(pool_type, network)

Gets the approval program for a given pool type

Parameters:
  • pool_type (PoolType) – a PoolType object for the type of pool (e.g. 30bp, 100bp fee)

  • pool_type – a PoolType object for the type of pool (e.g. 30bp, 100bp fee)

Returns:

approval program bytecode for given pool type as list of ints

Return type:

list

algofipy.amm.v1.amm_config.get_clear_state_program()

Gets the clear state program

Returns:

clear state program bytecode as list of ints

Return type:

list

algofipy.amm.v1.amm_config.get_pool_type(network, validator_index)

Gets the pool type for a given validator index

Parameters:
  • network (Network) – network Network (“testnet” or “mainnet”)

  • validator_index (PoolType) – a PoolType object for the type of pool (e.g. 30bp, 100bp fee)

Returns:

pool type for given validator index

Return type:

PoolType

algofipy.amm.v1.amm_config.get_stbl_asset_id(network)

Gets asset id of STBL for a given network

Parameters:

network (str) – network Network (“testnet” or “mainnet”)

Returns:

asset id of STBL for a given network

Return type:

int

algofipy.amm.v1.amm_config.get_usdc_asset_id(network)

Gets asset id of USDC for a given network

Parameters:

network (str) – network Network (“testnet” or “mainnet”)

Returns:

asset id of USDC for a given network

Return type:

int

algofipy.amm.v1.amm_config.get_validator_index(network, pool_type)

Gets the validator index for a given pool type and network

Parameters:
  • network (Network) – network Network (“testnet” or “mainnet”)

  • pool_type (PoolType) – a PoolType object for the type of pool (e.g. 30bp, 100bp fee)

Returns:

validator index for given type of pool

Return type:

int