What it offers
- closeTradeMarket: Close an open trade at market price
- updateStopLoss: Update stop loss on an open trade
- updateTakeProfit: Update take profit on an open trade
Notes
- Up to 1000x leverage on forex, 250x on crypto
- Diamond proxy pattern - single contract for all operations
- pairIndex identifies the trading pair (0=BTC/USD, 1=ETH/USD, etc.)
- index identifies one of the trader’s trades (a trader can have several)
- openTrade uses complex tuple param for trade parameters
- These are the multi-collateral Diamond’s (v8+) signatures. A trade is addressed by the trader’s own
index(their Nth trade), not by(pairIndex, index).
Its names in a program
On Polygon,GainsNetwork is a namespace: its contracts need no import.
Deployments
ABI
DiamondABI
import DiamondABI from "./protocols/gains-network/DiamondABI.json"; Speaks for: diamond.
openTrade((address user, uint32 index, uint16 pairIndex, uint24 leverage, bool long, bool isOpen, uint8 collateralIndex, uint8 tradeType, uint120 collateralAmount, uint64 openPrice, uint64 tp, uint64 sl, bool isCounterTrade, uint160 positionSizeToken, uint24 __placeholder) trade, uint16 maxSlippageP, address referrer)closeTradeMarket(uint32 index, uint64 expectedPrice)updateSl(uint32 index, uint64 newSl)updateTp(uint32 index, uint64 newTp)
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
