Skip to content
Merged
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
2 changes: 2 additions & 0 deletions apps/web/app/[locale]/margin-swap/hooks/useMarginSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
abi: MARGIN_MODULE_ABI,
functionName: "marginSwap223" as const,
address: marginModuleAddress,
// The module enforces the owner's minimum since Dex223-contracts #198 (MM21 below it).
args: [
BigInt(positionId),
BigInt(assetId1),
Expand All @@ -92,6 +93,7 @@
amountIn,
assetOutAddress,
fee,
minimumAmountOut,
] as const,
};
}
Expand Down Expand Up @@ -236,7 +238,7 @@
} catch (e) {
setStatus(MarginSwapStatus.ERROR_SWAP);
}
}, [

Check warning on line 241 in apps/web/app/[locale]/margin-swap/hooks/useMarginSwap.ts

View workflow job for this annotation

GitHub Actions / web

React Hook useCallback has an unnecessary dependency: 'addRecentTransaction'. Either exclude it or remove the dependency array
addRecentTransaction,
address,
chainId,
Expand Down
128 changes: 85 additions & 43 deletions apps/web/config/abis/marginModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -918,25 +918,6 @@ export const MARGIN_MODULE_ABI = [
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "id",
type: "uint256",
},
],
name: "isOrderOpen",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
Expand Down Expand Up @@ -1068,6 +1049,11 @@ export const MARGIN_MODULE_ABI = [
name: "_feeTier",
type: "uint24",
},
{
internalType: "uint256",
name: "_minAmountOut",
type: "uint256",
},
],
name: "marginSwap223",
outputs: [],
Expand Down Expand Up @@ -1218,6 +1204,44 @@ export const MARGIN_MODULE_ABI = [
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "orderLiquidationKeeper",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "orderMaintenanceMarginBps",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
Expand All @@ -1236,6 +1260,29 @@ export const MARGIN_MODULE_ABI = [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_orderId",
type: "uint256",
},
{
internalType: "uint256",
name: "_maintenanceMarginBps",
type: "uint256",
},
{
internalType: "address",
name: "_keeper",
type: "address",
},
],
name: "orderSetLenderProtection",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
Expand Down Expand Up @@ -1466,6 +1513,25 @@ export const MARGIN_MODULE_ABI = [
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "positionUnderwaterSince",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
Expand Down Expand Up @@ -1543,30 +1609,6 @@ export const MARGIN_MODULE_ABI = [
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address[]",
name: "tokens",
type: "address[]",
},
{
internalType: "bool",
name: "isContract",
type: "bool",
},
],
name: "predictTokenListsID",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
stateMutability: "pure",
type: "function",
},
{
inputs: [],
name: "priceOracle",
Expand Down
18 changes: 9 additions & 9 deletions apps/web/sdk_bi/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const CONVERTER_ADDRESS: Record<DexChainId, Address> = {

export const FACTORY_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0x899097B427cd04e1BD07FD3445cc90493300C3a5",
[DexChainId.SEPOLIA]: "0x4EC06106Cf666A817586563ae042ffF8B76e3460",
[DexChainId.SEPOLIA]: "0xbdC7986B4C46F3629948f78a8F9942A88c111A86",
[DexChainId.BSC_TESTNET]: "0x8524c3bD49Cd455EA0102BF194AdD2F21165E049",
[DexChainId.EOS]: "0xeA0A163e0196Bf1500B1B41d3ADdA0476dC137eb",
[DexChainId.BASE]: "0xeA0A163e0196Bf1500B1B41d3ADdA0476dC137eb",
Expand All @@ -47,7 +47,7 @@ export const FACTORY_ADDRESS: Record<DexChainId, Address> = {

export const ROUTER_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0x14248d524850B0B47B30F4332279330Cad2846a2",
[DexChainId.SEPOLIA]: "0xbc7B51762685eF1cEa3556321a8F6833775Fb5Ce",
[DexChainId.SEPOLIA]: "0x6812B2784111B8b674773CC0F32b8a480563E71b",
[DexChainId.BSC_TESTNET]: "0xb130D5e318898718C1Efa27Abe634294B0a4C4c8",
[DexChainId.EOS]: "0xc06C5F3a889DCDF23D54B4fB8FCE3DE2707199ED",
[DexChainId.BASE]: "0xc06C5F3a889DCDF23D54B4fB8FCE3DE2707199ED",
Expand All @@ -67,7 +67,7 @@ export const ROUTER_ADDRESS: Record<DexChainId, Address> = {

export const NONFUNGIBLE_POSITION_MANAGER_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0x15E22548C572C8Fdb3AcC600c040D5F2A19855D4",
[DexChainId.SEPOLIA]: "0x015C0b6608346b864f0d961473178980be0E8E95",
[DexChainId.SEPOLIA]: "0x461AFb20bB4b8f330608Ea582E13B1a6A749A4D0",
[DexChainId.BSC_TESTNET]: "0x9cCF60dDE926FB2579209bb0D6C00C8Cc873A458",
[DexChainId.EOS]: "0x2A40FF7c062336dC82A502aB38EBD3579e42BAE1",
[DexChainId.BASE]: "0x2A40FF7c062336dC82A502aB38EBD3579e42BAE1",
Expand All @@ -87,7 +87,7 @@ export const NONFUNGIBLE_POSITION_MANAGER_ADDRESS: Record<DexChainId, Address> =

export const POOL_INIT_CODE_HASH: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0xda784e03880632ad14c2c723b631f2331dadc42276947ab1e57f607bf738c568",
[DexChainId.SEPOLIA]: "0x5430bdad1581f0792683bc843126b9790788f74629bc98c072f809a1498a967f",
[DexChainId.SEPOLIA]: "0x594484e19d3745766c4f31d136117df59fd00e70bd281680364889bcb612ac60",
[DexChainId.BSC_TESTNET]: "0xf0d7ddf29422ea801b9317d66d14a1055d17fd476a9da81c3c985fb2d8e49281",
[DexChainId.EOS]: "0xda784e03880632ad14c2c723b631f2331dadc42276947ab1e57f607bf738c568",
[DexChainId.BASE]: "0xda784e03880632ad14c2c723b631f2331dadc42276947ab1e57f607bf738c568",
Expand All @@ -107,7 +107,7 @@ export const POOL_INIT_CODE_HASH: Record<DexChainId, Address> = {

export const CORE_AUTO_LISTING_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0x63054Fa5899Bce903E676CC478811bF1fed20E5b",
[DexChainId.SEPOLIA]: "0x31e1ec42C4dC30E50B2791F3a8e237399c498c3b",
[DexChainId.SEPOLIA]: "0x6BB287ab1a02Aa8Bb43Ed98D3Bb1DE824E062b35",
[DexChainId.BSC_TESTNET]: "0xD9EAC1C424554499322FECCb673fC62Ea92cF810",
[DexChainId.EOS]: "0x83E1e7f47536515db9Ec4D7C4024e7395CD11A48",
[DexChainId.BASE]: "0x83E1e7f47536515db9Ec4D7C4024e7395CD11A48",
Expand All @@ -127,7 +127,7 @@ export const CORE_AUTO_LISTING_ADDRESS: Record<DexChainId, Address> = {

export const FREE_AUTO_LISTING_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0xB442f1362163b168cebAd877067D35Eb8d9176d9",
[DexChainId.SEPOLIA]: "0xe53760E2873A3103f0Cb7664C23CAA5273e6FF2e",
[DexChainId.SEPOLIA]: "0xD46566B0682dccD55BBfCAF45C848086143F5a14",
[DexChainId.BSC_TESTNET]: "0xde839Df421dA5B5a4b34d872D90517C90B511b57",
[DexChainId.EOS]: "0xCc46E110426958E83e9298d46a50572691065eC5",
[DexChainId.BASE]: "0xCc46E110426958E83e9298d46a50572691065eC5",
Expand All @@ -149,7 +149,7 @@ export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";

export const MARGIN_TRADING_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: ZERO_ADDRESS,
[DexChainId.SEPOLIA]: "0x0cc18a9557230Da8b92A73dB7A6CE0FC41abb3De",
[DexChainId.SEPOLIA]: "0x05860334EAC4915fa678FCFa3e012d8c79641D18",
[DexChainId.BSC_TESTNET]: ZERO_ADDRESS,
[DexChainId.EOS]: ZERO_ADDRESS,
[DexChainId.BASE]: ZERO_ADDRESS,
Expand All @@ -169,7 +169,7 @@ export const MARGIN_TRADING_ADDRESS: Record<DexChainId, Address> = {

export const ORACLE_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: ZERO_ADDRESS,
[DexChainId.SEPOLIA]: "0x300D97201be6bE2aA48Bbe3E8B5a74B74a7BeB01",
[DexChainId.SEPOLIA]: "0x4859265CDBf63767569A76ab3FE22050008e4354",
[DexChainId.BSC_TESTNET]: ZERO_ADDRESS,
[DexChainId.EOS]: ZERO_ADDRESS,
[DexChainId.BASE]: ZERO_ADDRESS,
Expand Down Expand Up @@ -231,7 +231,7 @@ export const REVENUE_ADDRESS: Record<DexChainId, Address> = {
// ProtocolFeeCollector owns the factory and can only send pool protocol fees to REVENUE_ADDRESS.
export const FEE_COLLECTOR_ADDRESS: Record<DexChainId, Address> = {
[DexChainId.MAINNET]: "0x984e217ddAE675d706509B02EedB2FAF2F6a342E",
[DexChainId.SEPOLIA]: "0x77Ff8BC37218362efa7b088a6f0D70fE90b74555",
[DexChainId.SEPOLIA]: "0x44f9b4Dfa9AAF2F94C373b4B1d8fb356937b5C90",
[DexChainId.BSC_TESTNET]: ZERO_ADDRESS,
[DexChainId.EOS]: ZERO_ADDRESS,
[DexChainId.BASE]: ZERO_ADDRESS,
Expand Down
1 change: 1 addition & 0 deletions apps/web/tests/marginSwap.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ test("buildMarginSwapCallParams routes ERC-223 input to marginSwap223 and resolv
amountIn,
tokenLoan.address1, // _asset2 uses ERC-223 address1
3000,
500n, // _minAmountOut: the module enforces the owner's minimum (Dex223-contracts #198)
]);
assert.ok(
viem.encodeFunctionData({
Expand Down
Loading