TradeShield is a repository hosting a smart contract for implementing stop loss and limit sell functionalities on the Elys Network blockchain. This repository provides a robust and customizable solution for integrating advanced risk management mechanisms into decentralized applications.
The docs
folder in this repository contains detailed specifications for implementing stop loss and limit sell functionalities using the TradeShield smart contract. It includes comprehensive documentation and guidelines to assist developers in understanding and utilizing these features effectively.
TradeShield smart contracts are built using the CosmWasm framework, which provides a secure and efficient environment for executing WebAssembly-based smart contracts. These contracts are specifically designed for compatibility with Cosmos SDK 0.47 and the Elys Cosmos Modules.
A spot order is fulfilled when the specified price set by the trader aligns with the prevailing market price, prompting the immediate execution of the purchase or sale of a financial asset.
- Stop Loss Functionality: Enable users to set automated orders that trigger when the asset's price reaches a specified lower limit, minimizing potential losses.
- Limit Sell Functionality: Allow users to set automated orders that execute when the asset's price reaches a specified upper limit, securing profits.
- Limit Buy Fuctionality: Allow users to set automated orders that execute when the limit price is reaches, securing profits.
- Market Buy Fuctionality: Allow users to set automated orders that will execute at market price
A margin order involves trading an asset using funds provided by a third party. It allows users to trade larger positions with a smaller initial capital outlay.
- Stop Loss Functionality: Enable users to set automated orders that trigger when the asset's price reaches a specified lower limit, minimizing potential losses.
- Limit Sell Functionality: Allow users to set automated orders that execute when the asset's price reaches a specified upper limit, securing profits.
- Limit Buy Fuctionality: Allow users to set automated orders that execute when the limit price is reaches, securing profits.
- Market Buy Fuctionality: Allow users to set automated orders that will execute at market price
To start using TradeShield, follow these steps:
- Clone this repository to your local development environment.
- Navigate to the
docs
folder to access the detailed specifications and guidelines for implementing stop loss and limit sell functionalities. - Ensure you have the required dependencies, including the CosmWasm framework, Cosmos SDK 0.47, and the Elys Cosmos Modules.
- Review the example implementations provided in the repository to understand the integration process.
- Customize and deploy the TradeShield smart contracts according to your specific project requirements.
-
Install Ignite CLI Begin by installing the Ignite CLI tool by following the instructions provided in the Ignite CLI documentation.
-
Clone the Elys Repository Clone the Elys repository from GitHub and carefully follow the installation instructions provided.
-
Modify
config.yml
Within the Elys repository, navigate to the root directory and locate theconfig.yml
file. Modify the following lines:
- Change the
contract_addresses
value (line 38) to["elys14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s3fsthx"]
. - Modify the
broker_address
(line 439) to"elys14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s3fsthx"
.
- Start Ignite Node Open a separate terminal within the Elys repository and run the command:
ignite chain serve -r
Optionally, use -v
to display the node logs.
-
Download the Contract Download the desired version of the contract from the contract repository.
-
Store Contract on Chain Run the following command to store the contract on the chain:
elysd tx wasm store path/to/account_history_contract.wasm --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --gas=auto --gas-adjustment=1.3 -y -b=sync
Ensure to replace path/to/account_history_contract.wasm
with the actual path to the downloaded contract.
- Instantiate Contract Execute the command below to instantiate the contract on the Elys network:
elysd tx wasm instantiate 1 '{}' --from=treasury --label "Contract" --chain-id=elystestnet-1 --gas=auto --gas-adjustment=1.3 -b=sync --keyring-backend=test --no-admin -y
We welcome contributions from the community to enhance TradeShield's functionality and usability. If you would like to contribute, please follow the guidelines outlined in the CONTRIBUTING.md
file.
TradeShield is released under the Apache License. You are free to use, modify, and distribute this software as per the terms of the license.
If you encounter any issues, bugs, or have any suggestions for improvement, please open an issue on the Issue Tracker. We appreciate your feedback and will address the concerns as soon as possible.