Skip to content

Commit

Permalink
Add 1inch partner fee
Browse files Browse the repository at this point in the history
  • Loading branch information
omurovch committed May 15, 2024
1 parent 05b8e12 commit c049b8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ dependencies {
// Wallet kits
implementation 'com.github.horizontalsystems:ton-kit-kmm:f1fd301'
implementation 'com.github.horizontalsystems:bitcoin-kit-android:80fd413'
implementation 'com.github.horizontalsystems:ethereum-kit-android:f4957a9'
implementation 'com.github.horizontalsystems:ethereum-kit-android:3d83900'
implementation 'com.github.horizontalsystems:blockchain-fee-rate-kit-android:1d3bd49'
implementation 'com.github.horizontalsystems:binance-chain-kit-android:c1509a2'
implementation 'com.github.horizontalsystems:market-kit-android:a0361bf'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ object OneInchProvider : EvmSwapProvider() {
override val url = "https://app.1inch.io/"
override val icon = R.drawable.oneinch
private val oneInchKit by lazy { OneInchKit.getInstance(App.appConfigProvider.oneInchApiKey) }
private const val PARTNER_FEE: Float = 0.3F
private const val PARTNER_ADDRESS: String = "0xe42BBeE8389548fAe35C09072065b7fEc582b590"

// TODO take evmCoinAddress from oneInchKit
private val evmCoinAddress = Address("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
Expand Down Expand Up @@ -67,7 +69,8 @@ object OneInchProvider : EvmSwapProvider() {
chain = evmBlockchainHelper.chain,
fromToken = getTokenAddress(tokenIn),
toToken = getTokenAddress(tokenOut),
amount = amountIn.scaleUp(tokenIn.decimals)
amount = amountIn.scaleUp(tokenIn.decimals),
fee = PARTNER_FEE
).onErrorResumeNext {
Single.error(it.convertedError)
}.await()
Expand Down Expand Up @@ -132,7 +135,9 @@ object OneInchProvider : EvmSwapProvider() {
amount = amountIn.scaleUp(tokenIn.decimals),
slippagePercentage = slippage.toFloat(),
recipient = settingRecipient.value?.hex?.let { Address(it) },
gasPrice = gasPrice
gasPrice = gasPrice,
referrer = PARTNER_ADDRESS,
fee = PARTNER_FEE
).await()

val swapTx = swap.transaction
Expand Down

0 comments on commit c049b8c

Please sign in to comment.