Skip to content

Fixed typos #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## JS SDK Version ChangeLog
#### v3.6.0
1) dual Invest autoReinvest
2) guardina singature typeData
2) guardina signature typeData
3) remove signature 02/03 ended

#### v3.2.1
Expand Down
4 changes: 2 additions & 2 deletions docs/js_sdk/Deposit.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Choose deposit amount from UI

```ts
const { ethBalance } = await LoopringAPI.exchangeAPI.getEthBalances({owner: accAddress});
//tokenArr is Loopring supprot ERC20 TokenId Array.jion(',')
//tokenArr is Loopring support ERC20 TokenId Array.jion(',')
const { tokenBalances } = await LoopringAPI.exchangeAPI.getTokenBalances({owner: accAddress, token: tokenArr.join()})
```
API: [/api/v3/eth/tokenBalances](https://uat2.loopring.io/api/v3/eth/tokenBalances?owner=0xfF7d59D9316EBA168837E3eF924BCDFd64b237D8&token=0xfc28028d9b1f6966fe74710653232972f50673be%2C0x0000000000000000000000000000000000000000%2C0xd4e71c4bb48850f5971ce40aa428b09f242d3e8a%2C0xcd2c81b322a5b530b5fa3432e57da6803b0317f7%2C0x47525e6a5def04c9a56706e93f54cc70c2e8f165)
Expand Down Expand Up @@ -249,7 +249,7 @@ web3.eth.sendTransaction({
const tokenSymbol = "LRC";
const fee = 0;
/* tokenSymbol is ETH, sendTransaction value should be `amount + fee` (current fee is 0)
* other tokenSymbol as LRC addresss valueC is fee (current fee is 0)
* other tokenSymbol as LRC address valueC is fee (current fee is 0)
*/
const value = tokenSymbol === "ETH"? amount + fee : fee;
const data = genExchangeData(ERC20Method.Deposit, {
Expand Down
16 changes: 8 additions & 8 deletions docs/js_sdk/erc20Trade/orderERC20.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ The parameters to call this interface are "accountId" and "market=LRC-ETH". In t

**4) Set slippage as the slippage value user configured in UI (for example 0.1%)**

**5)Caculate minCostLRC and minCostETH as below**
**5)Calculate minCostLRC and minCostETH as below**

minCostLRC = max(minTokenLRC, tradeCostLRC/maxAllowBips)
minCostETH = max(minTokenETH, tradeCostETH/maxAllowBips)

**6) Caculate the cost by considering slippage**
**6) Calculate the cost by considering slippage**

minCostLRCSlip = minCostLRC/(1-slippage)
minCostETHSlip = minCostETH/(1-slippage)


**7) Cacluate the minimum quantity user has to set**
**7) Calculate the minimum quantity user has to set**

tradeCostSellLRC = max(tradeCostSellLRC, minTokenLRC) * 1.1
tradeCostSellETH = max(tradeCostSellETH, minTokenETH) * 1.1
Here we add additonally 10% tolerance.
Here we add additionally 10% tolerance.

**8) Caculate the previous minimum token amount per calling api/v3/user/orderUserRateAmount (existing logic)**
**8) Calculate the previous minimum token amount per calling api/v3/user/orderUserRateAmount (existing logic)**

This is the threshold to distinguish small quantity trading and normal trading
We will get two values (configSellLRC and configSellETH) which are used for previous trading quantity limit (Per USD 100) caculation
We will get two values (configSellLRC and configSellETH) which are used for previous trading quantity limit (Per USD 100) calculation

**9)Caculate the new maxFeeBips and start trading**
**9)Calculate the new maxFeeBips and start trading**

Let's take LRC->ETH as the example
User inputs the amount of LRC to convert, amount = sellLRC
Expand Down Expand Up @@ -728,7 +728,7 @@ const [{depth}, {ammPoolSnapshot}] = await Promise.all([
]);
```

### Step 5. check MinAmt see log and calc mini receive and ouput value & maxfeeBips & priceImpact
### Step 5. check MinAmt see log and calc mini receive and output value & maxfeeBips & priceImpact

```ts
const { calcTradeParams, maxFeeBips, minimumReceived } = calculateSwap(
Expand Down