@exodus/ethereum-api 6.3.23 → 6.3.25

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": "@exodus/ethereum-api",
3
- "version": "6.3.23",
3
+ "version": "6.3.25",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@exodus/asset-lib": "^3.7.1",
18
18
  "@exodus/crypto": "^1.0.0-rc.0",
19
- "@exodus/ethereum-lib": "^3.3.38",
19
+ "@exodus/ethereum-lib": "^3.3.39",
20
20
  "@exodus/ethereumjs-util": "^7.1.0-exodus.6",
21
21
  "@exodus/fetch": "^1.3.0-beta.4",
22
22
  "@exodus/simple-retry": "^0.0.6",
@@ -34,5 +34,5 @@
34
34
  "devDependencies": {
35
35
  "@exodus/models": "^8.10.4"
36
36
  },
37
- "gitHead": "c4f1f8dc3c6256e839af1faf2787228c91507656"
37
+ "gitHead": "dcd7a4ef6e00b26dc92bd7d3ec6ff65a4673fcdb"
38
38
  }
@@ -9,8 +9,8 @@ const RETRY_DELAYS = ['10s']
9
9
  export class EthereumStaking {
10
10
  static addresses = {
11
11
  ethereum: {
12
- EVERSTAKE_ADDRESS_CONTRACT_ACCOUNTING: '...', // TODO
13
- EVERSTAKE_ADDRESS_CONTRACT_POOL: '...', // TODO
12
+ EVERSTAKE_ADDRESS_CONTRACT_ACCOUNTING: '0x7a7f0b3c23C23a31cFcb0c44709be70d4D545c6e',
13
+ EVERSTAKE_ADDRESS_CONTRACT_POOL: '0xD523794C879D9eC028960a231F866758e405bE34',
14
14
  },
15
15
  ethereumgoerli: {
16
16
  EVERSTAKE_ADDRESS_CONTRACT_ACCOUNTING: '0x6e95818C2Dde3d87406F5C5d0A759d9372053a94',
@@ -19,8 +19,8 @@ export class EthereumStaking {
19
19
  }
20
20
  static METHODS_IDS = {
21
21
  DELEGATE: '0x3a29dbae', // stake(uint256 source)
22
- UNSTAKE: '0x215f826b', // unstake(uint256 amount)
23
- UNSTAKE_PENDING: '0x33986ffa', // unstakePending(uint256 amount)
22
+ UNSTAKE: '0x76ec871c', // unstake(uint256 amount)
23
+ UNSTAKE_PENDING: '0xed0723d4', // unstakePending(uint256 amount)
24
24
  }
25
25
 
26
26
  constructor(
@@ -142,7 +142,7 @@ export class EthereumStaking {
142
142
  }
143
143
  }
144
144
 
145
- async unstake({ address, amount, isAllowedInterchange = false, source = '2' }) {
145
+ async unstake({ address, amount, allowedInterchangeNum = 0, source = '2' }) {
146
146
  const amountWei = amount.toBaseString()
147
147
  const balance = await this.autocompoundBalanceOf(address)
148
148
 
@@ -151,7 +151,7 @@ export class EthereumStaking {
151
151
  to: this.poolAddress,
152
152
  amount: this.asset.currency.ZERO,
153
153
  data: bufferToHex(
154
- this.buildTxData(this.contractPool, 'unstake', amountWei, isAllowedInterchange, source)
154
+ this.buildTxData(this.contractPool, 'unstake', amountWei, allowedInterchangeNum, source)
155
155
  ),
156
156
  }
157
157
  } else {
@@ -56,6 +56,14 @@ export function createEthereumStakingService({
56
56
  let txId
57
57
  if (!pendingAmount.isZero) {
58
58
  const inactiveAmountToUnstake = pendingAmount.lte(amount) ? pendingAmount : amount
59
+ const leftOver = pendingAmount.sub(amount)
60
+ if (leftOver.gt(asset.currency.ZERO)) {
61
+ const minStake = staking.minAmount
62
+ if (leftOver.lt(minStake)) {
63
+ throw new Error(`Pending balance less than min stake amount ${minStake}`)
64
+ }
65
+ }
66
+
59
67
  const { to, data } = await staking.unstakePending({
60
68
  address: delegatorAddress,
61
69
  amount: inactiveAmountToUnstake,