Elrondex.Sc.PairSc (Elrondex v0.1.1) View Source

Link to this section Summary

Functions

Returns true if fee is enabled for given pair or false if its disabled.

Swaps a certain token amount with fixed amount value on input and minimum amount value on output.

Swaps a certain token amount value on input for a fixed amount value on output.

Link to this section Functions

Link to this function

accept_esdt_payment(account, pair, token_identifier, value)

View Source
Link to this function

add_liquidity(account, pair, arg1, arg2)

View Source
Link to this function

add_liquidity(account, pair, first_value_transfer, first_value_min, second_value_transfer, second_value_min)

View Source
Link to this function

get_amount_in(pair, token_wanted_identifier, amount_wanted, network)

View Source
Link to this function

get_amount_out(pair, token_in_identifier, amount_in, network)

View Source
Link to this function

get_equivalent(account, pair, token_identifier, value)

View Source
Link to this function

get_extern_swap_gas_limit(pair_address, network, opts \\ [])

View Source
Link to this function

get_fee_state(pair_address, network)

View Source

Returns true if fee is enabled for given pair or false if its disabled.

Arguments

  • pair_address - A pair address
  • network - A network
Link to this function

get_first_token_id(pair_address, network, opts \\ [])

View Source
Link to this function

get_lp_token_identifier(pair_address, network, opts \\ [])

View Source
Link to this function

get_pair(pair_address, network, opts \\ [])

View Source
Link to this function

get_reserve(pair_address, token_identifier, network, opts \\ [])

View Source
Link to this function

get_router_managed_address(pair_address, network, opts \\ [])

View Source
Link to this function

get_router_owner_managed_address(pair_address, network, opts \\ [])

View Source
Link to this function

get_second_token_id(pair_address, network, opts \\ [])

View Source
Link to this function

get_special_fee(pair_address, network, opts \\ [])

View Source
Link to this function

get_state(pair_address, network, opts \\ [])

View Source
Link to this function

get_total_fee_percent(pair_address, network, opts \\ [])

View Source
Link to this function

get_total_lp_token_supply(pair_address, network, opts \\ [])

View Source
Link to this function

remove_liquidity(account, pair, liquidity, first_token_amount_min, second_token_amount_min)

View Source
Link to this function

swap_tokens_fixed_input(account, pair, token_in, value_in, token_out, value_out_min)

View Source

Swaps a certain token amount with fixed amount value on input and minimum amount value on output.

Arguments

  • account - An account's struct
  • pair - A pair struct
  • token_in - Token identifier that we provide on input for swap operation
  • value_in - Fixed amount value for input token
  • token_out - Token identifier that we provide on output. The swap operation will return given token into account
  • value_out_min - Minimum amount for output token that is required for a successful swap operation

Examples

iex> Elrondex.Sc.PairSc.swap_tokens_fixed_input(Elrondex.Test.Bob.account, 
...> Elrondex.Test.Pair.wegld_usdc_pair, 
...> "WEGLD-bd4d79", 
...> 1000_000_000_000_000_000, 
...> "USDC-c76f1f", 
...> 2 * 50 * 1_000_000)
...> |> Map.get(:data)
"ESDTTransfer@5745474c442d626434643739@0de0b6b3a7640000@73776170546f6b656e734669786564496e707574@555344432d633736663166@05f5e100"
Link to this function

swap_tokens_fixed_output(account, pair, token_in, value_in_max, token_out, value_out)

View Source

Swaps a certain token amount value on input for a fixed amount value on output.

Arguments

  • account - An account's struct
  • pair - A pair struct
  • token_in - Token identifier that we provide on input for swap operation
  • value_in_max - Maximum amount value for input token
  • token_out - Token identifier that we provide on output. The swap operation will return given token into account
  • value_out - Fixed amount value for output token

Examples

iex> Elrondex.Sc.PairSc.swap_tokens_fixed_output(Elrondex.Test.Bob.account, 
...> Elrondex.Test.Pair.wegld_usdc_pair, 
...> "WEGLD-bd4d79", 
...> 130_000_000_000_000_0000, 
...> "USDC-c76f1f", 
...> 3 * 50 * 1_000_000)
...> |> Map.get(:data)
"ESDTTransfer@5745474c442d626434643739@120a871cc0020000@73776170546f6b656e7346697865644f7574707574@555344432d633736663166@08f0d180"
Link to this function

temporary_funds(account, pair, token_identifier)

View Source
Link to this function

temporary_funds(account, pair, caller, token_identifier)

View Source