-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
400 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,20 @@ | ||
import { test } from "vitest"; | ||
import { generateTransaction } from "core/src/transaction/generate-transaction"; | ||
import { AssetStore } from "core/src/transaction/types"; | ||
import { loadConfig } from "core/src/config/load-config"; | ||
import { simulateRouterOperation } from "core/src/path/tx-simulator"; | ||
import { getProvider } from "core/src/utils/get-provider"; | ||
import { simulateSingleAssetToSingleAsset } from "./utils"; | ||
|
||
test("generateTransaction: USDC to aPolUSDC (aaveV3Deposit)", async () => { | ||
const assetStore = new AssetStore(); | ||
const config = await loadConfig(); | ||
const provider = await getProvider({ chainId: 137 }); | ||
|
||
const routerOperation = await generateTransaction({ | ||
inputAllocation: [ | ||
{ | ||
assetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
amountStr: "1000000000", | ||
}, | ||
], | ||
outputAllocation: [ | ||
{ | ||
assetId: "371b83f1-3301-4c69-b3ad-8d199c6d1774", | ||
fraction: 1.0, | ||
}, | ||
], | ||
assetStore, | ||
simulateSingleAssetToSingleAsset({ | ||
chainId: 137, | ||
walletAddress: config.networks[137].routerSimulatorAddress, | ||
}); | ||
|
||
const result = await simulateRouterOperation({ | ||
chainId: 137, | ||
routerOperation, | ||
provider, | ||
sellAsset: assetStore.getAssetById("e251ecf6-48c2-4538-afcd-fbb92424054d"), | ||
inputAssetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
outputAssetId: "371b83f1-3301-4c69-b3ad-8d199c6d1774", | ||
amountIn: "1000000000", | ||
buyAsset: assetStore.getAssetById("371b83f1-3301-4c69-b3ad-8d199c6d1774"), | ||
}); | ||
|
||
console.dir( | ||
{ | ||
encodedTransactionData: routerOperation.getEncodedTransactionData(), | ||
result, | ||
}, | ||
{ depth: null, maxStringLength: null } | ||
); | ||
}); | ||
|
||
test.skip("generateTransaction: aPolUSDC (aaveV3Deposit) to USDC", async () => { | ||
const assetStore = new AssetStore(); | ||
const config = await loadConfig(); | ||
const provider = await getProvider({ chainId: 137 }); | ||
|
||
const routerOperation = await generateTransaction({ | ||
inputAllocation: [ | ||
{ | ||
assetId: "371b83f1-3301-4c69-b3ad-8d199c6d1774", | ||
amountStr: "1000000000", | ||
}, | ||
], | ||
outputAllocation: [ | ||
{ | ||
assetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
fraction: 1.0, | ||
}, | ||
], | ||
assetStore, | ||
simulateSingleAssetToSingleAsset({ | ||
chainId: 137, | ||
walletAddress: config.networks[137].routerSimulatorAddress, | ||
}); | ||
|
||
const result = await simulateRouterOperation({ | ||
chainId: 137, | ||
routerOperation, | ||
provider, | ||
sellAsset: assetStore.getAssetById("371b83f1-3301-4c69-b3ad-8d199c6d1774"), | ||
inputAssetId: "371b83f1-3301-4c69-b3ad-8d199c6d1774", | ||
outputAssetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
amountIn: "1000000000", | ||
buyAsset: assetStore.getAssetById("e251ecf6-48c2-4538-afcd-fbb92424054d"), | ||
}); | ||
|
||
console.dir( | ||
{ | ||
encodedTransactionData: routerOperation.getEncodedTransactionData(), | ||
result, | ||
}, | ||
{ depth: null, maxStringLength: null } | ||
); | ||
}); |
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,88 +1,20 @@ | ||
import { test } from "vitest"; | ||
import { generateTransaction } from "core/src/transaction/generate-transaction"; | ||
import { AssetStore } from "core/src/transaction/types"; | ||
import { loadConfig } from "core/src/config/load-config"; | ||
import { simulateRouterOperation } from "core/src/path/tx-simulator"; | ||
import { getProvider } from "core/src/utils/get-provider"; | ||
import { simulateSingleAssetToSingleAsset } from "./utils"; | ||
|
||
test("generateTransaction: USDC to QUICK (beefyDeposit)", async () => { | ||
const assetStore = new AssetStore(); | ||
const config = await loadConfig(); | ||
const provider = await getProvider({ chainId: 137 }); | ||
|
||
const routerOperation = await generateTransaction({ | ||
inputAllocation: [ | ||
{ | ||
assetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
amountStr: "1000000000", | ||
}, | ||
], | ||
outputAllocation: [ | ||
{ | ||
assetId: "37819023-9c6a-4848-8cf5-24a95350f001", | ||
fraction: 1.0, | ||
}, | ||
], | ||
assetStore, | ||
simulateSingleAssetToSingleAsset({ | ||
chainId: 137, | ||
walletAddress: config.networks[137].routerSimulatorAddress, | ||
}); | ||
|
||
const result = await simulateRouterOperation({ | ||
chainId: 137, | ||
routerOperation, | ||
provider, | ||
sellAsset: assetStore.getAssetById("e251ecf6-48c2-4538-afcd-fbb92424054d"), | ||
inputAssetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
outputAssetId: "37819023-9c6a-4848-8cf5-24a95350f001", | ||
amountIn: "1000000000", | ||
buyAsset: assetStore.getAssetById("37819023-9c6a-4848-8cf5-24a95350f001"), | ||
}); | ||
|
||
console.dir( | ||
{ | ||
encodedTransactionData: routerOperation.getEncodedTransactionData(), | ||
result, | ||
}, | ||
{ depth: null, maxStringLength: null } | ||
); | ||
}); | ||
|
||
test.skip("generateTransaction: beefy.finance (beefyDeposit) to USDC", async () => { | ||
const assetStore = new AssetStore(); | ||
const config = await loadConfig(); | ||
const provider = await getProvider({ chainId: 137 }); | ||
|
||
const routerOperation = await generateTransaction({ | ||
inputAllocation: [ | ||
{ | ||
assetId: "fecfd33d-e6a7-476b-89cb-910a0058fa48", | ||
amountStr: "1000000", | ||
}, | ||
], | ||
outputAllocation: [ | ||
{ | ||
assetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
fraction: 1.0, | ||
}, | ||
], | ||
assetStore, | ||
simulateSingleAssetToSingleAsset({ | ||
chainId: 137, | ||
walletAddress: config.networks[137].routerSimulatorAddress, | ||
}); | ||
|
||
const result = await simulateRouterOperation({ | ||
chainId: 137, | ||
routerOperation, | ||
provider, | ||
sellAsset: assetStore.getAssetById("fecfd33d-e6a7-476b-89cb-910a0058fa48"), | ||
inputAssetId: "fecfd33d-e6a7-476b-89cb-910a0058fa48", | ||
outputAssetId: "e251ecf6-48c2-4538-afcd-fbb92424054d", | ||
amountIn: "1000000", | ||
buyAsset: assetStore.getAssetById("e251ecf6-48c2-4538-afcd-fbb92424054d"), | ||
}); | ||
|
||
console.dir( | ||
{ | ||
encodedTransactionData: routerOperation.getEncodedTransactionData(), | ||
result, | ||
}, | ||
{ depth: null, maxStringLength: null } | ||
); | ||
}); |
Oops, something went wrong.