-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1043 from madfish-solutions/v3.1.37
V3.1.37
- Loading branch information
Showing
75 changed files
with
960 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Output field calculated', () => { | ||
beforeEach(() => { | ||
cy.visit('/coinflip'); | ||
cy.get('[data-test-id="acceptCookieButton"]').click(); | ||
}); | ||
it('Should_DisplayTitile_When_OpenedCoinflipPage', () => { | ||
cy.get('[id="coinflip-form-amount"]').click().type('1'); | ||
cy.waitUntil(() => (cy.get('[id="coinflip-form-payout"]') | ||
.invoke('val').then(parseFloat).then((val) => !Number.isNaN(val)))) | ||
cy.get('[id="coinflip-form-payout"]') | ||
.invoke('val').then(parseFloat).then((prevValue) => { | ||
cy.get('[data-test-id="coinflipPayoutCoefficient"] [data-test-id="amount"]') | ||
.invoke('text').then(parseFloat).should('eq', prevValue) | ||
}) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import { cssTransition } from "react-toastify"; | ||
|
||
describe('Form exists', () => { | ||
beforeEach(() => { | ||
cy.visit('/coinflip'); | ||
cy.get('[data-test-id="acceptCookieButton"]').click(); | ||
}); | ||
it('Should_DisplayTitile_When_OpenedCoinflipPage', () => { | ||
cy.get('[data-test-id="coinflipPageTitle"]').should('contain', 'Game'); | ||
}); | ||
it('Should_Have_WalletInfoSection_When_PageIsLoaded', () => { | ||
cy.get('[data-test-id="coinflipHereCanBeYourReward"]').should('contain', 'Here can be your reward'); | ||
}); | ||
it('Should_Have_TokenSelectSection_When_PageIsLoaded', () => { | ||
cy.get('[data-test-id="CoinflipTokenSelector"]').should('contain', 'Select Token to Play with'); | ||
}); | ||
it('Should_Have_SideSelectSection_When_PageIsLoaded', () => { | ||
cy.get('[data-test-id="coinflipDetails"]').should('contain', 'Select your side of coin'); | ||
}); | ||
it('Should_HaveGameInfoSection_When_PageIsLoaded', () => { | ||
cy.get('[data-test-id="coinflipRules"] [data-test-id="headerContent"]') | ||
.should('contain', 'Play Coinflip - get a chance to double your bid!') | ||
}) | ||
it('Should_Have_TotalWinsGteThan2900_When_PageIsLoaded', () =>{ | ||
cy.waitUntil(() => (cy.get('[data-test-id="coinflipTotalWins"] [data-test-id="amount"]') | ||
.invoke('text').then(parseFloat).then((val) => !Number.isNaN(val)))) | ||
cy.get('[data-test-id="coinflipTotalWins"] [data-test-id="amount"]') | ||
.invoke('text').then(parseInt).should('gte', 2) | ||
}); | ||
it('Should_Have_GameCountGteThan473_When_PageIsLoaded', () =>{ | ||
cy.get('[data-test-id="coinflipGamesCount"] [data-test-id="amount"]') | ||
.invoke('text').then(parseFloat).should('gte', 473) | ||
}); | ||
it('Should_Have_MaxBetGteThan0_When_PageIsLoaded', () =>{ | ||
cy.get('[data-test-id="coinflipMaxAllowableBid"] [data-test-id="amount"]') | ||
.invoke('text').then(parseFloat).should('gte', 0) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('User can choose token and side', () => { | ||
beforeEach(() => { | ||
cy.visit('/coinflip'); | ||
cy.get('[data-test-id="acceptCookieButton"]').click(); | ||
}); | ||
it('Should_SelectTezToken_When_ClickingOnIt', () => { | ||
cy.get('[data-test-id="XTZ"]').click(); | ||
cy.get('[data-test-id="tokensSymbols"]').should('contain', 'TEZ') | ||
cy.get('[data-test-id="rightVisibleCurrency"]').should('contain', 'XTZ') | ||
}); | ||
it('Should_SelectQuipuToken_When_ClickingOnIt', () => { | ||
cy.get('[data-test-id="QUIPU"]').click(); | ||
cy.get('[data-test-id="tokensSymbols"]').should('contain', 'QUIPU') | ||
cy.get('[data-test-id="rightVisibleCurrency"]').should('contain', 'QUIPU') | ||
}); | ||
it('Should_SelectHead_When_ClickingOnIt', () => { | ||
cy.get('[data-test-id="coinflipHeadButton"]').click(); | ||
cy.get('[data-test-id="coinflipHeadButton"]').should('contain', 'Head') | ||
}); | ||
it('Should_UnselectHead_When_UnselectingIt', () =>{ | ||
cy.get('[data-test-id="coinflipHeadButton"]').click(); | ||
cy.get('[data-test-id="coinflipHeadButton"]').click(); | ||
cy.get('[data-test-id="coinflipHeadButton"]').should('contain', '') | ||
}); | ||
it('Should_SelectTail_When_ClickingOnIt', () => { | ||
cy.get('[data-test-id="coinflipTailButton"]').click(); | ||
cy.get('[data-test-id="coinflipTailButton"]').should('contain', 'Tail') | ||
}); | ||
it('Should_UnselectTail_When_UnselectingIt', () =>{ | ||
cy.get('[data-test-id="coinflipTailButton"]').click(); | ||
cy.get('[data-test-id="coinflipTailButton"]').click(); | ||
cy.get('[data-test-id="coinflipTailButton"]').should('contain', '') | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Tooltips in the card', () => { | ||
it('Should_DisplayTooltips_When_HoweringMouseOver', () => { | ||
cy.visit('/coinflip'); | ||
cy.get('[data-test-id="acceptCookieButton"]').click(); | ||
|
||
cy.get('[data-test-id="coinflipPayoutCoefficient"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-1"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipBank"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-2"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipTotalWins"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-3"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipGamesCount"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-4"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipGameId"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-5"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipBetSize"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-6"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipRewardSize"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-7"]').should('be.visible'); | ||
|
||
cy.get('[data-test-id="coinflipGameResult"] [data-test-id="tooltip"]').trigger('focus'); | ||
cy.get('[aria-describedby="tippy-8"]').should('be.visible'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './get-new-liquidity-list.api'; | ||
export * from './get-new-liquidity-stats.api'; | ||
export * from './add-dex-two-liquidity.api'; | ||
export * from './remove-dex-two-liquidity.api'; | ||
export * from './create-new-liquidity-pool.api'; |
31 changes: 31 additions & 0 deletions
31
src/modules/new-liquidity/api/remove-dex-two-liquidity.api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { TezosToolkit } from '@taquito/taquito'; | ||
import { BigNumber } from 'bignumber.js'; | ||
|
||
import { sendBatch } from '@blockchain'; | ||
import { ZERO_BAKER_ADDRESS } from '@config/constants'; | ||
import { DEX_TWO_CONTRACT_ADDRESS } from '@config/environment'; | ||
import { AmountToken } from '@shared/types'; | ||
|
||
export const removeDexTwoLiquidityApi = async ( | ||
tezos: TezosToolkit, | ||
shares: BigNumber, | ||
tokensAndAmounts: Array<AmountToken>, | ||
deadline: string, | ||
accountPkh: string, | ||
candidate: string, | ||
itemId: BigNumber | ||
) => { | ||
if (!candidate) { | ||
candidate = ZERO_BAKER_ADDRESS; | ||
} | ||
|
||
const dexTwoContract = await tezos.wallet.at(DEX_TWO_CONTRACT_ADDRESS); | ||
|
||
const [tokenA, tokenB] = tokensAndAmounts; | ||
|
||
const dexTwoLiquidityParams = dexTwoContract.methods | ||
.divest_liquidity(itemId, tokenA.amount, tokenB.amount, shares, accountPkh, candidate, deadline) | ||
.toTransferParams(); | ||
|
||
return await sendBatch(tezos, [dexTwoLiquidityParams]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import BigNumber from 'bignumber.js'; | ||
|
||
import { isTezosToken } from '@shared/helpers'; | ||
import { AmountToken } from '@shared/types'; | ||
|
||
const ZERO_BN = new BigNumber('0'); | ||
|
||
export const getTezValue = (tokensAndAmounts: Array<AmountToken>) => { | ||
return tokensAndAmounts.find(item => isTezosToken(item.token))?.amount ?? ZERO_BN; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import BigNumber from 'bignumber.js'; | ||
|
||
import { PERCENTAGE_100 } from '@config/constants'; | ||
|
||
export const getValueWithFee = (value: BigNumber, fee: BigNumber.Value) => { | ||
const percentFee = new BigNumber(fee).multipliedBy(PERCENTAGE_100); | ||
|
||
return value.multipliedBy(PERCENTAGE_100.minus(percentFee)).dividedBy(PERCENTAGE_100); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './is-hot-pool.helper'; | ||
export * from './is-hot-pool'; | ||
export * from './get-value-with-fee'; | ||
export * from './get-tez-value'; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './use-add-liquidity'; | ||
export * from './use-remove-liquidity'; |
Oops, something went wrong.