Pair Proxy
- Trait:
PairProxy
- This proxy trait likely interacts with external components or contracts, performing operations like fetching prices or other data related to trading pairs.
Methods
get_safe_price_by_default_offset(pair_address, input_payment) -> EsdtTokenPayment
- Retrieves a safe price for a given pair, adjusting by a default offset.
Pair Actions
- Trait:
PairActionsModule
- The main trait that includes methods for adding and removing trading pairs.
Functions
add_pair(token_id: TokenIdentifier, pair_address: ManagedAddress)
- Adds a new trading pair to the contract. Requires validation of the token ID as a valid ESDT identifier and the pair address as a smart contract.
remove_pair(token_id: TokenIdentifier)
- Removes an existing trading pair based on the token ID.
Usage
- Adding a Pair: To introduce a new trading pair, the
add_pair function is used, requiring a valid ESDT token identifier and a smart contract address representing the pair.
- Removing a Pair: The
remove_pair function facilitates the removal of a trading pair from the system.
Important Notes
- Proper validation is performed in both adding and removing pairs, ensuring the integrity of the trading ecosystem within the contract.
- The
PairProxy trait suggests an abstraction layer for interacting with external data or functionalities, crucial for dynamic and real-time trading scenarios.