Skip to content

Commit

Permalink
Merge pull request #341 from EdgeApp/matthew/maya-protocol
Browse files Browse the repository at this point in the history
Add Maya Protocol
  • Loading branch information
peachbits authored Sep 20, 2024
2 parents 9cefb50 + e6e40e5 commit ba6d3ff
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 141 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- added: Add Maya Protocol
- changed: Separate thorchain and thorchainda initOptions and exchangeInfo cleaner

## 2.8.0 (2024-09-12)

- added: `minReceiveAmount` passed in `EdgeSwapQuotes` for lifi and rango
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { make0xGaslessPlugin } from './swap/defi/0x/0xGasless'
import { makeCosmosIbcPlugin } from './swap/defi/cosmosIbc'
import { makeLifiPlugin } from './swap/defi/lifi'
import { makeRangoPlugin } from './swap/defi/rango'
import { makeThorchainPlugin } from './swap/defi/thorchain'
import { makeThorchainDaPlugin } from './swap/defi/thorchainDa'
import { makeMayaProtocolPlugin } from './swap/defi/thorchain/mayaprotocol'
import { makeThorchainPlugin } from './swap/defi/thorchain/thorchain'
import { makeThorchainDaPlugin } from './swap/defi/thorchain/thorchainDa'
import { makeSpookySwapPlugin } from './swap/defi/uni-v2-based/plugins/spookySwap'
import { makeTombSwapPlugin } from './swap/defi/uni-v2-based/plugins/tombSwap'
import { makeVelodromePlugin } from './swap/defi/uni-v2-based/plugins/velodrome'
Expand All @@ -34,6 +35,7 @@ const plugins = {
sideshift: makeSideshiftPlugin,
spookySwap: makeSpookySwapPlugin,
swapuz: makeSwapuzPlugin,
mayaprotocol: makeMayaProtocolPlugin,
thorchain: makeThorchainPlugin,
thorchainda: makeThorchainDaPlugin,
tombSwap: makeTombSwapPlugin,
Expand Down
10 changes: 3 additions & 7 deletions src/swap/central/exolix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { div, gt, lt, mul } from 'biggystring'
import { gt, lt, mul } from 'biggystring'
import {
asEither,
asMaybe,
Expand All @@ -22,6 +22,7 @@ import {
SwapCurrencyError
} from 'edge-core-js/types'

import { div18 } from '../../util/biggystringplus'
import {
checkInvalidCodes,
checkWhitelistedMainnetCodes,
Expand All @@ -37,7 +38,6 @@ import {
getAddress,
memoType
} from '../../util/utils'
import { DIVIDE_PRECISION } from '../defi/thorchain'
import { asRatesResponse, EdgeSwapRequestPlugin, RatesRespose } from '../types'

const pluginId = 'exolix'
Expand Down Expand Up @@ -424,11 +424,7 @@ export function makeExolixPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin {
if (exchangeRate == null) throw new SwapCurrencyError(swapInfo, request)

const usdValue = mul(exchangeAmount, exchangeRate)
const maxExchangeAmount = div(
MAX_USD_VALUE,
exchangeRate,
DIVIDE_PRECISION
)
const maxExchangeAmount = div18(MAX_USD_VALUE, exchangeRate)
const maxNativeAmount = mul(maxExchangeAmount, denomToNative)

if (gt(usdValue, MAX_USD_VALUE)) {
Expand Down
Loading

0 comments on commit ba6d3ff

Please sign in to comment.