h-agent-swap 1.9.0 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h-agent-swap",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "agent-swap",
5
5
  "main": "src/index.js",
6
6
  "files": [
package/src/agent-swap.js CHANGED
@@ -151,7 +151,7 @@ class AgentSwap extends HI {
151
151
 
152
152
 
153
153
 
154
- async updateConfig({ tokenIn,tokenOut,config,tax }) {
154
+ async updateConfig({ tokenIn,tokenOut,config,tax,usdt = '' }) {
155
155
 
156
156
  config.feeRate = multiplication(division(config.feeRate,100),this.pointMax)
157
157
  config.reward = multiplication(division(config.reward,100),this.pointMax)
@@ -165,7 +165,7 @@ class AgentSwap extends HI {
165
165
  tax.tax = multiplication(division(tax.tax,100),this.pointMax)
166
166
  tax.backBuy = multiplication(division(tax.backBuy,100),this.pointMax)
167
167
 
168
- let symbol = new HERC20({ ...this.network, contract: tokenOut })
168
+ let symbol = new HERC20({ ...this.network, contract: usdt ? usdt : tokenOut })
169
169
  config.price = await symbol.toAmount(config.price)
170
170
 
171
171
  let params = [
@@ -223,10 +223,10 @@ class AgentSwap extends HI {
223
223
  }
224
224
 
225
225
 
226
- async getConfig({ tokenIn,tokenOut }) {
226
+ async getConfig({ tokenIn,tokenOut,usdt = '' }) {
227
227
  let result1 = await this.SC.methods.runConfig(tokenIn,tokenOut).call()
228
228
  let result2 = await this.SC.methods.taxConfig(tokenIn,tokenOut).call()
229
- let outToken = new HERC20({ ...this.network, contract: tokenOut })
229
+ let usdtToken = new HERC20({ ...this.network, contract: usdt ? usdt : tokenOut })
230
230
  let result = {
231
231
  ...result1,
232
232
  ...result2
@@ -237,7 +237,7 @@ class AgentSwap extends HI {
237
237
  result.feeMin = multiplication(division(result.feeMin,this.pointMax),100)
238
238
  result.feeRate = multiplication(division(result.feeRate,this.pointMax),100)
239
239
  result.range = multiplication(division(result.range,this.pointMax),100)
240
- result.price = await outToken.fromAmount(result.price)
240
+ result.price = await usdtToken.fromAmount(result.price)
241
241
  result.reward = multiplication(division(result.reward,this.pointMax),100)
242
242
 
243
243
  result.rewardMax = multiplication(division(result.rewardMax,this.pointMax),100)