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
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 SourceReturns true if fee is enabled for given pair or false if its disabled.
Arguments
pair_address
- A pair addressnetwork
- A network
Link to this function
get_router_owner_managed_address(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 SourceSwaps a certain token amount with fixed amount value on input and minimum amount value on output.
Arguments
account
- An account's structpair
- A pair structtoken_in
- Token identifier that we provide on input for swap operationvalue_in
- Fixed amount value for input tokentoken_out
- Token identifier that we provide on output. The swap operation will return given token into accountvalue_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 SourceSwaps a certain token amount value on input for a fixed amount value on output.
Arguments
account
- An account's structpair
- A pair structtoken_in
- Token identifier that we provide on input for swap operationvalue_in_max
- Maximum amount value for input tokentoken_out
- Token identifier that we provide on output. The swap operation will return given token into accountvalue_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"