Skip to content

[SOL-100] Fix typechecking errors #92

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 56 additions & 0 deletions tests/suits/cancel-by-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ describe("Cancel by Resolver", () => {
provider: banksClient,
orderConfig: state.orderConfig({
srcAmount: defaultSrcAmount,
dutchAuctionData: undefined,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -136,6 +142,11 @@ describe("Cancel by Resolver", () => {
srcAmount: defaultSrcAmount,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -185,6 +196,11 @@ describe("Cancel by Resolver", () => {
srcAmount: defaultSrcAmount,
fee: {
maxCancellationPremium: new anchor.BN(maxCancellationPremium),
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -267,6 +283,11 @@ describe("Cancel by Resolver", () => {
srcAmount: defaultSrcAmount,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -337,6 +358,11 @@ describe("Cancel by Resolver", () => {
srcAmount: defaultSrcAmount,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -411,6 +437,11 @@ describe("Cancel by Resolver", () => {
srcAmount: amount,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -478,6 +509,11 @@ describe("Cancel by Resolver", () => {
srcAmount: amount,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -517,6 +553,11 @@ describe("Cancel by Resolver", () => {
srcAmount: amount,
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -553,6 +594,11 @@ describe("Cancel by Resolver", () => {
orderConfig: state.orderConfig({
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -586,6 +632,11 @@ describe("Cancel by Resolver", () => {
orderConfig: state.orderConfig({
fee: {
maxCancellationPremium: defaultMaxCancellationPremium,
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down Expand Up @@ -623,6 +674,11 @@ describe("Cancel by Resolver", () => {
orderConfig: state.orderConfig({
fee: {
maxCancellationPremium: new anchor.BN(tokenAccountRent + 1),
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
},
cancellationAuctionDuration: order.auctionDuration,
}),
Expand Down
5 changes: 5 additions & 0 deletions tests/suits/dutch-auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ describe("Dutch Auction", () => {
protocolDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
surplusPercentage: 50, // 50%
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
maxCancellationPremium: undefined
},
dutchAuctionData: auction,
},
Expand Down Expand Up @@ -370,6 +374,7 @@ describe("Dutch Auction", () => {
protocolFee: 10000, // 10%
integratorFee: 15000, // 15%
surplusPercentage: 50, // 50%
maxCancellationPremium: undefined
},
dutchAuctionData: auction,
},
Expand Down
68 changes: 64 additions & 4 deletions tests/suits/fusion-swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ describe("Fusion Swap", () => {
protocolDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
protocolFee: 10000, // 10%
integratorDstAcc: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -669,6 +673,10 @@ describe("Fusion Swap", () => {
protocolDstAcc:
state.charlie.atas[splToken.NATIVE_MINT.toString()].address,
protocolFee: 10000, // 10%
integratorDstAcc: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -723,6 +731,10 @@ describe("Fusion Swap", () => {
integratorDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
integratorFee: 15000, // 15%
protocolDstAcc: undefined,
protocolFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -782,6 +794,10 @@ describe("Fusion Swap", () => {
integratorDstAcc:
state.charlie.atas[splToken.NATIVE_MINT.toString()].address,
integratorFee: 15000, // 15%
protocolDstAcc: undefined,
protocolFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -886,6 +902,8 @@ describe("Fusion Swap", () => {
integratorDstAcc:
state.dave.atas[splToken.NATIVE_MINT.toString()].address,
integratorFee: 15000, // 15%
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1260,7 +1278,13 @@ describe("Fusion Swap", () => {

it("Doesn't create escrow with the wrong surplus param", async () => {
const orderConfig = state.orderConfig({
fee: { surplusPercentage: 146 }, // 146%
fee: { surplusPercentage: 146, // 146%
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
integratorFee: undefined,
maxCancellationPremium: undefined
},
});

const [escrow] = anchor.web3.PublicKey.findProgramAddressSync(
Expand Down Expand Up @@ -1292,7 +1316,13 @@ describe("Fusion Swap", () => {

it("Doesn't create escrow with protocol_dst_acc from different mint", async () => {
const orderConfig = state.orderConfig({
fee: { protocolFee: 10000 }, // 10%
fee: { protocolFee: 10000, // 10%
protocolDstAcc: undefined,
integratorDstAcc: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
});

const [escrow] = anchor.web3.PublicKey.findProgramAddressSync(
Expand Down Expand Up @@ -1325,7 +1355,13 @@ describe("Fusion Swap", () => {

it("Doesn't create escrow with intergrator_dst_acc from different mint", async () => {
const orderConfig = state.orderConfig({
fee: { integratorFee: 10000 }, // 10%
fee: { integratorFee: 10000 , // 10%
protocolDstAcc: undefined,
integratorDstAcc: undefined,
protocolFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
}
});

const [escrow] = anchor.web3.PublicKey.findProgramAddressSync(
Expand Down Expand Up @@ -1366,6 +1402,10 @@ describe("Fusion Swap", () => {
protocolDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
protocolFee: 10000, // 10%
integratorDstAcc: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1396,6 +1436,10 @@ describe("Fusion Swap", () => {
protocolDstAcc:
state.charlie.atas[state.tokens[0].toString()].address, // wrong protocol_dst_acc mint
protocolFee: 10000, // 10%
integratorDstAcc: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1426,6 +1470,10 @@ describe("Fusion Swap", () => {
protocolDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
protocolFee: 10000, // 10%
integratorDstAcc: undefined,
integratorFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1454,6 +1502,10 @@ describe("Fusion Swap", () => {
integratorDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
integratorFee: 10000, // 10%
protocolDstAcc: undefined,
protocolFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1484,6 +1536,10 @@ describe("Fusion Swap", () => {
integratorDstAcc:
state.charlie.atas[state.tokens[0].toString()].address, // wrong integrator_dst_acc mint
integratorFee: 10000, // 10%
protocolDstAcc: undefined,
protocolFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1514,6 +1570,10 @@ describe("Fusion Swap", () => {
integratorDstAcc:
state.charlie.atas[state.tokens[1].toString()].address,
integratorFee: 10000, // 10%
protocolDstAcc: undefined,
protocolFee: undefined,
surplusPercentage: undefined,
maxCancellationPremium: undefined
},
},
});
Expand Down Expand Up @@ -1601,7 +1661,7 @@ describe("Fusion Swap", () => {
provider,
orderConfig: {
srcAmount: _srcAmount,
srcRemaining: _srcAmount,
// srcRemaining: _srcAmount, // TODO @sras, this appear to be unused, confirm and remove
minDstAmount: _dstAmount,
estimatedDstAmount: _dstAmount,
},
Expand Down
Loading
Loading