Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jellyfish-api-core, jellyfish-transaction-builder): Fix failed tests for fortcanningcrunch #1461

Merged
merged 77 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
eb0044a
Change to the latest docker image
May 12, 2022
d7d6bd5
Fix fail test
May 12, 2022
2b5a299
Update masternode doc
May 12, 2022
3db64d2
Add collateralTx
May 12, 2022
9715794
Update docs
May 12, 2022
6a04759
Update test
May 12, 2022
7688ecf
Fix failed tests
May 12, 2022
f673c6d
Fix failed tests
May 12, 2022
daf5aa5
Fix failed tests
May 12, 2022
5f22665
Fix failed tests
May 12, 2022
75ef967
Fix failed tests
May 12, 2022
cf5e863
Temporarily comment out failed test
May 12, 2022
1cb4ed7
Minor
May 12, 2022
85b659e
Add back commented code
May 13, 2022
20e991a
Merge branch 'main' into jimmy/rpc-updatemasternode
jingyi2811 May 13, 2022
06f3552
Fix failed test
jingyi2811 May 13, 2022
51bde58
Merge remote-tracking branch 'origin/main' into jimmy/v3-fix-failed-t…
jingyi2811 May 17, 2022
19c304c
Fixed withdrawFutureSwap failing tests.
surangap May 18, 2022
ebea81e
Fix block length
jingyi2811 May 19, 2022
8adb8be
Minor
jingyi2811 May 19, 2022
a5c7967
Minor
jingyi2811 May 19, 2022
e21fefc
Minor
jingyi2811 May 19, 2022
503fa08
Merge remote-tracking branch 'origin/main' into jimmy/v3-fix-failed-t…
jingyi2811 May 19, 2022
17cdd49
Fix failed test
jingyi2811 May 19, 2022
f745160
Fix failed test
jingyi2811 May 19, 2022
83eb8e5
Fix failed test
jingyi2811 May 19, 2022
6b51a53
Fix failed test
jingyi2811 May 19, 2022
bdec7b0
Updated to V3 latest image.
surangap May 20, 2022
84f315a
Updated image to stock-splits only.
surangap May 23, 2022
d38aad5
Fixed placeAuctionBid.test.ts failing tests with stock-splits.
surangap May 23, 2022
ee97164
Fixed withdrawFutureSwap.test.ts failing tests with stock-splits.
surangap May 23, 2022
5d23200
Updated image to latest fortcanningspicegardenheight.
surangap May 23, 2022
fc8c8db
Fixed failing tests.
surangap May 23, 2022
b53d5ec
Updated image to latest master.
surangap May 23, 2022
38f19da
Update packages/testcontainers/src/containers/RegTestContainer/index.ts
surangap May 24, 2022
4998416
Merge branch 'surangap/token-splits-port' of https://github.com/Jelly…
jingyi2811 May 24, 2022
e965ad1
Update docker image
jingyi2811 May 24, 2022
ed52cca
Merge remote-tracking branch 'origin/main' into surangap/token-splits…
jingyi2811 May 24, 2022
a15897c
Fix failed tests
jingyi2811 May 24, 2022
6c09f2f
fix pg setgov
canonbrother May 24, 2022
4406d65
Fix failed tests
jingyi2811 May 24, 2022
3837259
Merge remote-tracking branch 'origin/surangap/token-splits-port' into…
jingyi2811 May 24, 2022
f64baa8
Fix failed tests
jingyi2811 May 24, 2022
f55709f
Don't use v3 code, revert to old code
jingyi2811 May 24, 2022
847c489
Remove activateAfterBlock test unit and defaulted the value to 0 for …
jingyi2811 May 24, 2022
8a47bd2
Connect to the latest docker image
jingyi2811 May 24, 2022
4bb353b
Fix failed test
jingyi2811 May 24, 2022
c87b248
Skip on-chain governance code
jingyi2811 May 24, 2022
07ba8dc
Skip on-chain governance code
jingyi2811 May 24, 2022
6029be0
Connect to latest docker image
jingyi2811 May 24, 2022
28536b3
Fix failed test
jingyi2811 May 24, 2022
32faa4b
Fix failed test
jingyi2811 May 24, 2022
c968812
Fix failed test
jingyi2811 May 24, 2022
6f190ff
Connect to latest docker image
jingyi2811 May 24, 2022
557a536
add missing doc - poolpair dexfee
canonbrother May 25, 2022
3d4dba7
Fix bad code after which is the result of "eslint --fix"
jingyi2811 May 25, 2022
b2af44d
Fix bad code after which is the result of "eslint --fix"
jingyi2811 May 25, 2022
a30627d
Merge remote-tracking branch 'origin/surangap/token-splits-port' into…
jingyi2811 May 25, 2022
8088039
Remove redundant now function.
jingyi2811 May 25, 2022
8bc8aa4
Use skip instead
jingyi2811 May 25, 2022
18eebf7
Fix flaky test. (Retrieve date from a global variable)
jingyi2811 May 25, 2022
a59843e
Change variable name from currentTimestamp to now. (Which is the comm…
jingyi2811 May 25, 2022
ba08ffa
Use unique date for this test only
jingyi2811 May 25, 2022
6de7692
Set unique date for different oracle data
jingyi2811 May 25, 2022
0d11f0f
Fix flaky test
jingyi2811 May 25, 2022
555a74b
Temporarily skip this
jingyi2811 May 25, 2022
45806a5
Skip the entire describe
jingyi2811 May 25, 2022
e820f12
Skip and add comments
jingyi2811 May 26, 2022
b5cca7b
Fix wrong description
jingyi2811 May 26, 2022
533e273
Improve code
jingyi2811 May 26, 2022
734ef85
Revert back code
jingyi2811 May 26, 2022
b979707
Reverted changes to placeAuctionBid.test.ts file.
surangap May 26, 2022
4734b54
Temporarily skip flaky test
jingyi2811 May 26, 2022
f0c92e2
Updated to latest master image.
surangap May 27, 2022
00b1024
Updated to latest master image.
surangap May 27, 2022
17c9f59
Merge branch 'main' into surangap/token-splits-port
surangap May 30, 2022
20d2fc4
Updated the image to FCC.
surangap May 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 53 additions & 3 deletions apps/playground-api/__tests__/modules/PlaygroundModule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,81 @@ it('should have gov set', async () => {
const gov = await testing.container.call('getgov', ['ATTRIBUTES'])
expect(gov).toStrictEqual({
ATTRIBUTES: expect.objectContaining({
'v0/params/dfip2203/active': 'true',
'v0/params/dfip2203/reward_pct': '0.05',
'v0/params/dfip2203/block_period': '20',
'v0/token/0/fixed_interval_price_id': 'DFI/USD',
'v0/token/0/loan_collateral_enabled': 'true',
'v0/token/0/loan_collateral_factor': '1',
'v0/token/1/fixed_interval_price_id': 'BTC/USD',
'v0/token/1/loan_collateral_enabled': 'true',
'v0/token/1/loan_collateral_factor': '1',
'v0/token/2/fixed_interval_price_id': 'ETH/USD',
'v0/token/2/loan_collateral_enabled': 'true',
'v0/token/2/loan_collateral_factor': '0.7',
'v0/token/3/fixed_interval_price_id': 'USDT/USD',
'v0/token/3/loan_collateral_enabled': 'true',
'v0/token/3/loan_collateral_factor': '1',
'v0/token/5/fixed_interval_price_id': 'USDC/USD',
'v0/token/5/loan_collateral_enabled': 'true',
'v0/token/5/loan_collateral_factor': '1',
'v0/token/6/fixed_interval_price_id': 'CU10/USD',
'v0/token/6/loan_collateral_enabled': 'true',
'v0/token/6/loan_collateral_factor': '1',
'v0/token/7/fixed_interval_price_id': 'CD10/USD',
'v0/token/7/loan_collateral_enabled': 'true',
'v0/token/7/loan_collateral_factor': '1',
'v0/token/8/fixed_interval_price_id': 'CS25/USD',
'v0/token/8/loan_collateral_enabled': 'true',
'v0/token/8/loan_collateral_factor': '1',
'v0/token/9/fixed_interval_price_id': 'CR50/USD',
'v0/token/9/loan_collateral_enabled': 'true',
'v0/token/9/loan_collateral_factor': '1',
'v0/token/10/fixed_interval_price_id': 'ZERO/USD',
'v0/token/10/loan_collateral_enabled': 'true',
'v0/token/10/loan_collateral_factor': '1',
'v0/token/11/fixed_interval_price_id': 'OFF/USD',
'v0/token/11/loan_collateral_enabled': 'true',
'v0/token/11/loan_collateral_factor': '1',
'v0/token/12/payback_dfi': 'true',
'v0/token/12/payback_dfi_fee_pct': '0.01',
'v0/token/12/loan_payback/1': 'true',
'v0/token/12/loan_payback/14': 'true',
'v0/token/12/loan_payback_fee_pct/1': '0.01',
'v0/token/12/loan_payback_fee_pct/14': '0.01',
'v0/token/12/fixed_interval_price_id': 'DUSD/USD',
'v0/token/12/loan_collateral_enabled': 'true',
'v0/token/12/loan_collateral_factor': '0.99',
'v0/token/12/loan_minting_enabled': 'true',
'v0/token/12/loan_minting_interest': '0',
'v0/token/13/loan_payback/6': 'true',
'v0/token/13/loan_payback/12': 'true',
'v0/token/13/loan_payback_fee_pct/6': '0.01',
'v0/token/13/loan_payback_fee_pct/12': '0.01',
'v0/token/13/fixed_interval_price_id': 'TU10/USD',
'v0/token/13/loan_minting_enabled': 'true',
'v0/token/13/loan_minting_interest': '1',
'v0/token/14/loan_payback/1': 'true',
'v0/token/14/loan_payback/12': 'true',
'v0/token/14/loan_payback_fee_pct/1': '0.01',
'v0/token/14/loan_payback_fee_pct/12': '0.01',
'v0/token/14/fixed_interval_price_id': 'TD10/USD',
'v0/token/14/loan_minting_enabled': 'true',
'v0/token/14/loan_minting_interest': '1.5',
'v0/token/15/loan_payback/13': 'true',
'v0/token/15/loan_payback_fee_pct/13': '0.01',
'v0/token/15/fixed_interval_price_id': 'TS25/USD',
'v0/token/15/loan_minting_enabled': 'true',
'v0/token/15/loan_minting_interest': '2',
'v0/token/16/payback_dfi': 'true',
'v0/token/16/payback_dfi_fee_pct': '0.01',
'v0/token/16/loan_payback/12': 'true',
'v0/token/16/loan_payback/14': 'true',
'v0/token/16/loan_payback_fee_pct/12': '0.01',
'v0/token/16/loan_payback_fee_pct/14': '0.01',
'v0/params/dfip2203/active': 'true',
'v0/params/dfip2203/reward_pct': '0.05',
'v0/params/dfip2203/block_period': '20'
'v0/token/16/fixed_interval_price_id': 'TR50/USD',
'v0/token/16/loan_minting_enabled': 'true',
'v0/token/16/loan_minting_interest': '3'
})
})

Expand Down
4 changes: 0 additions & 4 deletions apps/playground-api/src/setups/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export abstract class PlaygroundSetup<Each> {
await this.before(list)

for (const each of list) {
if (await this.has(each)) {
jingyi2811 marked this conversation as resolved.
Show resolved Hide resolved
continue
}

await this.create(each)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const container = new LoanMasterNodeRegTestContainer()
let app: NestFastifyApplication
let controller: LoanController

let collateralTokenId1: string

beforeAll(async () => {
await container.start()
await container.waitForWalletCoinbaseMaturity()
Expand Down Expand Up @@ -68,7 +66,7 @@ beforeAll(async () => {
})
await testing.generate(1)

collateralTokenId1 = await testing.rpc.loan.setCollateralToken({
await testing.rpc.loan.setCollateralToken({
token: 'AAPL',
factor: new BigNumber(0.1),
fixedIntervalPriceId: 'AAPL/USD'
Expand Down Expand Up @@ -109,7 +107,6 @@ describe('list', () => {
tokenId: expect.any(String),
fixedIntervalPriceId: expect.any(String),
factor: expect.any(String),
activateAfterBlock: expect.any(Number),
token: {
collateralAddress: expect.any(String),
creation: {
Expand Down Expand Up @@ -175,10 +172,9 @@ describe('get', () => {
const data = await controller.getCollateral('AAPL')
expect(data).toStrictEqual(
{
tokenId: collateralTokenId1,
tokenId: expect.stringMatching(/[0-f]{64}/),
fixedIntervalPriceId: 'AAPL/USD',
factor: '0.1',
activateAfterBlock: 108,
token: {
collateralAddress: expect.any(String),
creation: {
Expand Down
1 change: 0 additions & 1 deletion apps/whale-api/src/module.api/loan.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ export class LoanController {
tokenId: detail.tokenId,
token: mapTokenData(id, tokenInfo),
factor: detail.factor.toFixed(),
activateAfterBlock: detail.activateAfterBlock.toNumber(),
fixedIntervalPriceId: detail.fixedIntervalPriceId,
activePrice: await this.getActivePrice(detail.fixedIntervalPriceId)
}
Expand Down
26 changes: 19 additions & 7 deletions docs/node/CATEGORIES/06-poolpair.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,29 @@ interface PoolPairsResult {
interface PoolPairInfo {
symbol: string
name: string
status: string
status: boolean
idTokenA: string
idTokenB: string
dexFeePctTokenA?: BigNumber
dexFeeInPctTokenA?: BigNumber
dexFeeOutPctTokenA?: BigNumber
dexFeePctTokenB?: BigNumber
dexFeeInPctTokenB?: BigNumber
dexFeeOutPctTokenB?: BigNumber
reserveA: BigNumber
reserveB: BigNumber
commission: BigNumber
totalLiquidity: BigNumber
'reserveA/reserveB': BigNumber
'reserveB/reserveA': BigNumber
'reserveA/reserveB': BigNumber | string
'reserveB/reserveA': BigNumber | string
tradeEnabled: boolean
ownerAddress: string
blockCommissionA: BigNumber
blockCommissionB: BigNumber
rewardPct: BigNumber
customRewards?: string[]
creationTx: string
creationHeight: number
creationHeight: BigNumber
}

interface PoolPairPagination {
Expand Down Expand Up @@ -81,20 +87,26 @@ interface PoolPairInfo {
status: boolean
idTokenA: string
idTokenB: string
dexFeePctTokenA?: BigNumber
dexFeeInPctTokenA?: BigNumber
dexFeeOutPctTokenA?: BigNumber
dexFeePctTokenB?: BigNumber
dexFeeInPctTokenB?: BigNumber
dexFeeOutPctTokenB?: BigNumber
reserveA: BigNumber
reserveB: BigNumber
commission: BigNumber
totalLiquidity: BigNumber
'reserveA/reserveB': BigNumber
'reserveB/reserveA': BigNumber
'reserveA/reserveB': BigNumber | string
'reserveB/reserveA': BigNumber | string
tradeEnabled: boolean
ownerAddress: string
blockCommissionA: BigNumber
blockCommissionB: BigNumber
rewardPct: BigNumber
customRewards?: string[]
creationTx: string
creationHeight: number
creationHeight: BigNumber
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/node/CATEGORIES/08-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ enum DfTxType {
interface AccountHistory {
owner: string
blockHeight: number
blockHash: string
blockTime: number
blockHash?: string
blockTime?: number
type: string
txn: number
txid: string
Expand Down Expand Up @@ -254,8 +254,8 @@ interface account {
interface AccountHistory {
owner: string
blockHeight: number
blockHash: string
blockTime: number
blockHash?: string
blockTime?: number
type: string
txn: number
txid: string
Expand Down
14 changes: 10 additions & 4 deletions docs/node/CATEGORIES/11-masternode.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,19 @@ interface MasternodePagination {
interface MasternodeInfo {
ownerAuthAddress: string
operatorAuthAddress: string
rewardAddress: string
creationHeight: number
resignHeight: number
resignTx: string
banHeight: number
banTx: string
collateralTx: string
state: MasternodeState
mintedBlocks: number
ownerIsMine: boolean
operatorIsMine: boolean
localMasternode: boolean
targetMultiplier?: number
targetMultipliers?: number[]
timelock?: number
}

interface MasternodeResult<T> {
Expand Down Expand Up @@ -118,16 +121,19 @@ enum MasternodeState {
interface MasternodeInfo {
ownerAuthAddress: string
operatorAuthAddress: string
rewardAddress: string
creationHeight: number
resignHeight: number
resignTx: string
banHeight: number
banTx: string
collateralTx: string
state: MasternodeState
mintedBlocks: number
ownerIsMine: boolean
operatorIsMine: boolean
localMasternode: boolean
targetMultiplier?: number
targetMultipliers?: number[]
timelock?: number
}

interface MasternodeResult<T> {
Expand Down
7 changes: 1 addition & 6 deletions docs/node/CATEGORIES/16-loan.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ List collateral tokens.

```ts title="client.loan.listCollateralTokens()"
interface loan {
listCollateralTokens (collateralToken: ListCollateralTokens = {}): Promise<CollateralTokenDetail[]>
}

interface ListCollateralTokens {
height?: number
all?: boolean
listCollateralTokens (): Promise<CollateralTokenDetail[]>
}

interface CollateralTokenDetail {
Expand Down
7 changes: 6 additions & 1 deletion docs/ocean/REFERENCES/poolpairs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ await api.poolpairs.list()
"displaySymbol": "dBTC",
"id": "2",
"reserve": "3755.6649905",
"blockCommission": "0"
"blockCommission": "0",
"fee": {
"pct": "0.001",
"inPct": "0.001",
"outPct": "0.001",
}
},
"tokenB": {
"symbol": "DFI",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ describe('Account', () => {
const accounts: Array<AccountResult<AccountOwner, string>> = await testing.rpc.account.listAccounts()

const { owner } = accounts[0]
const { hex, addresses } = owner
const { hex } = owner

const accountHistories = await testing.rpc.account.listAccountHistory(hex)

const referenceHistory = accountHistories[0]

const history = await testing.rpc.account.getAccountHistory(hex, referenceHistory.blockHeight, referenceHistory.txn)
expect(history.owner).toStrictEqual(referenceHistory.owner)
expect(history.blockHeight).toStrictEqual(referenceHistory.blockHeight)
expect(history.txn).toStrictEqual(referenceHistory.txn)
expect(history.txid).toStrictEqual(referenceHistory.txid)
expect(history.type).toStrictEqual(referenceHistory.type)
expect(history.blockHash).toStrictEqual(referenceHistory.blockHash)
jingyi2811 marked this conversation as resolved.
Show resolved Hide resolved
expect(history.blockTime).toStrictEqual(referenceHistory.blockTime)
expect(history.amounts).toStrictEqual(referenceHistory.amounts)
expect(addresses.includes(history.owner)).toStrictEqual(true)
expect(history).toStrictEqual(
{
owner: referenceHistory.owner,
blockHeight: referenceHistory.blockHeight,
blockHash: expect.stringMatching(/[0-f]{64}/),
blockTime: expect.any(Number),
txn: referenceHistory.txn,
txid: referenceHistory.txid,
amounts: referenceHistory.amounts,
type: 'MintToken'
}
)
})

it('should getAccountHistory with owner address', async () => {
Expand All @@ -57,14 +60,18 @@ describe('Account', () => {
const referenceHistory = accountHistories[0]

const history = await testing.rpc.account.getAccountHistory(referenceHistory.owner, referenceHistory.blockHeight, referenceHistory.txn)
expect(history.owner).toStrictEqual(referenceHistory.owner)
expect(history.blockHeight).toStrictEqual(referenceHistory.blockHeight)
expect(history.txn).toStrictEqual(referenceHistory.txn)
expect(history.txid).toStrictEqual(referenceHistory.txid)
expect(history.type).toStrictEqual(referenceHistory.type)
expect(history.blockHash).toStrictEqual(referenceHistory.blockHash)
expect(history.blockTime).toStrictEqual(referenceHistory.blockTime)
expect(history.amounts).toStrictEqual(referenceHistory.amounts)
expect(history).toStrictEqual(
{
owner: referenceHistory.owner,
blockHeight: referenceHistory.blockHeight,
blockHash: expect.stringMatching(/[0-f]{64}/),
blockTime: expect.any(Number),
txn: referenceHistory.txn,
txid: referenceHistory.txid,
amounts: referenceHistory.amounts,
type: 'MintToken'
}
)
})

it('should not getAccountHistory when address is not valid', async () => {
Expand Down
Loading