From e911dd53effde49bde4e907e6951852d65ec22d7 Mon Sep 17 00:00:00 2001 From: Zachary Couchman Date: Mon, 31 Jul 2023 01:07:47 -0400 Subject: [PATCH 1/9] WT-1257 Add widget input validators [NO-CHANGELOG] (#613) Co-authored-by: Zach Couchman --- .../lib/validations/widgetValidators.test.ts | 95 +++++++++++++++++++ .../src/lib/validations/widgetValidators.ts | 26 +++++ .../src/widgets/ImmutableWebComponent.tsx | 5 +- .../src/widgets/bridge/BridgeWebComponent.tsx | 30 +++++- .../src/widgets/bridge/BridgeWebView.tsx | 5 +- .../widgets/connect/ConnectWebComponent.tsx | 6 ++ .../src/widgets/swap/SwapWebComponent.tsx | 36 ++++++- .../src/widgets/swap/SwapWebView.tsx | 5 +- .../src/widgets/wallet/WalletWebComponent.tsx | 15 ++- 9 files changed, 210 insertions(+), 13 deletions(-) create mode 100644 packages/checkout/widgets-lib/src/lib/validations/widgetValidators.test.ts create mode 100644 packages/checkout/widgets-lib/src/lib/validations/widgetValidators.ts diff --git a/packages/checkout/widgets-lib/src/lib/validations/widgetValidators.test.ts b/packages/checkout/widgets-lib/src/lib/validations/widgetValidators.test.ts new file mode 100644 index 0000000000..6f14ea56a6 --- /dev/null +++ b/packages/checkout/widgets-lib/src/lib/validations/widgetValidators.test.ts @@ -0,0 +1,95 @@ +import { NATIVE } from '../constants'; +import { isValidAddress, isValidAmount, isValidWalletProvider } from './widgetValidators'; + +describe('widget validators', () => { + describe('Wallet Provider Validator', () => { + it('should return true for "metamask"', () => { + const result = isValidWalletProvider('metamask'); + expect(result).toBeTruthy(); + }); + + it('should return false for "METAMASK" (all uppercase)', () => { + const result = isValidWalletProvider('METAMASK'); + expect(result).toBeFalsy(); + }); + + it('should return false for undefined', () => { + const result = isValidWalletProvider(undefined); + expect(result).toBeFalsy(); + }); + + it('should return false for "metramask" ', () => { + const result = isValidWalletProvider('metramask'); + expect(result).toBeFalsy(); + }); + + it('should return false for empty string', () => { + const result = isValidWalletProvider(''); + expect(result).toBeFalsy(); + }); + }); + + describe('Amount Validator', () => { + const validCases = ['1', '1.0', '1.234567', '100000000', '']; // empty amount should pass as valid + const invalidCases = ['acdas', '0.1234s', '1.2345678', undefined]; + + validCases.forEach((testCase) => { + it(`should validate amount as a float with 6 decimal places for ${testCase}`, () => { + const result = isValidAmount(testCase); + expect(result).toBeTruthy(); + }); + }); + + invalidCases.forEach((testCase) => { + it(`should return false for any amount not a float with 6 decimal places for ${testCase}`, () => { + const result = isValidAmount(testCase); + expect(result).toBeFalsy(); + }); + }); + }); + + describe('Address Validator', () => { + const IMX_L1_ADDRESS = '0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF'; + const INVALID_ADDRESS = '0x1234567890'; + + it('should return true if address is valid', () => { + const result = isValidAddress(IMX_L1_ADDRESS); + expect(result).toBeTruthy(); + }); + + it('should return true if address is valid and lowercase', () => { + const result = isValidAddress(IMX_L1_ADDRESS.toLowerCase()); + expect(result).toBeTruthy(); + }); + + it('should return true if address is NATIVE string', () => { + const result = isValidAddress(NATIVE); + expect(result).toBeTruthy(); + }); + + it('should return true if address is NATIVE string lowercased', () => { + const result = isValidAddress(NATIVE.toLowerCase()); + expect(result).toBeTruthy(); + }); + + it('should return false if address is valid and uppercase', () => { + const result = isValidAddress(IMX_L1_ADDRESS.toUpperCase()); + expect(result).toBeFalsy(); + }); + + it('should return false if address is not valid', () => { + const result = isValidAddress(INVALID_ADDRESS); + expect(result).toBeFalsy(); + }); + + it('should return true if address empty', () => { + const result = isValidAddress(''); + expect(result).toBeTruthy(); + }); + + it('should return false if address is undefined', () => { + const result = isValidAddress(undefined); + expect(result).toBeFalsy(); + }); + }); +}); diff --git a/packages/checkout/widgets-lib/src/lib/validations/widgetValidators.ts b/packages/checkout/widgets-lib/src/lib/validations/widgetValidators.ts new file mode 100644 index 0000000000..57376c9710 --- /dev/null +++ b/packages/checkout/widgets-lib/src/lib/validations/widgetValidators.ts @@ -0,0 +1,26 @@ +import { WalletProviderName } from '@imtbl/checkout-sdk'; +import { isAddress } from 'ethers/lib/utils'; +import { amountInputValidation } from './amountInputValidations'; +import { NATIVE } from '../constants'; + +export function isValidWalletProvider(walletProvider: string | undefined) { + if (walletProvider === undefined) return false; + if (walletProvider === '') return false; + return Object.values(WalletProviderName).includes(walletProvider as WalletProviderName); +} + +export function isValidAmount(amount: string | undefined) { + if (amount === undefined) return false; + if (amount === '') return true; // let empty string pass through + if (!parseFloat(amount)) return false; + if (Number.isNaN(parseFloat(amount))) return false; + + return amountInputValidation(amount); +} + +export function isValidAddress(address: string | undefined) { + if (address === undefined) return false; + if (address === '') return true; + if (address === NATIVE || address === NATIVE.toLowerCase()) return true; + return isAddress(address); +} diff --git a/packages/checkout/widgets-lib/src/widgets/ImmutableWebComponent.tsx b/packages/checkout/widgets-lib/src/widgets/ImmutableWebComponent.tsx index 5384925a72..2391fffb1e 100644 --- a/packages/checkout/widgets-lib/src/widgets/ImmutableWebComponent.tsx +++ b/packages/checkout/widgets-lib/src/widgets/ImmutableWebComponent.tsx @@ -22,12 +22,12 @@ export abstract class ImmutableWebComponent extends HTMLElement { this.renderWidget(); } - attributeChangedCallback(name, oldValue, newValue) { + attributeChangedCallback(name: string, oldValue, newValue: any) { if (name === 'widgetConfig') { this.widgetConfig = this.parseWidgetConfig(newValue); this.updateCheckoutConfig(); } else { - this[name] = newValue; + this[name] = (newValue as string)?.toLowerCase(); } this.renderWidget(); } @@ -55,4 +55,5 @@ export abstract class ImmutableWebComponent extends HTMLElement { } abstract renderWidget(): void; + abstract validateInputs(): void; } diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebComponent.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebComponent.tsx index 53f8a8b61e..80c02bd55e 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebComponent.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebComponent.tsx @@ -6,6 +6,7 @@ import { ImmutableWebComponent } from '../ImmutableWebComponent'; import { ConnectTargetLayer, getL1ChainId } from '../../lib'; import { ConnectLoader, ConnectLoaderParams } from '../../components/ConnectLoader/ConnectLoader'; import { sendBridgeWidgetCloseEvent } from './BridgeWidgetEvents'; +import { isValidAddress, isValidAmount, isValidWalletProvider } from '../../lib/validations/widgetValidators'; export class ImmutableBridge extends ImmutableWebComponent { fromContractAddress = ''; @@ -16,15 +17,38 @@ export class ImmutableBridge extends ImmutableWebComponent { connectedCallback() { super.connectedCallback(); - this.fromContractAddress = this.getAttribute('fromContractAddress') as string; - this.amount = this.getAttribute('amount') as string; + this.fromContractAddress = this.getAttribute('fromContractAddress')?.toLowerCase() ?? ''; + this.amount = this.getAttribute('amount') ?? ''; this.walletProvider = this.getAttribute( 'walletProvider', - ) as WalletProviderName; + )?.toLowerCase() as WalletProviderName ?? WalletProviderName.METAMASK; + this.renderWidget(); } + validateInputs(): void { + if (!isValidWalletProvider(this.walletProvider)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "walletProvider" widget input'); + this.walletProvider = WalletProviderName.METAMASK; + } + + if (!isValidAmount(this.amount)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "amount" widget input'); + this.amount = ''; + } + + if (!isValidAddress(this.fromContractAddress)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "fromContractAddress" widget input'); + this.fromContractAddress = ''; + } + } + renderWidget() { + this.validateInputs(); + const connectLoaderParams: ConnectLoaderParams = { targetLayer: ConnectTargetLayer.LAYER1, walletProvider: this.walletProvider, diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebView.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebView.tsx index d7902808a0..6393e6ed7e 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebView.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWebView.tsx @@ -8,7 +8,10 @@ function BridgeWebView() { }; return ( - + ); } diff --git a/packages/checkout/widgets-lib/src/widgets/connect/ConnectWebComponent.tsx b/packages/checkout/widgets-lib/src/widgets/connect/ConnectWebComponent.tsx index 57ffd1d17a..1d2925b4b8 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/ConnectWebComponent.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/ConnectWebComponent.tsx @@ -9,7 +9,13 @@ export class ImmutableConnect extends ImmutableWebComponent { this.renderWidget(); } + validateInputs(): void { + // not implemented as nothing to validate for ConnectWidget + } + renderWidget() { + this.validateInputs(); + if (!this.reactRoot) { this.reactRoot = ReactDOM.createRoot(this); } diff --git a/packages/checkout/widgets-lib/src/widgets/swap/SwapWebComponent.tsx b/packages/checkout/widgets-lib/src/widgets/swap/SwapWebComponent.tsx index dbe0477786..f62348a551 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/SwapWebComponent.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/SwapWebComponent.tsx @@ -9,6 +9,7 @@ import { } from '../../components/ConnectLoader/ConnectLoader'; import { sendSwapWidgetCloseEvent } from './SwapWidgetEvents'; import { ConnectTargetLayer, getL2ChainId } from '../../lib'; +import { isValidAddress, isValidAmount, isValidWalletProvider } from '../../lib/validations/widgetValidators'; export class ImmutableSwap extends ImmutableWebComponent { walletProvider = WalletProviderName.METAMASK; @@ -23,14 +24,41 @@ export class ImmutableSwap extends ImmutableWebComponent { super.connectedCallback(); this.walletProvider = this.getAttribute( 'walletProvider', - ) as WalletProviderName; - this.amount = this.getAttribute('amount') as string; - this.fromContractAddress = this.getAttribute('fromContractAddress') as string; - this.toContractAddress = this.getAttribute('toContractAddress') as string; + )?.toLowerCase() as WalletProviderName ?? WalletProviderName.METAMASK; + this.amount = this.getAttribute('amount') ?? ''; + this.fromContractAddress = this.getAttribute('fromContractAddress')?.toLowerCase() ?? ''; + this.toContractAddress = this.getAttribute('toContractAddress')?.toLowerCase() ?? ''; this.renderWidget(); } + validateInputs(): void { + if (!isValidWalletProvider(this.walletProvider)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "walletProvider" widget input'); + this.walletProvider = WalletProviderName.METAMASK; + } + + if (!isValidAmount(this.amount)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "amount" widget input'); + this.amount = ''; + } + + if (!isValidAddress(this.fromContractAddress)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "fromContractAddress" widget input'); + this.fromContractAddress = ''; + } + + if (!isValidAddress(this.toContractAddress)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "toContractAddress" widget input'); + this.toContractAddress = ''; + } + } + renderWidget() { + this.validateInputs(); const connectLoaderParams: ConnectLoaderParams = { targetLayer: ConnectTargetLayer.LAYER2, walletProvider: this.walletProvider, diff --git a/packages/checkout/widgets-lib/src/widgets/swap/SwapWebView.tsx b/packages/checkout/widgets-lib/src/widgets/swap/SwapWebView.tsx index 6e5d075f9f..222385f35b 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/SwapWebView.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/SwapWebView.tsx @@ -8,7 +8,10 @@ function SwapWebView() { }; return ( - + ); } diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWebComponent.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWebComponent.tsx index d7ba1a56a4..a679c17a09 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWebComponent.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWebComponent.tsx @@ -9,17 +9,28 @@ import { import { sendWalletWidgetCloseEvent } from './WalletWidgetEvents'; import { ImmutableWebComponent } from '../ImmutableWebComponent'; import { ConnectTargetLayer, getL1ChainId, getL2ChainId } from '../../lib'; +import { isValidWalletProvider } from '../../lib/validations/widgetValidators'; export class ImmutableWallet extends ImmutableWebComponent { - walletProvider?:WalletProviderName; + walletProvider = WalletProviderName.METAMASK; connectedCallback() { super.connectedCallback(); - this.walletProvider = this.getAttribute('walletProvider') as WalletProviderName; + this.walletProvider = this.getAttribute('walletProvider')?.toLowerCase() as WalletProviderName + ?? WalletProviderName.METAMASK; this.renderWidget(); } + validateInputs(): void { + if (!isValidWalletProvider(this.walletProvider)) { + // eslint-disable-next-line no-console + console.warn('[IMTBL]: invalid "walletProvider" widget input'); + this.walletProvider = WalletProviderName.METAMASK; + } + } + renderWidget() { + this.validateInputs(); const connectLoaderParams: ConnectLoaderParams = { targetLayer: ConnectTargetLayer.LAYER2, walletProvider: this.walletProvider, From 9e71fd9389ee07533f00f78e41f4d96abd728a8a Mon Sep 17 00:00:00 2001 From: Mikhala <122326421+imx-mikhala@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:25:15 +0800 Subject: [PATCH 2/9] WT-1532 Handle WalletWidget Error View Try Again Button NO-CHANGELOG (#614) --- .../widgets-lib/src/views/error/ErrorView.tsx | 1 + .../src/widgets/wallet/WalletWidget.cy.tsx | 133 ++++++++++++------ .../src/widgets/wallet/WalletWidget.tsx | 42 ++++-- .../widgets/wallet/views/WalletBalances.tsx | 24 ++-- 4 files changed, 140 insertions(+), 60 deletions(-) diff --git a/packages/checkout/widgets-lib/src/views/error/ErrorView.tsx b/packages/checkout/widgets-lib/src/views/error/ErrorView.tsx index f129527d4b..45ea9c9782 100644 --- a/packages/checkout/widgets-lib/src/views/error/ErrorView.tsx +++ b/packages/checkout/widgets-lib/src/views/error/ErrorView.tsx @@ -43,6 +43,7 @@ export function ErrorView({ )} heroContent={} floatHeader + testId="error-view" > {errorText.body[0]} diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.cy.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.cy.tsx index eae691dd8c..5c97e5d186 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.cy.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.cy.tsx @@ -1,7 +1,7 @@ import { ChainId, Checkout } from '@imtbl/checkout-sdk'; import { IMTBLWidgetEvents } from '@imtbl/checkout-widgets'; import { - describe, it, cy, context, + describe, it, cy, } from 'local-cypress'; import { mount } from 'cypress/react18'; import { Web3Provider } from '@ethersproject/providers'; @@ -39,51 +39,102 @@ describe('WalletWidget tests', () => { connectionStatus: ConnectionStatus.CONNECTED_WITH_NETWORK, }; - it('should show loading screen when component is mounted', () => { - const widgetConfig = { - theme: WidgetTheme.DARK, - environment: Environment.SANDBOX, - isBridgeEnabled: false, - isSwapEnabled: false, - isOnRampEnabled: false, - } as StrongCheckoutWidgetsConfig; - - const balanceStub = cy - .stub(Checkout.prototype, 'getBalance') - .as('balanceNoNetworkStub'); - balanceStub.rejects({}); - const connectStub = cy - .stub(Checkout.prototype, 'connect') - .as('connectNoNetworkStub'); - connectStub.resolves({ - provider: mockProvider, - network: { name: '' }, + describe('WalletWidget initialisation', () => { + it('should show loading screen when component is mounted', () => { + const widgetConfig = { + theme: WidgetTheme.DARK, + environment: Environment.SANDBOX, + isBridgeEnabled: false, + isSwapEnabled: false, + isOnRampEnabled: false, + } as StrongCheckoutWidgetsConfig; + + const balanceStub = cy + .stub(Checkout.prototype, 'getBalance') + .as('balanceNoNetworkStub'); + balanceStub.rejects({}); + const connectStub = cy + .stub(Checkout.prototype, 'connect') + .as('connectNoNetworkStub'); + connectStub.resolves({ + provider: mockProvider, + network: { name: '' }, + }); + cy.stub(Checkout.prototype, 'getNetworkInfo') + .as('getNetworkInfoStub') + .resolves({ + chainId: ChainId.SEPOLIA, + isSupported: true, + nativeCurrency: { + symbol: 'eth', + }, + }); + + mount( + + + , + ); + + cySmartGet('loading-view').should('be.visible'); + cySmartGet('wallet-balances').should('be.visible'); }); - cy.stub(Checkout.prototype, 'getNetworkInfo') - .as('getNetworkInfoStub') - .resolves({ - chainId: ChainId.SEPOLIA, - isSupported: true, - nativeCurrency: { - symbol: 'eth', - }, + + it('should show error view on error initialising and retry when try again pressed', () => { + const widgetConfig = { + theme: WidgetTheme.DARK, + environment: Environment.SANDBOX, + isBridgeEnabled: false, + isSwapEnabled: false, + isOnRampEnabled: false, + } as StrongCheckoutWidgetsConfig; + + const balanceStub = cy + .stub(Checkout.prototype, 'getBalance') + .as('balanceNoNetworkStub'); + balanceStub.rejects({}); + const connectStub = cy + .stub(Checkout.prototype, 'connect') + .as('connectNoNetworkStub'); + connectStub.resolves({ + provider: mockProvider, + network: { name: '' }, }); + cy.stub(Checkout.prototype, 'getNetworkInfo') + .as('getNetworkInfoStub') + .onFirstCall() + .rejects({}) + .onSecondCall() + .resolves({ + chainId: ChainId.SEPOLIA, + isSupported: true, + nativeCurrency: { + symbol: 'eth', + }, + }); - mount( - - - , - ); - - cySmartGet('loading-view').should('be.visible'); - cySmartGet('wallet-balances').should('be.visible'); + mount( + + + , + ); + + cySmartGet('error-view').should('be.visible'); + cySmartGet('footer-button').click(); + cySmartGet('error-view').should('not.exist'); + cySmartGet('wallet-balances').should('be.visible'); + }); }); - context('Connected Wallet', () => { + describe('Connected Wallet', () => { let getAllBalancesStub; beforeEach(() => { cy.stub(Checkout.prototype, 'connect') diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx index fd862db499..b6820714d7 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx @@ -29,6 +29,7 @@ import { WidgetTheme } from '../../lib'; import { CoinInfo } from './views/CoinInfo'; import { TopUpView } from '../../views/top-up/TopUpView'; import { ConnectLoaderContext } from '../../context/connect-loader-context/ConnectLoaderContext'; +import { text } from '../../resources/text/textConfig'; export interface WalletWidgetProps { config: StrongCheckoutWidgetsConfig, @@ -36,6 +37,8 @@ export interface WalletWidgetProps { export function WalletWidget(props: WalletWidgetProps) { const { config } = props; + const errorActionText = text.views[SharedViews.ERROR_VIEW].actionText; + const loadingText = text.views[SharedViews.LOADING_VIEW].text; const { environment, theme, isOnRampEnabled, isSwapEnabled, isBridgeEnabled, @@ -76,10 +79,10 @@ export function WalletWidget(props: WalletWidgetProps) { }); }, [isBridgeEnabled, isSwapEnabled, isOnRampEnabled, environment]); - useEffect(() => { - (async () => { - if (!checkout || !provider) return; + const initialiseWallet = async () => { + if (!checkout || !provider) return; + try { const network = await checkout.getNetworkInfo({ provider, }); @@ -103,13 +106,34 @@ export function WalletWidget(props: WalletWidgetProps) { view: { type: WalletWidgetViews.WALLET_BALANCES }, }, }); + } catch (error: any) { + viewDispatch({ + payload: { + type: ViewActions.UPDATE_VIEW, + view: { + type: SharedViews.ERROR_VIEW, + error, + }, + }, + }); + } + }; + + useEffect(() => { + if (!checkout || !provider) return; + (async () => { + initialiseWallet(); })(); }, [checkout, provider]); - const errorAction = () => { - // TODO: please remove or if necessary keep the eslint ignore - // eslint-disable-next-line no-console - console.log('Something went wrong'); + const errorAction = async () => { + viewDispatch({ + payload: { + type: ViewActions.UPDATE_VIEW, + view: { type: WalletWidgetViews.WALLET_BALANCES }, + }, + }); + await initialiseWallet(); }; return ( @@ -118,7 +142,7 @@ export function WalletWidget(props: WalletWidgetProps) { {viewState.view.type === SharedViews.LOADING_VIEW && ( - + )} {viewState.view.type === WalletWidgetViews.WALLET_BALANCES && ( @@ -129,7 +153,7 @@ export function WalletWidget(props: WalletWidgetProps) { )} {viewState.view.type === SharedViews.ERROR_VIEW && ( diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx index f44bcff40c..6b87370e7b 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx @@ -112,19 +112,23 @@ export function WalletBalances() { return; } - const { gasFee } = await checkout.gasEstimate({ - gasEstimateType: GasEstimateType.BRIDGE_TO_L2, - isSpendingCapApprovalRequired: false, - }); + try { + const { gasFee } = await checkout.gasEstimate({ + gasEstimateType: GasEstimateType.BRIDGE_TO_L2, + isSpendingCapApprovalRequired: false, + }); + + if (!gasFee.estimatedAmount) { + setInsufficientFundsForBridgeToL2Gas(false); + return; + } - if (!gasFee.estimatedAmount) { + setInsufficientFundsForBridgeToL2Gas( + gasFee.estimatedAmount.gt(utils.parseUnits(ethBalance.balance, DEFAULT_TOKEN_DECIMALS)), + ); + } catch { setInsufficientFundsForBridgeToL2Gas(false); - return; } - - setInsufficientFundsForBridgeToL2Gas( - gasFee.estimatedAmount.gt(utils.parseUnits(ethBalance.balance, DEFAULT_TOKEN_DECIMALS)), - ); }; bridgeToL2GasCheck(); }, [tokenBalances, checkout, network]); From d5aa8ae43e1e1c934dd54fdd748e17278748a599 Mon Sep 17 00:00:00 2001 From: "Carmen(Jia) Liu" Date: Mon, 31 Jul 2023 15:20:35 +0800 Subject: [PATCH 3/9] Change the height for popup[NO-CHANGELOG] (#618) --- packages/passport/sdk/src/zkEvm/sendTransaction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/passport/sdk/src/zkEvm/sendTransaction.ts b/packages/passport/sdk/src/zkEvm/sendTransaction.ts index eb9d8f2f20..26e0fbd3a6 100644 --- a/packages/passport/sdk/src/zkEvm/sendTransaction.ts +++ b/packages/passport/sdk/src/zkEvm/sendTransaction.ts @@ -32,7 +32,7 @@ export const sendTransaction = async ({ config, user, }: EthSendTransactionParams): Promise => { - const popupWindowSize = { width: 480, height: 580 }; + const popupWindowSize = { width: 480, height: 520 }; guardianClient.loading(popupWindowSize); const transactionRequest: TransactionRequest = params[0]; From 57161b66b221a5d12f0fd91490c097723ce0afc4 Mon Sep 17 00:00:00 2001 From: Pano Skylakis <49353965+pano-skylakis@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:50:52 +1200 Subject: [PATCH 4/9] [NOJIRA][NO-CHANGELOG] Rename test utils file, add coverage to gitignore (#622) Co-authored-by: Pano Skylakis --- .gitignore | 1 + packages/internal/dex/sdk/src/config/config.test.ts | 2 +- .../dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts | 2 +- .../dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts | 2 +- packages/internal/dex/sdk/src/lib/getQuotesForRoutes.test.ts | 2 +- packages/internal/dex/sdk/src/lib/multicall.test.ts | 2 +- .../src/lib/poolUtils/ensureCorrectERC20AddressOrder.test.ts | 2 +- .../internal/dex/sdk/src/lib/poolUtils/fetchValidPools.test.ts | 2 +- .../dex/sdk/src/lib/poolUtils/generateERC20Pairs.test.ts | 2 +- .../lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.ts | 2 +- .../internal/dex/sdk/src/lib/transactionUtils/approval.test.ts | 2 +- packages/internal/dex/sdk/src/lib/transactionUtils/gas.test.ts | 2 +- packages/internal/dex/sdk/src/lib/utils.test.ts | 2 +- .../dex/sdk/src/{utils/testUtils.test.ts => test/utils.test.ts} | 2 +- .../internal/dex/sdk/src/{utils/testUtils.ts => test/utils.ts} | 0 15 files changed, 14 insertions(+), 13 deletions(-) rename packages/internal/dex/sdk/src/{utils/testUtils.test.ts => test/utils.test.ts} (95%) rename packages/internal/dex/sdk/src/{utils/testUtils.ts => test/utils.ts} (100%) diff --git a/.gitignore b/.gitignore index 2e338b3496..b4cc3fc183 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ dist/ +coverage/ .idea/ .DS_Store .vscode diff --git a/packages/internal/dex/sdk/src/config/config.test.ts b/packages/internal/dex/sdk/src/config/config.test.ts index 11c4a90dd4..08b440cb4b 100644 --- a/packages/internal/dex/sdk/src/config/config.test.ts +++ b/packages/internal/dex/sdk/src/config/config.test.ts @@ -1,6 +1,6 @@ import { Environment, ImmutableConfiguration } from '@imtbl/config'; import { ChainNotSupportedError, InvalidConfigurationError } from 'errors'; -import * as test from 'utils/testUtils'; +import * as test from 'test/utils'; import { ExchangeModuleConfiguration, ExchangeOverrides, TokenInfo } from '../types'; import { ExchangeConfiguration, ExchangeContracts } from './index'; import { IMMUTABLE_TESTNET_CHAIN_ID } from '../constants/chains'; diff --git a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts index 0582b86732..77cd8412ef 100644 --- a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts +++ b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts @@ -17,7 +17,7 @@ import { TEST_GAS_PRICE, IMX_TEST_TOKEN, TEST_TRANSACTION_GAS_USAGE, -} from './utils/testUtils'; +} from './test/utils'; import { Router } from './lib'; jest.mock('@ethersproject/providers'); diff --git a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts index ec08af9e97..5732989cff 100644 --- a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts +++ b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts @@ -10,7 +10,7 @@ import { TEST_PERIPHERY_ROUTER_ADDRESS, TEST_DEX_CONFIGURATION, TEST_GAS_PRICE, -} from './utils/testUtils'; +} from './test/utils'; jest.mock('@ethersproject/providers'); jest.mock('@ethersproject/contracts'); diff --git a/packages/internal/dex/sdk/src/lib/getQuotesForRoutes.test.ts b/packages/internal/dex/sdk/src/lib/getQuotesForRoutes.test.ts index 4f57593b3b..3600647e58 100644 --- a/packages/internal/dex/sdk/src/lib/getQuotesForRoutes.test.ts +++ b/packages/internal/dex/sdk/src/lib/getQuotesForRoutes.test.ts @@ -12,7 +12,7 @@ import { TEST_QUOTER_ADDRESS, TEST_RPC_URL, WETH_TEST_TOKEN, -} from '../utils/testUtils'; +} from '../test/utils'; import { Multicall__factory } from '../contracts/types'; jest.mock('@ethersproject/contracts'); diff --git a/packages/internal/dex/sdk/src/lib/multicall.test.ts b/packages/internal/dex/sdk/src/lib/multicall.test.ts index d838d48ba4..3a269a059d 100644 --- a/packages/internal/dex/sdk/src/lib/multicall.test.ts +++ b/packages/internal/dex/sdk/src/lib/multicall.test.ts @@ -15,7 +15,7 @@ import { TEST_V3_CORE_FACTORY_ADDRESS, USDC_TEST_TOKEN, WETH_TEST_TOKEN, -} from '../utils/testUtils'; +} from '../test/utils'; import { Multicall__factory } from '../contracts/types'; import { DEFAULT_GAS_QUOTE } from './getQuotesForRoutes'; diff --git a/packages/internal/dex/sdk/src/lib/poolUtils/ensureCorrectERC20AddressOrder.test.ts b/packages/internal/dex/sdk/src/lib/poolUtils/ensureCorrectERC20AddressOrder.test.ts index f1fa4514dc..8bac6b10d1 100644 --- a/packages/internal/dex/sdk/src/lib/poolUtils/ensureCorrectERC20AddressOrder.test.ts +++ b/packages/internal/dex/sdk/src/lib/poolUtils/ensureCorrectERC20AddressOrder.test.ts @@ -1,4 +1,4 @@ -import { IMX_TEST_TOKEN, WETH_TEST_TOKEN } from 'utils/testUtils'; +import { IMX_TEST_TOKEN, WETH_TEST_TOKEN } from 'test/utils'; import { ensureCorrectERC20AddressOrder } from './computePoolAddress'; import { ERC20Pair } from './generateERC20Pairs'; diff --git a/packages/internal/dex/sdk/src/lib/poolUtils/fetchValidPools.test.ts b/packages/internal/dex/sdk/src/lib/poolUtils/fetchValidPools.test.ts index fb4bffccc1..a64e5df06c 100644 --- a/packages/internal/dex/sdk/src/lib/poolUtils/fetchValidPools.test.ts +++ b/packages/internal/dex/sdk/src/lib/poolUtils/fetchValidPools.test.ts @@ -12,7 +12,7 @@ import { TEST_RPC_URL, TEST_V3_CORE_FACTORY_ADDRESS, WETH_TEST_TOKEN, -} from '../../utils/testUtils'; +} from '../../test/utils'; jest.mock('@ethersproject/contracts'); diff --git a/packages/internal/dex/sdk/src/lib/poolUtils/generateERC20Pairs.test.ts b/packages/internal/dex/sdk/src/lib/poolUtils/generateERC20Pairs.test.ts index f3784bae79..65bd6f2f01 100644 --- a/packages/internal/dex/sdk/src/lib/poolUtils/generateERC20Pairs.test.ts +++ b/packages/internal/dex/sdk/src/lib/poolUtils/generateERC20Pairs.test.ts @@ -6,7 +6,7 @@ import { USDC_TEST_TOKEN, WETH_TEST_TOKEN, uniqBy, -} from '../../utils/testUtils'; +} from '../../test/utils'; import { ensureCorrectERC20AddressOrder } from './computePoolAddress'; // TI TO [] = [TI / TO] diff --git a/packages/internal/dex/sdk/src/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.ts b/packages/internal/dex/sdk/src/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.ts index b8024beb9d..0297b678a0 100644 --- a/packages/internal/dex/sdk/src/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.ts +++ b/packages/internal/dex/sdk/src/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.ts @@ -7,7 +7,7 @@ import { USDC_TEST_TOKEN, WETH_TEST_TOKEN, uniqBy, -} from '../../utils/testUtils'; +} from '../../test/utils'; describe('generatePoolsFromTokenPairs', () => { describe('when given one TokenPair and one CommonRoutingTokens', () => { diff --git a/packages/internal/dex/sdk/src/lib/transactionUtils/approval.test.ts b/packages/internal/dex/sdk/src/lib/transactionUtils/approval.test.ts index 17763d83f8..ec13842432 100644 --- a/packages/internal/dex/sdk/src/lib/transactionUtils/approval.test.ts +++ b/packages/internal/dex/sdk/src/lib/transactionUtils/approval.test.ts @@ -1,6 +1,6 @@ import { JsonRpcProvider } from '@ethersproject/providers'; import { BigNumber } from '@ethersproject/bignumber'; -import { TEST_FROM_ADDRESS, TEST_PERIPHERY_ROUTER_ADDRESS, WETH_TEST_TOKEN } from 'utils/testUtils'; +import { TEST_FROM_ADDRESS, TEST_PERIPHERY_ROUTER_ADDRESS, WETH_TEST_TOKEN } from 'test/utils'; import { Contract } from '@ethersproject/contracts'; import { ERC20__factory } from 'contracts/types/factories/ERC20__factory'; import { ApproveError } from 'errors'; diff --git a/packages/internal/dex/sdk/src/lib/transactionUtils/gas.test.ts b/packages/internal/dex/sdk/src/lib/transactionUtils/gas.test.ts index b82910b365..4532bd5d2f 100644 --- a/packages/internal/dex/sdk/src/lib/transactionUtils/gas.test.ts +++ b/packages/internal/dex/sdk/src/lib/transactionUtils/gas.test.ts @@ -1,6 +1,6 @@ import { JsonRpcProvider } from '@ethersproject/providers'; import { BigNumber } from '@ethersproject/bignumber'; -import { TEST_CHAIN_ID, TEST_RPC_URL } from 'utils/testUtils'; +import { TEST_CHAIN_ID, TEST_RPC_URL } from 'test/utils'; import { calculateGasFee, fetchGasPrice } from './gas'; jest.mock('@ethersproject/providers'); diff --git a/packages/internal/dex/sdk/src/lib/utils.test.ts b/packages/internal/dex/sdk/src/lib/utils.test.ts index 588277c61c..229529a21c 100644 --- a/packages/internal/dex/sdk/src/lib/utils.test.ts +++ b/packages/internal/dex/sdk/src/lib/utils.test.ts @@ -1,5 +1,5 @@ import { ethers } from 'ethers'; -import { TEST_FROM_ADDRESS } from 'utils/testUtils'; +import { TEST_FROM_ADDRESS } from 'test/utils'; import { isValidNonZeroAddress } from './utils'; describe('utils', () => { diff --git a/packages/internal/dex/sdk/src/utils/testUtils.test.ts b/packages/internal/dex/sdk/src/test/utils.test.ts similarity index 95% rename from packages/internal/dex/sdk/src/utils/testUtils.test.ts rename to packages/internal/dex/sdk/src/test/utils.test.ts index 4c65ac6f09..045e4bbfed 100644 --- a/packages/internal/dex/sdk/src/utils/testUtils.test.ts +++ b/packages/internal/dex/sdk/src/test/utils.test.ts @@ -1,4 +1,4 @@ -import { uniqBy } from './testUtils'; +import { uniqBy } from './utils'; describe('uniqBy', () => { describe('when given an array of numbers with Math.floor func', () => { diff --git a/packages/internal/dex/sdk/src/utils/testUtils.ts b/packages/internal/dex/sdk/src/test/utils.ts similarity index 100% rename from packages/internal/dex/sdk/src/utils/testUtils.ts rename to packages/internal/dex/sdk/src/test/utils.ts From 976bb3fd572783082f3e54ea327ab56855b16e00 Mon Sep 17 00:00:00 2001 From: Pano Skylakis <49353965+pano-skylakis@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:27:56 +1200 Subject: [PATCH 5/9] [TP-1309][NO-CHANGELOG] Generate calldata for secondary fee swaps (#615) Co-authored-by: Pano Skylakis Co-authored-by: Benjamin Patch Co-authored-by: Keith Broughton --- packages/internal/dex/sdk/jest.config.ts | 1 + .../dex/sdk/src/config/config.test.ts | 40 +- packages/internal/dex/sdk/src/config/index.ts | 42 +- .../internal/dex/sdk/src/constants/index.ts | 2 +- .../internal/dex/sdk/src/constants/router.ts | 7 + .../internal/dex/sdk/src/constants/rpc.ts | 1 - .../sdk/src/contracts/ABIs/SecondaryFee.json | 6546 ++++++++++------- .../sdk/src/contracts/types/SecondaryFee.ts | 75 + .../types/factories/SecondaryFee__factory.ts | 45 +- ...ange.getUnsignedSwapTxFromAmountIn.test.ts | 150 +- ...nge.getUnsignedSwapTxFromAmountOut.test.ts | 24 +- packages/internal/dex/sdk/src/exchange.ts | 10 +- packages/internal/dex/sdk/src/lib/router.ts | 1 + .../dex/sdk/src/lib/transactionUtils/swap.ts | 182 +- .../internal/dex/sdk/src/lib/utils.test.ts | 2 +- packages/internal/dex/sdk/src/test/utils.ts | 233 +- packages/internal/dex/sdk/src/types/index.ts | 2 +- 17 files changed, 4551 insertions(+), 2812 deletions(-) delete mode 100644 packages/internal/dex/sdk/src/constants/rpc.ts diff --git a/packages/internal/dex/sdk/jest.config.ts b/packages/internal/dex/sdk/jest.config.ts index cd525c2210..25b4f2e853 100644 --- a/packages/internal/dex/sdk/jest.config.ts +++ b/packages/internal/dex/sdk/jest.config.ts @@ -9,6 +9,7 @@ const config: Config = { transform: { '^.+\\.(t|j)sx?$': '@swc/jest', }, + coveragePathIgnorePatterns:['node_modules', 'src/contracts/', 'src/test/'], transformIgnorePatterns: [], }; diff --git a/packages/internal/dex/sdk/src/config/config.test.ts b/packages/internal/dex/sdk/src/config/config.test.ts index 08b440cb4b..56be7cade2 100644 --- a/packages/internal/dex/sdk/src/config/config.test.ts +++ b/packages/internal/dex/sdk/src/config/config.test.ts @@ -24,6 +24,7 @@ describe('ExchangeConfiguration', () => { coreFactory: test.TEST_V3_CORE_FACTORY_ADDRESS, quoterV2: test.TEST_QUOTER_ADDRESS, peripheryRouter: test.TEST_PERIPHERY_ROUTER_ADDRESS, + secondaryFee: test.TEST_SECONDARY_FEE_ADDRESS, }; describe('when given sandbox environment with supported chain id', () => { @@ -107,12 +108,12 @@ describe('ExchangeConfiguration', () => { exchangeContracts: contractOverrides, commonRoutingTokens, nativeToken: test.IMX_TEST_TOKEN, - secondaryFees, }; const config = new ExchangeConfiguration({ - chainId, baseConfig: immutableConfig, + chainId, + secondaryFees, overrides, }); @@ -155,6 +156,7 @@ describe('ExchangeConfiguration', () => { coreFactory: test.TEST_V3_CORE_FACTORY_ADDRESS, quoterV2: test.TEST_QUOTER_ADDRESS, peripheryRouter: test.TEST_PERIPHERY_ROUTER_ADDRESS, + secondaryFee: test.TEST_SECONDARY_FEE_ADDRESS, }; const rpcURL = 'https://anrpcurl.net'; @@ -212,12 +214,12 @@ describe('ExchangeConfiguration', () => { exchangeContracts: contractOverrides, commonRoutingTokens: commonRoutingTokensSingle, nativeToken: test.IMX_TEST_TOKEN, - secondaryFees, }; expect(() => new ExchangeConfiguration({ - chainId, baseConfig: immutableConfig, + chainId, + secondaryFees, overrides, })).toThrow(new InvalidConfigurationError( `Invalid secondary fee recipient address: ${secondaryFees[0].feeRecipient}`, @@ -231,28 +233,52 @@ describe('ExchangeConfiguration', () => { environment: Environment.SANDBOX, }); // environment isn't used because we override all of the config values - const secondaryFees = [ + const secondaryFeesOneRecipient = [ { feeRecipient: dummyFeeRecipient, feeBasisPoints: 10001, }, ]; + const secondaryFeesMultipleRecipients = [ + { + feeRecipient: dummyFeeRecipient, + feeBasisPoints: 5000, + }, + { + feeRecipient: dummyFeeRecipient, + feeBasisPoints: 5000, + }, + { + feeRecipient: dummyFeeRecipient, + feeBasisPoints: 1000, + }, + ]; + const rpcURL = 'https://anrpcurl.net'; const overrides: ExchangeOverrides = { rpcURL, exchangeContracts: contractOverrides, commonRoutingTokens: commonRoutingTokensSingle, nativeToken: test.IMX_TEST_TOKEN, - secondaryFees, }; expect(() => new ExchangeConfiguration({ + baseConfig: immutableConfig, chainId, + secondaryFees: secondaryFeesOneRecipient, + overrides, + })).toThrow(new InvalidConfigurationError( + `Invalid secondary fee basis points: ${secondaryFeesOneRecipient[0].feeBasisPoints}`, + )); + + expect(() => new ExchangeConfiguration({ baseConfig: immutableConfig, + chainId, + secondaryFees: secondaryFeesMultipleRecipients, overrides, })).toThrow(new InvalidConfigurationError( - `Invalid secondary fee percentage: ${secondaryFees[0].feeBasisPoints}`, + 'Invalid total secondary fee basis points: 11000', )); }); diff --git a/packages/internal/dex/sdk/src/config/index.ts b/packages/internal/dex/sdk/src/config/index.ts index 83ef12c27e..7a5a8ef4cc 100644 --- a/packages/internal/dex/sdk/src/config/index.ts +++ b/packages/internal/dex/sdk/src/config/index.ts @@ -1,15 +1,21 @@ import { Environment, ImmutableConfiguration } from '@imtbl/config'; -import { IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS, TIMX_IMMUTABLE_TESTNET } from 'constants/tokens'; import { ChainNotSupportedError, InvalidConfigurationError } from 'errors'; -import { IMMUTABLE_TESTNET_CHAIN_ID, IMMUTABLE_TESTNET_RPC_URL } from 'constants/chains'; import { SecondaryFee, isValidNonZeroAddress } from 'lib'; import { Chain, ExchangeModuleConfiguration, ExchangeOverrides } from '../types'; +import { + IMMUTABLE_TESTNET_CHAIN_ID, + IMMUTABLE_TESTNET_COMMON_ROUTING_TOKENS, + IMMUTABLE_TESTNET_RPC_URL, + MAX_SECONDARY_FEE_BASIS_POINTS, + TIMX_IMMUTABLE_TESTNET, +} from '../constants'; export type ExchangeContracts = { multicall: string; coreFactory: string; quoterV2: string; peripheryRouter: string; + secondaryFee: string; }; export const CONTRACTS_FOR_CHAIN_ID: Record = { @@ -18,6 +24,7 @@ export const CONTRACTS_FOR_CHAIN_ID: Record = { coreFactory: '0x12739A8f1A8035F439092D016DAE19A2874F30d2', quoterV2: '0xF674847fBcca5C80315e3AE37043Dce99F6CC529', peripheryRouter: '0x0Afe6F5f4DC34461A801420634239FFaD50A2e44', + secondaryFee: '0x8dBE1f0900C5e92ad87A54521902a33ba1598C51', }, }; @@ -51,18 +58,24 @@ function validateOverrides(overrides: ExchangeOverrides) { throw new InvalidConfigurationError(`Invalid exchange contract address for ${key}`); } }); +} - if (!overrides.secondaryFees) { - return; - } +function validateSecondaryFees(secondaryFees: SecondaryFee[]) { + let totalSecondaryFeeBasisPoints = 0; - for (const secondaryFee of overrides.secondaryFees) { + for (const secondaryFee of secondaryFees) { if (!isValidNonZeroAddress(secondaryFee.feeRecipient)) { throw new InvalidConfigurationError(`Invalid secondary fee recipient address: ${secondaryFee.feeRecipient}`); } - if (secondaryFee.feeBasisPoints < 0 || secondaryFee.feeBasisPoints > 10000) { - throw new InvalidConfigurationError(`Invalid secondary fee percentage: ${secondaryFee.feeBasisPoints}`); + if (secondaryFee.feeBasisPoints < 0 || secondaryFee.feeBasisPoints > MAX_SECONDARY_FEE_BASIS_POINTS) { + throw new InvalidConfigurationError(`Invalid secondary fee basis points: ${secondaryFee.feeBasisPoints}`); } + + totalSecondaryFeeBasisPoints += secondaryFee.feeBasisPoints; + } + + if (totalSecondaryFeeBasisPoints > MAX_SECONDARY_FEE_BASIS_POINTS) { + throw new InvalidConfigurationError(`Invalid total secondary fee basis points: ${totalSecondaryFeeBasisPoints}`); } } @@ -70,16 +83,22 @@ function validateOverrides(overrides: ExchangeOverrides) { * {@link ExchangeConfiguration} is used to configure the {@link Exchange} class. * @param chainId the ID of the chain to configure. {@link SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT} contains the supported chains for each environment. * @param baseConfig the base {@link ImmutableConfiguration} for the {@link Exchange} class + * @param secondaryFees an optional array of {@link SecondaryFee}s to apply to all transactions. Total secondary fees must be less than {@link MAX_SECONDARY_FEE_BASIS_POINTS}. */ export class ExchangeConfiguration { public baseConfig: ImmutableConfiguration; public chain: Chain; - public secondaryFees: SecondaryFee[]; + public secondaryFees: SecondaryFee[] = []; - constructor({ chainId, baseConfig, overrides }: ExchangeModuleConfiguration) { + constructor({ + chainId, baseConfig, secondaryFees, overrides, + }: ExchangeModuleConfiguration) { this.baseConfig = baseConfig; + this.secondaryFees = secondaryFees || []; + + validateSecondaryFees(this.secondaryFees); if (overrides) { validateOverrides(overrides); @@ -91,11 +110,10 @@ export class ExchangeConfiguration { nativeToken: overrides.nativeToken, }; - this.secondaryFees = overrides.secondaryFees ? overrides.secondaryFees : []; + this.secondaryFees = secondaryFees || []; return; } - this.secondaryFees = []; const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId]; if (!chain) { diff --git a/packages/internal/dex/sdk/src/constants/index.ts b/packages/internal/dex/sdk/src/constants/index.ts index 844437f843..0a1467b6b2 100644 --- a/packages/internal/dex/sdk/src/constants/index.ts +++ b/packages/internal/dex/sdk/src/constants/index.ts @@ -1,3 +1,3 @@ -export * from './rpc'; export * from './tokens'; export * from './router'; +export * from './chains'; diff --git a/packages/internal/dex/sdk/src/constants/router.ts b/packages/internal/dex/sdk/src/constants/router.ts index 4eff8dfb1a..2bc1d36e31 100644 --- a/packages/internal/dex/sdk/src/constants/router.ts +++ b/packages/internal/dex/sdk/src/constants/router.ts @@ -1,10 +1,17 @@ // 0.1% default slippage export const DEFAULT_SLIPPAGE = 0.1; + // 15 minutes from the current Unix time export const DEFAULT_DEADLINE: number = Math.floor(Date.now() / 1000) + 60 * 15; + // most swaps will be able to resolve with 2 hops export const DEFAULT_MAX_HOPS: number = 2; + // after 10 hops, it is very unlikely a route will be available export const MAX_MAX_HOPS: number = 10; + // a max hop of 1 will require a direct swap with no intermediary pools export const MIN_MAX_HOPS: number = 1; + +// 10% maximum secondary fee +export const MAX_SECONDARY_FEE_BASIS_POINTS = 10000; diff --git a/packages/internal/dex/sdk/src/constants/rpc.ts b/packages/internal/dex/sdk/src/constants/rpc.ts deleted file mode 100644 index aff4052eac..0000000000 --- a/packages/internal/dex/sdk/src/constants/rpc.ts +++ /dev/null @@ -1 +0,0 @@ -export const POLYGON_ZKEVM_TESTNET_RPC_URL = 'https://rpc.public.zkevm-test.net'; diff --git a/packages/internal/dex/sdk/src/contracts/ABIs/SecondaryFee.json b/packages/internal/dex/sdk/src/contracts/ABIs/SecondaryFee.json index a15ae6bcab..097362f39e 100644 --- a/packages/internal/dex/sdk/src/contracts/ABIs/SecondaryFee.json +++ b/packages/internal/dex/sdk/src/contracts/ABIs/SecondaryFee.json @@ -375,6 +375,49 @@ "stateMutability": "payable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "owner", @@ -450,13 +493,13 @@ } ], "bytecode": { - "object": "0x608060405234801561001057600080fd5b5060405162001c6d38038062001c6d833981016040819052610031916100bc565b61003a3361006c565b6000805460ff60a01b19169055600180546001600160a01b0319166001600160a01b03929092169190911790556100ec565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100ce57600080fd5b81516001600160a01b03811681146100e557600080fd5b9392505050565b611b7180620000fc6000396000f3fe6080604052600436106100c25760003560e01c8063735de9f71161007f5780638da5cb5b116100595780638da5cb5b146101df578063d9a6f705146101fd578063ed921d3c14610213578063f2fde38b1461022657600080fd5b8063735de9f71461017f578063742ac944146101b75780638456cb59146101ca57600080fd5b80631411734e146100c757806314d90e1b146100ed5780631fd168ff146101165780633f4ba83a146101295780635c975abb14610140578063715018a61461016a575b600080fd5b6100da6100d5366004611744565b610246565b6040519081526020015b60405180910390f35b3480156100f957600080fd5b506101036103e881565b60405161ffff90911681526020016100e4565b6100da610124366004611744565b6103a4565b34801561013557600080fd5b5061013e610514565b005b34801561014c57600080fd5b50600054600160a01b900460ff1660405190151581526020016100e4565b34801561017657600080fd5b5061013e610526565b34801561018b57600080fd5b5060015461019f906001600160a01b031681565b6040516001600160a01b0390911681526020016100e4565b6100da6101c5366004611840565b610538565b3480156101d657600080fd5b5061013e610675565b3480156101eb57600080fd5b506000546001600160a01b031661019f565b34801561020957600080fd5b5061010361271081565b6100da610221366004611840565b610685565b34801561023257600080fd5b5061013e610241366004611896565b6107ad565b60208101516000906001600160a01b03163314801590610273575060208201516001600160a01b03163014155b156102995760405162461bcd60e51b8152600401610290906118ba565b60405180910390fd5b60006102a88360000151610826565b905060008061031383866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610309576102fa60408302860136819003810190611907565b815260200190600101906102dd565b5050505050610838565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103569088906004016119ea565b6020604051808303816000875af1158015610375573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039991906119fd565b979650505050505050565b604081015181516000919082906103ba90610919565b905060006103cb8560000151610826565b905060008060008061043e868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b828210156104345761042560408302860136819003810190611907565b81526020019060010190610408565b505050505061094f565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016104af91906119ea565b6020604051808303816000875af11580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906119fd565b97506105068787878c604001518587610a30565b505050505050509392505050565b61051c610c73565b610524610ccd565b565b61052e610c73565b6105246000610d22565b60608101516000906001600160a01b03163314801590610565575060608201516001600160a01b03163014155b156105825760405162461bcd60e51b8152600401610290906118ba565b6000806105e58460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b82821015610309576105d660408302860136819003810190611907565b815260200190600101906105b9565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf90610628908790600401611a16565b6020604051808303816000875af1158015610647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066b91906119fd565b9695505050505050565b61067d610c73565b610524610d72565b600080826080015190506000806000806106fa87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b82821015610434576106eb60408302860136819003810190611907565b815260200190600101906106ce565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df90610742908a90600401611a16565b6020604051808303816000875af1158015610761573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078591906119fd565b95506107a185886000015189602001518a608001518587610a30565b50505050509392505050565b6107b5610c73565b6001600160a01b03811661081a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610290565b61082381610d22565b50565b60006108328282610db5565b92915050565b600080548190600160a01b900460ff16610877576000806108598786610e1a565b90925090506108688288611a8b565b96506108748882610ff8565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af11580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee9190611a9e565b506108f98686611173565b306001600160a01b0385160361090d573393505b50929491935090915050565b6000806014835161092a9190611a8b565b9050600061093a8483601461126a565b9050610947816000610db5565b949350505050565b600080606081808261096b60005460ff600160a01b9091041690565b61098b576109798988610e1a565b9092509050610988828a611ac0565b98505b6001600160a01b038816301461099f573097505b6109a98b8b611173565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af11580156109fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a209190611a9e565b50979a9699509697505050505050565b600054600160a01b900460ff16610a4b57610a4b8482611377565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab691906119fd565b9050610ac28385611a8b565b811015610b115760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e742064697374726962757465646044820152606401610290565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b829190611a9e565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee91906119fd565b90508015610c695760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610c43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c679190611a9e565b505b5050505050505050565b6000546001600160a01b031633146105245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610290565b610cd56114e6565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610d7a611536565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d053390565b6000610dc2826014611ac0565b83511015610e0a5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610290565b500160200151600160601b900490565b6000606081805b8451811015610e6b57848181518110610e3c57610e3c611ad3565b60200260200101516020015161ffff1682610e579190611ac0565b915080610e6381611ae9565b915050610e21565b506103e8811115610ebe5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f4645450000006044820152606401610290565b600080855167ffffffffffffffff811115610edb57610edb6115c8565b604051908082528060200260200182016040528015610f2057816020015b6040805180820190915260008082526020820152815260200190600190039081610ef95790505b50905060005b8651811015610fe957600061271061ffff16888381518110610f4a57610f4a611ad3565b60200260200101516020015161ffff168a610f659190611b02565b610f6f9190611b19565b90506040518060400160405280898481518110610f8e57610f8e611ad3565b6020026020010151600001516001600160a01b0316815260200182815250838381518110610fbe57610fbe611ad3565b6020908102919091010152610fd38185611ac0565b9350508080610fe190611ae9565b915050610f26565b509093509150505b9250929050565b60005b815181101561116e57826001600160a01b03166323b872dd3384848151811061102657611026611ad3565b60200260200101516000015185858151811061104457611044611ad3565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af11580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca9190611a9e565b508181815181106110dd576110dd611ad3565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061113957611139611ad3565b60200260200101516020015160405161115491815260200190565b60405180910390a48061116681611ae9565b915050610ffb565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa1580156111c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e891906119fd565b10156112665760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611242573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190611a9e565b5050565b60608161127881601f611ac0565b10156112b75760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610290565b6112c18284611ac0565b845110156113055760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610290565b606082158015611324576040519150600082526020820160405261136e565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561135d578051835260209283019201611345565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561116e57826001600160a01b031663a9059cbb8383815181106113a4576113a4611ad3565b6020026020010151600001518484815181106113c2576113c2611ad3565b6020026020010151602001516040518363ffffffff1660e01b81526004016113ff9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af115801561141e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114429190611a9e565b5081818151811061145557611455611ad3565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106114b1576114b1611ad3565b6020026020010151602001516040516114cc91815260200190565b60405180910390a4806114de81611ae9565b91505061137a565b600054600160a01b900460ff166105245760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610290565b600054600160a01b900460ff16156105245760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610290565b60008083601f84011261159557600080fd5b50813567ffffffffffffffff8111156115ad57600080fd5b6020830191508360208260061b8501011115610ff157600080fd5b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715611601576116016115c8565b60405290565b60405160e0810167ffffffffffffffff81118282101715611601576116016115c8565b604051601f8201601f1916810167ffffffffffffffff81118282101715611653576116536115c8565b604052919050565b6001600160a01b038116811461082357600080fd5b803561167b8161165b565b919050565b60006080828403121561169257600080fd5b61169a6115de565b9050813567ffffffffffffffff808211156116b457600080fd5b818401915084601f8301126116c857600080fd5b81356020828211156116dc576116dc6115c8565b6116ee601f8301601f1916820161162a565b9250818352868183860101111561170457600080fd5b81818501828501376000818385010152828552611722818701611670565b8186015250505050604082013560408201526060820135606082015292915050565b60008060006040848603121561175957600080fd5b833567ffffffffffffffff8082111561177157600080fd5b61177d87838801611583565b9095509350602086013591508082111561179657600080fd5b506117a386828701611680565b9150509250925092565b600060e082840312156117bf57600080fd5b6117c7611607565b905081356117d48161165b565b815260208201356117e48161165b565b6020820152604082013562ffffff811681146117ff57600080fd5b604082015261181060608301611670565b60608201526080820135608082015260a082013560a082015261183560c08301611670565b60c082015292915050565b6000806000610100848603121561185657600080fd5b833567ffffffffffffffff81111561186d57600080fd5b61187986828701611583565b909450925061188d905085602086016117ad565b90509250925092565b6000602082840312156118a857600080fd5b81356118b38161165b565b9392505050565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b60006040828403121561191957600080fd5b6040516040810181811067ffffffffffffffff8211171561193c5761193c6115c8565b604052823561194a8161165b565b8152602083013561ffff8116811461196157600080fd5b60208201529392505050565b6000815160808452805180608086015260005b8181101561199d57602081840181015160a0888401015201611980565b50600060a08287010152602084015191506119c360208601836001600160a01b03169052565b60408481015190860152606093840151938501939093525050601f01601f19160160a00190565b6020815260006118b3602083018461196d565b600060208284031215611a0f57600080fd5b5051919050565b60e08101610832828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052601160045260246000fd5b8181038181111561083257610832611a75565b600060208284031215611ab057600080fd5b815180151581146118b357600080fd5b8082018082111561083257610832611a75565b634e487b7160e01b600052603260045260246000fd5b600060018201611afb57611afb611a75565b5060010190565b808202811582820484141761083257610832611a75565b600082611b3657634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220ace639a098395b7bea514c42166a1e5a567128581e5b4dad8d6cc013080bd70964736f6c63430008130033", - "sourceMap": "480:14464:35:-:0;;;1134:90;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;936:32:17;719:10:22;936:18:17;:32::i;:::-;1006:5:18;996:15;;-1:-1:-1;;;;996:15:18;;;-1:-1:-1;1176:41:35;;-1:-1:-1;;;;;;1176:41:35;-1:-1:-1;;;;;1176:41:35;;;;;;;;;;480:14464;;2426:187:17;2499:16;2518:6;;-1:-1:-1;;;;;2534:17:17;;;-1:-1:-1;;;;;;2534:17:17;;;;;;2566:40;;2518:6;;;;;;;2566:40;;2499:16;2566:40;2489:124;2426:187;:::o;14:290:44:-;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:44;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:44:o;:::-;480:14464:35;;;;;;", + "object": "0x60806040523480156200001157600080fd5b5060405162002123380380620021238339810160408190526200003491620000c2565b6200003f3362000072565b6000805460ff60a01b19169055600180546001600160a01b0319166001600160a01b0392909216919091179055620000f4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000d557600080fd5b81516001600160a01b0381168114620000ed57600080fd5b9392505050565b61201f80620001046000396000f3fe6080604052600436106100e85760003560e01c8063735de9f71161008a578063ac9650d811610059578063ac9650d814610243578063d9a6f70514610263578063ed921d3c14610279578063f2fde38b1461028c57600080fd5b8063735de9f7146101c5578063742ac944146101fd5780638456cb59146102105780638da5cb5b1461022557600080fd5b80633f4ba83a116100c65780633f4ba83a1461014f5780635ae401dc146101665780635c975abb14610186578063715018a6146101b057600080fd5b80631411734e146100ed57806314d90e1b146101135780631fd168ff1461013c575b600080fd5b6101006100fb366004611a14565b6102ac565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101296103e881565b60405161ffff909116815260200161010a565b61010061014a366004611a14565b61040a565b34801561015b57600080fd5b5061016461057a565b005b610179610174366004611ac0565b61058c565b60405161010a9190611b5b565b34801561019257600080fd5b50600054600160a01b900460ff16604051901515815260200161010a565b3480156101bc57600080fd5b506101646105e2565b3480156101d157600080fd5b506001546101e5906001600160a01b031681565b6040516001600160a01b03909116815260200161010a565b61010061020b366004611c50565b6105f4565b34801561021c57600080fd5b50610164610731565b34801561023157600080fd5b506000546001600160a01b03166101e5565b34801561024f57600080fd5b5061017961025e366004611ca5565b610741565b34801561026f57600080fd5b5061012961271081565b610100610287366004611c50565b610836565b34801561029857600080fd5b506101646102a7366004611ce6565b61095e565b60208101516000906001600160a01b031633148015906102d9575060208201516001600160a01b03163014155b156102ff5760405162461bcd60e51b81526004016102f690611d03565b60405180910390fd5b600061030e83600001516109d7565b905060008061037983866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761036060408302860136819003810190611d50565b81526020019060010190610343565b50505050506109e3565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103bc908890600401611dfc565b6020604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190611e0f565b979650505050505050565b6040810151815160009190829061042090610ac4565b9050600061043185600001516109d7565b90506000806000806104a4868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761048b60408302860136819003810190611d50565b8152602001906001019061046e565b5050505050610af2565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016105159190611dfc565b6020604051808303816000875af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611e0f565b975061056c8787878c604001518587610bd3565b505050505050509392505050565b610582610e16565b61058a610e70565b565b6060834211156105d05760405162461bcd60e51b815260206004820152600f60248201526e111958591b1a5b99481c185cdcd959608a1b60448201526064016102f6565b6105da8383610741565b949350505050565b6105ea610e16565b61058a6000610ec5565b60608101516000906001600160a01b03163314801590610621575060608201516001600160a01b03163014155b1561063e5760405162461bcd60e51b81526004016102f690611d03565b6000806106a18460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761069260408302860136819003810190611d50565b81526020019060010190610675565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf906106e4908790600401611e28565b6020604051808303816000875af1158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611e0f565b9695505050505050565b610739610e16565b61058a610f15565b6060816001600160401b0381111561075b5761075b61189c565b60405190808252806020026020018201604052801561078e57816020015b60608152602001906001900390816107795790505b50905060005b8281101561082e576107fe308585848181106107b2576107b2611e87565b90506020028101906107c49190611e9d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f5892505050565b82828151811061081057610810611e87565b6020026020010181905250808061082690611ef9565b915050610794565b505b92915050565b600080826080015190506000806000806108ab87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761089c60408302860136819003810190611d50565b8152602001906001019061087f565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df906108f3908a90600401611e28565b6020604051808303816000875af1158015610912573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109369190611e0f565b955061095285886000015189602001518a608001518587610bd3565b50505050509392505050565b610966610e16565b6001600160a01b0381166109cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f6565b6109d481610ec5565b50565b60006108308282610f84565b600080548190600160a01b900460ff16610a2257600080610a048786610fe9565b9092509050610a138288611f12565b9650610a1f88826111c6565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a999190611f25565b50610aa48686611341565b306001600160a01b03851603610ab8573393505b50929491935090915050565b60008060148351610ad59190611f12565b90506000610ae584836014611438565b90506105da816000610f84565b6000806060818082610b0e60005460ff600160a01b9091041690565b610b2e57610b1c8988610fe9565b9092509050610b2b828a611f47565b98505b6001600160a01b0388163014610b42573097505b610b4c8b8b611341565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af1158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611f25565b50979a9699509697505050505050565b600054600160a01b900460ff16610bee57610bee8482611545565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190611e0f565b9050610c658385611f12565b811015610cb45760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e7420646973747269627574656460448201526064016102f6565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611f25565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190611e0f565b90508015610e0c5760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611f25565b505b5050505050505050565b6000546001600160a01b0316331461058a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f6565b610e786116b4565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f1d611704565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ea83390565b6060610f7d8383604051806060016040528060278152602001611fc360279139611751565b9392505050565b6000610f91826014611f47565b83511015610fd95760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016102f6565b500160200151600160601b900490565b6000606081805b845181101561103a5784818151811061100b5761100b611e87565b60200260200101516020015161ffff16826110269190611f47565b91508061103281611ef9565b915050610ff0565b506103e881111561108d5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f46454500000060448201526064016102f6565b60008085516001600160401b038111156110a9576110a961189c565b6040519080825280602002602001820160405280156110ee57816020015b60408051808201909152600080825260208201528152602001906001900390816110c75790505b50905060005b86518110156111b757600061271061ffff1688838151811061111857611118611e87565b60200260200101516020015161ffff168a6111339190611f5a565b61113d9190611f71565b9050604051806040016040528089848151811061115c5761115c611e87565b6020026020010151600001516001600160a01b031681526020018281525083838151811061118c5761118c611e87565b60209081029190910101526111a18185611f47565b93505080806111af90611ef9565b9150506110f4565b509093509150505b9250929050565b60005b815181101561133c57826001600160a01b03166323b872dd338484815181106111f4576111f4611e87565b60200260200101516000015185858151811061121257611212611e87565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112989190611f25565b508181815181106112ab576112ab611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061130757611307611e87565b60200260200101516020015160405161132291815260200190565b60405180910390a48061133481611ef9565b9150506111c9565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611e0f565b10156114345760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611410573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190611f25565b5050565b60608161144681601f611f47565b10156114855760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016102f6565b61148f8284611f47565b845110156114d35760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102f6565b6060821580156114f2576040519150600082526020820160405261153c565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561152b578051835260209283019201611513565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561133c57826001600160a01b031663a9059cbb83838151811061157257611572611e87565b60200260200101516000015184848151811061159057611590611e87565b6020026020010151602001516040518363ffffffff1660e01b81526004016115cd9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156115ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116109190611f25565b5081818151811061162357611623611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061167f5761167f611e87565b60200260200101516020015160405161169a91815260200190565b60405180910390a4806116ac81611ef9565b915050611548565b600054600160a01b900460ff1661058a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016102f6565b600054600160a01b900460ff161561058a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016102f6565b6060600080856001600160a01b03168560405161176e9190611f93565b600060405180830381855af49150503d80600081146117a9576040519150601f19603f3d011682016040523d82523d6000602084013e6117ae565b606091505b50915091506107278683838760608315611829578251600003611822576001600160a01b0385163b6118225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102f6565b50816105da565b6105da838381511561183e5781518083602001fd5b8060405162461bcd60e51b81526004016102f69190611faf565b60008083601f84011261186a57600080fd5b5081356001600160401b0381111561188157600080fd5b6020830191508360208260061b85010111156111bf57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156118d4576118d461189c565b60405290565b60405160e081016001600160401b03811182821017156118d4576118d461189c565b604051601f8201601f191681016001600160401b03811182821017156119245761192461189c565b604052919050565b6001600160a01b03811681146109d457600080fd5b803561194c8161192c565b919050565b60006080828403121561196357600080fd5b61196b6118b2565b905081356001600160401b038082111561198457600080fd5b818401915084601f83011261199857600080fd5b81356020828211156119ac576119ac61189c565b6119be601f8301601f191682016118fc565b925081835286818386010111156119d457600080fd5b818185018285013760008183850101528285526119f2818701611941565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215611a2957600080fd5b83356001600160401b0380821115611a4057600080fd5b611a4c87838801611858565b90955093506020860135915080821115611a6557600080fd5b50611a7286828701611951565b9150509250925092565b60008083601f840112611a8e57600080fd5b5081356001600160401b03811115611aa557600080fd5b6020830191508360208260051b85010111156111bf57600080fd5b600080600060408486031215611ad557600080fd5b8335925060208401356001600160401b03811115611af257600080fd5b611afe86828701611a7c565b9497909650939450505050565b60005b83811015611b26578181015183820152602001611b0e565b50506000910152565b60008151808452611b47816020860160208601611b0b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611bb057603f19888603018452611b9e858351611b2f565b94509285019290850190600101611b82565b5092979650505050505050565b600060e08284031215611bcf57600080fd5b611bd76118da565b90508135611be48161192c565b81526020820135611bf48161192c565b6020820152604082013562ffffff81168114611c0f57600080fd5b6040820152611c2060608301611941565b60608201526080820135608082015260a082013560a0820152611c4560c08301611941565b60c082015292915050565b60008060006101008486031215611c6657600080fd5b83356001600160401b03811115611c7c57600080fd5b611c8886828701611858565b9094509250611c9c90508560208601611bbd565b90509250925092565b60008060208385031215611cb857600080fd5b82356001600160401b03811115611cce57600080fd5b611cda85828601611a7c565b90969095509350505050565b600060208284031215611cf857600080fd5b8135610f7d8161192c565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b600060408284031215611d6257600080fd5b604051604081018181106001600160401b0382111715611d8457611d8461189c565b6040528235611d928161192c565b8152602083013561ffff81168114611da957600080fd5b60208201529392505050565b6000815160808452611dca6080850182611b2f565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b602081526000610f7d6020830184611db5565b600060208284031215611e2157600080fd5b5051919050565b60e08101610830828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611eb457600080fd5b8301803591506001600160401b03821115611ece57600080fd5b6020019150368190038213156111bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611f0b57611f0b611ee3565b5060010190565b8181038181111561083057610830611ee3565b600060208284031215611f3757600080fd5b81518015158114610f7d57600080fd5b8082018082111561083057610830611ee3565b808202811582820484141761083057610830611ee3565b600082611f8e57634e487b7160e01b600052601260045260246000fd5b500490565b60008251611fa5818460208701611b0b565b9190910192915050565b602081526000610f7d6020830184611b2f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203925f97cd63c2e61736a2a442ff1d4bf966f453350e9df354a849229f69092cf64736f6c63430008130033", + "sourceMap": "531:15016:46:-:0;;;1185:90;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;936:32:17;719:10:23;936:18:17;:32::i;:::-;1006:5:18;996:15;;-1:-1:-1;;;;996:15:18;;;-1:-1:-1;1227:41:46;;-1:-1:-1;;;;;;1227:41:46;-1:-1:-1;;;;;1227:41:46;;;;;;;;;;531:15016;;2426:187:17;2499:16;2518:6;;-1:-1:-1;;;;;2534:17:17;;;-1:-1:-1;;;;;;2534:17:17;;;;;;2566:40;;2518:6;;;;;;;2566:40;;2499:16;2566:40;2489:124;2426:187;:::o;14:290:55:-;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:55;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:55:o;:::-;531:15016:46;;;;;;", "linkReferences": {} }, "deployedBytecode": { - "object": "0x6080604052600436106100c25760003560e01c8063735de9f71161007f5780638da5cb5b116100595780638da5cb5b146101df578063d9a6f705146101fd578063ed921d3c14610213578063f2fde38b1461022657600080fd5b8063735de9f71461017f578063742ac944146101b75780638456cb59146101ca57600080fd5b80631411734e146100c757806314d90e1b146100ed5780631fd168ff146101165780633f4ba83a146101295780635c975abb14610140578063715018a61461016a575b600080fd5b6100da6100d5366004611744565b610246565b6040519081526020015b60405180910390f35b3480156100f957600080fd5b506101036103e881565b60405161ffff90911681526020016100e4565b6100da610124366004611744565b6103a4565b34801561013557600080fd5b5061013e610514565b005b34801561014c57600080fd5b50600054600160a01b900460ff1660405190151581526020016100e4565b34801561017657600080fd5b5061013e610526565b34801561018b57600080fd5b5060015461019f906001600160a01b031681565b6040516001600160a01b0390911681526020016100e4565b6100da6101c5366004611840565b610538565b3480156101d657600080fd5b5061013e610675565b3480156101eb57600080fd5b506000546001600160a01b031661019f565b34801561020957600080fd5b5061010361271081565b6100da610221366004611840565b610685565b34801561023257600080fd5b5061013e610241366004611896565b6107ad565b60208101516000906001600160a01b03163314801590610273575060208201516001600160a01b03163014155b156102995760405162461bcd60e51b8152600401610290906118ba565b60405180910390fd5b60006102a88360000151610826565b905060008061031383866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610309576102fa60408302860136819003810190611907565b815260200190600101906102dd565b5050505050610838565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103569088906004016119ea565b6020604051808303816000875af1158015610375573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039991906119fd565b979650505050505050565b604081015181516000919082906103ba90610919565b905060006103cb8560000151610826565b905060008060008061043e868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b828210156104345761042560408302860136819003810190611907565b81526020019060010190610408565b505050505061094f565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016104af91906119ea565b6020604051808303816000875af11580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906119fd565b97506105068787878c604001518587610a30565b505050505050509392505050565b61051c610c73565b610524610ccd565b565b61052e610c73565b6105246000610d22565b60608101516000906001600160a01b03163314801590610565575060608201516001600160a01b03163014155b156105825760405162461bcd60e51b8152600401610290906118ba565b6000806105e58460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b82821015610309576105d660408302860136819003810190611907565b815260200190600101906105b9565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf90610628908790600401611a16565b6020604051808303816000875af1158015610647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066b91906119fd565b9695505050505050565b61067d610c73565b610524610d72565b600080826080015190506000806000806106fa87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b82821015610434576106eb60408302860136819003810190611907565b815260200190600101906106ce565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df90610742908a90600401611a16565b6020604051808303816000875af1158015610761573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078591906119fd565b95506107a185886000015189602001518a608001518587610a30565b50505050509392505050565b6107b5610c73565b6001600160a01b03811661081a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610290565b61082381610d22565b50565b60006108328282610db5565b92915050565b600080548190600160a01b900460ff16610877576000806108598786610e1a565b90925090506108688288611a8b565b96506108748882610ff8565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af11580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee9190611a9e565b506108f98686611173565b306001600160a01b0385160361090d573393505b50929491935090915050565b6000806014835161092a9190611a8b565b9050600061093a8483601461126a565b9050610947816000610db5565b949350505050565b600080606081808261096b60005460ff600160a01b9091041690565b61098b576109798988610e1a565b9092509050610988828a611ac0565b98505b6001600160a01b038816301461099f573097505b6109a98b8b611173565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af11580156109fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a209190611a9e565b50979a9699509697505050505050565b600054600160a01b900460ff16610a4b57610a4b8482611377565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab691906119fd565b9050610ac28385611a8b565b811015610b115760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e742064697374726962757465646044820152606401610290565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b829190611a9e565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee91906119fd565b90508015610c695760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610c43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c679190611a9e565b505b5050505050505050565b6000546001600160a01b031633146105245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610290565b610cd56114e6565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610d7a611536565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d053390565b6000610dc2826014611ac0565b83511015610e0a5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610290565b500160200151600160601b900490565b6000606081805b8451811015610e6b57848181518110610e3c57610e3c611ad3565b60200260200101516020015161ffff1682610e579190611ac0565b915080610e6381611ae9565b915050610e21565b506103e8811115610ebe5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f4645450000006044820152606401610290565b600080855167ffffffffffffffff811115610edb57610edb6115c8565b604051908082528060200260200182016040528015610f2057816020015b6040805180820190915260008082526020820152815260200190600190039081610ef95790505b50905060005b8651811015610fe957600061271061ffff16888381518110610f4a57610f4a611ad3565b60200260200101516020015161ffff168a610f659190611b02565b610f6f9190611b19565b90506040518060400160405280898481518110610f8e57610f8e611ad3565b6020026020010151600001516001600160a01b0316815260200182815250838381518110610fbe57610fbe611ad3565b6020908102919091010152610fd38185611ac0565b9350508080610fe190611ae9565b915050610f26565b509093509150505b9250929050565b60005b815181101561116e57826001600160a01b03166323b872dd3384848151811061102657611026611ad3565b60200260200101516000015185858151811061104457611044611ad3565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af11580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca9190611a9e565b508181815181106110dd576110dd611ad3565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061113957611139611ad3565b60200260200101516020015160405161115491815260200190565b60405180910390a48061116681611ae9565b915050610ffb565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa1580156111c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e891906119fd565b10156112665760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611242573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190611a9e565b5050565b60608161127881601f611ac0565b10156112b75760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610290565b6112c18284611ac0565b845110156113055760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610290565b606082158015611324576040519150600082526020820160405261136e565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561135d578051835260209283019201611345565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561116e57826001600160a01b031663a9059cbb8383815181106113a4576113a4611ad3565b6020026020010151600001518484815181106113c2576113c2611ad3565b6020026020010151602001516040518363ffffffff1660e01b81526004016113ff9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af115801561141e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114429190611a9e565b5081818151811061145557611455611ad3565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106114b1576114b1611ad3565b6020026020010151602001516040516114cc91815260200190565b60405180910390a4806114de81611ae9565b91505061137a565b600054600160a01b900460ff166105245760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610290565b600054600160a01b900460ff16156105245760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610290565b60008083601f84011261159557600080fd5b50813567ffffffffffffffff8111156115ad57600080fd5b6020830191508360208260061b8501011115610ff157600080fd5b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715611601576116016115c8565b60405290565b60405160e0810167ffffffffffffffff81118282101715611601576116016115c8565b604051601f8201601f1916810167ffffffffffffffff81118282101715611653576116536115c8565b604052919050565b6001600160a01b038116811461082357600080fd5b803561167b8161165b565b919050565b60006080828403121561169257600080fd5b61169a6115de565b9050813567ffffffffffffffff808211156116b457600080fd5b818401915084601f8301126116c857600080fd5b81356020828211156116dc576116dc6115c8565b6116ee601f8301601f1916820161162a565b9250818352868183860101111561170457600080fd5b81818501828501376000818385010152828552611722818701611670565b8186015250505050604082013560408201526060820135606082015292915050565b60008060006040848603121561175957600080fd5b833567ffffffffffffffff8082111561177157600080fd5b61177d87838801611583565b9095509350602086013591508082111561179657600080fd5b506117a386828701611680565b9150509250925092565b600060e082840312156117bf57600080fd5b6117c7611607565b905081356117d48161165b565b815260208201356117e48161165b565b6020820152604082013562ffffff811681146117ff57600080fd5b604082015261181060608301611670565b60608201526080820135608082015260a082013560a082015261183560c08301611670565b60c082015292915050565b6000806000610100848603121561185657600080fd5b833567ffffffffffffffff81111561186d57600080fd5b61187986828701611583565b909450925061188d905085602086016117ad565b90509250925092565b6000602082840312156118a857600080fd5b81356118b38161165b565b9392505050565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b60006040828403121561191957600080fd5b6040516040810181811067ffffffffffffffff8211171561193c5761193c6115c8565b604052823561194a8161165b565b8152602083013561ffff8116811461196157600080fd5b60208201529392505050565b6000815160808452805180608086015260005b8181101561199d57602081840181015160a0888401015201611980565b50600060a08287010152602084015191506119c360208601836001600160a01b03169052565b60408481015190860152606093840151938501939093525050601f01601f19160160a00190565b6020815260006118b3602083018461196d565b600060208284031215611a0f57600080fd5b5051919050565b60e08101610832828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052601160045260246000fd5b8181038181111561083257610832611a75565b600060208284031215611ab057600080fd5b815180151581146118b357600080fd5b8082018082111561083257610832611a75565b634e487b7160e01b600052603260045260246000fd5b600060018201611afb57611afb611a75565b5060010190565b808202811582820484141761083257610832611a75565b600082611b3657634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220ace639a098395b7bea514c42166a1e5a567128581e5b4dad8d6cc013080bd70964736f6c63430008130033", - "sourceMap": "480:14464:35:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3171:771;;;;;;:::i;:::-;;:::i;:::-;;;3527:25:44;;;3515:2;3500:18;3171:771:35;;;;;;;;634:46;;;;;;;;;;;;675:5;634:46;;;;;3737:6:44;3725:19;;;3707:38;;3695:2;3680:18;634:46:35;3563:188:44;5938:965:35;;;;;;:::i;:::-;;:::i;14877:65::-;;;;;;;;;;;;;:::i;:::-;;1615:84:18;;;;;;;;;;-1:-1:-1;1662:4:18;1685:7;-1:-1:-1;;;1685:7:18;;;;1615:84;;4689:14:44;;4682:22;4664:41;;4652:2;4637:18;1615:84:18;4524:187:44;1824:101:17;;;;;;;;;;;;;:::i;747:34:35:-;;;;;;;;;;-1:-1:-1;747:34:35;;;;-1:-1:-1;;;;;747:34:35;;;;;;-1:-1:-1;;;;;4903:32:44;;;4885:51;;4873:2;4858:18;747:34:35;4716:226:44;1853:689:35;;;;;;:::i;:::-;;:::i;14727:61::-;;;;;;;;;;;;;:::i;1201:85:17:-;;;;;;;;;;-1:-1:-1;1247:7:17;1273:6;-1:-1:-1;;;;;1273:6:17;1201:85;;575:53:35;;;;;;;;;;;;622:6;575:53;;4524:832;;;;;;:::i;:::-;;:::i;2074:198:17:-;;;;;;;;;;-1:-1:-1;2074:198:17;;;;;:::i;:::-;;:::i;3171:771:35:-;3372:16;;;;3339:17;;-1:-1:-1;;;;;3372:30:35;3392:10;3372:30;;;;:67;;-1:-1:-1;3406:16:35;;;;-1:-1:-1;;;;;3406:33:35;3434:4;3406:33;;3372:67;3368:153;;;3455:55;;-1:-1:-1;;;3455:55:35;;;;;;;:::i;:::-;;;;;;;;3368:153;3578:15;3596:31;:6;:11;;;:29;:31::i;:::-;3578:49;;3639:16;3657:17;3690:75;3710:7;3719:6;:15;;;3736:6;:16;;;3754:10;;3690:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:19;:75::i;:::-;3775:15;;;;:26;;;-1:-1:-1;;;;;3811:28:35;;;:16;;;:28;3903:13;;:32;;-1:-1:-1;;;3903:32:35;;3638:127;;-1:-1:-1;3638:127:35;;-1:-1:-1;3903:13:35;;:24;;:32;;3775:6;;3903:32;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3891:44;3171:771;-1:-1:-1;;;;;;;3171:771:35:o;5938:965::-;6217:16;;;;6261:11;;6108:16;;6217;6108;;6261:31;;:29;:31::i;:::-;6243:49;;6302:16;6321:31;:6;:11;;;:29;:31::i;:::-;6302:50;;6364:17;6383;6402:35;6439:22;6477:101;6498:7;6507:6;:22;;;6531:6;:16;;;6549:6;:16;;;6567:10;;6477:101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:20;:101::i;:::-;6363:215;;;;;;;;6607:9;6588:6;:16;;:28;;;;;6645:9;6626:6;:16;;:28;-1:-1:-1;;;;;6626:28:35;;;-1:-1:-1;;;;;6626:28:35;;;;;6717:13;;;;;;;;;-1:-1:-1;;;;;6717:13:35;-1:-1:-1;;;;;6717:25:35;;6743:6;6717:33;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;6706:44;;6761:135;6801:17;6820:7;6829:8;6839:6;:16;;;6857:14;6873:13;6761:26;:135::i;:::-;6126:777;;;;;;;5938:965;;;;;:::o;14877:65::-;1094:13:17;:11;:13::i;:::-;14925:10:35::1;:8;:10::i;:::-;14877:65::o:0;1824:101:17:-;1094:13;:11;:13::i;:::-;1888:30:::1;1915:1;1888:18;:30::i;1853:689:35:-:0;2066:16;;;;2033:17;;-1:-1:-1;;;;;2066:30:35;2086:10;2066:30;;;;:67;;-1:-1:-1;2100:16:35;;;;-1:-1:-1;;;;;2100:33:35;2128:4;2100:33;;2066:67;2062:153;;;2149:55;;-1:-1:-1;;;2149:55:35;;;;;;;:::i;2062:153::-;2226:16;2244:17;2277:82;2297:6;:14;;;2313:6;:15;;;2330:6;:16;;;2348:10;;2277:82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;2369:15;;;:26;;;-1:-1:-1;;;;;2405:28:35;;;:16;;;:28;2497:13;;:38;;-1:-1:-1;;;2497:38:35;;2225:134;;-1:-1:-1;2225:134:35;;-1:-1:-1;2497:13:35;;:30;;:38;;2369:6;;2497:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2485:50;1853:689;-1:-1:-1;;;;;;1853:689:35:o;14727:61::-;1094:13:17;:11;:13::i;:::-;14773:8:35::1;:6;:8::i;4524:832::-:0;4706:16;4734:25;4762:6;:16;;;4734:44;;4790:17;4809;4828:35;4865:22;4903:108;4924:6;:14;;;4940:6;:22;;;4964:6;:16;;;4982:6;:16;;;5000:10;;4903:108;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;5021:16;;;:28;;;-1:-1:-1;;;;;5059:28:35;;;:16;;;:28;5150:13;;:39;;-1:-1:-1;;;5150:39:35;;4789:222;;-1:-1:-1;4789:222:35;;-1:-1:-1;4789:222:35;;-1:-1:-1;4789:222:35;-1:-1:-1;5150:13:35;;:31;;:39;;5021:6;;5150:39;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5139:50;;5200:149;5240:17;5259:6;:14;;;5275:6;:15;;;5292:6;:16;;;5310:14;5326:13;5200:26;:149::i;:::-;4724:632;;;;;4524:832;;;;;:::o;2074:198:17:-;1094:13;:11;:13::i;:::-;-1:-1:-1;;;;;2162:22:17;::::1;2154:73;;;::::0;-1:-1:-1;;;2154:73:17;;11664:2:44;2154:73:17::1;::::0;::::1;11646:21:44::0;11703:2;11683:18;;;11676:30;11742:34;11722:18;;;11715:62;-1:-1:-1;;;11793:18:44;;;11786:36;11839:19;;2154:73:17::1;11462:402:44::0;2154:73:17::1;2237:28;2256:8;2237:18;:28::i;:::-;2074:198:::0;:::o;1582:119:37:-;1651:7;1677:17;:4;1651:7;1677:14;:17::i;:::-;1670:24;1582:119;-1:-1:-1;;1582:119:37:o;8575:1089:35:-;8755:7;1685::18;;8755::35;;-1:-1:-1;;;1685:7:18;;;;8783:390:35;;8905:12;8919:35;8958:36;8973:8;8983:10;8958:14;:36::i;:::-;8904:90;;-1:-1:-1;8904:90:35;-1:-1:-1;9019:15:35;8904:90;9019:8;:15;:::i;:::-;9008:26;;9103:59;9139:7;9148:13;9103:35;:59::i;:::-;8798:375;;8783:390;9357:65;;-1:-1:-1;;;9357:65:35;;9386:10;9357:65;;;12374:34:44;9406:4:35;12424:18:44;;;12417:43;12476:18;;;12469:34;;;-1:-1:-1;;;;;9357:28:35;;;;;12309:18:44;;9357:65:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;9433:34;9449:7;9458:8;9433:15;:34::i;:::-;9507:4;-1:-1:-1;;;;;9482:30:35;;;9478:137;;9594:10;9578:26;;9478:137;-1:-1:-1;9633:8:35;;9643:13;;-1:-1:-1;8575:1089:35;;-1:-1:-1;;8575:1089:35:o;936:640:37:-;1005:7;1355:37;257:2;1395:4;:11;:31;;;;:::i;:::-;1355:71;-1:-1:-1;1437:26:37;1466:60;:4;1355:71;257:2;1466:10;:60::i;:::-;1437:89;-1:-1:-1;1543:26:37;1437:89;1567:1;1543:23;:26::i;:::-;1536:33;936:640;-1:-1:-1;;;;936:640:37:o;10388:1076:35:-;10596:7;;10614:21;10596:7;;10614:21;10742:8;1662:4:18;1685:7;;-1:-1:-1;;;1685:7:18;;;;;1615:84;10742:8:35;10737:163;;10800:37;10815:9;10826:10;10800:14;:37::i;:::-;10766:71;;-1:-1:-1;10766:71:35;-1:-1:-1;10863:26:35;10766:71;10863:9;:26;:::i;:::-;10851:38;;10737:163;-1:-1:-1;;;;;10914:30:35;;10939:4;10914:30;10910:178;;11072:4;11048:29;;10910:178;11098:34;11114:7;11123:8;11098:15;:34::i;:::-;11317:65;;-1:-1:-1;;;11317:65:35;;11346:10;11317:65;;;12374:34:44;11366:4:35;12424:18:44;;;12417:43;12476:18;;;12469:34;;;-1:-1:-1;;;;;11317:28:35;;;;;12309:18:44;;11317:65:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;11401:9:35;;11412:13;;-1:-1:-1;11427:13:35;;-1:-1:-1;;;;;;10388:1076:35:o;11996:1257::-;1662:4:18;1685:7;-1:-1:-1;;;1685:7:18;;;;12293:101:35;;12322:61;12359:8;12369:13;12322:36;:61::i;:::-;12430:41;;-1:-1:-1;;;12430:41:35;;12465:4;12430:41;;;4885:51:44;12404:23:35;;-1:-1:-1;;;;;12430:26:35;;;;;4858:18:44;;12430:41:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;12404:67;-1:-1:-1;12777:26:35;12789:14;12777:9;:26;:::i;:::-;12758:15;:45;;12750:90;;;;-1:-1:-1;;;12750:90:35;;13128:2:44;12750:90:35;;;13110:21:44;;;13147:18;;;13140:30;13206:34;13186:18;;;13179:62;13258:18;;12750:90:35;12926:356:44;12750:90:35;12913:56;;-1:-1:-1;;;12913:56:35;;12939:10;12913:56;;;13461:51:44;13528:18;;;13521:34;;;-1:-1:-1;;;;;12913:25:35;;;;;13434:18:44;;12913:56:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;13014:40:35;;-1:-1:-1;;;13014:40:35;;13048:4;13014:40;;;4885:51:44;12980:31:35;;-1:-1:-1;;;;;13014:25:35;;;;;4858:18:44;;13014:40:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;12980:74;-1:-1:-1;13068:27:35;;13064:183;;13175:61;;-1:-1:-1;;;13175:61:35;;13200:10;13175:61;;;13461:51:44;13528:18;;;13521:34;;;-1:-1:-1;;;;;13175:24:35;;;;;13434:18:44;;13175:61:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;13064:183;12237:1016;;11996:1257;;;;;;:::o;1359:130:17:-;1247:7;1273:6;-1:-1:-1;;;;;1273:6:17;719:10:22;1422:23:17;1414:68;;;;-1:-1:-1;;;1414:68:17;;13768:2:44;1414:68:17;;;13750:21:44;;;13787:18;;;13780:30;13846:34;13826:18;;;13819:62;13898:18;;1414:68:17;13566:356:44;2433:117:18;1486:16;:14;:16::i;:::-;2501:5:::1;2491:15:::0;;-1:-1:-1;;;;2491:15:18::1;::::0;;2521:22:::1;719:10:22::0;2530:12:18::1;2521:22;::::0;-1:-1:-1;;;;;4903:32:44;;;4885:51;;4873:2;4858:18;2521:22:18::1;;;;;;;2433:117::o:0;2426:187:17:-;2499:16;2518:6;;-1:-1:-1;;;;;2534:17:17;;;-1:-1:-1;;;;;;2534:17:17;;;;;;2566:40;;2518:6;;;;;;;2566:40;;2499:16;2566:40;2489:124;2426:187;:::o;2186:115:18:-;1239:19;:17;:19::i;:::-;2245:7:::1;:14:::0;;-1:-1:-1;;;;2245:14:18::1;-1:-1:-1::0;;;2245:14:18::1;::::0;;2274:20:::1;2281:12;719:10:22::0;;640:96;12267:354:23;12346:7;12390:11;:6;12399:2;12390:11;:::i;:::-;12373:6;:13;:28;;12365:62;;;;-1:-1:-1;;;12365:62:23;;14129:2:44;12365:62:23;;;14111:21:44;14168:2;14148:18;;;14141:30;-1:-1:-1;;;14187:18:44;;;14180:51;14248:18;;12365:62:23;13927:345:44;12365:62:23;-1:-1:-1;12515:30:23;12531:4;12515:30;12509:37;-1:-1:-1;;;12505:71:23;;;12267:354::o;6996:1063:35:-;7121:7;7130:21;7121:7;;7271:125;7295:10;:17;7291:1;:21;7271:125;;;7352:10;7363:1;7352:13;;;;;;;;:::i;:::-;;;;;;;:33;;;7333:52;;;;;;;:::i;:::-;;-1:-1:-1;7314:3:35;;;;:::i;:::-;;;;7271:125;;;-1:-1:-1;675:5:35;7413:34;;;7405:76;;;;-1:-1:-1;;;7405:76:35;;14751:2:44;7405:76:35;;;14733:21:44;14790:2;14770:18;;;14763:30;14829:31;14809:18;;;14802:59;14878:18;;7405:76:35;14549:353:44;7405:76:35;7492:17;7523:35;7580:10;:17;7561:37;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;7561:37:35;;;;;;;;;;;;;;;;7523:75;;7696:9;7691:318;7715:10;:17;7711:1;:21;7691:318;;;7753:17;622:6;7829:30;;7791:10;7802:1;7791:13;;;;;;;;:::i;:::-;;;;;;;:33;;;7783:42;;7774:6;:51;;;;:::i;:::-;7773:86;;;;:::i;:::-;7753:106;;7893:69;;;;;;;;7918:10;7929:1;7918:13;;;;;;;;:::i;:::-;;;;;;;:23;;;-1:-1:-1;;;;;7893:69:35;;;;;7951:9;7893:69;;;7874:13;7888:1;7874:16;;;;;;;;:::i;:::-;;;;;;;;;;:88;7976:22;7989:9;7976:22;;:::i;:::-;;;7739:270;7734:3;;;;;:::i;:::-;;;;7691:318;;;-1:-1:-1;8027:9:35;;-1:-1:-1;8038:13:35;-1:-1:-1;;6996:1063:35;;;;;;:::o;13351:388::-;13472:9;13467:266;13491:13;:20;13487:1;:24;13467:266;;;13539:5;-1:-1:-1;;;;;13532:26:35;;13559:10;13571:13;13585:1;13571:16;;;;;;;;:::i;:::-;;;;;;;:26;;;13599:13;13613:1;13599:16;;;;;;;;:::i;:::-;;;;;;;;;;;;:23;;13532:91;;-1:-1:-1;;;;;;13532:91:35;;;;;;;-1:-1:-1;;;;;12392:15:44;;;13532:91:35;;;12374:34:44;12444:15;;;;12424:18;;;12417:43;12476:18;;;12469:34;12309:18;;13532:91:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;13670:13;13684:1;13670:16;;;;;;;;:::i;:::-;;;;;;;:26;;;-1:-1:-1;;;;;13642:80:35;13658:10;-1:-1:-1;;;;;13642:80:35;13651:5;-1:-1:-1;;;;;13642:80:35;;13698:13;13712:1;13698:16;;;;;;;;:::i;:::-;;;;;;;:23;;;13642:80;;;;3527:25:44;;3515:2;3500:18;;3381:177;13642:80:35;;;;;;;;13513:3;;;;:::i;:::-;;;;13467:266;;;;13351:388;;:::o;14314:326::-;14511:13;;14464:62;;-1:-1:-1;;;14464:62:35;;14496:4;14464:62;;;15514:34:44;-1:-1:-1;;;;;14511:13:35;;;15564:18:44;;;15557:43;14529:14:35;;14464:23;;;;;15449:18:44;;14464:62:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:79;14460:174;;;14589:13;;14559:64;;-1:-1:-1;;;14559:64:35;;-1:-1:-1;;;;;14589:13:35;;;14559:64;;;13461:51:44;-1:-1:-1;;13528:18:44;;;13521:34;14559:21:35;;;;;;13434:18:44;;14559:64:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;14460:174::-;14314:326;;:::o;9457:2804:23:-;9603:12;9655:7;9639:12;9655:7;9649:2;9639:12;:::i;:::-;:23;;9631:50;;;;-1:-1:-1;;;9631:50:23;;15813:2:44;9631:50:23;;;15795:21:44;15852:2;15832:18;;;15825:30;-1:-1:-1;;;15871:18:44;;;15864:44;15925:18;;9631:50:23;15611:338:44;9631:50:23;9716:16;9725:7;9716:6;:16;:::i;:::-;9699:6;:13;:33;;9691:63;;;;-1:-1:-1;;;9691:63:23;;16156:2:44;9691:63:23;;;16138:21:44;16195:2;16175:18;;;16168:30;-1:-1:-1;;;16214:18:44;;;16207:47;16271:18;;9691:63:23;15954:341:44;9691:63:23;9765:22;9828:15;;9856:1967;;;;11964:4;11958:11;11945:24;;12150:1;12139:9;12132:20;12198:4;12187:9;12183:20;12177:4;12170:34;9821:2397;;9856:1967;10038:4;10032:11;10019:24;;10697:2;10688:7;10684:16;11079:9;11072:17;11066:4;11062:28;11050:9;11039;11035:25;11031:60;11127:7;11123:2;11119:16;11379:6;11365:9;11358:17;11352:4;11348:28;11336:9;11328:6;11324:22;11320:57;11316:70;11153:425;11412:3;11408:2;11405:11;11153:425;;;11550:9;;11539:21;;11453:4;11445:13;;;;11485;11153:425;;;-1:-1:-1;;11596:26:23;;;11804:2;11787:11;-1:-1:-1;;11783:25:23;11777:4;11770:39;-1:-1:-1;9821:2397:23;-1:-1:-1;12245:9:23;9457:2804;-1:-1:-1;;;;9457:2804:23:o;13840:373:35:-;13962:9;13957:250;13981:13;:20;13977:1;:24;13957:250;;;14029:5;-1:-1:-1;;;;;14022:22:35;;14045:13;14059:1;14045:16;;;;;;;;:::i;:::-;;;;;;;:26;;;14073:13;14087:1;14073:16;;;;;;;;:::i;:::-;;;;;;;:23;;;14022:75;;;;;;;;;;;;;;;-1:-1:-1;;;;;13479:32:44;;;;13461:51;;13543:2;13528:18;;13521:34;13449:2;13434:18;;13287:274;14022:75:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;14144:13;14158:1;14144:16;;;;;;;;:::i;:::-;;;;;;;:26;;;-1:-1:-1;;;;;14116:80:35;14132:10;-1:-1:-1;;;;;14116:80:35;14125:5;-1:-1:-1;;;;;14116:80:35;;14172:13;14186:1;14172:16;;;;;;;;:::i;:::-;;;;;;;:23;;;14116:80;;;;3527:25:44;;3515:2;3500:18;;3381:177;14116:80:35;;;;;;;;14003:3;;;;:::i;:::-;;;;13957:250;;1945:106:18;1662:4;1685:7;-1:-1:-1;;;1685:7:18;;;;2003:41;;;;-1:-1:-1;;;2003:41:18;;16502:2:44;2003:41:18;;;16484:21:44;16541:2;16521:18;;;16514:30;-1:-1:-1;;;16560:18:44;;;16553:50;16620:18;;2003:41:18;16300:344:44;1767:106:18;1662:4;1685:7;-1:-1:-1;;;1685:7:18;;;;1836:9;1828:38;;;;-1:-1:-1;;;1828:38:18;;16851:2:44;1828:38:18;;;16833:21:44;16890:2;16870:18;;;16863:30;-1:-1:-1;;;16909:18:44;;;16902:46;16965:18;;1828:38:18;16649:340:44;14:392;102:8;112:6;166:3;159:4;151:6;147:17;143:27;133:55;;184:1;181;174:12;133:55;-1:-1:-1;207:20:44;;250:18;239:30;;236:50;;;282:1;279;272:12;236:50;319:4;311:6;307:17;295:29;;379:3;372:4;362:6;359:1;355:14;347:6;343:27;339:38;336:47;333:67;;;396:1;393;386:12;411:127;472:10;467:3;463:20;460:1;453:31;503:4;500:1;493:15;527:4;524:1;517:15;543:253;615:2;609:9;657:4;645:17;;692:18;677:34;;713:22;;;674:62;671:88;;;739:18;;:::i;:::-;775:2;768:22;543:253;:::o;801:::-;873:2;867:9;915:4;903:17;;950:18;935:34;;971:22;;;932:62;929:88;;;997:18;;:::i;1059:275::-;1130:2;1124:9;1195:2;1176:13;;-1:-1:-1;;1172:27:44;1160:40;;1230:18;1215:34;;1251:22;;;1212:62;1209:88;;;1277:18;;:::i;:::-;1313:2;1306:22;1059:275;;-1:-1:-1;1059:275:44:o;1339:131::-;-1:-1:-1;;;;;1414:31:44;;1404:42;;1394:70;;1460:1;1457;1450:12;1475:134;1543:20;;1572:31;1543:20;1572:31;:::i;:::-;1475:134;;;:::o;1614:995::-;1677:5;1725:4;1713:9;1708:3;1704:19;1700:30;1697:50;;;1743:1;1740;1733:12;1697:50;1765:22;;:::i;:::-;1756:31;;1823:9;1810:23;1852:18;1893:2;1885:6;1882:14;1879:34;;;1909:1;1906;1899:12;1879:34;1947:6;1936:9;1932:22;1922:32;;1992:3;1985:4;1981:2;1977:13;1973:23;1963:51;;2010:1;2007;2000:12;1963:51;2046:2;2033:16;2068:4;2091:2;2087;2084:10;2081:36;;;2097:18;;:::i;:::-;2139:53;2182:2;2163:13;;-1:-1:-1;;2159:27:44;2155:36;;2139:53;:::i;:::-;2126:66;;2215:2;2208:5;2201:17;2255:3;2250:2;2245;2241;2237:11;2233:20;2230:29;2227:49;;;2272:1;2269;2262:12;2227:49;2327:2;2322;2318;2314:11;2309:2;2302:5;2298:14;2285:45;2371:1;2366:2;2361;2354:5;2350:14;2346:23;2339:34;2396:5;2389;2382:20;2434:38;2468:2;2457:9;2453:18;2434:38;:::i;:::-;2429:2;2422:5;2418:14;2411:62;;;;;2533:2;2522:9;2518:18;2505:32;2500:2;2493:5;2489:14;2482:56;2598:2;2587:9;2583:18;2570:32;2565:2;2558:5;2554:14;2547:56;1614:995;;;;:::o;2614:762::-;2781:6;2789;2797;2850:2;2838:9;2829:7;2825:23;2821:32;2818:52;;;2866:1;2863;2856:12;2818:52;2906:9;2893:23;2935:18;2976:2;2968:6;2965:14;2962:34;;;2992:1;2989;2982:12;2962:34;3031:95;3118:7;3109:6;3098:9;3094:22;3031:95;:::i;:::-;3145:8;;-1:-1:-1;3005:121:44;-1:-1:-1;3233:2:44;3218:18;;3205:32;;-1:-1:-1;3249:16:44;;;3246:36;;;3278:1;3275;3268:12;3246:36;;3301:69;3362:7;3351:8;3340:9;3336:24;3301:69;:::i;:::-;3291:79;;;2614:762;;;;;:::o;4947:889::-;5016:5;5064:4;5052:9;5047:3;5043:19;5039:30;5036:50;;;5082:1;5079;5072:12;5036:50;5104:22;;:::i;:::-;5095:31;;5163:9;5150:23;5182:33;5207:7;5182:33;:::i;:::-;5224:22;;5298:2;5283:18;;5270:32;5311:33;5270:32;5311:33;:::i;:::-;5371:2;5360:14;;5353:31;5436:2;5421:18;;5408:32;5484:8;5471:22;;5459:35;;5449:63;;5508:1;5505;5498:12;5449:63;5539:2;5528:14;;5521:31;5584:38;5618:2;5603:18;;5584:38;:::i;:::-;5579:2;5572:5;5568:14;5561:62;5684:3;5673:9;5669:19;5656:33;5650:3;5643:5;5639:15;5632:58;5751:3;5740:9;5736:19;5723:33;5717:3;5710:5;5706:15;5699:58;5790:39;5824:3;5813:9;5809:19;5790:39;:::i;:::-;5784:3;5777:5;5773:15;5766:64;4947:889;;;;:::o;5841:646::-;6014:6;6022;6030;6083:3;6071:9;6062:7;6058:23;6054:33;6051:53;;;6100:1;6097;6090:12;6051:53;6140:9;6127:23;6173:18;6165:6;6162:30;6159:50;;;6205:1;6202;6195:12;6159:50;6244:95;6331:7;6322:6;6311:9;6307:22;6244:95;:::i;:::-;6358:8;;-1:-1:-1;6218:121:44;-1:-1:-1;6412:69:44;;-1:-1:-1;6473:7:44;6468:2;6453:18;;6412:69;:::i;:::-;6402:79;;5841:646;;;;;:::o;7461:247::-;7520:6;7573:2;7561:9;7552:7;7548:23;7544:32;7541:52;;;7589:1;7586;7579:12;7541:52;7628:9;7615:23;7647:31;7672:5;7647:31;:::i;:::-;7697:5;7461:247;-1:-1:-1;;;7461:247:44:o;7713:409::-;7915:2;7897:21;;;7954:2;7934:18;;;7927:30;7993:34;7988:2;7973:18;;7966:62;-1:-1:-1;;;8059:2:44;8044:18;;8037:43;8112:3;8097:19;;7713:409::o;8127:682::-;8221:6;8274:2;8262:9;8253:7;8249:23;8245:32;8242:52;;;8290:1;8287;8280:12;8242:52;8323:2;8317:9;8365:2;8357:6;8353:15;8434:6;8422:10;8419:22;8398:18;8386:10;8383:34;8380:62;8377:88;;;8445:18;;:::i;:::-;8481:2;8474:22;8518:23;;8550:31;8518:23;8550:31;:::i;:::-;8590:21;;8663:2;8648:18;;8635:32;8711:6;8698:20;;8686:33;;8676:61;;8733:1;8730;8723:12;8676:61;8765:2;8753:15;;8746:32;8757:6;8127:682;-1:-1:-1;;;8127:682:44:o;8814:731::-;8873:3;8917:5;8911:12;8944:4;8939:3;8932:17;8978:12;8972:19;9023:6;9016:4;9011:3;9007:14;9000:30;9048:1;9058:145;9072:6;9069:1;9066:13;9058:145;;;9186:4;9164:20;;;9160:31;;9154:38;9148:3;9135:11;;;9131:21;9124:69;9087:12;9058:145;;;9062:3;9247:1;9241:3;9232:6;9227:3;9223:16;9219:26;9212:37;9297:4;9290:5;9286:16;9280:23;9258:45;;9312:50;9356:4;9351:3;9347:14;9331;-1:-1:-1;;;;;6558:31:44;6546:44;;6492:104;9312:50;9411:4;9400:16;;;9394:23;9378:14;;;9371:47;9467:4;9456:16;;;9450:23;9434:14;;;9427:47;;;;-1:-1:-1;;9528:2:44;9507:15;-1:-1:-1;;9503:29:44;9494:39;9535:3;9490:49;;8814:731::o;9550:287::-;9749:2;9738:9;9731:21;9712:4;9769:62;9827:2;9816:9;9812:18;9804:6;9769:62;:::i;9842:184::-;9912:6;9965:2;9953:9;9944:7;9940:23;9936:32;9933:52;;;9981:1;9978;9971:12;9933:52;-1:-1:-1;10004:16:44;;9842:184;-1:-1:-1;9842:184:44:o;10862:294::-;11078:3;11063:19;;11091:59;11067:9;11132:6;10455:12;;-1:-1:-1;;;;;10451:21:44;;;10439:34;;10526:4;10515:16;;;10509:23;10505:32;;10489:14;;;10482:56;10591:4;10580:16;;;10574:23;10599:8;10570:38;10554:14;;;10547:62;10662:4;10651:16;;;10645:23;10641:32;;10625:14;;;10618:56;10723:4;10712:16;;;10706:23;10690:14;;;10683:47;10419:3;10768:16;;;10762:23;10746:14;;;10739:47;10839:4;10828:16;;;10822:23;10818:32;10802:14;;10795:56;10325:532;11869:127;11930:10;11925:3;11921:20;11918:1;11911:31;11961:4;11958:1;11951:15;11985:4;11982:1;11975:15;12001:128;12068:9;;;12089:11;;;12086:37;;;12103:18;;:::i;12514:277::-;12581:6;12634:2;12622:9;12613:7;12609:23;12605:32;12602:52;;;12650:1;12647;12640:12;12602:52;12682:9;12676:16;12735:5;12728:13;12721:21;12714:5;12711:32;12701:60;;12757:1;12754;12747:12;12796:125;12861:9;;;12882:10;;;12879:36;;;12895:18;;:::i;14277:127::-;14338:10;14333:3;14329:20;14326:1;14319:31;14369:4;14366:1;14359:15;14393:4;14390:1;14383:15;14409:135;14448:3;14469:17;;;14466:43;;14489:18;;:::i;:::-;-1:-1:-1;14536:1:44;14525:13;;14409:135::o;14907:168::-;14980:9;;;15011;;15028:15;;;15022:22;;15008:37;14998:71;;15049:18;;:::i;15080:217::-;15120:1;15146;15136:132;;15190:10;15185:3;15181:20;15178:1;15171:31;15225:4;15222:1;15215:15;15253:4;15250:1;15243:15;15136:132;-1:-1:-1;15282:9:44;;15080:217::o", + "object": "0x6080604052600436106100e85760003560e01c8063735de9f71161008a578063ac9650d811610059578063ac9650d814610243578063d9a6f70514610263578063ed921d3c14610279578063f2fde38b1461028c57600080fd5b8063735de9f7146101c5578063742ac944146101fd5780638456cb59146102105780638da5cb5b1461022557600080fd5b80633f4ba83a116100c65780633f4ba83a1461014f5780635ae401dc146101665780635c975abb14610186578063715018a6146101b057600080fd5b80631411734e146100ed57806314d90e1b146101135780631fd168ff1461013c575b600080fd5b6101006100fb366004611a14565b6102ac565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101296103e881565b60405161ffff909116815260200161010a565b61010061014a366004611a14565b61040a565b34801561015b57600080fd5b5061016461057a565b005b610179610174366004611ac0565b61058c565b60405161010a9190611b5b565b34801561019257600080fd5b50600054600160a01b900460ff16604051901515815260200161010a565b3480156101bc57600080fd5b506101646105e2565b3480156101d157600080fd5b506001546101e5906001600160a01b031681565b6040516001600160a01b03909116815260200161010a565b61010061020b366004611c50565b6105f4565b34801561021c57600080fd5b50610164610731565b34801561023157600080fd5b506000546001600160a01b03166101e5565b34801561024f57600080fd5b5061017961025e366004611ca5565b610741565b34801561026f57600080fd5b5061012961271081565b610100610287366004611c50565b610836565b34801561029857600080fd5b506101646102a7366004611ce6565b61095e565b60208101516000906001600160a01b031633148015906102d9575060208201516001600160a01b03163014155b156102ff5760405162461bcd60e51b81526004016102f690611d03565b60405180910390fd5b600061030e83600001516109d7565b905060008061037983866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761036060408302860136819003810190611d50565b81526020019060010190610343565b50505050506109e3565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103bc908890600401611dfc565b6020604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190611e0f565b979650505050505050565b6040810151815160009190829061042090610ac4565b9050600061043185600001516109d7565b90506000806000806104a4868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761048b60408302860136819003810190611d50565b8152602001906001019061046e565b5050505050610af2565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016105159190611dfc565b6020604051808303816000875af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611e0f565b975061056c8787878c604001518587610bd3565b505050505050509392505050565b610582610e16565b61058a610e70565b565b6060834211156105d05760405162461bcd60e51b815260206004820152600f60248201526e111958591b1a5b99481c185cdcd959608a1b60448201526064016102f6565b6105da8383610741565b949350505050565b6105ea610e16565b61058a6000610ec5565b60608101516000906001600160a01b03163314801590610621575060608201516001600160a01b03163014155b1561063e5760405162461bcd60e51b81526004016102f690611d03565b6000806106a18460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761069260408302860136819003810190611d50565b81526020019060010190610675565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf906106e4908790600401611e28565b6020604051808303816000875af1158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611e0f565b9695505050505050565b610739610e16565b61058a610f15565b6060816001600160401b0381111561075b5761075b61189c565b60405190808252806020026020018201604052801561078e57816020015b60608152602001906001900390816107795790505b50905060005b8281101561082e576107fe308585848181106107b2576107b2611e87565b90506020028101906107c49190611e9d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f5892505050565b82828151811061081057610810611e87565b6020026020010181905250808061082690611ef9565b915050610794565b505b92915050565b600080826080015190506000806000806108ab87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761089c60408302860136819003810190611d50565b8152602001906001019061087f565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df906108f3908a90600401611e28565b6020604051808303816000875af1158015610912573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109369190611e0f565b955061095285886000015189602001518a608001518587610bd3565b50505050509392505050565b610966610e16565b6001600160a01b0381166109cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f6565b6109d481610ec5565b50565b60006108308282610f84565b600080548190600160a01b900460ff16610a2257600080610a048786610fe9565b9092509050610a138288611f12565b9650610a1f88826111c6565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a999190611f25565b50610aa48686611341565b306001600160a01b03851603610ab8573393505b50929491935090915050565b60008060148351610ad59190611f12565b90506000610ae584836014611438565b90506105da816000610f84565b6000806060818082610b0e60005460ff600160a01b9091041690565b610b2e57610b1c8988610fe9565b9092509050610b2b828a611f47565b98505b6001600160a01b0388163014610b42573097505b610b4c8b8b611341565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af1158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611f25565b50979a9699509697505050505050565b600054600160a01b900460ff16610bee57610bee8482611545565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190611e0f565b9050610c658385611f12565b811015610cb45760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e7420646973747269627574656460448201526064016102f6565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611f25565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190611e0f565b90508015610e0c5760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611f25565b505b5050505050505050565b6000546001600160a01b0316331461058a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f6565b610e786116b4565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f1d611704565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ea83390565b6060610f7d8383604051806060016040528060278152602001611fc360279139611751565b9392505050565b6000610f91826014611f47565b83511015610fd95760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016102f6565b500160200151600160601b900490565b6000606081805b845181101561103a5784818151811061100b5761100b611e87565b60200260200101516020015161ffff16826110269190611f47565b91508061103281611ef9565b915050610ff0565b506103e881111561108d5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f46454500000060448201526064016102f6565b60008085516001600160401b038111156110a9576110a961189c565b6040519080825280602002602001820160405280156110ee57816020015b60408051808201909152600080825260208201528152602001906001900390816110c75790505b50905060005b86518110156111b757600061271061ffff1688838151811061111857611118611e87565b60200260200101516020015161ffff168a6111339190611f5a565b61113d9190611f71565b9050604051806040016040528089848151811061115c5761115c611e87565b6020026020010151600001516001600160a01b031681526020018281525083838151811061118c5761118c611e87565b60209081029190910101526111a18185611f47565b93505080806111af90611ef9565b9150506110f4565b509093509150505b9250929050565b60005b815181101561133c57826001600160a01b03166323b872dd338484815181106111f4576111f4611e87565b60200260200101516000015185858151811061121257611212611e87565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112989190611f25565b508181815181106112ab576112ab611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061130757611307611e87565b60200260200101516020015160405161132291815260200190565b60405180910390a48061133481611ef9565b9150506111c9565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611e0f565b10156114345760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611410573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190611f25565b5050565b60608161144681601f611f47565b10156114855760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016102f6565b61148f8284611f47565b845110156114d35760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102f6565b6060821580156114f2576040519150600082526020820160405261153c565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561152b578051835260209283019201611513565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561133c57826001600160a01b031663a9059cbb83838151811061157257611572611e87565b60200260200101516000015184848151811061159057611590611e87565b6020026020010151602001516040518363ffffffff1660e01b81526004016115cd9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156115ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116109190611f25565b5081818151811061162357611623611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061167f5761167f611e87565b60200260200101516020015160405161169a91815260200190565b60405180910390a4806116ac81611ef9565b915050611548565b600054600160a01b900460ff1661058a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016102f6565b600054600160a01b900460ff161561058a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016102f6565b6060600080856001600160a01b03168560405161176e9190611f93565b600060405180830381855af49150503d80600081146117a9576040519150601f19603f3d011682016040523d82523d6000602084013e6117ae565b606091505b50915091506107278683838760608315611829578251600003611822576001600160a01b0385163b6118225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102f6565b50816105da565b6105da838381511561183e5781518083602001fd5b8060405162461bcd60e51b81526004016102f69190611faf565b60008083601f84011261186a57600080fd5b5081356001600160401b0381111561188157600080fd5b6020830191508360208260061b85010111156111bf57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156118d4576118d461189c565b60405290565b60405160e081016001600160401b03811182821017156118d4576118d461189c565b604051601f8201601f191681016001600160401b03811182821017156119245761192461189c565b604052919050565b6001600160a01b03811681146109d457600080fd5b803561194c8161192c565b919050565b60006080828403121561196357600080fd5b61196b6118b2565b905081356001600160401b038082111561198457600080fd5b818401915084601f83011261199857600080fd5b81356020828211156119ac576119ac61189c565b6119be601f8301601f191682016118fc565b925081835286818386010111156119d457600080fd5b818185018285013760008183850101528285526119f2818701611941565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215611a2957600080fd5b83356001600160401b0380821115611a4057600080fd5b611a4c87838801611858565b90955093506020860135915080821115611a6557600080fd5b50611a7286828701611951565b9150509250925092565b60008083601f840112611a8e57600080fd5b5081356001600160401b03811115611aa557600080fd5b6020830191508360208260051b85010111156111bf57600080fd5b600080600060408486031215611ad557600080fd5b8335925060208401356001600160401b03811115611af257600080fd5b611afe86828701611a7c565b9497909650939450505050565b60005b83811015611b26578181015183820152602001611b0e565b50506000910152565b60008151808452611b47816020860160208601611b0b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611bb057603f19888603018452611b9e858351611b2f565b94509285019290850190600101611b82565b5092979650505050505050565b600060e08284031215611bcf57600080fd5b611bd76118da565b90508135611be48161192c565b81526020820135611bf48161192c565b6020820152604082013562ffffff81168114611c0f57600080fd5b6040820152611c2060608301611941565b60608201526080820135608082015260a082013560a0820152611c4560c08301611941565b60c082015292915050565b60008060006101008486031215611c6657600080fd5b83356001600160401b03811115611c7c57600080fd5b611c8886828701611858565b9094509250611c9c90508560208601611bbd565b90509250925092565b60008060208385031215611cb857600080fd5b82356001600160401b03811115611cce57600080fd5b611cda85828601611a7c565b90969095509350505050565b600060208284031215611cf857600080fd5b8135610f7d8161192c565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b600060408284031215611d6257600080fd5b604051604081018181106001600160401b0382111715611d8457611d8461189c565b6040528235611d928161192c565b8152602083013561ffff81168114611da957600080fd5b60208201529392505050565b6000815160808452611dca6080850182611b2f565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b602081526000610f7d6020830184611db5565b600060208284031215611e2157600080fd5b5051919050565b60e08101610830828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611eb457600080fd5b8301803591506001600160401b03821115611ece57600080fd5b6020019150368190038213156111bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611f0b57611f0b611ee3565b5060010190565b8181038181111561083057610830611ee3565b600060208284031215611f3757600080fd5b81518015158114610f7d57600080fd5b8082018082111561083057610830611ee3565b808202811582820484141761083057610830611ee3565b600082611f8e57634e487b7160e01b600052601260045260246000fd5b500490565b60008251611fa5818460208701611b0b565b9190910192915050565b602081526000610f7d6020830184611b2f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203925f97cd63c2e61736a2a442ff1d4bf966f453350e9df354a849229f69092cf64736f6c63430008130033", + "sourceMap": "531:15016:46:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3774:771;;;;;;:::i;:::-;;:::i;:::-;;;3527:25:55;;;3515:2;3500:18;3774:771:46;;;;;;;;685:46;;;;;;;;;;;;726:5;685:46;;;;;3737:6:55;3725:19;;;3707:38;;3695:2;3680:18;685:46:46;3563:188:55;6541:965:46;;;;;;:::i;:::-;;:::i;15480:65::-;;;;;;;;;;;;;:::i;:::-;;1281:234;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;1615:84:18:-;;;;;;;;;;-1:-1:-1;1662:4:18;1685:7;-1:-1:-1;;;1685:7:18;;;;1615:84;;6931:14:55;;6924:22;6906:41;;6894:2;6879:18;1615:84:18;6766:187:55;1824:101:17;;;;;;;;;;;;;:::i;798:34:46:-;;;;;;;;;;-1:-1:-1;798:34:46;;;;-1:-1:-1;;;;;798:34:46;;;;;;-1:-1:-1;;;;;7145:32:55;;;7127:51;;7115:2;7100:18;798:34:46;6958:226:55;2456:689:46;;;;;;:::i;:::-;;:::i;15330:61::-;;;;;;;;;;;;;:::i;1201:85:17:-;;;;;;;;;;-1:-1:-1;1247:7:17;1273:6;-1:-1:-1;;;;;1273:6:17;1201:85;;1521:306:46;;;;;;;;;;-1:-1:-1;1521:306:46;;;;;:::i;:::-;;:::i;626:53::-;;;;;;;;;;;;673:6;626:53;;5127:832;;;;;;:::i;:::-;;:::i;2074:198:17:-;;;;;;;;;;-1:-1:-1;2074:198:17;;;;;:::i;:::-;;:::i;3774:771:46:-;3975:16;;;;3942:17;;-1:-1:-1;;;;;3975:30:46;3995:10;3975:30;;;;:67;;-1:-1:-1;4009:16:46;;;;-1:-1:-1;;;;;4009:33:46;4037:4;4009:33;;3975:67;3971:153;;;4058:55;;-1:-1:-1;;;4058:55:46;;;;;;;:::i;:::-;;;;;;;;3971:153;4181:15;4199:31;:6;:11;;;:29;:31::i;:::-;4181:49;;4242:16;4260:17;4293:75;4313:7;4322:6;:15;;;4339:6;:16;;;4357:10;;4293:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:19;:75::i;:::-;4378:15;;;;:26;;;-1:-1:-1;;;;;4414:28:46;;;:16;;;:28;4506:13;;:32;;-1:-1:-1;;;4506:32:46;;4241:127;;-1:-1:-1;4241:127:46;;-1:-1:-1;4506:13:46;;:24;;:32;;4378:6;;4506:32;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4494:44;3774:771;-1:-1:-1;;;;;;;3774:771:46:o;6541:965::-;6820:16;;;;6864:11;;6711:16;;6820;6711;;6864:31;;:29;:31::i;:::-;6846:49;;6905:16;6924:31;:6;:11;;;:29;:31::i;:::-;6905:50;;6967:17;6986;7005:35;7042:22;7080:101;7101:7;7110:6;:22;;;7134:6;:16;;;7152:6;:16;;;7170:10;;7080:101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:20;:101::i;:::-;6966:215;;;;;;;;7210:9;7191:6;:16;;:28;;;;;7248:9;7229:6;:16;;:28;-1:-1:-1;;;;;7229:28:46;;;-1:-1:-1;;;;;7229:28:46;;;;;7320:13;;;;;;;;;-1:-1:-1;;;;;7320:13:46;-1:-1:-1;;;;;7320:25:46;;7346:6;7320:33;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;7309:44;;7364:135;7404:17;7423:7;7432:8;7442:6;:16;;;7460:14;7476:13;7364:26;:135::i;:::-;6729:777;;;;;;;6541:965;;;;;:::o;15480:65::-;1094:13:17;:11;:13::i;:::-;15528:10:46::1;:8;:10::i;:::-;15480:65::o:0;1281:234::-;1391:14;1448:8;1429:15;:27;;1421:55;;;;-1:-1:-1;;;1421:55:46;;12811:2:55;1421:55:46;;;12793:21:55;12850:2;12830:18;;;12823:30;-1:-1:-1;;;12869:18:55;;;12862:45;12924:18;;1421:55:46;12609:339:55;1421:55:46;1493:15;1503:4;;1493:9;:15::i;:::-;1486:22;1281:234;-1:-1:-1;;;;1281:234:46:o;1824:101:17:-;1094:13;:11;:13::i;:::-;1888:30:::1;1915:1;1888:18;:30::i;2456:689:46:-:0;2669:16;;;;2636:17;;-1:-1:-1;;;;;2669:30:46;2689:10;2669:30;;;;:67;;-1:-1:-1;2703:16:46;;;;-1:-1:-1;;;;;2703:33:46;2731:4;2703:33;;2669:67;2665:153;;;2752:55;;-1:-1:-1;;;2752:55:46;;;;;;;:::i;2665:153::-;2829:16;2847:17;2880:82;2900:6;:14;;;2916:6;:15;;;2933:6;:16;;;2951:10;;2880:82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;2972:15;;;:26;;;-1:-1:-1;;;;;3008:28:46;;;:16;;;:28;3100:13;;:38;;-1:-1:-1;;;3100:38:46;;2828:134;;-1:-1:-1;2828:134:46;;-1:-1:-1;3100:13:46;;:30;;:38;;2972:6;;3100:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3088:50;2456:689;-1:-1:-1;;;;;;2456:689:46:o;15330:61::-;1094:13:17;:11;:13::i;:::-;15376:8:46::1;:6;:8::i;1521:306::-:0;1587:22;1643:4;-1:-1:-1;;;;;1631:24:46;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1621:34;;1670:9;1665:132;1685:15;;;1665:132;;;1734:52;1771:4;1778;;1783:1;1778:7;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;1734:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1734:28:46;;-1:-1:-1;;;1734:52:46:i;:::-;1721:7;1729:1;1721:10;;;;;;;;:::i;:::-;;;;;;:65;;;;1702:3;;;;;:::i;:::-;;;;1665:132;;;;1521:306;;;;;:::o;5127:832::-;5309:16;5337:25;5365:6;:16;;;5337:44;;5393:17;5412;5431:35;5468:22;5506:108;5527:6;:14;;;5543:6;:22;;;5567:6;:16;;;5585:6;:16;;;5603:10;;5506:108;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;5624:16;;;:28;;;-1:-1:-1;;;;;5662:28:46;;;:16;;;:28;5753:13;;:39;;-1:-1:-1;;;5753:39:46;;5392:222;;-1:-1:-1;5392:222:46;;-1:-1:-1;5392:222:46;;-1:-1:-1;5392:222:46;-1:-1:-1;5753:13:46;;:31;;:39;;5624:6;;5753:39;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5742:50;;5803:149;5843:17;5862:6;:14;;;5878:6;:15;;;5895:6;:16;;;5913:14;5929:13;5803:26;:149::i;:::-;5327:632;;;;;5127:832;;;;;:::o;2074:198:17:-;1094:13;:11;:13::i;:::-;-1:-1:-1;;;;;2162:22:17;::::1;2154:73;;;::::0;-1:-1:-1;;;2154:73:17;;15222:2:55;2154:73:17::1;::::0;::::1;15204:21:55::0;15261:2;15241:18;;;15234:30;15300:34;15280:18;;;15273:62;-1:-1:-1;;;15351:18:55;;;15344:36;15397:19;;2154:73:17::1;15020:402:55::0;2154:73:17::1;2237:28;2256:8;2237:18;:28::i;:::-;2074:198:::0;:::o;1582:119:48:-;1651:7;1677:17;:4;1651:7;1677:14;:17::i;9178:1089:46:-;9358:7;1685::18;;9358::46;;-1:-1:-1;;;1685:7:18;;;;9386:390:46;;9508:12;9522:35;9561:36;9576:8;9586:10;9561:14;:36::i;:::-;9507:90;;-1:-1:-1;9507:90:46;-1:-1:-1;9622:15:46;9507:90;9622:8;:15;:::i;:::-;9611:26;;9706:59;9742:7;9751:13;9706:35;:59::i;:::-;9401:375;;9386:390;9960:65;;-1:-1:-1;;;9960:65:46;;9989:10;9960:65;;;15800:34:55;10009:4:46;15850:18:55;;;15843:43;15902:18;;;15895:34;;;-1:-1:-1;;;;;9960:28:46;;;;;15735:18:55;;9960:65:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;10036:34;10052:7;10061:8;10036:15;:34::i;:::-;10110:4;-1:-1:-1;;;;;10085:30:46;;;10081:137;;10197:10;10181:26;;10081:137;-1:-1:-1;10236:8:46;;10246:13;;-1:-1:-1;9178:1089:46;;-1:-1:-1;;9178:1089:46:o;936:640:48:-;1005:7;1355:37;257:2;1395:4;:11;:31;;;;:::i;:::-;1355:71;-1:-1:-1;1437:26:48;1466:60;:4;1355:71;257:2;1466:10;:60::i;:::-;1437:89;-1:-1:-1;1543:26:48;1437:89;1567:1;1543:23;:26::i;10991:1076:46:-;11199:7;;11217:21;11199:7;;11217:21;11345:8;1662:4:18;1685:7;;-1:-1:-1;;;1685:7:18;;;;;1615:84;11345:8:46;11340:163;;11403:37;11418:9;11429:10;11403:14;:37::i;:::-;11369:71;;-1:-1:-1;11369:71:46;-1:-1:-1;11466:26:46;11369:71;11466:9;:26;:::i;:::-;11454:38;;11340:163;-1:-1:-1;;;;;11517:30:46;;11542:4;11517:30;11513:178;;11675:4;11651:29;;11513:178;11701:34;11717:7;11726:8;11701:15;:34::i;:::-;11920:65;;-1:-1:-1;;;11920:65:46;;11949:10;11920:65;;;15800:34:55;11969:4:46;15850:18:55;;;15843:43;15902:18;;;15895:34;;;-1:-1:-1;;;;;11920:28:46;;;;;15735:18:55;;11920:65:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;12004:9:46;;12015:13;;-1:-1:-1;12030:13:46;;-1:-1:-1;;;;;;10991:1076:46:o;12599:1257::-;1662:4:18;1685:7;-1:-1:-1;;;1685:7:18;;;;12896:101:46;;12925:61;12962:8;12972:13;12925:36;:61::i;:::-;13033:41;;-1:-1:-1;;;13033:41:46;;13068:4;13033:41;;;7127:51:55;13007:23:46;;-1:-1:-1;;;;;13033:26:46;;;;;7100:18:55;;13033:41:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;13007:67;-1:-1:-1;13380:26:46;13392:14;13380:9;:26;:::i;:::-;13361:15;:45;;13353:90;;;;-1:-1:-1;;;13353:90:46;;16554:2:55;13353:90:46;;;16536:21:55;;;16573:18;;;16566:30;16632:34;16612:18;;;16605:62;16684:18;;13353:90:46;16352:356:55;13353:90:46;13516:56;;-1:-1:-1;;;13516:56:46;;13542:10;13516:56;;;16887:51:55;16954:18;;;16947:34;;;-1:-1:-1;;;;;13516:25:46;;;;;16860:18:55;;13516:56:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;13617:40:46;;-1:-1:-1;;;13617:40:46;;13651:4;13617:40;;;7127:51:55;13583:31:46;;-1:-1:-1;;;;;13617:25:46;;;;;7100:18:55;;13617:40:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;13583:74;-1:-1:-1;13671:27:46;;13667:183;;13778:61;;-1:-1:-1;;;13778:61:46;;13803:10;13778:61;;;16887:51:55;16954:18;;;16947:34;;;-1:-1:-1;;;;;13778:24:46;;;;;16860:18:55;;13778:61:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;13667:183;12840:1016;;12599:1257;;;;;;:::o;1359:130:17:-;1247:7;1273:6;-1:-1:-1;;;;;1273:6:17;719:10:23;1422:23:17;1414:68;;;;-1:-1:-1;;;1414:68:17;;17194:2:55;1414:68:17;;;17176:21:55;;;17213:18;;;17206:30;17272:34;17252:18;;;17245:62;17324:18;;1414:68:17;16992:356:55;2433:117:18;1486:16;:14;:16::i;:::-;2501:5:::1;2491:15:::0;;-1:-1:-1;;;;2491:15:18::1;::::0;;2521:22:::1;719:10:23::0;2530:12:18::1;2521:22;::::0;-1:-1:-1;;;;;7145:32:55;;;7127:51;;7115:2;7100:18;2521:22:18::1;;;;;;;2433:117::o:0;2426:187:17:-;2499:16;2518:6;;-1:-1:-1;;;;;2534:17:17;;;-1:-1:-1;;;;;;2534:17:17;;;;;;2566:40;;2518:6;;;;;;;2566:40;;2499:16;2566:40;2489:124;2426:187;:::o;2186:115:18:-;1239:19;:17;:19::i;:::-;2245:7:::1;:14:::0;;-1:-1:-1;;;;2245:14:18::1;-1:-1:-1::0;;;2245:14:18::1;::::0;;2274:20:::1;2281:12;719:10:23::0;;640:96;6674:198:22;6757:12;6788:77;6809:6;6817:4;6788:77;;;;;;;;;;;;;;;;;:20;:77::i;:::-;6781:84;6674:198;-1:-1:-1;;;6674:198:22:o;12267:354:24:-;12346:7;12390:11;:6;12399:2;12390:11;:::i;:::-;12373:6;:13;:28;;12365:62;;;;-1:-1:-1;;;12365:62:24;;17555:2:55;12365:62:24;;;17537:21:55;17594:2;17574:18;;;17567:30;-1:-1:-1;;;17613:18:55;;;17606:51;17674:18;;12365:62:24;17353:345:55;12365:62:24;-1:-1:-1;12515:30:24;12531:4;12515:30;12509:37;-1:-1:-1;;;12505:71:24;;;12267:354::o;7599:1063:46:-;7724:7;7733:21;7724:7;;7874:125;7898:10;:17;7894:1;:21;7874:125;;;7955:10;7966:1;7955:13;;;;;;;;:::i;:::-;;;;;;;:33;;;7936:52;;;;;;;:::i;:::-;;-1:-1:-1;7917:3:46;;;;:::i;:::-;;;;7874:125;;;-1:-1:-1;726:5:46;8016:34;;;8008:76;;;;-1:-1:-1;;;8008:76:46;;17905:2:55;8008:76:46;;;17887:21:55;17944:2;17924:18;;;17917:30;17983:31;17963:18;;;17956:59;18032:18;;8008:76:46;17703:353:55;8008:76:46;8095:17;8126:35;8183:10;:17;-1:-1:-1;;;;;8164:37:46;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;8164:37:46;;;;;;;;;;;;;;;;8126:75;;8299:9;8294:318;8318:10;:17;8314:1;:21;8294:318;;;8356:17;673:6;8432:30;;8394:10;8405:1;8394:13;;;;;;;;:::i;:::-;;;;;;;:33;;;8386:42;;8377:6;:51;;;;:::i;:::-;8376:86;;;;:::i;:::-;8356:106;;8496:69;;;;;;;;8521:10;8532:1;8521:13;;;;;;;;:::i;:::-;;;;;;;:23;;;-1:-1:-1;;;;;8496:69:46;;;;;8554:9;8496:69;;;8477:13;8491:1;8477:16;;;;;;;;:::i;:::-;;;;;;;;;;:88;8579:22;8592:9;8579:22;;:::i;:::-;;;8342:270;8337:3;;;;;:::i;:::-;;;;8294:318;;;-1:-1:-1;8630:9:46;;-1:-1:-1;8641:13:46;-1:-1:-1;;7599:1063:46;;;;;;:::o;13954:388::-;14075:9;14070:266;14094:13;:20;14090:1;:24;14070:266;;;14142:5;-1:-1:-1;;;;;14135:26:46;;14162:10;14174:13;14188:1;14174:16;;;;;;;;:::i;:::-;;;;;;;:26;;;14202:13;14216:1;14202:16;;;;;;;;:::i;:::-;;;;;;;;;;;;:23;;14135:91;;-1:-1:-1;;;;;;14135:91:46;;;;;;;-1:-1:-1;;;;;15818:15:55;;;14135:91:46;;;15800:34:55;15870:15;;;;15850:18;;;15843:43;15902:18;;;15895:34;15735:18;;14135:91:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;14273:13;14287:1;14273:16;;;;;;;;:::i;:::-;;;;;;;:26;;;-1:-1:-1;;;;;14245:80:46;14261:10;-1:-1:-1;;;;;14245:80:46;14254:5;-1:-1:-1;;;;;14245:80:46;;14301:13;14315:1;14301:16;;;;;;;;:::i;:::-;;;;;;;:23;;;14245:80;;;;3527:25:55;;3515:2;3500:18;;3381:177;14245:80:46;;;;;;;;14116:3;;;;:::i;:::-;;;;14070:266;;;;13954:388;;:::o;14917:326::-;15114:13;;15067:62;;-1:-1:-1;;;15067:62:46;;15099:4;15067:62;;;18668:34:55;-1:-1:-1;;;;;15114:13:46;;;18718:18:55;;;18711:43;15132:14:46;;15067:23;;;;;18603:18:55;;15067:62:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:79;15063:174;;;15192:13;;15162:64;;-1:-1:-1;;;15162:64:46;;-1:-1:-1;;;;;15192:13:46;;;15162:64;;;16887:51:55;-1:-1:-1;;16954:18:55;;;16947:34;15162:21:46;;;;;;16860:18:55;;15162:64:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;15063:174::-;14917:326;;:::o;9457:2804:24:-;9603:12;9655:7;9639:12;9655:7;9649:2;9639:12;:::i;:::-;:23;;9631:50;;;;-1:-1:-1;;;9631:50:24;;18967:2:55;9631:50:24;;;18949:21:55;19006:2;18986:18;;;18979:30;-1:-1:-1;;;19025:18:55;;;19018:44;19079:18;;9631:50:24;18765:338:55;9631:50:24;9716:16;9725:7;9716:6;:16;:::i;:::-;9699:6;:13;:33;;9691:63;;;;-1:-1:-1;;;9691:63:24;;19310:2:55;9691:63:24;;;19292:21:55;19349:2;19329:18;;;19322:30;-1:-1:-1;;;19368:18:55;;;19361:47;19425:18;;9691:63:24;19108:341:55;9691:63:24;9765:22;9828:15;;9856:1967;;;;11964:4;11958:11;11945:24;;12150:1;12139:9;12132:20;12198:4;12187:9;12183:20;12177:4;12170:34;9821:2397;;9856:1967;10038:4;10032:11;10019:24;;10697:2;10688:7;10684:16;11079:9;11072:17;11066:4;11062:28;11050:9;11039;11035:25;11031:60;11127:7;11123:2;11119:16;11379:6;11365:9;11358:17;11352:4;11348:28;11336:9;11328:6;11324:22;11320:57;11316:70;11153:425;11412:3;11408:2;11405:11;11153:425;;;11550:9;;11539:21;;11453:4;11445:13;;;;11485;11153:425;;;-1:-1:-1;;11596:26:24;;;11804:2;11787:11;-1:-1:-1;;11783:25:24;11777:4;11770:39;-1:-1:-1;9821:2397:24;-1:-1:-1;12245:9:24;9457:2804;-1:-1:-1;;;;9457:2804:24:o;14443:373:46:-;14565:9;14560:250;14584:13;:20;14580:1;:24;14560:250;;;14632:5;-1:-1:-1;;;;;14625:22:46;;14648:13;14662:1;14648:16;;;;;;;;:::i;:::-;;;;;;;:26;;;14676:13;14690:1;14676:16;;;;;;;;:::i;:::-;;;;;;;:23;;;14625:75;;;;;;;;;;;;;;;-1:-1:-1;;;;;16905:32:55;;;;16887:51;;16969:2;16954:18;;16947:34;16875:2;16860:18;;16713:274;14625:75:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;14747:13;14761:1;14747:16;;;;;;;;:::i;:::-;;;;;;;:26;;;-1:-1:-1;;;;;14719:80:46;14735:10;-1:-1:-1;;;;;14719:80:46;14728:5;-1:-1:-1;;;;;14719:80:46;;14775:13;14789:1;14775:16;;;;;;;;:::i;:::-;;;;;;;:23;;;14719:80;;;;3527:25:55;;3515:2;3500:18;;3381:177;14719:80:46;;;;;;;;14606:3;;;;:::i;:::-;;;;14560:250;;1945:106:18;1662:4;1685:7;-1:-1:-1;;;1685:7:18;;;;2003:41;;;;-1:-1:-1;;;2003:41:18;;19656:2:55;2003:41:18;;;19638:21:55;19695:2;19675:18;;;19668:30;-1:-1:-1;;;19714:18:55;;;19707:50;19774:18;;2003:41:18;19454:344:55;1767:106:18;1662:4;1685:7;-1:-1:-1;;;1685:7:18;;;;1836:9;1828:38;;;;-1:-1:-1;;;1828:38:18;;20005:2:55;1828:38:18;;;19987:21:55;20044:2;20024:18;;;20017:30;-1:-1:-1;;;20063:18:55;;;20056:46;20119:18;;1828:38:18;19803:340:55;7058:325:22;7199:12;7224;7238:23;7265:6;-1:-1:-1;;;;;7265:19:22;7285:4;7265:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7223:67;;;;7307:69;7334:6;7342:7;7351:10;7363:12;7851;7879:7;7875:418;;;7906:10;:17;7927:1;7906:22;7902:286;;-1:-1:-1;;;;;1702:19:22;;;8113:60;;;;-1:-1:-1;;;8113:60:22;;20642:2:55;8113:60:22;;;20624:21:55;20681:2;20661:18;;;20654:30;20720:31;20700:18;;;20693:59;20769:18;;8113:60:22;20440:353:55;8113:60:22;-1:-1:-1;8208:10:22;8201:17;;7875:418;8249:33;8257:10;8269:12;8980:17;;:21;8976:379;;9208:10;9202:17;9264:15;9251:10;9247:2;9243:19;9236:44;8976:379;9331:12;9324:20;;-1:-1:-1;;;9324:20:22;;;;;;;;:::i;14:392:55:-;102:8;112:6;166:3;159:4;151:6;147:17;143:27;133:55;;184:1;181;174:12;133:55;-1:-1:-1;207:20:55;;-1:-1:-1;;;;;239:30:55;;236:50;;;282:1;279;272:12;236:50;319:4;311:6;307:17;295:29;;379:3;372:4;362:6;359:1;355:14;347:6;343:27;339:38;336:47;333:67;;;396:1;393;386:12;411:127;472:10;467:3;463:20;460:1;453:31;503:4;500:1;493:15;527:4;524:1;517:15;543:253;615:2;609:9;657:4;645:17;;-1:-1:-1;;;;;677:34:55;;713:22;;;674:62;671:88;;;739:18;;:::i;:::-;775:2;768:22;543:253;:::o;801:::-;873:2;867:9;915:4;903:17;;-1:-1:-1;;;;;935:34:55;;971:22;;;932:62;929:88;;;997:18;;:::i;1059:275::-;1130:2;1124:9;1195:2;1176:13;;-1:-1:-1;;1172:27:55;1160:40;;-1:-1:-1;;;;;1215:34:55;;1251:22;;;1212:62;1209:88;;;1277:18;;:::i;:::-;1313:2;1306:22;1059:275;;-1:-1:-1;1059:275:55:o;1339:131::-;-1:-1:-1;;;;;1414:31:55;;1404:42;;1394:70;;1460:1;1457;1450:12;1475:134;1543:20;;1572:31;1543:20;1572:31;:::i;:::-;1475:134;;;:::o;1614:995::-;1677:5;1725:4;1713:9;1708:3;1704:19;1700:30;1697:50;;;1743:1;1740;1733:12;1697:50;1765:22;;:::i;:::-;1756:31;;1823:9;1810:23;-1:-1:-1;;;;;1893:2:55;1885:6;1882:14;1879:34;;;1909:1;1906;1899:12;1879:34;1947:6;1936:9;1932:22;1922:32;;1992:3;1985:4;1981:2;1977:13;1973:23;1963:51;;2010:1;2007;2000:12;1963:51;2046:2;2033:16;2068:4;2091:2;2087;2084:10;2081:36;;;2097:18;;:::i;:::-;2139:53;2182:2;2163:13;;-1:-1:-1;;2159:27:55;2155:36;;2139:53;:::i;:::-;2126:66;;2215:2;2208:5;2201:17;2255:3;2250:2;2245;2241;2237:11;2233:20;2230:29;2227:49;;;2272:1;2269;2262:12;2227:49;2327:2;2322;2318;2314:11;2309:2;2302:5;2298:14;2285:45;2371:1;2366:2;2361;2354:5;2350:14;2346:23;2339:34;2396:5;2389;2382:20;2434:38;2468:2;2457:9;2453:18;2434:38;:::i;:::-;2429:2;2422:5;2418:14;2411:62;;;;;2533:2;2522:9;2518:18;2505:32;2500:2;2493:5;2489:14;2482:56;2598:2;2587:9;2583:18;2570:32;2565:2;2558:5;2554:14;2547:56;1614:995;;;;:::o;2614:762::-;2781:6;2789;2797;2850:2;2838:9;2829:7;2825:23;2821:32;2818:52;;;2866:1;2863;2856:12;2818:52;2906:9;2893:23;-1:-1:-1;;;;;2976:2:55;2968:6;2965:14;2962:34;;;2992:1;2989;2982:12;2962:34;3031:95;3118:7;3109:6;3098:9;3094:22;3031:95;:::i;:::-;3145:8;;-1:-1:-1;3005:121:55;-1:-1:-1;3233:2:55;3218:18;;3205:32;;-1:-1:-1;3249:16:55;;;3246:36;;;3278:1;3275;3268:12;3246:36;;3301:69;3362:7;3351:8;3340:9;3336:24;3301:69;:::i;:::-;3291:79;;;2614:762;;;;;:::o;4524:374::-;4594:8;4604:6;4658:3;4651:4;4643:6;4639:17;4635:27;4625:55;;4676:1;4673;4666:12;4625:55;-1:-1:-1;4699:20:55;;-1:-1:-1;;;;;4731:30:55;;4728:50;;;4774:1;4771;4764:12;4728:50;4811:4;4803:6;4799:17;4787:29;;4871:3;4864:4;4854:6;4851:1;4847:14;4839:6;4835:27;4831:38;4828:47;4825:67;;;4888:1;4885;4878:12;4903:523;5009:6;5017;5025;5078:2;5066:9;5057:7;5053:23;5049:32;5046:52;;;5094:1;5091;5084:12;5046:52;5130:9;5117:23;5107:33;;5191:2;5180:9;5176:18;5163:32;-1:-1:-1;;;;;5210:6:55;5207:30;5204:50;;;5250:1;5247;5240:12;5204:50;5289:77;5358:7;5349:6;5338:9;5334:22;5289:77;:::i;:::-;4903:523;;5385:8;;-1:-1:-1;5263:103:55;;-1:-1:-1;;;;4903:523:55:o;5431:250::-;5516:1;5526:113;5540:6;5537:1;5534:13;5526:113;;;5616:11;;;5610:18;5597:11;;;5590:39;5562:2;5555:10;5526:113;;;-1:-1:-1;;5673:1:55;5655:16;;5648:27;5431:250::o;5686:270::-;5727:3;5765:5;5759:12;5792:6;5787:3;5780:19;5808:76;5877:6;5870:4;5865:3;5861:14;5854:4;5847:5;5843:16;5808:76;:::i;:::-;5938:2;5917:15;-1:-1:-1;;5913:29:55;5904:39;;;;5945:4;5900:50;;5686:270;-1:-1:-1;;5686:270:55:o;5961:800::-;6121:4;6150:2;6190;6179:9;6175:18;6220:2;6209:9;6202:21;6243:6;6278;6272:13;6309:6;6301;6294:22;6347:2;6336:9;6332:18;6325:25;;6409:2;6399:6;6396:1;6392:14;6381:9;6377:30;6373:39;6359:53;;6447:2;6439:6;6435:15;6468:1;6478:254;6492:6;6489:1;6486:13;6478:254;;;6585:2;6581:7;6569:9;6561:6;6557:22;6553:36;6548:3;6541:49;6613:39;6645:6;6636;6630:13;6613:39;:::i;:::-;6603:49;-1:-1:-1;6710:12:55;;;;6675:15;;;;6514:1;6507:9;6478:254;;;-1:-1:-1;6749:6:55;;5961:800;-1:-1:-1;;;;;;;5961:800:55:o;7189:889::-;7258:5;7306:4;7294:9;7289:3;7285:19;7281:30;7278:50;;;7324:1;7321;7314:12;7278:50;7346:22;;:::i;:::-;7337:31;;7405:9;7392:23;7424:33;7449:7;7424:33;:::i;:::-;7466:22;;7540:2;7525:18;;7512:32;7553:33;7512:32;7553:33;:::i;:::-;7613:2;7602:14;;7595:31;7678:2;7663:18;;7650:32;7726:8;7713:22;;7701:35;;7691:63;;7750:1;7747;7740:12;7691:63;7781:2;7770:14;;7763:31;7826:38;7860:2;7845:18;;7826:38;:::i;:::-;7821:2;7814:5;7810:14;7803:62;7926:3;7915:9;7911:19;7898:33;7892:3;7885:5;7881:15;7874:58;7993:3;7982:9;7978:19;7965:33;7959:3;7952:5;7948:15;7941:58;8032:39;8066:3;8055:9;8051:19;8032:39;:::i;:::-;8026:3;8019:5;8015:15;8008:64;7189:889;;;;:::o;8083:646::-;8256:6;8264;8272;8325:3;8313:9;8304:7;8300:23;8296:33;8293:53;;;8342:1;8339;8332:12;8293:53;8382:9;8369:23;-1:-1:-1;;;;;8407:6:55;8404:30;8401:50;;;8447:1;8444;8437:12;8401:50;8486:95;8573:7;8564:6;8553:9;8549:22;8486:95;:::i;:::-;8600:8;;-1:-1:-1;8460:121:55;-1:-1:-1;8654:69:55;;-1:-1:-1;8715:7:55;8710:2;8695:18;;8654:69;:::i;:::-;8644:79;;8083:646;;;;;:::o;8942:455::-;9039:6;9047;9100:2;9088:9;9079:7;9075:23;9071:32;9068:52;;;9116:1;9113;9106:12;9068:52;9156:9;9143:23;-1:-1:-1;;;;;9181:6:55;9178:30;9175:50;;;9221:1;9218;9211:12;9175:50;9260:77;9329:7;9320:6;9309:9;9305:22;9260:77;:::i;:::-;9356:8;;9234:103;;-1:-1:-1;8942:455:55;-1:-1:-1;;;;8942:455:55:o;10054:247::-;10113:6;10166:2;10154:9;10145:7;10141:23;10137:32;10134:52;;;10182:1;10179;10172:12;10134:52;10221:9;10208:23;10240:31;10265:5;10240:31;:::i;10306:409::-;10508:2;10490:21;;;10547:2;10527:18;;;10520:30;10586:34;10581:2;10566:18;;10559:62;-1:-1:-1;;;10652:2:55;10637:18;;10630:43;10705:3;10690:19;;10306:409::o;10720:682::-;10814:6;10867:2;10855:9;10846:7;10842:23;10838:32;10835:52;;;10883:1;10880;10873:12;10835:52;10916:2;10910:9;10958:2;10950:6;10946:15;11027:6;11015:10;11012:22;-1:-1:-1;;;;;10979:10:55;10976:34;10973:62;10970:88;;;11038:18;;:::i;:::-;11074:2;11067:22;11111:23;;11143:31;11111:23;11143:31;:::i;:::-;11183:21;;11256:2;11241:18;;11228:32;11304:6;11291:20;;11279:33;;11269:61;;11326:1;11323;11316:12;11269:61;11358:2;11346:15;;11339:32;11350:6;10720:682;-1:-1:-1;;;10720:682:55:o;11407:422::-;11466:3;11510:5;11504:12;11537:4;11532:3;11525:17;11563:46;11603:4;11598:3;11594:14;11580:12;11563:46;:::i;:::-;11662:4;11651:16;;;11645:23;-1:-1:-1;;;;;11641:49:55;11625:14;;;11618:73;11740:4;11729:16;;;11723:23;11707:14;;;11700:47;11796:4;11785:16;;;11779:23;11763:14;;;;11756:47;;;;-1:-1:-1;11551:58:55;;11407:422;-1:-1:-1;11407:422:55:o;11834:287::-;12033:2;12022:9;12015:21;11996:4;12053:62;12111:2;12100:9;12096:18;12088:6;12053:62;:::i;12126:184::-;12196:6;12249:2;12237:9;12228:7;12224:23;12220:32;12217:52;;;12265:1;12262;12255:12;12217:52;-1:-1:-1;12288:16:55;;12126:184;-1:-1:-1;12126:184:55:o;13490:294::-;13706:3;13691:19;;13719:59;13695:9;13760:6;13083:12;;-1:-1:-1;;;;;13079:21:55;;;13067:34;;13154:4;13143:16;;;13137:23;13133:32;;13117:14;;;13110:56;13219:4;13208:16;;;13202:23;13227:8;13198:38;13182:14;;;13175:62;13290:4;13279:16;;;13273:23;13269:32;;13253:14;;;13246:56;13351:4;13340:16;;;13334:23;13318:14;;;13311:47;13047:3;13396:16;;;13390:23;13374:14;;;13367:47;13467:4;13456:16;;;13450:23;13446:32;13430:14;;13423:56;12953:532;13789:127;13850:10;13845:3;13841:20;13838:1;13831:31;13881:4;13878:1;13871:15;13905:4;13902:1;13895:15;13921:521;13998:4;14004:6;14064:11;14051:25;14158:2;14154:7;14143:8;14127:14;14123:29;14119:43;14099:18;14095:68;14085:96;;14177:1;14174;14167:12;14085:96;14204:33;;14256:20;;;-1:-1:-1;;;;;;14288:30:55;;14285:50;;;14331:1;14328;14321:12;14285:50;14364:4;14352:17;;-1:-1:-1;14395:14:55;14391:27;;;14381:38;;14378:58;;;14432:1;14429;14422:12;14447:127;14508:10;14503:3;14499:20;14496:1;14489:31;14539:4;14536:1;14529:15;14563:4;14560:1;14553:15;14579:135;14618:3;14639:17;;;14636:43;;14659:18;;:::i;:::-;-1:-1:-1;14706:1:55;14695:13;;14579:135::o;15427:128::-;15494:9;;;15515:11;;;15512:37;;;15529:18;;:::i;15940:277::-;16007:6;16060:2;16048:9;16039:7;16035:23;16031:32;16028:52;;;16076:1;16073;16066:12;16028:52;16108:9;16102:16;16161:5;16154:13;16147:21;16140:5;16137:32;16127:60;;16183:1;16180;16173:12;16222:125;16287:9;;;16308:10;;;16305:36;;;16321:18;;:::i;18061:168::-;18134:9;;;18165;;18182:15;;;18176:22;;18162:37;18152:71;;18203:18;;:::i;18234:217::-;18274:1;18300;18290:132;;18344:10;18339:3;18335:20;18332:1;18325:31;18379:4;18376:1;18369:15;18407:4;18404:1;18397:15;18290:132;-1:-1:-1;18436:9:55;;18234:217::o;20148:287::-;20277:3;20315:6;20309:13;20331:66;20390:6;20385:3;20378:4;20370:6;20366:17;20331:66;:::i;:::-;20413:16;;;;;20148:287;-1:-1:-1;;20148:287:55:o;20798:219::-;20947:2;20936:9;20929:21;20910:4;20967:44;21007:2;20996:9;20992:18;20984:6;20967:44;:::i", "linkReferences": {} }, "methodIdentifiers": { @@ -466,6 +509,8 @@ "exactInputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))": "1411734e", "exactOutputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))": "ed921d3c", "exactOutputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))": "1fd168ff", + "multicall(bytes[])": "ac9650d8", + "multicall(uint256,bytes[])": "5ae401dc", "owner()": "8da5cb5b", "pause()": "8456cb59", "paused()": "5c975abb", @@ -474,7 +519,7 @@ "uniswapRouter()": "735de9f7", "unpause()": "3f4ba83a" }, - "rawMetadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_uniRouter\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"feePayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"feeRecipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"FeeTaken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASIS_POINT_PRECISION\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_SERVICE_FEE\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenIn\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenOut\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"fee\",\"type\":\"uint24\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMinimum\",\"type\":\"uint256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"}],\"internalType\":\"struct IV3SwapRouter.ExactInputSingleParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactInputSingleWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMinimum\",\"type\":\"uint256\"}],\"internalType\":\"struct IV3SwapRouter.ExactInputParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactInputWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenIn\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenOut\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"fee\",\"type\":\"uint24\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMaximum\",\"type\":\"uint256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"}],\"internalType\":\"struct IV3SwapRouter.ExactOutputSingleParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactOutputSingleWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMaximum\",\"type\":\"uint256\"}],\"internalType\":\"struct IV3SwapRouter.ExactOutputParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactOutputWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapRouter\",\"outputs\":[{\"internalType\":\"contract IV3SwapRouter\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_uniRouter\":\"The address of the Uniswap V3 router contract.\"}},\"exactInputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"details\":\"Takes a fee on the input token, by taking a cut from the `amountIn`, of the size of the fee amount, before doing the swap. This means that the developer, when quoting the swap, should calculate the fee amount and decrease the `amountIn` by that amount.This swap has only one hop.Emits a `FeeTaken` event for each fee recipient.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"exactInputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"details\":\"Takes a fee on the input token, by taking a cut from the `amountIn`, of the size of the fee amount, before doing the swap. This means that the developer, when quoting the swap, should calculate the fee amount and decrease the `amountIn` by that amount.Emits a `FeeTaken` event for each fee recipient.This swap has only one hop.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"exactOutputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"details\":\"Takes a fee on the output token, by increasing the `amountOut` by the fee amount. This means that the developer, when quoting the swap, should calculate the fee amount and increase the `amountOut` by that amount.Emits a `FeeTaken` event for each fee recipient.This swap has only one hop.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"exactOutputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"details\":\"Takes a fee on the output token, by increasing the `amountOut` by the fee amount. This means that the developer, when quoting the swap, should calculate the fee amount and increase the `amountOut` by that amount.Emits a `FeeTaken` event for each fee recipient.This swap has multiple hops.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Sets the Uniswap V3 router contract.\"},\"exactInputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"notice\":\"Swaps `amountIn` of `tokenIn` for as much as possible of `tokenOut` on behalf of the given `recipient` address,\"},\"exactInputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"notice\":\"Swaps `amountIn` of `tokenIn` for as much as possible of `tokenOut` on behalf of the given `recipient` address,\"},\"exactOutputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"notice\":\"Swaps some amount of `tokenIn` for `amountOut` of `tokenOut` on behalf of the given `recipient` address,\"},\"exactOutputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"notice\":\"Swaps `amountIn` of `tokenIn` for some amount of `tokenOut` on behalf of the given `recipient` address>\"},\"pause()\":{\"notice\":\"Pauses the fee capture mechanism of the contract.\"},\"unpause()\":{\"notice\":\"Unpauses the fee capture mechanism of the contract.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/SecondaryFee.sol\":\"SecondaryFee\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@swap-router-contracts/=lib/swap-router-contracts/\",\":@uniswap/=lib/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":openzeppelin/=lib/openzeppelin-contracts/\",\":solidity-bytes-utils/=lib/solidity-bytes-utils/contracts/\",\":swap-router-contracts/=lib/swap-router-contracts/contracts/\",\":v3-core/=lib/v3-core/\",\":v3-periphery/=lib/v3-periphery/contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts/contracts/access/Ownable.sol\":{\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc980984badf3984b6303b377711220e067722bbd6a135b24669ff5069ef9f32\",\"dweb:/ipfs/QmPHXMSXj99XjSVM21YsY6aNtLLjLVXDbyN76J5HQYvvrz\"]},\"lib/openzeppelin-contracts/contracts/security/Pausable.sol\":{\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ddabb16009cd17eaca3143feadf450ac13e72919ebe2ca50e00f61cb78bc004\",\"dweb:/ipfs/QmSPwPxX7d6TTWakN5jy5wsaGkS1y9TW8fuhGSraMkLk2B\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd39944e8fc06be6dbe2dd1d8449b5336e23c6a7ba3e8e9ae5ae0f37f35283f5\",\"dweb:/ipfs/QmPV3FGYjVwvKSgAXKUN3r9T9GwniZz83CxBpM7vyj2G53\"]},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"lib/solidity-bytes-utils/contracts/BytesLib.sol\":{\"keccak256\":\"0xf75784dfc94ea43668eb195d5690a1dde1b6eda62017e73a3899721583821d29\",\"license\":\"Unlicense\",\"urls\":[\"bzz-raw://ca16cef8b94f3ac75d376489a668618f6c4595a906b939d674a883f4bf426014\",\"dweb:/ipfs/QmceGU7qhyFLSejaj6i4dEtMzXDCSF3aYDtW1UeKjXQaRn\"]},\"lib/swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol\":{\"keccak256\":\"0xa2300af2b82af292216a8f3f301a86e65463655fff9fb791515e3fd2ccf4a14c\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://a0a9bece58527fb5c1773d86666c7a71884a78f413e230dfa8c8a7f8ea564ef9\",\"dweb:/ipfs/QmbDhvpoZJN1KntxUUxkYV89RPTwqVBiyHBkvVh4QHSveo\"]},\"lib/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol\":{\"keccak256\":\"0x3f485fb1a44e8fbeadefb5da07d66edab3cfe809f0ac4074b1e54e3eb3c4cf69\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://095ce0626b41318c772b3ebf19d548282607f6a8f3d6c41c13edfbd5370c8652\",\"dweb:/ipfs/QmVDZfJJ89UUCE1hMyzqpkZAtQ8jUsBgZNE5AMRG7RzRFS\"]},\"src/SecondaryFee.sol\":{\"keccak256\":\"0xf8c9823fce37a62fb978e477acd403b1a7c9789816a83b1b24603e8bb5648a93\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://80e40b596b3148ee5df246811ea29da695c4dffcb75297f1eecfedf874e00144\",\"dweb:/ipfs/QmXNYygL5MjLQzE9danrSmS47JYg8mjaUVhjou3y7fXxVL\"]},\"src/interfaces/ISecondaryFee.sol\":{\"keccak256\":\"0xcd02e2aab28a39eabfdae7aaa1696103ace0d0671dcdd91bcfca6d414923f30b\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://47a32283d3e6272698da3e39e65a14c16f8f510f1dac7b6537ff90524e901582\",\"dweb:/ipfs/QmVDVx1B4DMXzGP534MKHxuaUoHGBfeXUHi2KGjnf6QnSM\"]},\"src/utils/PoolPath.sol\":{\"keccak256\":\"0x86e10045a4ebe4829e97efd04c37d4f300134d2909dce6b11c5c1d6b59409e0f\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://a209a8ed00cfb0dfd80411471fe29a2f104c8be3df567c997ff394a8c61f7a3e\",\"dweb:/ipfs/Qmag2FgdUFSPxVr99Y8SbCcZtgY1XC9RRg4pdx8NUu73Wu\"]}},\"version\":1}", + "rawMetadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_uniRouter\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"feePayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"feeRecipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"FeeTaken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASIS_POINT_PRECISION\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_SERVICE_FEE\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenIn\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenOut\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"fee\",\"type\":\"uint24\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMinimum\",\"type\":\"uint256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"}],\"internalType\":\"struct IV3SwapRouter.ExactInputSingleParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactInputSingleWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMinimum\",\"type\":\"uint256\"}],\"internalType\":\"struct IV3SwapRouter.ExactInputParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactInputWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenIn\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenOut\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"fee\",\"type\":\"uint24\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMaximum\",\"type\":\"uint256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"}],\"internalType\":\"struct IV3SwapRouter.ExactOutputSingleParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactOutputSingleWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"feePrcntBasisPoints\",\"type\":\"uint16\"}],\"internalType\":\"struct ISecondaryFee.ServiceFeeParams[]\",\"name\":\"serviceFee\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMaximum\",\"type\":\"uint256\"}],\"internalType\":\"struct IV3SwapRouter.ExactOutputParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactOutputWithServiceFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapRouter\",\"outputs\":[{\"internalType\":\"contract IV3SwapRouter\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_uniRouter\":\"The address of the Uniswap V3 router contract.\"}},\"exactInputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"details\":\"Takes a fee on the input token, by taking a cut from the `amountIn`, of the size of the fee amount, before doing the swap. This means that the developer, when quoting the swap, should calculate the fee amount and decrease the `amountIn` by that amount.This swap has only one hop.Emits a `FeeTaken` event for each fee recipient.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"exactInputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"details\":\"Takes a fee on the input token, by taking a cut from the `amountIn`, of the size of the fee amount, before doing the swap. This means that the developer, when quoting the swap, should calculate the fee amount and decrease the `amountIn` by that amount.Emits a `FeeTaken` event for each fee recipient.This swap has only one hop.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"exactOutputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"details\":\"Takes a fee on the output token, by increasing the `amountOut` by the fee amount. This means that the developer, when quoting the swap, should calculate the fee amount and increase the `amountOut` by that amount.Emits a `FeeTaken` event for each fee recipient.This swap has only one hop.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"exactOutputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"details\":\"Takes a fee on the output token, by increasing the `amountOut` by the fee amount. This means that the developer, when quoting the swap, should calculate the fee amount and increase the `amountOut` by that amount.Emits a `FeeTaken` event for each fee recipient.This swap has multiple hops.\",\"params\":{\"params\":\"The swap parameters.\",\"serviceFee\":\"The details of the service fee(s).\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Sets the Uniswap V3 router contract.\"},\"exactInputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"notice\":\"Swaps `amountIn` of `tokenIn` for as much as possible of `tokenOut` on behalf of the given `recipient` address,\"},\"exactInputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"notice\":\"Swaps `amountIn` of `tokenIn` for as much as possible of `tokenOut` on behalf of the given `recipient` address,\"},\"exactOutputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))\":{\"notice\":\"Swaps some amount of `tokenIn` for `amountOut` of `tokenOut` on behalf of the given `recipient` address,\"},\"exactOutputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))\":{\"notice\":\"Swaps `amountIn` of `tokenIn` for some amount of `tokenOut` on behalf of the given `recipient` address>\"},\"pause()\":{\"notice\":\"Pauses the fee capture mechanism of the contract.\"},\"unpause()\":{\"notice\":\"Unpauses the fee capture mechanism of the contract.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/SecondaryFee.sol\":\"SecondaryFee\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@ensdomains/=lib/v3-core/node_modules/@ensdomains/\",\":@openzeppelin/=lib/swap-router-contracts/node_modules/@openzeppelin/contracts/\",\":@solidity-parser/=lib/v3-core/node_modules/solhint/node_modules/\",\":@swap-router-contracts/=lib/swap-router-contracts/\",\":@uniswap/=lib/\",\":@uniswap/=lib/swap-router-contracts/node_modules/@uniswap/\",\":base64-sol/=lib/swap-router-contracts/node_modules/base64-sol/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":hardhat/=lib/v3-core/node_modules/hardhat/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":openzeppelin/=lib/openzeppelin-contracts/\",\":solidity-bytes-utils/=lib/solidity-bytes-utils/contracts/\",\":swap-router-contracts/=lib/swap-router-contracts/contracts/\",\":v3-core/=lib/v3-core/\",\":v3-periphery/=lib/v3-periphery/contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts/contracts/access/Ownable.sol\":{\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc980984badf3984b6303b377711220e067722bbd6a135b24669ff5069ef9f32\",\"dweb:/ipfs/QmPHXMSXj99XjSVM21YsY6aNtLLjLVXDbyN76J5HQYvvrz\"]},\"lib/openzeppelin-contracts/contracts/security/Pausable.sol\":{\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ddabb16009cd17eaca3143feadf450ac13e72919ebe2ca50e00f61cb78bc004\",\"dweb:/ipfs/QmSPwPxX7d6TTWakN5jy5wsaGkS1y9TW8fuhGSraMkLk2B\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd39944e8fc06be6dbe2dd1d8449b5336e23c6a7ba3e8e9ae5ae0f37f35283f5\",\"dweb:/ipfs/QmPV3FGYjVwvKSgAXKUN3r9T9GwniZz83CxBpM7vyj2G53\"]},\"lib/openzeppelin-contracts/contracts/utils/Address.sol\":{\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2455248c8ddd9cc6a7af76a13973cddf222072427e7b0e2a7d1aff345145e931\",\"dweb:/ipfs/QmfYjnjRbWqYpuxurqveE6HtzsY1Xx323J428AKQgtBJZm\"]},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"lib/solidity-bytes-utils/contracts/BytesLib.sol\":{\"keccak256\":\"0xf75784dfc94ea43668eb195d5690a1dde1b6eda62017e73a3899721583821d29\",\"license\":\"Unlicense\",\"urls\":[\"bzz-raw://ca16cef8b94f3ac75d376489a668618f6c4595a906b939d674a883f4bf426014\",\"dweb:/ipfs/QmceGU7qhyFLSejaj6i4dEtMzXDCSF3aYDtW1UeKjXQaRn\"]},\"lib/swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol\":{\"keccak256\":\"0xa2300af2b82af292216a8f3f301a86e65463655fff9fb791515e3fd2ccf4a14c\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://a0a9bece58527fb5c1773d86666c7a71884a78f413e230dfa8c8a7f8ea564ef9\",\"dweb:/ipfs/QmbDhvpoZJN1KntxUUxkYV89RPTwqVBiyHBkvVh4QHSveo\"]},\"lib/swap-router-contracts/node_modules/@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol\":{\"keccak256\":\"0x3f485fb1a44e8fbeadefb5da07d66edab3cfe809f0ac4074b1e54e3eb3c4cf69\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://095ce0626b41318c772b3ebf19d548282607f6a8f3d6c41c13edfbd5370c8652\",\"dweb:/ipfs/QmVDZfJJ89UUCE1hMyzqpkZAtQ8jUsBgZNE5AMRG7RzRFS\"]},\"src/SecondaryFee.sol\":{\"keccak256\":\"0x5f749502acdd2c907f5516404d833a1f9e0350ab4bb5d66ac7bb3c0baf66a254\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://4a6403229f23185daf9076fcbc4c20987cfe115392b7bc6b9165fee25f02f47a\",\"dweb:/ipfs/QmWCpvtFkapHbhsH1omvpqumbz6sQVBTecUVPLH6tDxDQU\"]},\"src/interfaces/ISecondaryFee.sol\":{\"keccak256\":\"0xcd02e2aab28a39eabfdae7aaa1696103ace0d0671dcdd91bcfca6d414923f30b\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://47a32283d3e6272698da3e39e65a14c16f8f510f1dac7b6537ff90524e901582\",\"dweb:/ipfs/QmVDVx1B4DMXzGP534MKHxuaUoHGBfeXUHi2KGjnf6QnSM\"]},\"src/utils/PoolPath.sol\":{\"keccak256\":\"0x86e10045a4ebe4829e97efd04c37d4f300134d2909dce6b11c5c1d6b59409e0f\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://a209a8ed00cfb0dfd80411471fe29a2f104c8be3df567c997ff394a8c61f7a3e\",\"dweb:/ipfs/Qmag2FgdUFSPxVr99Y8SbCcZtgY1XC9RRg4pdx8NUu73Wu\"]}},\"version\":1}", "metadata": { "compiler": { "version": "0.8.19+commit.7dd6d404" @@ -857,6 +902,49 @@ } ] }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function", + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ] + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ] + }, { "inputs": [], "stateMutability": "view", @@ -1008,17 +1096,23 @@ }, "settings": { "remappings": [ - ":@swap-router-contracts/=lib/swap-router-contracts/", - ":@uniswap/=lib/", - ":ds-test/=lib/forge-std/lib/ds-test/src/", - ":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", - ":forge-std/=lib/forge-std/src/", - ":openzeppelin-contracts/=lib/openzeppelin-contracts/", - ":openzeppelin/=lib/openzeppelin-contracts/", - ":solidity-bytes-utils/=lib/solidity-bytes-utils/contracts/", - ":swap-router-contracts/=lib/swap-router-contracts/contracts/", - ":v3-core/=lib/v3-core/", - ":v3-periphery/=lib/v3-periphery/contracts/" + "@ensdomains/=lib/v3-core/node_modules/@ensdomains/", + "@openzeppelin/=lib/swap-router-contracts/node_modules/@openzeppelin/contracts/", + "@solidity-parser/=lib/v3-core/node_modules/solhint/node_modules/", + "@swap-router-contracts/=lib/swap-router-contracts/", + "@uniswap/=lib/", + "@uniswap/=lib/swap-router-contracts/node_modules/@uniswap/", + "base64-sol/=lib/swap-router-contracts/node_modules/base64-sol/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", + "forge-std/=lib/forge-std/src/", + "hardhat/=lib/v3-core/node_modules/hardhat/", + "openzeppelin-contracts/=lib/openzeppelin-contracts/", + "openzeppelin/=lib/openzeppelin-contracts/", + "solidity-bytes-utils/=lib/solidity-bytes-utils/contracts/", + "swap-router-contracts/=lib/swap-router-contracts/contracts/", + "v3-core/=lib/v3-core/", + "v3-periphery/=lib/v3-periphery/contracts/" ], "optimizer": { "enabled": true, @@ -1057,6 +1151,14 @@ ], "license": "MIT" }, + "lib/openzeppelin-contracts/contracts/utils/Address.sol": { + "keccak256": "0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa", + "urls": [ + "bzz-raw://2455248c8ddd9cc6a7af76a13973cddf222072427e7b0e2a7d1aff345145e931", + "dweb:/ipfs/QmfYjnjRbWqYpuxurqveE6HtzsY1Xx323J428AKQgtBJZm" + ], + "license": "MIT" + }, "lib/openzeppelin-contracts/contracts/utils/Context.sol": { "keccak256": "0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7", "urls": [ @@ -1081,7 +1183,7 @@ ], "license": "GPL-2.0-or-later" }, - "lib/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol": { + "lib/swap-router-contracts/node_modules/@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol": { "keccak256": "0x3f485fb1a44e8fbeadefb5da07d66edab3cfe809f0ac4074b1e54e3eb3c4cf69", "urls": [ "bzz-raw://095ce0626b41318c772b3ebf19d548282607f6a8f3d6c41c13edfbd5370c8652", @@ -1090,10 +1192,10 @@ "license": "GPL-2.0-or-later" }, "src/SecondaryFee.sol": { - "keccak256": "0xf8c9823fce37a62fb978e477acd403b1a7c9789816a83b1b24603e8bb5648a93", + "keccak256": "0x5f749502acdd2c907f5516404d833a1f9e0350ab4bb5d66ac7bb3c0baf66a254", "urls": [ - "bzz-raw://80e40b596b3148ee5df246811ea29da695c4dffcb75297f1eecfedf874e00144", - "dweb:/ipfs/QmXNYygL5MjLQzE9danrSmS47JYg8mjaUVhjou3y7fXxVL" + "bzz-raw://4a6403229f23185daf9076fcbc4c20987cfe115392b7bc6b9165fee25f02f47a", + "dweb:/ipfs/QmWCpvtFkapHbhsH1omvpqumbz6sQVBTecUVPLH6tDxDQU" ], "license": "Apache-2.0" }, @@ -1118,85 +1220,122 @@ }, "ast": { "absolutePath": "src/SecondaryFee.sol", - "id": 32141, + "id": 32545, "exportedSymbols": { - "Context": [30262], - "IERC20": [30215], - "ISecondaryFee": [32198], - "IV3SwapRouter": [30687], - "Ownable": [29442], - "Pausable": [29550], - "PoolPath": [32258], - "SecondaryFee": [32140] + "Address": [ + 30570 + ], + "Context": [ + 30592 + ], + "IERC20": [ + 30215 + ], + "ISecondaryFee": [ + 32602 + ], + "IV3SwapRouter": [ + 31017 + ], + "Ownable": [ + 29442 + ], + "Pausable": [ + 29550 + ], + "PoolPath": [ + 32662 + ], + "SecondaryFee": [ + 32544 + ] }, "nodeType": "SourceUnit", - "src": "87:14858:35", + "src": "87:15461:46", "nodes": [ { - "id": 31247, + "id": 31577, "nodeType": "PragmaDirective", - "src": "87:24:35", + "src": "87:24:46", "nodes": [], - "literals": ["solidity", "^", "0.8", ".13"] + "literals": [ + "solidity", + "^", + "0.8", + ".13" + ] }, { - "id": 31248, + "id": 31578, "nodeType": "ImportDirective", - "src": "113:51:35", + "src": "113:51:46", "nodes": [], "absolutePath": "lib/openzeppelin-contracts/contracts/access/Ownable.sol", "file": "openzeppelin/contracts/access/Ownable.sol", "nameLocation": "-1:-1:-1", - "scope": 32141, + "scope": 32545, "sourceUnit": 29443, "symbolAliases": [], "unitAlias": "" }, { - "id": 31249, + "id": 31579, "nodeType": "ImportDirective", - "src": "165:54:35", + "src": "165:54:46", "nodes": [], "absolutePath": "lib/openzeppelin-contracts/contracts/security/Pausable.sol", "file": "openzeppelin/contracts/security/Pausable.sol", "nameLocation": "-1:-1:-1", - "scope": 32141, + "scope": 32545, "sourceUnit": 29551, "symbolAliases": [], "unitAlias": "" }, { - "id": 31250, + "id": 31580, "nodeType": "ImportDirective", - "src": "220:55:35", + "src": "220:55:46", "nodes": [], "absolutePath": "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol", "file": "openzeppelin/contracts/token/ERC20/IERC20.sol", "nameLocation": "-1:-1:-1", - "scope": 32141, + "scope": 32545, "sourceUnit": 30216, "symbolAliases": [], "unitAlias": "" }, { - "id": 31252, + "id": 31581, + "nodeType": "ImportDirective", + "src": "276:50:46", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts/contracts/utils/Address.sol", + "file": "openzeppelin/contracts/utils/Address.sol", + "nameLocation": "-1:-1:-1", + "scope": 32545, + "sourceUnit": 30571, + "symbolAliases": [], + "unitAlias": "" + }, + { + "id": 31583, "nodeType": "ImportDirective", - "src": "276:92:35", + "src": "327:92:46", "nodes": [], "absolutePath": "lib/swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol", "file": "@swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol", "nameLocation": "-1:-1:-1", - "scope": 32141, - "sourceUnit": 30688, + "scope": 32545, + "sourceUnit": 31018, "symbolAliases": [ { "foreign": { - "id": 31251, + "id": 31582, "name": "IV3SwapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 30687, - "src": "284:13:35", + "referencedDeclaration": 31017, + "src": "335:13:46", "typeDescriptions": {} }, "nameLocation": "-1:-1:-1" @@ -1205,24 +1344,24 @@ "unitAlias": "" }, { - "id": 31254, + "id": 31585, "nodeType": "ImportDirective", - "src": "370:61:35", + "src": "421:61:46", "nodes": [], "absolutePath": "src/interfaces/ISecondaryFee.sol", "file": "./interfaces/ISecondaryFee.sol", "nameLocation": "-1:-1:-1", - "scope": 32141, - "sourceUnit": 32199, + "scope": 32545, + "sourceUnit": 32603, "symbolAliases": [ { "foreign": { - "id": 31253, + "id": 31584, "name": "ISecondaryFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32198, - "src": "378:13:35", + "referencedDeclaration": 32602, + "src": "429:13:46", "typeDescriptions": {} }, "nameLocation": "-1:-1:-1" @@ -1231,24 +1370,24 @@ "unitAlias": "" }, { - "id": 31256, + "id": 31587, "nodeType": "ImportDirective", - "src": "432:46:35", + "src": "483:46:46", "nodes": [], "absolutePath": "src/utils/PoolPath.sol", "file": "./utils/PoolPath.sol", "nameLocation": "-1:-1:-1", - "scope": 32141, - "sourceUnit": 32259, + "scope": 32545, + "sourceUnit": 32663, "symbolAliases": [ { "foreign": { - "id": 31255, + "id": 31586, "name": "PoolPath", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32258, - "src": "440:8:35", + "referencedDeclaration": 32662, + "src": "491:8:46", "typeDescriptions": {} }, "nameLocation": "-1:-1:-1" @@ -1257,29 +1396,31 @@ "unitAlias": "" }, { - "id": 32140, + "id": 32544, "nodeType": "ContractDefinition", - "src": "480:14464:35", + "src": "531:15016:46", "nodes": [ { - "id": 31265, + "id": 31596, "nodeType": "UsingForDirective", - "src": "544:25:35", + "src": "595:25:46", "nodes": [], "global": false, "libraryName": { - "id": 31263, + "id": 31594, "name": "PoolPath", - "nameLocations": ["550:8:35"], + "nameLocations": [ + "601:8:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32258, - "src": "550:8:35" + "referencedDeclaration": 32662, + "src": "601:8:46" }, "typeName": { - "id": 31264, + "id": 31595, "name": "bytes", "nodeType": "ElementaryTypeName", - "src": "563:5:35", + "src": "614:5:46", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" @@ -1287,16 +1428,16 @@ } }, { - "id": 31268, + "id": 31599, "nodeType": "VariableDeclaration", - "src": "575:53:35", + "src": "626:53:46", "nodes": [], "constant": true, "functionSelector": "d9a6f705", "mutability": "constant", "name": "BASIS_POINT_PRECISION", - "nameLocation": "598:21:35", - "scope": 32140, + "nameLocation": "649:21:46", + "scope": 32544, "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -1304,10 +1445,10 @@ "typeString": "uint16" }, "typeName": { - "id": 31266, + "id": 31597, "name": "uint16", "nodeType": "ElementaryTypeName", - "src": "575:6:35", + "src": "626:6:46", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" @@ -1315,14 +1456,14 @@ }, "value": { "hexValue": "31305f303030", - "id": 31267, + "id": 31598, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "622:6:35", + "src": "673:6:46", "typeDescriptions": { "typeIdentifier": "t_rational_10000_by_1", "typeString": "int_const 10000" @@ -1332,16 +1473,16 @@ "visibility": "public" }, { - "id": 31271, + "id": 31602, "nodeType": "VariableDeclaration", - "src": "634:46:35", + "src": "685:46:46", "nodes": [], "constant": true, "functionSelector": "14d90e1b", "mutability": "constant", "name": "MAX_SERVICE_FEE", - "nameLocation": "657:15:35", - "scope": 32140, + "nameLocation": "708:15:46", + "scope": 32544, "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -1349,10 +1490,10 @@ "typeString": "uint16" }, "typeName": { - "id": 31269, + "id": 31600, "name": "uint16", "nodeType": "ElementaryTypeName", - "src": "634:6:35", + "src": "685:6:46", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" @@ -1360,14 +1501,14 @@ }, "value": { "hexValue": "315f303030", - "id": 31270, + "id": 31601, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "675:5:35", + "src": "726:5:46", "typeDescriptions": { "typeIdentifier": "t_rational_1000_by_1", "typeString": "int_const 1000" @@ -1377,65 +1518,67 @@ "visibility": "public" }, { - "id": 31274, + "id": 31605, "nodeType": "VariableDeclaration", - "src": "747:34:35", + "src": "798:34:46", "nodes": [], "constant": false, "functionSelector": "735de9f7", "mutability": "mutable", "name": "uniswapRouter", - "nameLocation": "768:13:35", - "scope": 32140, + "nameLocation": "819:13:46", + "scope": 32544, "stateVariable": true, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" }, "typeName": { - "id": 31273, + "id": 31604, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31272, + "id": 31603, "name": "IV3SwapRouter", - "nameLocations": ["747:13:35"], + "nameLocations": [ + "798:13:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 30687, - "src": "747:13:35" + "referencedDeclaration": 31017, + "src": "798:13:46" }, - "referencedDeclaration": 30687, - "src": "747:13:35", + "referencedDeclaration": 31017, + "src": "798:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } }, "visibility": "public" }, { - "id": 31284, + "id": 31615, "nodeType": "EventDefinition", - "src": "788:116:35", + "src": "839:116:46", "nodes": [], "anonymous": false, "eventSelector": "1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e", "name": "FeeTaken", - "nameLocation": "794:8:35", + "nameLocation": "845:8:46", "parameters": { - "id": 31283, + "id": 31614, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31276, + "id": 31607, "indexed": true, "mutability": "mutable", "name": "feeToken", - "nameLocation": "819:8:35", + "nameLocation": "870:8:46", "nodeType": "VariableDeclaration", - "scope": 31284, - "src": "803:24:35", + "scope": 31615, + "src": "854:24:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1443,10 +1586,10 @@ "typeString": "address" }, "typeName": { - "id": 31275, + "id": 31606, "name": "address", "nodeType": "ElementaryTypeName", - "src": "803:7:35", + "src": "854:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -1457,14 +1600,14 @@ }, { "constant": false, - "id": 31278, + "id": 31609, "indexed": true, "mutability": "mutable", "name": "feePayer", - "nameLocation": "845:8:35", + "nameLocation": "896:8:46", "nodeType": "VariableDeclaration", - "scope": 31284, - "src": "829:24:35", + "scope": 31615, + "src": "880:24:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1472,10 +1615,10 @@ "typeString": "address" }, "typeName": { - "id": 31277, + "id": 31608, "name": "address", "nodeType": "ElementaryTypeName", - "src": "829:7:35", + "src": "880:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -1486,14 +1629,14 @@ }, { "constant": false, - "id": 31280, + "id": 31611, "indexed": true, "mutability": "mutable", "name": "feeRecipient", - "nameLocation": "871:12:35", + "nameLocation": "922:12:46", "nodeType": "VariableDeclaration", - "scope": 31284, - "src": "855:28:35", + "scope": 31615, + "src": "906:28:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1501,10 +1644,10 @@ "typeString": "address" }, "typeName": { - "id": 31279, + "id": 31610, "name": "address", "nodeType": "ElementaryTypeName", - "src": "855:7:35", + "src": "906:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -1515,14 +1658,14 @@ }, { "constant": false, - "id": 31282, + "id": 31613, "indexed": false, "mutability": "mutable", "name": "feeAmount", - "nameLocation": "893:9:35", + "nameLocation": "944:9:46", "nodeType": "VariableDeclaration", - "scope": 31284, - "src": "885:17:35", + "scope": 31615, + "src": "936:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1530,10 +1673,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31281, + "id": 31612, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "885:7:35", + "src": "936:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1542,25 +1685,25 @@ "visibility": "internal" } ], - "src": "802:101:35" + "src": "853:101:46" } }, { - "id": 31289, + "id": 31620, "nodeType": "StructDefinition", - "src": "910:78:35", + "src": "961:78:46", "nodes": [], "canonicalName": "SecondaryFee.FeeRecipient", "members": [ { "constant": false, - "id": 31286, + "id": 31617, "mutability": "mutable", "name": "recipient", - "nameLocation": "948:9:35", + "nameLocation": "999:9:46", "nodeType": "VariableDeclaration", - "scope": 31289, - "src": "940:17:35", + "scope": 31620, + "src": "991:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1568,10 +1711,10 @@ "typeString": "address" }, "typeName": { - "id": 31285, + "id": 31616, "name": "address", "nodeType": "ElementaryTypeName", - "src": "940:7:35", + "src": "991:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -1582,13 +1725,13 @@ }, { "constant": false, - "id": 31288, + "id": 31619, "mutability": "mutable", "name": "amount", - "nameLocation": "975:6:35", + "nameLocation": "1026:6:46", "nodeType": "VariableDeclaration", - "scope": 31289, - "src": "967:14:35", + "scope": 31620, + "src": "1018:14:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1596,10 +1739,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31287, + "id": 31618, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "967:7:35", + "src": "1018:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1609,37 +1752,37 @@ } ], "name": "FeeRecipient", - "nameLocation": "917:12:35", - "scope": 32140, + "nameLocation": "968:12:46", + "scope": 32544, "visibility": "public" }, { - "id": 31302, + "id": 31633, "nodeType": "FunctionDefinition", - "src": "1134:90:35", + "src": "1185:90:46", "nodes": [], "body": { - "id": 31301, + "id": 31632, "nodeType": "Block", - "src": "1166:58:35", + "src": "1217:58:46", "nodes": [], "statements": [ { "expression": { - "id": 31299, + "id": 31630, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31295, + "id": 31626, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "1176:13:35", + "referencedDeclaration": 31605, + "src": "1227:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } }, @@ -1648,12 +1791,12 @@ "rightHandSide": { "arguments": [ { - "id": 31297, + "id": 31628, "name": "_uniRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31292, - "src": "1206:10:35", + "referencedDeclaration": 31623, + "src": "1257:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1667,111 +1810,1029 @@ "typeString": "address" } ], - "id": 31296, + "id": 31627, "name": "IV3SwapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 30687, - "src": "1192:13:35", + "referencedDeclaration": 31017, + "src": "1243:13:46", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_IV3SwapRouter_$30687_$", + "typeIdentifier": "t_type$_t_contract$_IV3SwapRouter_$31017_$", "typeString": "type(contract IV3SwapRouter)" } }, - "id": 31298, + "id": 31629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1243:25:46", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", + "typeString": "contract IV3SwapRouter" + } + }, + "src": "1227:41:46", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", + "typeString": "contract IV3SwapRouter" + } + }, + "id": 31631, + "nodeType": "ExpressionStatement", + "src": "1227:41:46" + } + ] + }, + "documentation": { + "id": 31621, + "nodeType": "StructuredDocumentation", + "src": "1045:135:46", + "text": " @notice Sets the Uniswap V3 router contract.\n @param _uniRouter The address of the Uniswap V3 router contract." + }, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "parameters": { + "id": 31624, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 31623, + "mutability": "mutable", + "name": "_uniRouter", + "nameLocation": "1205:10:46", + "nodeType": "VariableDeclaration", + "scope": 31633, + "src": "1197:18:46", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 31622, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1197:7:46", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1196:20:46" + }, + "returnParameters": { + "id": 31625, + "nodeType": "ParameterList", + "parameters": [], + "src": "1217:0:46" + }, + "scope": 32544, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "id": 31657, + "nodeType": "FunctionDefinition", + "src": "1281:234:46", + "nodes": [], + "body": { + "id": 31656, + "nodeType": "Block", + "src": "1411:104:46", + "nodes": [], + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 31648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 31645, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "1429:5:46", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 31646, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1435:9:46", + "memberName": "timestamp", + "nodeType": "MemberAccess", + "src": "1429:15:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 31647, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31635, + "src": "1448:8:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1429:27:46", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "446561646c696e6520706173736564", + "id": 31649, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1458:17:46", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c195e135a65761ec6a2507e19968654c5f0b65ae83f886b1ce55ea9533041f5f", + "typeString": "literal_string \"Deadline passed\"" + }, + "value": "Deadline passed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c195e135a65761ec6a2507e19968654c5f0b65ae83f886b1ce55ea9533041f5f", + "typeString": "literal_string \"Deadline passed\"" + } + ], + "id": 31644, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "1421:7:46", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 31650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1421:55:46", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 31651, + "nodeType": "ExpressionStatement", + "src": "1421:55:46" + }, + { + "expression": { + "arguments": [ + { + "id": 31653, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31638, + "src": "1503:4:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes calldata[] calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes calldata[] calldata" + } + ], + "id": 31652, + "name": "multicall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31706, + "src": "1493:9:46", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr_$returns$_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_$", + "typeString": "function (bytes calldata[] calldata) returns (bytes memory[] memory)" + } + }, + "id": 31654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1493:15:46", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "functionReturnParameters": 31643, + "id": 31655, + "nodeType": "Return", + "src": "1486:22:46" + } + ] + }, + "functionSelector": "5ae401dc", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "multicall", + "nameLocation": "1290:9:46", + "parameters": { + "id": 31639, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 31635, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "1308:8:46", + "nodeType": "VariableDeclaration", + "scope": 31657, + "src": "1300:16:46", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 31634, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1300:7:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 31638, + "mutability": "mutable", + "name": "data", + "nameLocation": "1335:4:46", + "nodeType": "VariableDeclaration", + "scope": 31657, + "src": "1318:21:46", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes[]" + }, + "typeName": { + "baseType": { + "id": 31636, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1318:5:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 31637, + "nodeType": "ArrayTypeName", + "src": "1318:7:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + }, + "visibility": "internal" + } + ], + "src": "1299:41:46" + }, + "returnParameters": { + "id": 31643, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 31642, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 31657, + "src": "1391:14:46", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes[]" + }, + "typeName": { + "baseType": { + "id": 31640, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1391:5:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 31641, + "nodeType": "ArrayTypeName", + "src": "1391:7:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + }, + "visibility": "internal" + } + ], + "src": "1390:16:46" + }, + "scope": 32544, + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "id": 31706, + "nodeType": "FunctionDefinition", + "src": "1521:306:46", + "nodes": [], + "body": { + "id": 31705, + "nodeType": "Block", + "src": "1611:216:46", + "nodes": [], + "statements": [ + { + "expression": { + "id": 31673, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 31666, + "name": "results", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31664, + "src": "1621:7:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "expression": { + "id": 31670, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31660, + "src": "1643:4:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes calldata[] calldata" + } + }, + "id": 31671, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1648:6:46", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1643:11:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 31669, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1631:11:46", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory[] memory)" + }, + "typeName": { + "baseType": { + "id": 31667, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1635:5:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 31668, + "nodeType": "ArrayTypeName", + "src": "1635:7:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + } + }, + "id": 31672, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1631:24:46", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "src": "1621:34:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 31674, + "nodeType": "ExpressionStatement", + "src": "1621:34:46" + }, + { + "body": { + "id": 31701, + "nodeType": "Block", + "src": "1707:90:46", + "statements": [ + { + "expression": { + "id": 31699, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 31686, + "name": "results", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31664, + "src": "1721:7:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 31688, + "indexExpression": { + "id": 31687, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31676, + "src": "1729:1:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1721:10:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 31693, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "1771:4:46", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SecondaryFee_$32544", + "typeString": "contract SecondaryFee" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SecondaryFee_$32544", + "typeString": "contract SecondaryFee" + } + ], + "id": 31692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1763:7:46", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 31691, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1763:7:46", + "typeDescriptions": {} + } + }, + "id": 31694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1763:13:46", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "baseExpression": { + "id": 31695, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31660, + "src": "1778:4:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes calldata[] calldata" + } + }, + "id": 31697, + "indexExpression": { + "id": 31696, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31676, + "src": "1783:1:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1778:7:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + ], + "expression": { + "id": 31689, + "name": "Address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30570, + "src": "1734:7:46", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Address_$30570_$", + "typeString": "type(library Address)" + } + }, + "id": 31690, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1742:20:46", + "memberName": "functionDelegateCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 30457, + "src": "1734:28:46", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (address,bytes memory) returns (bytes memory)" + } + }, + "id": 31698, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1734:52:46", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "1721:65:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 31700, + "nodeType": "ExpressionStatement", + "src": "1721:65:46" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 31682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 31679, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31676, + "src": "1685:1:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 31680, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31660, + "src": "1689:4:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes calldata[] calldata" + } + }, + "id": 31681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1694:6:46", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1689:11:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1685:15:46", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 31702, + "initializationExpression": { + "assignments": [ + 31676 + ], + "declarations": [ + { + "constant": false, + "id": 31676, + "mutability": "mutable", + "name": "i", + "nameLocation": "1678:1:46", + "nodeType": "VariableDeclaration", + "scope": 31702, + "src": "1670:9:46", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 31675, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1670:7:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 31678, + "initialValue": { + "hexValue": "30", + "id": 31677, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1682:1:46", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1670:13:46" + }, + "loopExpression": { + "expression": { + "id": 31684, "isConstant": false, "isLValue": false, "isPure": false, - "kind": "typeConversion", "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1192:25:35", - "tryCall": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1702:3:46", + "subExpression": { + "id": 31683, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31676, + "src": "1702:1:46", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", - "typeString": "contract IV3SwapRouter" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "src": "1176:41:35", + "id": 31685, + "nodeType": "ExpressionStatement", + "src": "1702:3:46" + }, + "nodeType": "ForStatement", + "src": "1665:132:46" + }, + { + "expression": { + "id": 31703, + "name": "results", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31664, + "src": "1813:7:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", - "typeString": "contract IV3SwapRouter" + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" } }, - "id": 31300, - "nodeType": "ExpressionStatement", - "src": "1176:41:35" + "functionReturnParameters": 31665, + "id": 31704, + "nodeType": "Return", + "src": "1806:14:46" } ] }, - "documentation": { - "id": 31290, - "nodeType": "StructuredDocumentation", - "src": "994:135:35", - "text": " @notice Sets the Uniswap V3 router contract.\n @param _uniRouter The address of the Uniswap V3 router contract." - }, + "functionSelector": "ac9650d8", "implemented": true, - "kind": "constructor", + "kind": "function", "modifiers": [], - "name": "", - "nameLocation": "-1:-1:-1", + "name": "multicall", + "nameLocation": "1530:9:46", "parameters": { - "id": 31293, + "id": 31661, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31292, + "id": 31660, "mutability": "mutable", - "name": "_uniRouter", - "nameLocation": "1154:10:35", + "name": "data", + "nameLocation": "1557:4:46", "nodeType": "VariableDeclaration", - "scope": 31302, - "src": "1146:18:35", + "scope": 31706, + "src": "1540:21:46", "stateVariable": false, - "storageLocation": "default", + "storageLocation": "calldata", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", + "typeString": "bytes[]" }, "typeName": { - "id": 31291, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1146:7:35", - "stateMutability": "nonpayable", + "baseType": { + "id": 31658, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1540:5:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 31659, + "nodeType": "ArrayTypeName", + "src": "1540:7:46", "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" } }, "visibility": "internal" } ], - "src": "1145:20:35" + "src": "1539:23:46" }, "returnParameters": { - "id": 31294, + "id": 31665, "nodeType": "ParameterList", - "parameters": [], - "src": "1166:0:35" + "parameters": [ + { + "constant": false, + "id": 31664, + "mutability": "mutable", + "name": "results", + "nameLocation": "1602:7:46", + "nodeType": "VariableDeclaration", + "scope": 31706, + "src": "1587:22:46", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes[]" + }, + "typeName": { + "baseType": { + "id": 31662, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1587:5:46", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 31663, + "nodeType": "ArrayTypeName", + "src": "1587:7:46", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + }, + "visibility": "internal" + } + ], + "src": "1586:24:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", - "virtual": false, + "virtual": true, "visibility": "public" }, { - "id": 31368, + "id": 31772, "nodeType": "FunctionDefinition", - "src": "1853:689:35", + "src": "2456:689:46", "nodes": [], "body": { - "id": 31367, + "id": 31771, "nodeType": "Block", - "src": "2052:490:35", + "src": "2655:490:46", "nodes": [], "statements": [ { @@ -1780,7 +2841,7 @@ "typeIdentifier": "t_bool", "typeString": "bool" }, - "id": 31327, + "id": 31731, "isConstant": false, "isLValue": false, "isPure": false, @@ -1790,34 +2851,34 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 31319, + "id": 31723, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { - "id": 31315, + "id": 31719, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2066:6:35", + "referencedDeclaration": 31714, + "src": "2669:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31316, + "id": 31720, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "2073:9:35", + "memberLocation": "2676:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30610, - "src": "2066:16:35", + "referencedDeclaration": 30940, + "src": "2669:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1827,32 +2888,32 @@ "operator": "!=", "rightExpression": { "expression": { - "id": 31317, + "id": 31721, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "2086:3:35", + "src": "2689:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31318, + "id": 31722, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "2090:6:35", + "memberLocation": "2693:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "2086:10:35", + "src": "2689:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "2066:30:35", + "src": "2669:30:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -1865,34 +2926,34 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 31326, + "id": 31730, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { - "id": 31320, + "id": 31724, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2100:6:35", + "referencedDeclaration": 31714, + "src": "2703:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31321, + "id": 31725, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "2107:9:35", + "memberLocation": "2710:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30610, - "src": "2100:16:35", + "referencedDeclaration": 30940, + "src": "2703:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1903,14 +2964,14 @@ "rightExpression": { "arguments": [ { - "id": 31324, + "id": 31728, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "2128:4:35", + "src": "2731:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -1918,30 +2979,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31323, + "id": 31727, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "2120:7:35", + "src": "2723:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31322, + "id": 31726, "name": "address", "nodeType": "ElementaryTypeName", - "src": "2120:7:35", + "src": "2723:7:46", "typeDescriptions": {} } }, - "id": 31325, + "id": 31729, "isConstant": false, "isLValue": false, "isPure": false, @@ -1950,46 +3011,46 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "2120:13:35", + "src": "2723:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "2100:33:35", + "src": "2703:33:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "src": "2066:67:35", + "src": "2669:67:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31333, + "id": 31737, "nodeType": "IfStatement", - "src": "2062:153:35", + "src": "2665:153:46", "trueBody": { - "id": 31332, + "id": 31736, "nodeType": "Block", - "src": "2135:80:35", + "src": "2738:80:46", "statements": [ { "expression": { "arguments": [ { "hexValue": "726563697069656e74206d757374206265206d73672e73656e646572206f72207468697320636f6e7472616374", - "id": 31329, + "id": 31733, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "2156:47:35", + "src": "2759:47:46", "typeDescriptions": { "typeIdentifier": "t_stringliteral_de56bf71b2db31401030fbf83dd6a5dc62986741b03b41c4afee32bc46c74c71", "typeString": "literal_string \"recipient must be msg.sender or this contract\"" @@ -2004,18 +3065,21 @@ "typeString": "literal_string \"recipient must be msg.sender or this contract\"" } ], - "id": 31328, + "id": 31732, "name": "revert", "nodeType": "Identifier", - "overloadedDeclarations": [-19, -19], + "overloadedDeclarations": [ + -19, + -19 + ], "referencedDeclaration": -19, - "src": "2149:6:35", + "src": "2752:6:46", "typeDescriptions": { "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", "typeString": "function (string memory) pure" } }, - "id": 31330, + "id": 31734, "isConstant": false, "isLValue": false, "isPure": false, @@ -2024,32 +3088,35 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "2149:55:35", + "src": "2752:55:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31331, + "id": 31735, "nodeType": "ExpressionStatement", - "src": "2149:55:35" + "src": "2752:55:46" } ] } }, { - "assignments": [31335, 31337], + "assignments": [ + 31739, + 31741 + ], "declarations": [ { "constant": false, - "id": 31335, + "id": 31739, "mutability": "mutable", "name": "amountIn", - "nameLocation": "2234:8:35", + "nameLocation": "2837:8:46", "nodeType": "VariableDeclaration", - "scope": 31367, - "src": "2226:16:35", + "scope": 31771, + "src": "2829:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2057,10 +3124,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31334, + "id": 31738, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "2226:7:35", + "src": "2829:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -2070,13 +3137,13 @@ }, { "constant": false, - "id": 31337, + "id": 31741, "mutability": "mutable", "name": "recipient", - "nameLocation": "2252:9:35", + "nameLocation": "2855:9:46", "nodeType": "VariableDeclaration", - "scope": 31367, - "src": "2244:17:35", + "scope": 31771, + "src": "2847:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2084,10 +3151,10 @@ "typeString": "address" }, "typeName": { - "id": 31336, + "id": 31740, "name": "address", "nodeType": "ElementaryTypeName", - "src": "2244:7:35", + "src": "2847:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -2097,32 +3164,32 @@ "visibility": "internal" } ], - "id": 31347, + "id": 31751, "initialValue": { "arguments": [ { "expression": { - "id": 31339, + "id": 31743, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2297:6:35", + "referencedDeclaration": 31714, + "src": "2900:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31340, + "id": 31744, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "2304:7:35", + "memberLocation": "2907:7:46", "memberName": "tokenIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30604, - "src": "2297:14:35", + "referencedDeclaration": 30934, + "src": "2900:14:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -2130,27 +3197,27 @@ }, { "expression": { - "id": 31341, + "id": 31745, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2313:6:35", + "referencedDeclaration": 31714, + "src": "2916:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31342, + "id": 31746, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "2320:8:35", + "memberLocation": "2923:8:46", "memberName": "amountIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30612, - "src": "2313:15:35", + "referencedDeclaration": 30942, + "src": "2916:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -2158,41 +3225,41 @@ }, { "expression": { - "id": 31343, + "id": 31747, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2330:6:35", + "referencedDeclaration": 31714, + "src": "2933:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31344, + "id": 31748, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "2337:9:35", + "memberLocation": "2940:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30610, - "src": "2330:16:35", + "referencedDeclaration": 30940, + "src": "2933:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31345, + "id": 31749, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31307, - "src": "2348:10:35", + "referencedDeclaration": 31711, + "src": "2951:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } } @@ -2212,22 +3279,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } ], - "id": 31338, + "id": 31742, "name": "_exactInputInternal", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31791, - "src": "2277:19:35", + "referencedDeclaration": 32195, + "src": "2880:19:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$", + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$", "typeString": "function (address,uint256,address,struct ISecondaryFee.ServiceFeeParams memory[] memory) returns (uint256,address)" } }, - "id": 31346, + "id": 31750, "isConstant": false, "isLValue": false, "isPure": false, @@ -2236,7 +3303,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "2277:82:35", + "src": "2880:82:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$", @@ -2244,38 +3311,38 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "2225:134:35" + "src": "2828:134:46" }, { "expression": { - "id": 31352, + "id": 31756, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31348, + "id": 31752, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2369:6:35", + "referencedDeclaration": 31714, + "src": "2972:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31350, + "id": 31754, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "2376:8:35", + "memberLocation": "2979:8:46", "memberName": "amountIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30612, - "src": "2369:15:35", + "referencedDeclaration": 30942, + "src": "2972:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -2284,57 +3351,57 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31351, + "id": 31755, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31335, - "src": "2387:8:35", + "referencedDeclaration": 31739, + "src": "2990:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "2369:26:35", + "src": "2972:26:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31353, + "id": 31757, "nodeType": "ExpressionStatement", - "src": "2369:26:35" + "src": "2972:26:46" }, { "expression": { - "id": 31358, + "id": 31762, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31354, + "id": 31758, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2405:6:35", + "referencedDeclaration": 31714, + "src": "3008:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } }, - "id": 31356, + "id": 31760, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "2412:9:35", + "memberLocation": "3015:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30610, - "src": "2405:16:35", + "referencedDeclaration": 30940, + "src": "3008:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -2343,41 +3410,41 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31357, + "id": 31761, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31337, - "src": "2424:9:35", + "referencedDeclaration": 31741, + "src": "3027:9:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "2405:28:35", + "src": "3008:28:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 31359, + "id": 31763, "nodeType": "ExpressionStatement", - "src": "2405:28:35" + "src": "3008:28:46" }, { "expression": { - "id": 31365, + "id": 31769, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31360, + "id": 31764, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31313, - "src": "2485:9:35", + "referencedDeclaration": 31717, + "src": "3088:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -2388,14 +3455,14 @@ "rightHandSide": { "arguments": [ { - "id": 31363, + "id": 31767, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31310, - "src": "2528:6:35", + "referencedDeclaration": 31714, + "src": "3131:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } } @@ -2403,38 +3470,38 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams memory" } ], "expression": { - "id": 31361, + "id": 31765, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "2497:13:35", + "referencedDeclaration": 31605, + "src": "3100:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } }, - "id": 31362, + "id": 31766, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "2511:16:35", + "memberLocation": "3114:16:46", "memberName": "exactInputSingle", "nodeType": "MemberAccess", - "referencedDeclaration": 30626, - "src": "2497:30:35", + "referencedDeclaration": 30956, + "src": "3100:30:46", "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_struct$_ExactInputSingleParams_$30617_memory_ptr_$returns$_t_uint256_$", + "typeIdentifier": "t_function_external_payable$_t_struct$_ExactInputSingleParams_$30947_memory_ptr_$returns$_t_uint256_$", "typeString": "function (struct IV3SwapRouter.ExactInputSingleParams memory) payable external returns (uint256)" } }, - "id": 31364, + "id": 31768, "isConstant": false, "isLValue": false, "isPure": false, @@ -2443,30 +3510,32 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "2497:38:35", + "src": "3100:38:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "2485:50:35", + "src": "3088:50:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31366, + "id": 31770, "nodeType": "ExpressionStatement", - "src": "2485:50:35" + "src": "3088:50:46" } ] }, - "baseFunctions": [32161], + "baseFunctions": [ + 32565 + ], "documentation": { - "id": 31303, + "id": 31707, "nodeType": "StructuredDocumentation", - "src": "1230:618:35", + "src": "1833:618:46", "text": " @notice Swaps `amountIn` of `tokenIn` for as much as possible of `tokenOut` on behalf of the given `recipient` address,\n @dev Takes a fee on the input token, by taking a cut from the `amountIn`, of the size of the fee amount, before doing the swap.\n This means that the developer, when quoting the swap, should calculate the fee amount and decrease the `amountIn` by that amount.\n @dev This swap has only one hop.\n @dev Emits a `FeeTaken` event for each fee recipient.\n @param params The swap parameters.\n @param serviceFee The details of the service fee(s)." }, "functionSelector": "742ac944", @@ -2474,50 +3543,52 @@ "kind": "function", "modifiers": [], "name": "exactInputSingleWithServiceFee", - "nameLocation": "1862:30:35", + "nameLocation": "2465:30:46", "parameters": { - "id": 31311, + "id": 31715, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31307, + "id": 31711, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "1930:10:35", + "nameLocation": "2533:10:46", "nodeType": "VariableDeclaration", - "scope": 31368, - "src": "1902:38:35", + "scope": 31772, + "src": "2505:38:46", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31305, + "id": 31709, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31304, + "id": 31708, "name": "ServiceFeeParams", - "nameLocations": ["1902:16:35"], + "nameLocations": [ + "2505:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "1902:16:35" + "referencedDeclaration": 32553, + "src": "2505:16:46" }, - "referencedDeclaration": 32149, - "src": "1902:16:35", + "referencedDeclaration": 32553, + "src": "2505:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31306, + "id": 31710, "nodeType": "ArrayTypeName", - "src": "1902:18:35", + "src": "2505:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, @@ -2525,55 +3596,58 @@ }, { "constant": false, - "id": 31310, + "id": 31714, "mutability": "mutable", "name": "params", - "nameLocation": "1994:6:35", + "nameLocation": "2597:6:46", "nodeType": "VariableDeclaration", - "scope": 31368, - "src": "1950:50:35", + "scope": 31772, + "src": "2553:50:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams" }, "typeName": { - "id": 31309, + "id": 31713, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31308, + "id": 31712, "name": "IV3SwapRouter.ExactInputSingleParams", - "nameLocations": ["1950:13:35", "1964:22:35"], + "nameLocations": [ + "2553:13:46", + "2567:22:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 30617, - "src": "1950:36:35" + "referencedDeclaration": 30947, + "src": "2553:36:46" }, - "referencedDeclaration": 30617, - "src": "1950:36:35", + "referencedDeclaration": 30947, + "src": "2553:36:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputSingleParams_$30617_storage_ptr", + "typeIdentifier": "t_struct$_ExactInputSingleParams_$30947_storage_ptr", "typeString": "struct IV3SwapRouter.ExactInputSingleParams" } }, "visibility": "internal" } ], - "src": "1892:114:35" + "src": "2495:114:46" }, "returnParameters": { - "id": 31314, + "id": 31718, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31313, + "id": 31717, "mutability": "mutable", "name": "amountOut", - "nameLocation": "2041:9:35", + "nameLocation": "2644:9:46", "nodeType": "VariableDeclaration", - "scope": 31368, - "src": "2033:17:35", + "scope": 31772, + "src": "2636:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2581,10 +3655,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31312, + "id": 31716, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "2033:7:35", + "src": "2636:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -2593,22 +3667,22 @@ "visibility": "internal" } ], - "src": "2032:19:35" + "src": "2635:19:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "payable", "virtual": false, "visibility": "external" }, { - "id": 31440, + "id": 31844, "nodeType": "FunctionDefinition", - "src": "3171:771:35", + "src": "3774:771:46", "nodes": [], "body": { - "id": 31439, + "id": 31843, "nodeType": "Block", - "src": "3358:584:35", + "src": "3961:584:46", "nodes": [], "statements": [ { @@ -2617,7 +3691,7 @@ "typeIdentifier": "t_bool", "typeString": "bool" }, - "id": 31393, + "id": 31797, "isConstant": false, "isLValue": false, "isPure": false, @@ -2627,34 +3701,34 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 31385, + "id": 31789, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { - "id": 31381, + "id": 31785, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3372:6:35", + "referencedDeclaration": 31780, + "src": "3975:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31382, + "id": 31786, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "3379:9:35", + "memberLocation": "3982:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30630, - "src": "3372:16:35", + "referencedDeclaration": 30960, + "src": "3975:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -2664,32 +3738,32 @@ "operator": "!=", "rightExpression": { "expression": { - "id": 31383, + "id": 31787, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "3392:3:35", + "src": "3995:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31384, + "id": 31788, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "3396:6:35", + "memberLocation": "3999:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "3392:10:35", + "src": "3995:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "3372:30:35", + "src": "3975:30:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -2702,34 +3776,34 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 31392, + "id": 31796, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { - "id": 31386, + "id": 31790, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3406:6:35", + "referencedDeclaration": 31780, + "src": "4009:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31387, + "id": 31791, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "3413:9:35", + "memberLocation": "4016:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30630, - "src": "3406:16:35", + "referencedDeclaration": 30960, + "src": "4009:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -2740,14 +3814,14 @@ "rightExpression": { "arguments": [ { - "id": 31390, + "id": 31794, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "3434:4:35", + "src": "4037:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -2755,30 +3829,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31389, + "id": 31793, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "3426:7:35", + "src": "4029:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31388, + "id": 31792, "name": "address", "nodeType": "ElementaryTypeName", - "src": "3426:7:35", + "src": "4029:7:46", "typeDescriptions": {} } }, - "id": 31391, + "id": 31795, "isConstant": false, "isLValue": false, "isPure": false, @@ -2787,46 +3861,46 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "3426:13:35", + "src": "4029:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "3406:33:35", + "src": "4009:33:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "src": "3372:67:35", + "src": "3975:67:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31399, + "id": 31803, "nodeType": "IfStatement", - "src": "3368:153:35", + "src": "3971:153:46", "trueBody": { - "id": 31398, + "id": 31802, "nodeType": "Block", - "src": "3441:80:35", + "src": "4044:80:46", "statements": [ { "expression": { "arguments": [ { "hexValue": "726563697069656e74206d757374206265206d73672e73656e646572206f72207468697320636f6e7472616374", - "id": 31395, + "id": 31799, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "3462:47:35", + "src": "4065:47:46", "typeDescriptions": { "typeIdentifier": "t_stringliteral_de56bf71b2db31401030fbf83dd6a5dc62986741b03b41c4afee32bc46c74c71", "typeString": "literal_string \"recipient must be msg.sender or this contract\"" @@ -2841,18 +3915,21 @@ "typeString": "literal_string \"recipient must be msg.sender or this contract\"" } ], - "id": 31394, + "id": 31798, "name": "revert", "nodeType": "Identifier", - "overloadedDeclarations": [-19, -19], + "overloadedDeclarations": [ + -19, + -19 + ], "referencedDeclaration": -19, - "src": "3455:6:35", + "src": "4058:6:46", "typeDescriptions": { "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", "typeString": "function (string memory) pure" } }, - "id": 31396, + "id": 31800, "isConstant": false, "isLValue": false, "isPure": false, @@ -2861,32 +3938,34 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "3455:55:35", + "src": "4058:55:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31397, + "id": 31801, "nodeType": "ExpressionStatement", - "src": "3455:55:35" + "src": "4058:55:46" } ] } }, { - "assignments": [31401], + "assignments": [ + 31805 + ], "declarations": [ { "constant": false, - "id": 31401, + "id": 31805, "mutability": "mutable", "name": "tokenIn", - "nameLocation": "3586:7:35", + "nameLocation": "4189:7:46", "nodeType": "VariableDeclaration", - "scope": 31439, - "src": "3578:15:35", + "scope": 31843, + "src": "4181:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2894,10 +3973,10 @@ "typeString": "address" }, "typeName": { - "id": 31400, + "id": 31804, "name": "address", "nodeType": "ElementaryTypeName", - "src": "3578:7:35", + "src": "4181:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -2907,55 +3986,55 @@ "visibility": "internal" } ], - "id": 31406, + "id": 31810, "initialValue": { "arguments": [], "expression": { "argumentTypes": [], "expression": { "expression": { - "id": 31402, + "id": 31806, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3596:6:35", + "referencedDeclaration": 31780, + "src": "4199:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31403, + "id": 31807, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "3603:4:35", + "memberLocation": "4206:4:46", "memberName": "path", "nodeType": "MemberAccess", - "referencedDeclaration": 30628, - "src": "3596:11:35", + "referencedDeclaration": 30958, + "src": "4199:11:46", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, - "id": 31404, + "id": 31808, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "3608:17:35", + "memberLocation": "4211:17:46", "memberName": "getFirstPoolToken", "nodeType": "MemberAccess", - "referencedDeclaration": 32257, - "src": "3596:29:35", + "referencedDeclaration": 32661, + "src": "4199:29:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_address_$attached_to$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) pure returns (address)" } }, - "id": 31405, + "id": 31809, "isConstant": false, "isLValue": false, "isPure": false, @@ -2964,7 +4043,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "3596:31:35", + "src": "4199:31:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -2972,20 +4051,23 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "3578:49:35" + "src": "4181:49:46" }, { - "assignments": [31408, 31410], + "assignments": [ + 31812, + 31814 + ], "declarations": [ { "constant": false, - "id": 31408, + "id": 31812, "mutability": "mutable", "name": "amountIn", - "nameLocation": "3647:8:35", + "nameLocation": "4250:8:46", "nodeType": "VariableDeclaration", - "scope": 31439, - "src": "3639:16:35", + "scope": 31843, + "src": "4242:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2993,10 +4075,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31407, + "id": 31811, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "3639:7:35", + "src": "4242:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3006,13 +4088,13 @@ }, { "constant": false, - "id": 31410, + "id": 31814, "mutability": "mutable", "name": "recipient", - "nameLocation": "3665:9:35", + "nameLocation": "4268:9:46", "nodeType": "VariableDeclaration", - "scope": 31439, - "src": "3657:17:35", + "scope": 31843, + "src": "4260:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -3020,10 +4102,10 @@ "typeString": "address" }, "typeName": { - "id": 31409, + "id": 31813, "name": "address", "nodeType": "ElementaryTypeName", - "src": "3657:7:35", + "src": "4260:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -3033,16 +4115,16 @@ "visibility": "internal" } ], - "id": 31419, + "id": 31823, "initialValue": { "arguments": [ { - "id": 31412, + "id": 31816, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31401, - "src": "3710:7:35", + "referencedDeclaration": 31805, + "src": "4313:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -3050,27 +4132,27 @@ }, { "expression": { - "id": 31413, + "id": 31817, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3719:6:35", + "referencedDeclaration": 31780, + "src": "4322:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31414, + "id": 31818, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "3726:8:35", + "memberLocation": "4329:8:46", "memberName": "amountIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30632, - "src": "3719:15:35", + "referencedDeclaration": 30962, + "src": "4322:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3078,41 +4160,41 @@ }, { "expression": { - "id": 31415, + "id": 31819, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3736:6:35", + "referencedDeclaration": 31780, + "src": "4339:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31416, + "id": 31820, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "3743:9:35", + "memberLocation": "4346:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30630, - "src": "3736:16:35", + "referencedDeclaration": 30960, + "src": "4339:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31417, + "id": 31821, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31373, - "src": "3754:10:35", + "referencedDeclaration": 31777, + "src": "4357:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } } @@ -3132,22 +4214,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } ], - "id": 31411, + "id": 31815, "name": "_exactInputInternal", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31791, - "src": "3690:19:35", + "referencedDeclaration": 32195, + "src": "4293:19:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$", + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$", "typeString": "function (address,uint256,address,struct ISecondaryFee.ServiceFeeParams memory[] memory) returns (uint256,address)" } }, - "id": 31418, + "id": 31822, "isConstant": false, "isLValue": false, "isPure": false, @@ -3156,7 +4238,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "3690:75:35", + "src": "4293:75:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$", @@ -3164,38 +4246,38 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "3638:127:35" + "src": "4241:127:46" }, { "expression": { - "id": 31424, + "id": 31828, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31420, + "id": 31824, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3775:6:35", + "referencedDeclaration": 31780, + "src": "4378:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31422, + "id": 31826, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "3782:8:35", + "memberLocation": "4385:8:46", "memberName": "amountIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30632, - "src": "3775:15:35", + "referencedDeclaration": 30962, + "src": "4378:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3204,57 +4286,57 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31423, + "id": 31827, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31408, - "src": "3793:8:35", + "referencedDeclaration": 31812, + "src": "4396:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "3775:26:35", + "src": "4378:26:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31425, + "id": 31829, "nodeType": "ExpressionStatement", - "src": "3775:26:35" + "src": "4378:26:46" }, { "expression": { - "id": 31430, + "id": 31834, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31426, + "id": 31830, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3811:6:35", + "referencedDeclaration": 31780, + "src": "4414:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } }, - "id": 31428, + "id": 31832, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "3818:9:35", + "memberLocation": "4421:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30630, - "src": "3811:16:35", + "referencedDeclaration": 30960, + "src": "4414:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -3263,41 +4345,41 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31429, + "id": 31833, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31410, - "src": "3830:9:35", + "referencedDeclaration": 31814, + "src": "4433:9:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "3811:28:35", + "src": "4414:28:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 31431, + "id": 31835, "nodeType": "ExpressionStatement", - "src": "3811:28:35" + "src": "4414:28:46" }, { "expression": { - "id": 31437, + "id": 31841, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31432, + "id": 31836, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31379, - "src": "3891:9:35", + "referencedDeclaration": 31783, + "src": "4494:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3308,14 +4390,14 @@ "rightHandSide": { "arguments": [ { - "id": 31435, + "id": 31839, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31376, - "src": "3928:6:35", + "referencedDeclaration": 31780, + "src": "4531:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } } @@ -3323,38 +4405,38 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams memory" } ], "expression": { - "id": 31433, + "id": 31837, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "3903:13:35", + "referencedDeclaration": 31605, + "src": "4506:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } }, - "id": 31434, + "id": 31838, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "3917:10:35", + "memberLocation": "4520:10:46", "memberName": "exactInput", "nodeType": "MemberAccess", - "referencedDeclaration": 30644, - "src": "3903:24:35", + "referencedDeclaration": 30974, + "src": "4506:24:46", "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_struct$_ExactInputParams_$30635_memory_ptr_$returns$_t_uint256_$", + "typeIdentifier": "t_function_external_payable$_t_struct$_ExactInputParams_$30965_memory_ptr_$returns$_t_uint256_$", "typeString": "function (struct IV3SwapRouter.ExactInputParams memory) payable external returns (uint256)" } }, - "id": 31436, + "id": 31840, "isConstant": false, "isLValue": false, "isPure": false, @@ -3363,30 +4445,32 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "3903:32:35", + "src": "4506:32:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "3891:44:35", + "src": "4494:44:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31438, + "id": 31842, "nodeType": "ExpressionStatement", - "src": "3891:44:35" + "src": "4494:44:46" } ] }, - "baseFunctions": [32173], + "baseFunctions": [ + 32577 + ], "documentation": { - "id": 31369, + "id": 31773, "nodeType": "StructuredDocumentation", - "src": "2548:618:35", + "src": "3151:618:46", "text": " @notice Swaps `amountIn` of `tokenIn` for as much as possible of `tokenOut` on behalf of the given `recipient` address,\n @dev Takes a fee on the input token, by taking a cut from the `amountIn`, of the size of the fee amount, before doing the swap.\n This means that the developer, when quoting the swap, should calculate the fee amount and decrease the `amountIn` by that amount.\n @dev Emits a `FeeTaken` event for each fee recipient.\n @dev This swap has only one hop.\n @param params The swap parameters.\n @param serviceFee The details of the service fee(s)." }, "functionSelector": "1411734e", @@ -3394,50 +4478,52 @@ "kind": "function", "modifiers": [], "name": "exactInputWithServiceFee", - "nameLocation": "3180:24:35", + "nameLocation": "3783:24:46", "parameters": { - "id": 31377, + "id": 31781, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31373, + "id": 31777, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "3242:10:35", + "nameLocation": "3845:10:46", "nodeType": "VariableDeclaration", - "scope": 31440, - "src": "3214:38:35", + "scope": 31844, + "src": "3817:38:46", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31371, + "id": 31775, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31370, + "id": 31774, "name": "ServiceFeeParams", - "nameLocations": ["3214:16:35"], + "nameLocations": [ + "3817:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "3214:16:35" + "referencedDeclaration": 32553, + "src": "3817:16:46" }, - "referencedDeclaration": 32149, - "src": "3214:16:35", + "referencedDeclaration": 32553, + "src": "3817:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31372, + "id": 31776, "nodeType": "ArrayTypeName", - "src": "3214:18:35", + "src": "3817:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, @@ -3445,55 +4531,58 @@ }, { "constant": false, - "id": 31376, + "id": 31780, "mutability": "mutable", "name": "params", - "nameLocation": "3300:6:35", + "nameLocation": "3903:6:46", "nodeType": "VariableDeclaration", - "scope": 31440, - "src": "3262:44:35", + "scope": 31844, + "src": "3865:44:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_memory_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_memory_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams" }, "typeName": { - "id": 31375, + "id": 31779, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31374, + "id": 31778, "name": "IV3SwapRouter.ExactInputParams", - "nameLocations": ["3262:13:35", "3276:16:35"], + "nameLocations": [ + "3865:13:46", + "3879:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 30635, - "src": "3262:30:35" + "referencedDeclaration": 30965, + "src": "3865:30:46" }, - "referencedDeclaration": 30635, - "src": "3262:30:35", + "referencedDeclaration": 30965, + "src": "3865:30:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactInputParams_$30635_storage_ptr", + "typeIdentifier": "t_struct$_ExactInputParams_$30965_storage_ptr", "typeString": "struct IV3SwapRouter.ExactInputParams" } }, "visibility": "internal" } ], - "src": "3204:108:35" + "src": "3807:108:46" }, "returnParameters": { - "id": 31380, + "id": 31784, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31379, + "id": 31783, "mutability": "mutable", "name": "amountOut", - "nameLocation": "3347:9:35", + "nameLocation": "3950:9:46", "nodeType": "VariableDeclaration", - "scope": 31440, - "src": "3339:17:35", + "scope": 31844, + "src": "3942:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -3501,10 +4590,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31378, + "id": 31782, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "3339:7:35", + "src": "3942:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3513,36 +4602,38 @@ "visibility": "internal" } ], - "src": "3338:19:35" + "src": "3941:19:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "payable", "virtual": false, "visibility": "external" }, { - "id": 31512, + "id": 31916, "nodeType": "FunctionDefinition", - "src": "4524:832:35", + "src": "5127:832:46", "nodes": [], "body": { - "id": 31511, + "id": 31915, "nodeType": "Block", - "src": "4724:632:35", + "src": "5327:632:46", "nodes": [], "statements": [ { - "assignments": [31454], + "assignments": [ + 31858 + ], "declarations": [ { "constant": false, - "id": 31454, + "id": 31858, "mutability": "mutable", "name": "originalAmountOut", - "nameLocation": "4742:17:35", + "nameLocation": "5345:17:46", "nodeType": "VariableDeclaration", - "scope": 31511, - "src": "4734:25:35", + "scope": 31915, + "src": "5337:25:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -3550,10 +4641,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31453, + "id": 31857, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "4734:7:35", + "src": "5337:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3562,50 +4653,55 @@ "visibility": "internal" } ], - "id": 31457, + "id": 31861, "initialValue": { "expression": { - "id": 31455, + "id": 31859, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "4762:6:35", + "referencedDeclaration": 31852, + "src": "5365:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31456, + "id": 31860, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "4769:9:35", + "memberLocation": "5372:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30654, - "src": "4762:16:35", + "referencedDeclaration": 30984, + "src": "5365:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", - "src": "4734:44:35" + "src": "5337:44:46" }, { - "assignments": [31459, 31461, 31465, 31467], + "assignments": [ + 31863, + 31865, + 31869, + 31871 + ], "declarations": [ { "constant": false, - "id": 31459, + "id": 31863, "mutability": "mutable", "name": "amountOut", - "nameLocation": "4798:9:35", + "nameLocation": "5401:9:46", "nodeType": "VariableDeclaration", - "scope": 31511, - "src": "4790:17:35", + "scope": 31915, + "src": "5393:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -3613,10 +4709,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31458, + "id": 31862, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "4790:7:35", + "src": "5393:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3626,13 +4722,13 @@ }, { "constant": false, - "id": 31461, + "id": 31865, "mutability": "mutable", "name": "recipient", - "nameLocation": "4817:9:35", + "nameLocation": "5420:9:46", "nodeType": "VariableDeclaration", - "scope": 31511, - "src": "4809:17:35", + "scope": 31915, + "src": "5412:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -3640,10 +4736,10 @@ "typeString": "address" }, "typeName": { - "id": 31460, + "id": 31864, "name": "address", "nodeType": "ElementaryTypeName", - "src": "4809:7:35", + "src": "5412:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -3654,43 +4750,45 @@ }, { "constant": false, - "id": 31465, + "id": 31869, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "4850:13:35", + "nameLocation": "5453:13:46", "nodeType": "VariableDeclaration", - "scope": 31511, - "src": "4828:35:35", + "scope": 31915, + "src": "5431:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31463, + "id": 31867, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31462, + "id": 31866, "name": "FeeRecipient", - "nameLocations": ["4828:12:35"], + "nameLocations": [ + "5431:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "4828:12:35" + "referencedDeclaration": 31620, + "src": "5431:12:46" }, - "referencedDeclaration": 31289, - "src": "4828:12:35", + "referencedDeclaration": 31620, + "src": "5431:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31464, + "id": 31868, "nodeType": "ArrayTypeName", - "src": "4828:14:35", + "src": "5431:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, @@ -3698,13 +4796,13 @@ }, { "constant": false, - "id": 31467, + "id": 31871, "mutability": "mutable", "name": "totalFeeAmount", - "nameLocation": "4873:14:35", + "nameLocation": "5476:14:46", "nodeType": "VariableDeclaration", - "scope": 31511, - "src": "4865:22:35", + "scope": 31915, + "src": "5468:22:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -3712,10 +4810,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31466, + "id": 31870, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "4865:7:35", + "src": "5468:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3724,32 +4822,32 @@ "visibility": "internal" } ], - "id": 31479, + "id": 31883, "initialValue": { "arguments": [ { "expression": { - "id": 31469, + "id": 31873, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "4924:6:35", + "referencedDeclaration": 31852, + "src": "5527:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31470, + "id": 31874, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "4931:7:35", + "memberLocation": "5534:7:46", "memberName": "tokenIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30646, - "src": "4924:14:35", + "referencedDeclaration": 30976, + "src": "5527:14:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -3757,27 +4855,27 @@ }, { "expression": { - "id": 31471, + "id": 31875, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "4940:6:35", + "referencedDeclaration": 31852, + "src": "5543:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31472, + "id": 31876, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "4947:15:35", + "memberLocation": "5550:15:46", "memberName": "amountInMaximum", "nodeType": "MemberAccess", - "referencedDeclaration": 30656, - "src": "4940:22:35", + "referencedDeclaration": 30986, + "src": "5543:22:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3785,27 +4883,27 @@ }, { "expression": { - "id": 31473, + "id": 31877, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "4964:6:35", + "referencedDeclaration": 31852, + "src": "5567:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31474, + "id": 31878, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "4971:9:35", + "memberLocation": "5574:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30654, - "src": "4964:16:35", + "referencedDeclaration": 30984, + "src": "5567:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3813,41 +4911,41 @@ }, { "expression": { - "id": 31475, + "id": 31879, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "4982:6:35", + "referencedDeclaration": 31852, + "src": "5585:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31476, + "id": 31880, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "4989:9:35", + "memberLocation": "5592:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30652, - "src": "4982:16:35", + "referencedDeclaration": 30982, + "src": "5585:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31477, + "id": 31881, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31445, - "src": "5000:10:35", + "referencedDeclaration": 31849, + "src": "5603:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } } @@ -3871,22 +4969,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } ], - "id": 31468, + "id": 31872, "name": "_exactOutputInternal", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31887, - "src": "4903:20:35", + "referencedDeclaration": 32291, + "src": "5506:20:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", "typeString": "function (address,uint256,uint256,address,struct ISecondaryFee.ServiceFeeParams memory[] memory) returns (uint256,address,struct SecondaryFee.FeeRecipient memory[] memory,uint256)" } }, - "id": 31478, + "id": 31882, "isConstant": false, "isLValue": false, "isPure": false, @@ -3895,46 +4993,46 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "4903:108:35", + "src": "5506:108:46", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", "typeString": "tuple(uint256,address,struct SecondaryFee.FeeRecipient memory[] memory,uint256)" } }, "nodeType": "VariableDeclarationStatement", - "src": "4789:222:35" + "src": "5392:222:46" }, { "expression": { - "id": 31484, + "id": 31888, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31480, + "id": 31884, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "5021:6:35", + "referencedDeclaration": 31852, + "src": "5624:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31482, + "id": 31886, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "5028:9:35", + "memberLocation": "5631:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30654, - "src": "5021:16:35", + "referencedDeclaration": 30984, + "src": "5624:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -3943,57 +5041,57 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31483, + "id": 31887, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31459, - "src": "5040:9:35", + "referencedDeclaration": 31863, + "src": "5643:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "5021:28:35", + "src": "5624:28:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31485, + "id": 31889, "nodeType": "ExpressionStatement", - "src": "5021:28:35" + "src": "5624:28:46" }, { "expression": { - "id": 31490, + "id": 31894, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31486, + "id": 31890, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "5059:6:35", + "referencedDeclaration": 31852, + "src": "5662:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31488, + "id": 31892, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "5066:9:35", + "memberLocation": "5669:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30652, - "src": "5059:16:35", + "referencedDeclaration": 30982, + "src": "5662:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -4002,41 +5100,41 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31489, + "id": 31893, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31461, - "src": "5078:9:35", + "referencedDeclaration": 31865, + "src": "5681:9:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "5059:28:35", + "src": "5662:28:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 31491, + "id": 31895, "nodeType": "ExpressionStatement", - "src": "5059:28:35" + "src": "5662:28:46" }, { "expression": { - "id": 31497, + "id": 31901, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31492, + "id": 31896, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31451, - "src": "5139:8:35", + "referencedDeclaration": 31855, + "src": "5742:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4047,14 +5145,14 @@ "rightHandSide": { "arguments": [ { - "id": 31495, + "id": 31899, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "5182:6:35", + "referencedDeclaration": 31852, + "src": "5785:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } } @@ -4062,38 +5160,38 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } ], "expression": { - "id": 31493, + "id": 31897, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "5150:13:35", + "referencedDeclaration": 31605, + "src": "5753:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } }, - "id": 31494, + "id": 31898, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "5164:17:35", + "memberLocation": "5767:17:46", "memberName": "exactOutputSingle", "nodeType": "MemberAccess", - "referencedDeclaration": 30668, - "src": "5150:31:35", + "referencedDeclaration": 30998, + "src": "5753:31:46", "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_struct$_ExactOutputSingleParams_$30659_memory_ptr_$returns$_t_uint256_$", + "typeIdentifier": "t_function_external_payable$_t_struct$_ExactOutputSingleParams_$30989_memory_ptr_$returns$_t_uint256_$", "typeString": "function (struct IV3SwapRouter.ExactOutputSingleParams memory) payable external returns (uint256)" } }, - "id": 31496, + "id": 31900, "isConstant": false, "isLValue": false, "isPure": false, @@ -4102,33 +5200,33 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "5150:39:35", + "src": "5753:39:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "5139:50:35", + "src": "5742:50:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31498, + "id": 31902, "nodeType": "ExpressionStatement", - "src": "5139:50:35" + "src": "5742:50:46" }, { "expression": { "arguments": [ { - "id": 31500, + "id": 31904, "name": "originalAmountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31454, - "src": "5240:17:35", + "referencedDeclaration": 31858, + "src": "5843:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4136,27 +5234,27 @@ }, { "expression": { - "id": 31501, + "id": 31905, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "5259:6:35", + "referencedDeclaration": 31852, + "src": "5862:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31502, + "id": 31906, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "5266:7:35", + "memberLocation": "5869:7:46", "memberName": "tokenIn", "nodeType": "MemberAccess", - "referencedDeclaration": 30646, - "src": "5259:14:35", + "referencedDeclaration": 30976, + "src": "5862:14:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -4164,27 +5262,27 @@ }, { "expression": { - "id": 31503, + "id": 31907, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "5275:6:35", + "referencedDeclaration": 31852, + "src": "5878:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31504, + "id": 31908, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "5282:8:35", + "memberLocation": "5885:8:46", "memberName": "tokenOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30648, - "src": "5275:15:35", + "referencedDeclaration": 30978, + "src": "5878:15:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -4192,53 +5290,53 @@ }, { "expression": { - "id": 31505, + "id": 31909, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31448, - "src": "5292:6:35", + "referencedDeclaration": 31852, + "src": "5895:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams memory" } }, - "id": 31506, + "id": 31910, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "5299:9:35", + "memberLocation": "5902:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30654, - "src": "5292:16:35", + "referencedDeclaration": 30984, + "src": "5895:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31507, + "id": 31911, "name": "totalFeeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31467, - "src": "5310:14:35", + "referencedDeclaration": 31871, + "src": "5913:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31508, + "id": 31912, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31465, - "src": "5326:13:35", + "referencedDeclaration": 31869, + "src": "5929:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } } @@ -4266,22 +5364,22 @@ "typeString": "uint256" }, { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } ], - "id": 31499, + "id": 31903, "name": "_transferFundsToRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31972, - "src": "5200:26:35", + "referencedDeclaration": 32376, + "src": "5803:26:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$returns$__$", + "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$returns$__$", "typeString": "function (uint256,address,address,uint256,uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "id": 31509, + "id": 31913, "isConstant": false, "isLValue": false, "isPure": false, @@ -4290,24 +5388,26 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "5200:149:35", + "src": "5803:149:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31510, + "id": 31914, "nodeType": "ExpressionStatement", - "src": "5200:149:35" + "src": "5803:149:46" } ] }, - "baseFunctions": [32185], + "baseFunctions": [ + 32589 + ], "documentation": { - "id": 31441, + "id": 31845, "nodeType": "StructuredDocumentation", - "src": "3948:571:35", + "src": "4551:571:46", "text": " @notice Swaps some amount of `tokenIn` for `amountOut` of `tokenOut` on behalf of the given `recipient` address,\n @dev Takes a fee on the output token, by increasing the `amountOut` by the fee amount.\n This means that the developer, when quoting the swap, should calculate the fee amount and increase the `amountOut` by that amount.\n @dev Emits a `FeeTaken` event for each fee recipient.\n @dev This swap has only one hop.\n @param params The swap parameters.\n @param serviceFee The details of the service fee(s)." }, "functionSelector": "ed921d3c", @@ -4315,50 +5415,52 @@ "kind": "function", "modifiers": [], "name": "exactOutputSingleWithServiceFee", - "nameLocation": "4533:31:35", + "nameLocation": "5136:31:46", "parameters": { - "id": 31449, + "id": 31853, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31445, + "id": 31849, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "4602:10:35", + "nameLocation": "5205:10:46", "nodeType": "VariableDeclaration", - "scope": 31512, - "src": "4574:38:35", + "scope": 31916, + "src": "5177:38:46", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31443, + "id": 31847, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31442, + "id": 31846, "name": "ServiceFeeParams", - "nameLocations": ["4574:16:35"], + "nameLocations": [ + "5177:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "4574:16:35" + "referencedDeclaration": 32553, + "src": "5177:16:46" }, - "referencedDeclaration": 32149, - "src": "4574:16:35", + "referencedDeclaration": 32553, + "src": "5177:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31444, + "id": 31848, "nodeType": "ArrayTypeName", - "src": "4574:18:35", + "src": "5177:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, @@ -4366,55 +5468,58 @@ }, { "constant": false, - "id": 31448, + "id": 31852, "mutability": "mutable", "name": "params", - "nameLocation": "4667:6:35", + "nameLocation": "5270:6:46", "nodeType": "VariableDeclaration", - "scope": 31512, - "src": "4622:51:35", + "scope": 31916, + "src": "5225:51:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams" }, "typeName": { - "id": 31447, + "id": 31851, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31446, + "id": 31850, "name": "IV3SwapRouter.ExactOutputSingleParams", - "nameLocations": ["4622:13:35", "4636:23:35"], + "nameLocations": [ + "5225:13:46", + "5239:23:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 30659, - "src": "4622:37:35" + "referencedDeclaration": 30989, + "src": "5225:37:46" }, - "referencedDeclaration": 30659, - "src": "4622:37:35", + "referencedDeclaration": 30989, + "src": "5225:37:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30659_storage_ptr", + "typeIdentifier": "t_struct$_ExactOutputSingleParams_$30989_storage_ptr", "typeString": "struct IV3SwapRouter.ExactOutputSingleParams" } }, "visibility": "internal" } ], - "src": "4564:115:35" + "src": "5167:115:46" }, "returnParameters": { - "id": 31452, + "id": 31856, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31451, + "id": 31855, "mutability": "mutable", "name": "amountIn", - "nameLocation": "4714:8:35", + "nameLocation": "5317:8:46", "nodeType": "VariableDeclaration", - "scope": 31512, - "src": "4706:16:35", + "scope": 31916, + "src": "5309:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4422,10 +5527,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31450, + "id": 31854, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "4706:7:35", + "src": "5309:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4434,36 +5539,38 @@ "visibility": "internal" } ], - "src": "4705:18:35" + "src": "5308:18:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "payable", "virtual": false, "visibility": "external" }, { - "id": 31595, + "id": 31999, "nodeType": "FunctionDefinition", - "src": "5938:965:35", + "src": "6541:965:46", "nodes": [], "body": { - "id": 31594, + "id": 31998, "nodeType": "Block", - "src": "6126:777:35", + "src": "6729:777:46", "nodes": [], "statements": [ { - "assignments": [31526], + "assignments": [ + 31930 + ], "declarations": [ { "constant": false, - "id": 31526, + "id": 31930, "mutability": "mutable", "name": "originalAmountOut", - "nameLocation": "6197:17:35", + "nameLocation": "6800:17:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6189:25:35", + "scope": 31998, + "src": "6792:25:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4471,10 +5578,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31525, + "id": 31929, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "6189:7:35", + "src": "6792:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4483,50 +5590,52 @@ "visibility": "internal" } ], - "id": 31529, + "id": 31933, "initialValue": { "expression": { - "id": 31527, + "id": 31931, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6217:6:35", + "referencedDeclaration": 31924, + "src": "6820:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31528, + "id": 31932, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6224:9:35", + "memberLocation": "6827:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30674, - "src": "6217:16:35", + "referencedDeclaration": 31004, + "src": "6820:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", - "src": "6189:44:35" + "src": "6792:44:46" }, { - "assignments": [31531], + "assignments": [ + 31935 + ], "declarations": [ { "constant": false, - "id": 31531, + "id": 31935, "mutability": "mutable", "name": "tokenIn", - "nameLocation": "6251:7:35", + "nameLocation": "6854:7:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6243:15:35", + "scope": 31998, + "src": "6846:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4534,10 +5643,10 @@ "typeString": "address" }, "typeName": { - "id": 31530, + "id": 31934, "name": "address", "nodeType": "ElementaryTypeName", - "src": "6243:7:35", + "src": "6846:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -4547,55 +5656,55 @@ "visibility": "internal" } ], - "id": 31536, + "id": 31940, "initialValue": { "arguments": [], "expression": { "argumentTypes": [], "expression": { "expression": { - "id": 31532, + "id": 31936, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6261:6:35", + "referencedDeclaration": 31924, + "src": "6864:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31533, + "id": 31937, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6268:4:35", + "memberLocation": "6871:4:46", "memberName": "path", "nodeType": "MemberAccess", - "referencedDeclaration": 30670, - "src": "6261:11:35", + "referencedDeclaration": 31000, + "src": "6864:11:46", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, - "id": 31534, + "id": 31938, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "6273:17:35", + "memberLocation": "6876:17:46", "memberName": "getFinalPoolToken", "nodeType": "MemberAccess", - "referencedDeclaration": 32244, - "src": "6261:29:35", + "referencedDeclaration": 32648, + "src": "6864:29:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_address_$attached_to$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) pure returns (address)" } }, - "id": 31535, + "id": 31939, "isConstant": false, "isLValue": false, "isPure": false, @@ -4604,7 +5713,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "6261:31:35", + "src": "6864:31:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -4612,20 +5721,22 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "6243:49:35" + "src": "6846:49:46" }, { - "assignments": [31538], + "assignments": [ + 31942 + ], "declarations": [ { "constant": false, - "id": 31538, + "id": 31942, "mutability": "mutable", "name": "tokenOut", - "nameLocation": "6310:8:35", + "nameLocation": "6913:8:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6302:16:35", + "scope": 31998, + "src": "6905:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4633,10 +5744,10 @@ "typeString": "address" }, "typeName": { - "id": 31537, + "id": 31941, "name": "address", "nodeType": "ElementaryTypeName", - "src": "6302:7:35", + "src": "6905:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -4646,55 +5757,55 @@ "visibility": "internal" } ], - "id": 31543, + "id": 31947, "initialValue": { "arguments": [], "expression": { "argumentTypes": [], "expression": { "expression": { - "id": 31539, + "id": 31943, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6321:6:35", + "referencedDeclaration": 31924, + "src": "6924:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31540, + "id": 31944, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6328:4:35", + "memberLocation": "6931:4:46", "memberName": "path", "nodeType": "MemberAccess", - "referencedDeclaration": 30670, - "src": "6321:11:35", + "referencedDeclaration": 31000, + "src": "6924:11:46", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, - "id": 31541, + "id": 31945, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "6333:17:35", + "memberLocation": "6936:17:46", "memberName": "getFirstPoolToken", "nodeType": "MemberAccess", - "referencedDeclaration": 32257, - "src": "6321:29:35", + "referencedDeclaration": 32661, + "src": "6924:29:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_address_$attached_to$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) pure returns (address)" } }, - "id": 31542, + "id": 31946, "isConstant": false, "isLValue": false, "isPure": false, @@ -4703,7 +5814,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "6321:31:35", + "src": "6924:31:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -4711,20 +5822,25 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "6302:50:35" + "src": "6905:50:46" }, { - "assignments": [31545, 31547, 31551, 31553], + "assignments": [ + 31949, + 31951, + 31955, + 31957 + ], "declarations": [ { "constant": false, - "id": 31545, + "id": 31949, "mutability": "mutable", "name": "amountOut", - "nameLocation": "6372:9:35", + "nameLocation": "6975:9:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6364:17:35", + "scope": 31998, + "src": "6967:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4732,10 +5848,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31544, + "id": 31948, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "6364:7:35", + "src": "6967:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4745,13 +5861,13 @@ }, { "constant": false, - "id": 31547, + "id": 31951, "mutability": "mutable", "name": "recipient", - "nameLocation": "6391:9:35", + "nameLocation": "6994:9:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6383:17:35", + "scope": 31998, + "src": "6986:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4759,10 +5875,10 @@ "typeString": "address" }, "typeName": { - "id": 31546, + "id": 31950, "name": "address", "nodeType": "ElementaryTypeName", - "src": "6383:7:35", + "src": "6986:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -4773,43 +5889,45 @@ }, { "constant": false, - "id": 31551, + "id": 31955, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "6424:13:35", + "nameLocation": "7027:13:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6402:35:35", + "scope": 31998, + "src": "7005:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31549, + "id": 31953, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31548, + "id": 31952, "name": "FeeRecipient", - "nameLocations": ["6402:12:35"], + "nameLocations": [ + "7005:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "6402:12:35" + "referencedDeclaration": 31620, + "src": "7005:12:46" }, - "referencedDeclaration": 31289, - "src": "6402:12:35", + "referencedDeclaration": 31620, + "src": "7005:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31550, + "id": 31954, "nodeType": "ArrayTypeName", - "src": "6402:14:35", + "src": "7005:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, @@ -4817,13 +5935,13 @@ }, { "constant": false, - "id": 31553, + "id": 31957, "mutability": "mutable", "name": "totalFeeAmount", - "nameLocation": "6447:14:35", + "nameLocation": "7050:14:46", "nodeType": "VariableDeclaration", - "scope": 31594, - "src": "6439:22:35", + "scope": 31998, + "src": "7042:22:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -4831,10 +5949,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31552, + "id": 31956, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "6439:7:35", + "src": "7042:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4843,16 +5961,16 @@ "visibility": "internal" } ], - "id": 31564, + "id": 31968, "initialValue": { "arguments": [ { - "id": 31555, + "id": 31959, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31531, - "src": "6498:7:35", + "referencedDeclaration": 31935, + "src": "7101:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -4860,27 +5978,27 @@ }, { "expression": { - "id": 31556, + "id": 31960, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6507:6:35", + "referencedDeclaration": 31924, + "src": "7110:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31557, + "id": 31961, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6514:15:35", + "memberLocation": "7117:15:46", "memberName": "amountInMaximum", "nodeType": "MemberAccess", - "referencedDeclaration": 30676, - "src": "6507:22:35", + "referencedDeclaration": 31006, + "src": "7110:22:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4888,27 +6006,27 @@ }, { "expression": { - "id": 31558, + "id": 31962, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6531:6:35", + "referencedDeclaration": 31924, + "src": "7134:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31559, + "id": 31963, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6538:9:35", + "memberLocation": "7141:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30674, - "src": "6531:16:35", + "referencedDeclaration": 31004, + "src": "7134:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -4916,41 +6034,41 @@ }, { "expression": { - "id": 31560, + "id": 31964, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6549:6:35", + "referencedDeclaration": 31924, + "src": "7152:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31561, + "id": 31965, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6556:9:35", + "memberLocation": "7159:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30672, - "src": "6549:16:35", + "referencedDeclaration": 31002, + "src": "7152:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31562, + "id": 31966, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31517, - "src": "6567:10:35", + "referencedDeclaration": 31921, + "src": "7170:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } } @@ -4974,22 +6092,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams calldata[] calldata" } ], - "id": 31554, + "id": 31958, "name": "_exactOutputInternal", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31887, - "src": "6477:20:35", + "referencedDeclaration": 32291, + "src": "7080:20:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_uint256_$_t_address_$_t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", "typeString": "function (address,uint256,uint256,address,struct ISecondaryFee.ServiceFeeParams memory[] memory) returns (uint256,address,struct SecondaryFee.FeeRecipient memory[] memory,uint256)" } }, - "id": 31563, + "id": 31967, "isConstant": false, "isLValue": false, "isPure": false, @@ -4998,46 +6116,46 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "6477:101:35", + "src": "7080:101:46", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", "typeString": "tuple(uint256,address,struct SecondaryFee.FeeRecipient memory[] memory,uint256)" } }, "nodeType": "VariableDeclarationStatement", - "src": "6363:215:35" + "src": "6966:215:46" }, { "expression": { - "id": 31569, + "id": 31973, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31565, + "id": 31969, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6588:6:35", + "referencedDeclaration": 31924, + "src": "7191:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31567, + "id": 31971, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "6595:9:35", + "memberLocation": "7198:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30674, - "src": "6588:16:35", + "referencedDeclaration": 31004, + "src": "7191:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5046,57 +6164,57 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31568, + "id": 31972, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31545, - "src": "6607:9:35", + "referencedDeclaration": 31949, + "src": "7210:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "6588:28:35", + "src": "7191:28:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31570, + "id": 31974, "nodeType": "ExpressionStatement", - "src": "6588:28:35" + "src": "7191:28:46" }, { "expression": { - "id": 31575, + "id": 31979, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "expression": { - "id": 31571, + "id": 31975, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6626:6:35", + "referencedDeclaration": 31924, + "src": "7229:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31573, + "id": 31977, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, - "memberLocation": "6633:9:35", + "memberLocation": "7236:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 30672, - "src": "6626:16:35", + "referencedDeclaration": 31002, + "src": "7229:16:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -5105,41 +6223,41 @@ "nodeType": "Assignment", "operator": "=", "rightHandSide": { - "id": 31574, + "id": 31978, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31547, - "src": "6645:9:35", + "referencedDeclaration": 31951, + "src": "7248:9:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "6626:28:35", + "src": "7229:28:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 31576, + "id": 31980, "nodeType": "ExpressionStatement", - "src": "6626:28:35" + "src": "7229:28:46" }, { "expression": { - "id": 31582, + "id": 31986, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31577, + "id": 31981, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31523, - "src": "6706:8:35", + "referencedDeclaration": 31927, + "src": "7309:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5150,14 +6268,14 @@ "rightHandSide": { "arguments": [ { - "id": 31580, + "id": 31984, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6743:6:35", + "referencedDeclaration": 31924, + "src": "7346:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } } @@ -5165,38 +6283,38 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } ], "expression": { - "id": 31578, + "id": 31982, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "6717:13:35", + "referencedDeclaration": 31605, + "src": "7320:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } }, - "id": 31579, + "id": 31983, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "6731:11:35", + "memberLocation": "7334:11:46", "memberName": "exactOutput", "nodeType": "MemberAccess", - "referencedDeclaration": 30686, - "src": "6717:25:35", + "referencedDeclaration": 31016, + "src": "7320:25:46", "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_struct$_ExactOutputParams_$30677_memory_ptr_$returns$_t_uint256_$", + "typeIdentifier": "t_function_external_payable$_t_struct$_ExactOutputParams_$31007_memory_ptr_$returns$_t_uint256_$", "typeString": "function (struct IV3SwapRouter.ExactOutputParams memory) payable external returns (uint256)" } }, - "id": 31581, + "id": 31985, "isConstant": false, "isLValue": false, "isPure": false, @@ -5205,57 +6323,57 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "6717:33:35", + "src": "7320:33:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "6706:44:35", + "src": "7309:44:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31583, + "id": 31987, "nodeType": "ExpressionStatement", - "src": "6706:44:35" + "src": "7309:44:46" }, { "expression": { "arguments": [ { - "id": 31585, + "id": 31989, "name": "originalAmountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31526, - "src": "6801:17:35", + "referencedDeclaration": 31930, + "src": "7404:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31586, + "id": 31990, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31531, - "src": "6820:7:35", + "referencedDeclaration": 31935, + "src": "7423:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31587, + "id": 31991, "name": "tokenOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31538, - "src": "6829:8:35", + "referencedDeclaration": 31942, + "src": "7432:8:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -5263,53 +6381,53 @@ }, { "expression": { - "id": 31588, + "id": 31992, "name": "params", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31520, - "src": "6839:6:35", + "referencedDeclaration": 31924, + "src": "7442:6:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams memory" } }, - "id": 31589, + "id": 31993, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "6846:9:35", + "memberLocation": "7449:9:46", "memberName": "amountOut", "nodeType": "MemberAccess", - "referencedDeclaration": 30674, - "src": "6839:16:35", + "referencedDeclaration": 31004, + "src": "7442:16:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31590, + "id": 31994, "name": "totalFeeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31553, - "src": "6857:14:35", + "referencedDeclaration": 31957, + "src": "7460:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31591, + "id": 31995, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31551, - "src": "6873:13:35", + "referencedDeclaration": 31955, + "src": "7476:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } } @@ -5337,22 +6455,22 @@ "typeString": "uint256" }, { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } ], - "id": 31584, + "id": 31988, "name": "_transferFundsToRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31972, - "src": "6761:26:35", + "referencedDeclaration": 32376, + "src": "7364:26:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$returns$__$", + "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$returns$__$", "typeString": "function (uint256,address,address,uint256,uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "id": 31592, + "id": 31996, "isConstant": false, "isLValue": false, "isPure": false, @@ -5361,24 +6479,26 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "6761:135:35", + "src": "7364:135:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31593, + "id": 31997, "nodeType": "ExpressionStatement", - "src": "6761:135:35" + "src": "7364:135:46" } ] }, - "baseFunctions": [32197], + "baseFunctions": [ + 32601 + ], "documentation": { - "id": 31513, + "id": 31917, "nodeType": "StructuredDocumentation", - "src": "5362:571:35", + "src": "5965:571:46", "text": " @notice Swaps `amountIn` of `tokenIn` for some amount of `tokenOut` on behalf of the given `recipient` address>\n @dev Takes a fee on the output token, by increasing the `amountOut` by the fee amount.\n This means that the developer, when quoting the swap, should calculate the fee amount and increase the `amountOut` by that amount.\n @dev Emits a `FeeTaken` event for each fee recipient.\n @dev This swap has multiple hops.\n @param params The swap parameters.\n @param serviceFee The details of the service fee(s)." }, "functionSelector": "1fd168ff", @@ -5386,50 +6506,52 @@ "kind": "function", "modifiers": [], "name": "exactOutputWithServiceFee", - "nameLocation": "5947:25:35", + "nameLocation": "6550:25:46", "parameters": { - "id": 31521, + "id": 31925, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31517, + "id": 31921, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "6010:10:35", + "nameLocation": "6613:10:46", "nodeType": "VariableDeclaration", - "scope": 31595, - "src": "5982:38:35", + "scope": 31999, + "src": "6585:38:46", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_calldata_ptr_$dyn_calldata_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_calldata_ptr_$dyn_calldata_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31515, + "id": 31919, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31514, + "id": 31918, "name": "ServiceFeeParams", - "nameLocations": ["5982:16:35"], + "nameLocations": [ + "6585:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "5982:16:35" + "referencedDeclaration": 32553, + "src": "6585:16:46" }, - "referencedDeclaration": 32149, - "src": "5982:16:35", + "referencedDeclaration": 32553, + "src": "6585:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31516, + "id": 31920, "nodeType": "ArrayTypeName", - "src": "5982:18:35", + "src": "6585:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, @@ -5437,55 +6559,58 @@ }, { "constant": false, - "id": 31520, + "id": 31924, "mutability": "mutable", "name": "params", - "nameLocation": "6069:6:35", + "nameLocation": "6672:6:46", "nodeType": "VariableDeclaration", - "scope": 31595, - "src": "6030:45:35", + "scope": 31999, + "src": "6633:45:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_memory_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_memory_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams" }, "typeName": { - "id": 31519, + "id": 31923, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31518, + "id": 31922, "name": "IV3SwapRouter.ExactOutputParams", - "nameLocations": ["6030:13:35", "6044:17:35"], + "nameLocations": [ + "6633:13:46", + "6647:17:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 30677, - "src": "6030:31:35" + "referencedDeclaration": 31007, + "src": "6633:31:46" }, - "referencedDeclaration": 30677, - "src": "6030:31:35", + "referencedDeclaration": 31007, + "src": "6633:31:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ExactOutputParams_$30677_storage_ptr", + "typeIdentifier": "t_struct$_ExactOutputParams_$31007_storage_ptr", "typeString": "struct IV3SwapRouter.ExactOutputParams" } }, "visibility": "internal" } ], - "src": "5972:109:35" + "src": "6575:109:46" }, "returnParameters": { - "id": 31524, + "id": 31928, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31523, + "id": 31927, "mutability": "mutable", "name": "amountIn", - "nameLocation": "6116:8:35", + "nameLocation": "6719:8:46", "nodeType": "VariableDeclaration", - "scope": 31595, - "src": "6108:16:35", + "scope": 31999, + "src": "6711:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -5493,10 +6618,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31522, + "id": 31926, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "6108:7:35", + "src": "6711:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5505,36 +6630,38 @@ "visibility": "internal" } ], - "src": "6107:18:35" + "src": "6710:18:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "payable", "virtual": false, "visibility": "external" }, { - "id": 31710, + "id": 32114, "nodeType": "FunctionDefinition", - "src": "6996:1063:35", + "src": "7599:1063:46", "nodes": [], "body": { - "id": 31709, + "id": 32113, "nodeType": "Block", - "src": "7157:902:35", + "src": "7760:902:46", "nodes": [], "statements": [ { - "assignments": [31612], + "assignments": [ + 32016 + ], "declarations": [ { "constant": false, - "id": 31612, + "id": 32016, "mutability": "mutable", "name": "serviceFeeTotal", - "nameLocation": "7175:15:35", + "nameLocation": "7778:15:46", "nodeType": "VariableDeclaration", - "scope": 31709, - "src": "7167:23:35", + "scope": 32113, + "src": "7770:23:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -5542,10 +6669,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31611, + "id": 32015, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7167:7:35", + "src": "7770:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5554,30 +6681,30 @@ "visibility": "internal" } ], - "id": 31613, + "id": 32017, "nodeType": "VariableDeclarationStatement", - "src": "7167:23:35" + "src": "7770:23:46" }, { "body": { - "id": 31632, + "id": 32036, "nodeType": "Block", - "src": "7319:77:35", + "src": "7922:77:46", "statements": [ { "expression": { - "id": 31630, + "id": 32034, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31625, + "id": 32029, "name": "serviceFeeTotal", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31612, - "src": "7333:15:35", + "referencedDeclaration": 32016, + "src": "7936:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5588,25 +6715,25 @@ "rightHandSide": { "expression": { "baseExpression": { - "id": 31626, + "id": 32030, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31602, - "src": "7352:10:35", + "referencedDeclaration": 32006, + "src": "7955:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } }, - "id": 31628, + "id": 32032, "indexExpression": { - "id": 31627, + "id": 32031, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31615, - "src": "7363:1:35", + "referencedDeclaration": 32019, + "src": "7966:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5617,36 +6744,36 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "7352:13:35", + "src": "7955:13:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_memory_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory" } }, - "id": 31629, + "id": 32033, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "7366:19:35", + "memberLocation": "7969:19:46", "memberName": "feePrcntBasisPoints", "nodeType": "MemberAccess", - "referencedDeclaration": 32148, - "src": "7352:33:35", + "referencedDeclaration": 32552, + "src": "7955:33:46", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, - "src": "7333:52:35", + "src": "7936:52:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31631, + "id": 32035, "nodeType": "ExpressionStatement", - "src": "7333:52:35" + "src": "7936:52:46" } ] }, @@ -5655,18 +6782,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31621, + "id": 32025, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31618, + "id": 32022, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31615, - "src": "7291:1:35", + "referencedDeclaration": 32019, + "src": "7894:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5676,50 +6803,52 @@ "operator": "<", "rightExpression": { "expression": { - "id": 31619, + "id": 32023, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31602, - "src": "7295:10:35", + "referencedDeclaration": 32006, + "src": "7898:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } }, - "id": 31620, + "id": 32024, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "7306:6:35", + "memberLocation": "7909:6:46", "memberName": "length", "nodeType": "MemberAccess", - "src": "7295:17:35", + "src": "7898:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "7291:21:35", + "src": "7894:21:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31633, + "id": 32037, "initializationExpression": { - "assignments": [31615], + "assignments": [ + 32019 + ], "declarations": [ { "constant": false, - "id": 31615, + "id": 32019, "mutability": "mutable", "name": "i", - "nameLocation": "7284:1:35", + "nameLocation": "7887:1:46", "nodeType": "VariableDeclaration", - "scope": 31633, - "src": "7276:9:35", + "scope": 32037, + "src": "7879:9:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -5727,10 +6856,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31614, + "id": 32018, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7276:7:35", + "src": "7879:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5739,17 +6868,17 @@ "visibility": "internal" } ], - "id": 31617, + "id": 32021, "initialValue": { "hexValue": "30", - "id": 31616, + "id": 32020, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "7288:1:35", + "src": "7891:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" @@ -5757,11 +6886,11 @@ "value": "0" }, "nodeType": "VariableDeclarationStatement", - "src": "7276:13:35" + "src": "7879:13:46" }, "loopExpression": { "expression": { - "id": 31623, + "id": 32027, "isConstant": false, "isLValue": false, "isPure": false, @@ -5769,14 +6898,14 @@ "nodeType": "UnaryOperation", "operator": "++", "prefix": false, - "src": "7314:3:35", + "src": "7917:3:46", "subExpression": { - "id": 31622, + "id": 32026, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31615, - "src": "7314:1:35", + "referencedDeclaration": 32019, + "src": "7917:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5787,12 +6916,12 @@ "typeString": "uint256" } }, - "id": 31624, + "id": 32028, "nodeType": "ExpressionStatement", - "src": "7314:3:35" + "src": "7917:3:46" }, "nodeType": "ForStatement", - "src": "7271:125:35" + "src": "7874:125:46" }, { "expression": { @@ -5802,18 +6931,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31637, + "id": 32041, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31635, + "id": 32039, "name": "serviceFeeTotal", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31612, - "src": "7413:15:35", + "referencedDeclaration": 32016, + "src": "8016:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5822,18 +6951,18 @@ "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { - "id": 31636, + "id": 32040, "name": "MAX_SERVICE_FEE", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31271, - "src": "7432:15:35", + "referencedDeclaration": 31602, + "src": "8035:15:46", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, - "src": "7413:34:35", + "src": "8016:34:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -5841,14 +6970,14 @@ }, { "hexValue": "5365727669636520666565203e204d41585f534552564943455f464545", - "id": 31638, + "id": 32042, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "7449:31:35", + "src": "8052:31:46", "typeDescriptions": { "typeIdentifier": "t_stringliteral_798df039c59b33721defd0c501a4c03270a50baf90e20bde8b6904edabe9a58b", "typeString": "literal_string \"Service fee > MAX_SERVICE_FEE\"" @@ -5867,18 +6996,21 @@ "typeString": "literal_string \"Service fee > MAX_SERVICE_FEE\"" } ], - "id": 31634, + "id": 32038, "name": "require", "nodeType": "Identifier", - "overloadedDeclarations": [-18, -18], + "overloadedDeclarations": [ + -18, + -18 + ], "referencedDeclaration": -18, - "src": "7405:7:35", + "src": "8008:7:46", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 31639, + "id": 32043, "isConstant": false, "isLValue": false, "isPure": false, @@ -5887,29 +7019,31 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "7405:76:35", + "src": "8008:76:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31640, + "id": 32044, "nodeType": "ExpressionStatement", - "src": "7405:76:35" + "src": "8008:76:46" }, { - "assignments": [31642], + "assignments": [ + 32046 + ], "declarations": [ { "constant": false, - "id": 31642, + "id": 32046, "mutability": "mutable", "name": "totalFees", - "nameLocation": "7500:9:35", + "nameLocation": "8103:9:46", "nodeType": "VariableDeclaration", - "scope": 31709, - "src": "7492:17:35", + "scope": 32113, + "src": "8095:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -5917,10 +7051,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31641, + "id": 32045, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7492:7:35", + "src": "8095:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -5929,17 +7063,17 @@ "visibility": "internal" } ], - "id": 31644, + "id": 32048, "initialValue": { "hexValue": "30", - "id": 31643, + "id": 32047, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "7512:1:35", + "src": "8115:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" @@ -5947,81 +7081,85 @@ "value": "0" }, "nodeType": "VariableDeclarationStatement", - "src": "7492:21:35" + "src": "8095:21:46" }, { - "assignments": [31649], + "assignments": [ + 32053 + ], "declarations": [ { "constant": false, - "id": 31649, + "id": 32053, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "7545:13:35", + "nameLocation": "8148:13:46", "nodeType": "VariableDeclaration", - "scope": 31709, - "src": "7523:35:35", + "scope": 32113, + "src": "8126:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31647, + "id": 32051, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31646, + "id": 32050, "name": "FeeRecipient", - "nameLocations": ["7523:12:35"], + "nameLocations": [ + "8126:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "7523:12:35" + "referencedDeclaration": 31620, + "src": "8126:12:46" }, - "referencedDeclaration": 31289, - "src": "7523:12:35", + "referencedDeclaration": 31620, + "src": "8126:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31648, + "id": 32052, "nodeType": "ArrayTypeName", - "src": "7523:14:35", + "src": "8126:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "id": 31657, + "id": 32061, "initialValue": { "arguments": [ { "expression": { - "id": 31654, + "id": 32058, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31602, - "src": "7580:10:35", + "referencedDeclaration": 32006, + "src": "8183:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } }, - "id": 31655, + "id": 32059, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "7591:6:35", + "memberLocation": "8194:6:46", "memberName": "length", "nodeType": "MemberAccess", - "src": "7580:17:35", + "src": "8183:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6035,46 +7173,48 @@ "typeString": "uint256" } ], - "id": 31653, + "id": 32057, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", - "src": "7561:18:35", + "src": "8164:18:46", "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "function (uint256) pure returns (struct SecondaryFee.FeeRecipient memory[] memory)" }, "typeName": { "baseType": { - "id": 31651, + "id": 32055, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31650, + "id": 32054, "name": "FeeRecipient", - "nameLocations": ["7565:12:35"], + "nameLocations": [ + "8168:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "7565:12:35" + "referencedDeclaration": 31620, + "src": "8168:12:46" }, - "referencedDeclaration": 31289, - "src": "7565:12:35", + "referencedDeclaration": 31620, + "src": "8168:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31652, + "id": 32056, "nodeType": "ArrayTypeName", - "src": "7565:14:35", + "src": "8168:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } } }, - "id": 31656, + "id": 32060, "isConstant": false, "isLValue": false, "isPure": false, @@ -6083,34 +7223,36 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "7561:37:35", + "src": "8164:37:46", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, "nodeType": "VariableDeclarationStatement", - "src": "7523:75:35" + "src": "8126:75:46" }, { "body": { - "id": 31703, + "id": 32107, "nodeType": "Block", - "src": "7739:270:35", + "src": "8342:270:46", "statements": [ { - "assignments": [31670], + "assignments": [ + 32074 + ], "declarations": [ { "constant": false, - "id": 31670, + "id": 32074, "mutability": "mutable", "name": "feeAmount", - "nameLocation": "7761:9:35", + "nameLocation": "8364:9:46", "nodeType": "VariableDeclaration", - "scope": 31703, - "src": "7753:17:35", + "scope": 32107, + "src": "8356:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -6118,10 +7260,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31669, + "id": 32073, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7753:7:35", + "src": "8356:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6130,13 +7272,13 @@ "visibility": "internal" } ], - "id": 31686, + "id": 32090, "initialValue": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31685, + "id": 32089, "isConstant": false, "isLValue": false, "isPure": false, @@ -6148,18 +7290,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31679, + "id": 32083, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31671, + "id": 32075, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31598, - "src": "7774:6:35", + "referencedDeclaration": 32002, + "src": "8377:6:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6172,25 +7314,25 @@ { "expression": { "baseExpression": { - "id": 31674, + "id": 32078, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31602, - "src": "7791:10:35", + "referencedDeclaration": 32006, + "src": "8394:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } }, - "id": 31676, + "id": 32080, "indexExpression": { - "id": 31675, + "id": 32079, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31659, - "src": "7802:1:35", + "referencedDeclaration": 32063, + "src": "8405:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6201,22 +7343,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "7791:13:35", + "src": "8394:13:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_memory_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory" } }, - "id": 31677, + "id": 32081, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "7805:19:35", + "memberLocation": "8408:19:46", "memberName": "feePrcntBasisPoints", "nodeType": "MemberAccess", - "referencedDeclaration": 32148, - "src": "7791:33:35", + "referencedDeclaration": 32552, + "src": "8394:33:46", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" @@ -6230,26 +7372,26 @@ "typeString": "uint16" } ], - "id": 31673, + "id": 32077, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "7783:7:35", + "src": "8386:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { - "id": 31672, + "id": 32076, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7783:7:35", + "src": "8386:7:46", "typeDescriptions": {} } }, - "id": 31678, + "id": 32082, "isConstant": false, "isLValue": false, "isPure": false, @@ -6258,28 +7400,28 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "7783:42:35", + "src": "8386:42:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "7774:51:35", + "src": "8377:51:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], - "id": 31680, + "id": 32084, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", - "src": "7773:53:35", + "src": "8376:53:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6290,12 +7432,12 @@ "rightExpression": { "arguments": [ { - "id": 31683, + "id": 32087, "name": "BASIS_POINT_PRECISION", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31268, - "src": "7837:21:35", + "referencedDeclaration": 31599, + "src": "8440:21:46", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" @@ -6309,26 +7451,26 @@ "typeString": "uint16" } ], - "id": 31682, + "id": 32086, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "7829:7:35", + "src": "8432:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { - "id": 31681, + "id": 32085, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7829:7:35", + "src": "8432:7:46", "typeDescriptions": {} } }, - "id": 31684, + "id": 32088, "isConstant": false, "isLValue": false, "isPure": true, @@ -6337,50 +7479,50 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "7829:30:35", + "src": "8432:30:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "7773:86:35", + "src": "8376:86:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", - "src": "7753:106:35" + "src": "8356:106:46" }, { "expression": { - "id": 31697, + "id": 32101, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "baseExpression": { - "id": 31687, + "id": 32091, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31649, - "src": "7874:13:35", + "referencedDeclaration": 32053, + "src": "8477:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 31689, + "id": 32093, "indexExpression": { - "id": 31688, + "id": 32092, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31659, - "src": "7888:1:35", + "referencedDeclaration": 32063, + "src": "8491:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6391,9 +7533,9 @@ "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", - "src": "7874:16:35", + "src": "8477:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, @@ -6404,25 +7546,25 @@ { "expression": { "baseExpression": { - "id": 31691, + "id": 32095, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31602, - "src": "7918:10:35", + "referencedDeclaration": 32006, + "src": "8521:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } }, - "id": 31693, + "id": 32097, "indexExpression": { - "id": 31692, + "id": 32096, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31659, - "src": "7929:1:35", + "referencedDeclaration": 32063, + "src": "8532:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6433,34 +7575,34 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "7918:13:35", + "src": "8521:13:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_memory_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory" } }, - "id": 31694, + "id": 32098, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "7932:9:35", + "memberLocation": "8535:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 32146, - "src": "7918:23:35", + "referencedDeclaration": 32550, + "src": "8521:23:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31695, + "id": 32099, "name": "feeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31670, - "src": "7951:9:35", + "referencedDeclaration": 32074, + "src": "8554:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6478,57 +7620,63 @@ "typeString": "uint256" } ], - "id": 31690, + "id": 32094, "name": "FeeRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31289, - "src": "7893:12:35", + "referencedDeclaration": 31620, + "src": "8496:12:46", "typeDescriptions": { - "typeIdentifier": "t_type$_t_struct$_FeeRecipient_$31289_storage_ptr_$", + "typeIdentifier": "t_type$_t_struct$_FeeRecipient_$31620_storage_ptr_$", "typeString": "type(struct SecondaryFee.FeeRecipient storage pointer)" } }, - "id": 31696, + "id": 32100, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, - "nameLocations": ["7907:9:35", "7943:6:35"], - "names": ["recipient", "amount"], + "nameLocations": [ + "8510:9:46", + "8546:6:46" + ], + "names": [ + "recipient", + "amount" + ], "nodeType": "FunctionCall", - "src": "7893:69:35", + "src": "8496:69:46", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "src": "7874:88:35", + "src": "8477:88:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 31698, + "id": 32102, "nodeType": "ExpressionStatement", - "src": "7874:88:35" + "src": "8477:88:46" }, { "expression": { - "id": 31701, + "id": 32105, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31699, + "id": 32103, "name": "totalFees", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31642, - "src": "7976:9:35", + "referencedDeclaration": 32046, + "src": "8579:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6537,26 +7685,26 @@ "nodeType": "Assignment", "operator": "+=", "rightHandSide": { - "id": 31700, + "id": 32104, "name": "feeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31670, - "src": "7989:9:35", + "referencedDeclaration": 32074, + "src": "8592:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "7976:22:35", + "src": "8579:22:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31702, + "id": 32106, "nodeType": "ExpressionStatement", - "src": "7976:22:35" + "src": "8579:22:46" } ] }, @@ -6565,18 +7713,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31665, + "id": 32069, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31662, + "id": 32066, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31659, - "src": "7711:1:35", + "referencedDeclaration": 32063, + "src": "8314:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6586,50 +7734,52 @@ "operator": "<", "rightExpression": { "expression": { - "id": 31663, + "id": 32067, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31602, - "src": "7715:10:35", + "referencedDeclaration": 32006, + "src": "8318:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } }, - "id": 31664, + "id": 32068, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "7726:6:35", + "memberLocation": "8329:6:46", "memberName": "length", "nodeType": "MemberAccess", - "src": "7715:17:35", + "src": "8318:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "7711:21:35", + "src": "8314:21:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31704, + "id": 32108, "initializationExpression": { - "assignments": [31659], + "assignments": [ + 32063 + ], "declarations": [ { "constant": false, - "id": 31659, + "id": 32063, "mutability": "mutable", "name": "i", - "nameLocation": "7704:1:35", + "nameLocation": "8307:1:46", "nodeType": "VariableDeclaration", - "scope": 31704, - "src": "7696:9:35", + "scope": 32108, + "src": "8299:9:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -6637,10 +7787,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31658, + "id": 32062, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7696:7:35", + "src": "8299:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6649,17 +7799,17 @@ "visibility": "internal" } ], - "id": 31661, + "id": 32065, "initialValue": { "hexValue": "30", - "id": 31660, + "id": 32064, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "7708:1:35", + "src": "8311:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" @@ -6667,11 +7817,11 @@ "value": "0" }, "nodeType": "VariableDeclarationStatement", - "src": "7696:13:35" + "src": "8299:13:46" }, "loopExpression": { "expression": { - "id": 31667, + "id": 32071, "isConstant": false, "isLValue": false, "isPure": false, @@ -6679,14 +7829,14 @@ "nodeType": "UnaryOperation", "operator": "++", "prefix": false, - "src": "7734:3:35", + "src": "8337:3:46", "subExpression": { - "id": 31666, + "id": 32070, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31659, - "src": "7734:1:35", + "referencedDeclaration": 32063, + "src": "8337:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6697,85 +7847,85 @@ "typeString": "uint256" } }, - "id": 31668, + "id": 32072, "nodeType": "ExpressionStatement", - "src": "7734:3:35" + "src": "8337:3:46" }, "nodeType": "ForStatement", - "src": "7691:318:35" + "src": "8294:318:46" }, { "expression": { "components": [ { - "id": 31705, + "id": 32109, "name": "totalFees", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31642, - "src": "8027:9:35", + "referencedDeclaration": 32046, + "src": "8630:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31706, + "id": 32110, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31649, - "src": "8038:13:35", + "referencedDeclaration": 32053, + "src": "8641:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } } ], - "id": 31707, + "id": 32111, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", - "src": "8026:26:35", + "src": "8629:26:46", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "tuple(uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "functionReturnParameters": 31610, - "id": 31708, + "functionReturnParameters": 32014, + "id": 32112, "nodeType": "Return", - "src": "8019:33:35" + "src": "8622:33:46" } ] }, "documentation": { - "id": 31596, + "id": 32000, "nodeType": "StructuredDocumentation", - "src": "6909:82:35", + "src": "7512:82:46", "text": " @notice Calculates the total fee amount and the fee recipients." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_calculateFees", - "nameLocation": "7005:14:35", + "nameLocation": "7608:14:46", "parameters": { - "id": 31603, + "id": 32007, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31598, + "id": 32002, "mutability": "mutable", "name": "amount", - "nameLocation": "7028:6:35", + "nameLocation": "7631:6:46", "nodeType": "VariableDeclaration", - "scope": 31710, - "src": "7020:14:35", + "scope": 32114, + "src": "7623:14:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -6783,10 +7933,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31597, + "id": 32001, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7020:7:35", + "src": "7623:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6796,64 +7946,66 @@ }, { "constant": false, - "id": 31602, + "id": 32006, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "7062:10:35", + "nameLocation": "7665:10:46", "nodeType": "VariableDeclaration", - "scope": 31710, - "src": "7036:36:35", + "scope": 32114, + "src": "7639:36:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31600, + "id": 32004, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31599, + "id": 32003, "name": "ServiceFeeParams", - "nameLocations": ["7036:16:35"], + "nameLocations": [ + "7639:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "7036:16:35" + "referencedDeclaration": 32553, + "src": "7639:16:46" }, - "referencedDeclaration": 32149, - "src": "7036:16:35", + "referencedDeclaration": 32553, + "src": "7639:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31601, + "id": 32005, "nodeType": "ArrayTypeName", - "src": "7036:18:35", + "src": "7639:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, "visibility": "internal" } ], - "src": "7019:54:35" + "src": "7622:54:46" }, "returnParameters": { - "id": 31610, + "id": 32014, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31605, + "id": 32009, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31710, - "src": "7121:7:35", + "scope": 32114, + "src": "7724:7:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -6861,10 +8013,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31604, + "id": 32008, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "7121:7:35", + "src": "7724:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -6874,70 +8026,72 @@ }, { "constant": false, - "id": 31609, + "id": 32013, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31710, - "src": "7130:21:35", + "scope": 32114, + "src": "7733:21:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31607, + "id": 32011, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31606, + "id": 32010, "name": "FeeRecipient", - "nameLocations": ["7130:12:35"], + "nameLocations": [ + "7733:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "7130:12:35" + "referencedDeclaration": 31620, + "src": "7733:12:46" }, - "referencedDeclaration": 31289, - "src": "7130:12:35", + "referencedDeclaration": 31620, + "src": "7733:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31608, + "id": 32012, "nodeType": "ArrayTypeName", - "src": "7130:14:35", + "src": "7733:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "src": "7120:32:35" + "src": "7723:32:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { - "id": 31791, + "id": 32195, "nodeType": "FunctionDefinition", - "src": "8575:1089:35", + "src": "9178:1089:46", "nodes": [], "body": { - "id": 31790, + "id": 32194, "nodeType": "Block", - "src": "8773:891:35", + "src": "9376:891:46", "nodes": [], "statements": [ { "condition": { - "id": 31730, + "id": 32134, "isConstant": false, "isLValue": false, "isPure": false, @@ -6945,23 +8099,23 @@ "nodeType": "UnaryOperation", "operator": "!", "prefix": true, - "src": "8787:9:35", + "src": "9390:9:46", "subExpression": { "arguments": [], "expression": { "argumentTypes": [], - "id": 31728, + "id": 32132, "name": "paused", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 29494, - "src": "8788:6:35", + "src": "9391:6:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, - "id": 31729, + "id": 32133, "isConstant": false, "isLValue": false, "isPure": false, @@ -6970,7 +8124,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "8788:8:35", + "src": "9391:8:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", @@ -6982,26 +8136,29 @@ "typeString": "bool" } }, - "id": 31754, + "id": 32158, "nodeType": "IfStatement", - "src": "8783:390:35", + "src": "9386:390:46", "trueBody": { - "id": 31753, + "id": 32157, "nodeType": "Block", - "src": "8798:375:35", + "src": "9401:375:46", "statements": [ { - "assignments": [31732, 31736], + "assignments": [ + 32136, + 32140 + ], "declarations": [ { "constant": false, - "id": 31732, + "id": 32136, "mutability": "mutable", "name": "fees", - "nameLocation": "8913:4:35", + "nameLocation": "9516:4:46", "nodeType": "VariableDeclaration", - "scope": 31753, - "src": "8905:12:35", + "scope": 32157, + "src": "9508:12:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7009,10 +8166,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31731, + "id": 32135, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "8905:7:35", + "src": "9508:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7022,73 +8179,75 @@ }, { "constant": false, - "id": 31736, + "id": 32140, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "8941:13:35", + "nameLocation": "9544:13:46", "nodeType": "VariableDeclaration", - "scope": 31753, - "src": "8919:35:35", + "scope": 32157, + "src": "9522:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31734, + "id": 32138, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31733, + "id": 32137, "name": "FeeRecipient", - "nameLocations": ["8919:12:35"], + "nameLocations": [ + "9522:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "8919:12:35" + "referencedDeclaration": 31620, + "src": "9522:12:46" }, - "referencedDeclaration": 31289, - "src": "8919:12:35", + "referencedDeclaration": 31620, + "src": "9522:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31735, + "id": 32139, "nodeType": "ArrayTypeName", - "src": "8919:14:35", + "src": "9522:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "id": 31741, + "id": 32145, "initialValue": { "arguments": [ { - "id": 31738, + "id": 32142, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31715, - "src": "8973:8:35", + "referencedDeclaration": 32119, + "src": "9576:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31739, + "id": 32143, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31721, - "src": "8983:10:35", + "referencedDeclaration": 32125, + "src": "9586:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } } @@ -7100,22 +8259,22 @@ "typeString": "uint256" }, { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } ], - "id": 31737, + "id": 32141, "name": "_calculateFees", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31710, - "src": "8958:14:35", + "referencedDeclaration": 32114, + "src": "9561:14:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "function (uint256,struct ISecondaryFee.ServiceFeeParams memory[] memory) pure returns (uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "id": 31740, + "id": 32144, "isConstant": false, "isLValue": false, "isPure": false, @@ -7124,30 +8283,30 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "8958:36:35", + "src": "9561:36:46", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "tuple(uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, "nodeType": "VariableDeclarationStatement", - "src": "8904:90:35" + "src": "9507:90:46" }, { "expression": { - "id": 31746, + "id": 32150, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31742, + "id": 32146, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31715, - "src": "9008:8:35", + "referencedDeclaration": 32119, + "src": "9611:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7160,18 +8319,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31745, + "id": 32149, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31743, + "id": 32147, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31715, - "src": "9019:8:35", + "referencedDeclaration": 32119, + "src": "9622:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7180,57 +8339,57 @@ "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { - "id": 31744, + "id": 32148, "name": "fees", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31732, - "src": "9030:4:35", + "referencedDeclaration": 32136, + "src": "9633:4:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "9019:15:35", + "src": "9622:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "9008:26:35", + "src": "9611:26:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31747, + "id": 32151, "nodeType": "ExpressionStatement", - "src": "9008:26:35" + "src": "9611:26:46" }, { "expression": { "arguments": [ { - "id": 31749, + "id": 32153, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31713, - "src": "9139:7:35", + "referencedDeclaration": 32117, + "src": "9742:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31750, + "id": 32154, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31736, - "src": "9148:13:35", + "referencedDeclaration": 32140, + "src": "9751:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } } @@ -7242,22 +8401,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } ], - "id": 31748, + "id": 32152, "name": "_transferFeesToRecipientsExactInput", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32026, - "src": "9103:35:35", + "referencedDeclaration": 32430, + "src": "9706:35:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$returns$__$", + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$returns$__$", "typeString": "function (address,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "id": 31751, + "id": 32155, "isConstant": false, "isLValue": false, "isPure": false, @@ -7266,16 +8425,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "9103:59:35", + "src": "9706:59:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31752, + "id": 32156, "nodeType": "ExpressionStatement", - "src": "9103:59:35" + "src": "9706:59:46" } ] } @@ -7285,26 +8444,26 @@ "arguments": [ { "expression": { - "id": 31759, + "id": 32163, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "9386:3:35", + "src": "9989:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31760, + "id": 32164, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "9390:6:35", + "memberLocation": "9993:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "9386:10:35", + "src": "9989:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -7313,14 +8472,14 @@ { "arguments": [ { - "id": 31763, + "id": 32167, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "9406:4:35", + "src": "10009:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -7328,30 +8487,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31762, + "id": 32166, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "9398:7:35", + "src": "10001:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31761, + "id": 32165, "name": "address", "nodeType": "ElementaryTypeName", - "src": "9398:7:35", + "src": "10001:7:46", "typeDescriptions": {} } }, - "id": 31764, + "id": 32168, "isConstant": false, "isLValue": false, "isPure": false, @@ -7360,7 +8519,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "9398:13:35", + "src": "10001:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -7368,12 +8527,12 @@ } }, { - "id": 31765, + "id": 32169, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31715, - "src": "9413:8:35", + "referencedDeclaration": 32119, + "src": "10016:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7398,12 +8557,12 @@ "expression": { "arguments": [ { - "id": 31756, + "id": 32160, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31713, - "src": "9364:7:35", + "referencedDeclaration": 32117, + "src": "9967:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -7417,18 +8576,18 @@ "typeString": "address" } ], - "id": 31755, + "id": 32159, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "9357:6:35", + "src": "9960:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31757, + "id": 32161, "isConstant": false, "isLValue": false, "isPure": false, @@ -7437,29 +8596,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "9357:15:35", + "src": "9960:15:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31758, + "id": 32162, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "9373:12:35", + "memberLocation": "9976:12:46", "memberName": "transferFrom", "nodeType": "MemberAccess", "referencedDeclaration": 30214, - "src": "9357:28:35", + "src": "9960:28:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,address,uint256) external returns (bool)" } }, - "id": 31766, + "id": 32170, "isConstant": false, "isLValue": false, "isPure": false, @@ -7468,39 +8627,39 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "9357:65:35", + "src": "9960:65:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31767, + "id": 32171, "nodeType": "ExpressionStatement", - "src": "9357:65:35" + "src": "9960:65:46" }, { "expression": { "arguments": [ { - "id": 31769, + "id": 32173, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31713, - "src": "9449:7:35", + "referencedDeclaration": 32117, + "src": "10052:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31770, + "id": 32174, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31715, - "src": "9458:8:35", + "referencedDeclaration": 32119, + "src": "10061:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7518,18 +8677,18 @@ "typeString": "uint256" } ], - "id": 31768, + "id": 32172, "name": "_ensureApproved", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32119, - "src": "9433:15:35", + "referencedDeclaration": 32523, + "src": "10036:15:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,uint256)" } }, - "id": 31771, + "id": 32175, "isConstant": false, "isLValue": false, "isPure": false, @@ -7538,16 +8697,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "9433:34:35", + "src": "10036:34:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31772, + "id": 32176, "nodeType": "ExpressionStatement", - "src": "9433:34:35" + "src": "10036:34:46" }, { "condition": { @@ -7555,18 +8714,18 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 31778, + "id": 32182, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31773, + "id": 32177, "name": "swapRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31717, - "src": "9482:13:35", + "referencedDeclaration": 32121, + "src": "10085:13:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -7577,14 +8736,14 @@ "rightExpression": { "arguments": [ { - "id": 31776, + "id": 32180, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "9507:4:35", + "src": "10110:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -7592,30 +8751,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31775, + "id": 32179, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "9499:7:35", + "src": "10102:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31774, + "id": 32178, "name": "address", "nodeType": "ElementaryTypeName", - "src": "9499:7:35", + "src": "10102:7:46", "typeDescriptions": {} } }, - "id": 31777, + "id": 32181, "isConstant": false, "isLValue": false, "isPure": false, @@ -7624,41 +8783,41 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "9499:13:35", + "src": "10102:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "9482:30:35", + "src": "10085:30:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31785, + "id": 32189, "nodeType": "IfStatement", - "src": "9478:137:35", + "src": "10081:137:46", "trueBody": { - "id": 31784, + "id": 32188, "nodeType": "Block", - "src": "9514:101:35", + "src": "10117:101:46", "statements": [ { "expression": { - "id": 31782, + "id": 32186, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31779, + "id": 32183, "name": "swapRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31717, - "src": "9578:13:35", + "referencedDeclaration": 32121, + "src": "10181:13:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -7668,40 +8827,40 @@ "operator": "=", "rightHandSide": { "expression": { - "id": 31780, + "id": 32184, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "9594:3:35", + "src": "10197:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31781, + "id": 32185, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "9598:6:35", + "memberLocation": "10201:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "9594:10:35", + "src": "10197:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "9578:26:35", + "src": "10181:26:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 31783, + "id": 32187, "nodeType": "ExpressionStatement", - "src": "9578:26:35" + "src": "10181:26:46" } ] } @@ -7710,74 +8869,74 @@ "expression": { "components": [ { - "id": 31786, + "id": 32190, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31715, - "src": "9633:8:35", + "referencedDeclaration": 32119, + "src": "10236:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31787, + "id": 32191, "name": "swapRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31717, - "src": "9643:13:35", + "referencedDeclaration": 32121, + "src": "10246:13:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], - "id": 31788, + "id": 32192, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", - "src": "9632:25:35", + "src": "10235:25:46", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$", "typeString": "tuple(uint256,address)" } }, - "functionReturnParameters": 31727, - "id": 31789, + "functionReturnParameters": 32131, + "id": 32193, "nodeType": "Return", - "src": "9625:32:35" + "src": "10228:32:46" } ] }, "documentation": { - "id": 31711, + "id": 32115, "nodeType": "StructuredDocumentation", - "src": "8065:505:35", + "src": "8668:505:46", "text": " @notice Private function for the fee logic of `exactInputSingleWithServiceFee` and `exactInputWithServiceFee`.\n @param tokenIn The token to swap from.\n @param amountIn The amount of `tokenIn` to swap.\n @param swapRecipient The address to receive the swap result.\n @param serviceFee The details of the service fee(s).\n @return uint256 The amount of `tokenIn` to swap, after subtracting the fee.\n @return address The address to receive the swap result." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_exactInputInternal", - "nameLocation": "8584:19:35", + "nameLocation": "9187:19:46", "parameters": { - "id": 31722, + "id": 32126, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31713, + "id": 32117, "mutability": "mutable", "name": "tokenIn", - "nameLocation": "8621:7:35", + "nameLocation": "9224:7:46", "nodeType": "VariableDeclaration", - "scope": 31791, - "src": "8613:15:35", + "scope": 32195, + "src": "9216:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7785,10 +8944,10 @@ "typeString": "address" }, "typeName": { - "id": 31712, + "id": 32116, "name": "address", "nodeType": "ElementaryTypeName", - "src": "8613:7:35", + "src": "9216:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -7799,13 +8958,13 @@ }, { "constant": false, - "id": 31715, + "id": 32119, "mutability": "mutable", "name": "amountIn", - "nameLocation": "8646:8:35", + "nameLocation": "9249:8:46", "nodeType": "VariableDeclaration", - "scope": 31791, - "src": "8638:16:35", + "scope": 32195, + "src": "9241:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7813,10 +8972,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31714, + "id": 32118, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "8638:7:35", + "src": "9241:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7826,13 +8985,13 @@ }, { "constant": false, - "id": 31717, + "id": 32121, "mutability": "mutable", "name": "swapRecipient", - "nameLocation": "8672:13:35", + "nameLocation": "9275:13:46", "nodeType": "VariableDeclaration", - "scope": 31791, - "src": "8664:21:35", + "scope": 32195, + "src": "9267:21:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7840,10 +8999,10 @@ "typeString": "address" }, "typeName": { - "id": 31716, + "id": 32120, "name": "address", "nodeType": "ElementaryTypeName", - "src": "8664:7:35", + "src": "9267:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -7854,64 +9013,66 @@ }, { "constant": false, - "id": 31721, + "id": 32125, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "8721:10:35", + "nameLocation": "9324:10:46", "nodeType": "VariableDeclaration", - "scope": 31791, - "src": "8695:36:35", + "scope": 32195, + "src": "9298:36:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31719, + "id": 32123, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31718, + "id": 32122, "name": "ServiceFeeParams", - "nameLocations": ["8695:16:35"], + "nameLocations": [ + "9298:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "8695:16:35" + "referencedDeclaration": 32553, + "src": "9298:16:46" }, - "referencedDeclaration": 32149, - "src": "8695:16:35", + "referencedDeclaration": 32553, + "src": "9298:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31720, + "id": 32124, "nodeType": "ArrayTypeName", - "src": "8695:18:35", + "src": "9298:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, "visibility": "internal" } ], - "src": "8603:134:35" + "src": "9206:134:46" }, "returnParameters": { - "id": 31727, + "id": 32131, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31724, + "id": 32128, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31791, - "src": "8755:7:35", + "scope": 32195, + "src": "9358:7:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7919,10 +9080,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31723, + "id": 32127, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "8755:7:35", + "src": "9358:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -7932,13 +9093,13 @@ }, { "constant": false, - "id": 31726, + "id": 32130, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31791, - "src": "8764:7:35", + "scope": 32195, + "src": "9367:7:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7946,10 +9107,10 @@ "typeString": "address" }, "typeName": { - "id": 31725, + "id": 32129, "name": "address", "nodeType": "ElementaryTypeName", - "src": "8764:7:35", + "src": "9367:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -7959,36 +9120,38 @@ "visibility": "internal" } ], - "src": "8754:18:35" + "src": "9357:18:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "private" }, { - "id": 31887, + "id": 32291, "nodeType": "FunctionDefinition", - "src": "10388:1076:35", + "src": "10991:1076:46", "nodes": [], "body": { - "id": 31886, + "id": 32290, "nodeType": "Block", - "src": "10646:818:35", + "src": "11249:818:46", "nodes": [], "statements": [ { - "assignments": [31818], + "assignments": [ + 32222 + ], "declarations": [ { "constant": false, - "id": 31818, + "id": 32222, "mutability": "mutable", "name": "totalFeeAmount", - "nameLocation": "10664:14:35", + "nameLocation": "11267:14:46", "nodeType": "VariableDeclaration", - "scope": 31886, - "src": "10656:22:35", + "scope": 32290, + "src": "11259:22:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -7996,10 +9159,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31817, + "id": 32221, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "10656:7:35", + "src": "11259:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8008,17 +9171,17 @@ "visibility": "internal" } ], - "id": 31820, + "id": 32224, "initialValue": { "hexValue": "30", - "id": 31819, + "id": 32223, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "10681:1:35", + "src": "11284:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" @@ -8026,63 +9189,67 @@ "value": "0" }, "nodeType": "VariableDeclarationStatement", - "src": "10656:26:35" + "src": "11259:26:46" }, { - "assignments": [31825], + "assignments": [ + 32229 + ], "declarations": [ { "constant": false, - "id": 31825, + "id": 32229, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "10714:13:35", + "nameLocation": "11317:13:46", "nodeType": "VariableDeclaration", - "scope": 31886, - "src": "10692:35:35", + "scope": 32290, + "src": "11295:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31823, + "id": 32227, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31822, + "id": 32226, "name": "FeeRecipient", - "nameLocations": ["10692:12:35"], + "nameLocations": [ + "11295:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "10692:12:35" + "referencedDeclaration": 31620, + "src": "11295:12:46" }, - "referencedDeclaration": 31289, - "src": "10692:12:35", + "referencedDeclaration": 31620, + "src": "11295:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31824, + "id": 32228, "nodeType": "ArrayTypeName", - "src": "10692:14:35", + "src": "11295:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "id": 31826, + "id": 32230, "nodeType": "VariableDeclarationStatement", - "src": "10692:35:35" + "src": "11295:35:46" }, { "condition": { - "id": 31829, + "id": 32233, "isConstant": false, "isLValue": false, "isPure": false, @@ -8090,23 +9257,23 @@ "nodeType": "UnaryOperation", "operator": "!", "prefix": true, - "src": "10741:9:35", + "src": "11344:9:46", "subExpression": { "arguments": [], "expression": { "argumentTypes": [], - "id": 31827, + "id": 32231, "name": "paused", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 29494, - "src": "10742:6:35", + "src": "11345:6:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, - "id": 31828, + "id": 32232, "isConstant": false, "isLValue": false, "isPure": false, @@ -8115,7 +9282,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "10742:8:35", + "src": "11345:8:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", @@ -8127,17 +9294,17 @@ "typeString": "bool" } }, - "id": 31846, + "id": 32250, "nodeType": "IfStatement", - "src": "10737:163:35", + "src": "11340:163:46", "trueBody": { - "id": 31845, + "id": 32249, "nodeType": "Block", - "src": "10752:148:35", + "src": "11355:148:46", "statements": [ { "expression": { - "id": 31837, + "id": 32241, "isConstant": false, "isLValue": false, "isPure": false, @@ -8145,40 +9312,40 @@ "leftHandSide": { "components": [ { - "id": 31830, + "id": 32234, "name": "totalFeeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31818, - "src": "10767:14:35", + "referencedDeclaration": 32222, + "src": "11370:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31831, + "id": 32235, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31825, - "src": "10783:13:35", + "referencedDeclaration": 32229, + "src": "11386:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } } ], - "id": 31832, + "id": 32236, "isConstant": false, "isInlineArray": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "TupleExpression", - "src": "10766:31:35", + "src": "11369:31:46", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "tuple(uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, @@ -8187,26 +9354,26 @@ "rightHandSide": { "arguments": [ { - "id": 31834, + "id": 32238, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31798, - "src": "10815:9:35", + "referencedDeclaration": 32202, + "src": "11418:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31835, + "id": 32239, "name": "serviceFee", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31804, - "src": "10826:10:35", + "referencedDeclaration": 32208, + "src": "11429:10:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } } @@ -8218,22 +9385,22 @@ "typeString": "uint256" }, { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams memory[] memory" } ], - "id": 31833, + "id": 32237, "name": "_calculateFees", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31710, - "src": "10800:14:35", + "referencedDeclaration": 32114, + "src": "11403:14:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr_$returns$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "function (uint256,struct ISecondaryFee.ServiceFeeParams memory[] memory) pure returns (uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "id": 31836, + "id": 32240, "isConstant": false, "isLValue": false, "isPure": false, @@ -8242,37 +9409,37 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "10800:37:35", + "src": "11403:37:46", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$", "typeString": "tuple(uint256,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "src": "10766:71:35", + "src": "11369:71:46", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31838, + "id": 32242, "nodeType": "ExpressionStatement", - "src": "10766:71:35" + "src": "11369:71:46" }, { "expression": { - "id": 31843, + "id": 32247, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31839, + "id": 32243, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31798, - "src": "10851:9:35", + "referencedDeclaration": 32202, + "src": "11454:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8285,18 +9452,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31842, + "id": 32246, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31840, + "id": 32244, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31798, - "src": "10863:9:35", + "referencedDeclaration": 32202, + "src": "11466:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8305,32 +9472,32 @@ "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { - "id": 31841, + "id": 32245, "name": "totalFeeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31818, - "src": "10875:14:35", + "referencedDeclaration": 32222, + "src": "11478:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "10863:26:35", + "src": "11466:26:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "10851:38:35", + "src": "11454:38:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 31844, + "id": 32248, "nodeType": "ExpressionStatement", - "src": "10851:38:35" + "src": "11454:38:46" } ] } @@ -8341,18 +9508,18 @@ "typeIdentifier": "t_address", "typeString": "address" }, - "id": 31852, + "id": 32256, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31847, + "id": 32251, "name": "swapRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31800, - "src": "10914:13:35", + "referencedDeclaration": 32204, + "src": "11517:13:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -8363,14 +9530,14 @@ "rightExpression": { "arguments": [ { - "id": 31850, + "id": 32254, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "10939:4:35", + "src": "11542:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -8378,30 +9545,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31849, + "id": 32253, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "10931:7:35", + "src": "11534:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31848, + "id": 32252, "name": "address", "nodeType": "ElementaryTypeName", - "src": "10931:7:35", + "src": "11534:7:46", "typeDescriptions": {} } }, - "id": 31851, + "id": 32255, "isConstant": false, "isLValue": false, "isPure": false, @@ -8410,41 +9577,41 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "10931:13:35", + "src": "11534:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "10914:30:35", + "src": "11517:30:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31861, + "id": 32265, "nodeType": "IfStatement", - "src": "10910:178:35", + "src": "11513:178:46", "trueBody": { - "id": 31860, + "id": 32264, "nodeType": "Block", - "src": "10946:142:35", + "src": "11549:142:46", "statements": [ { "expression": { - "id": 31858, + "id": 32262, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { - "id": 31853, + "id": 32257, "name": "swapRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31800, - "src": "11048:13:35", + "referencedDeclaration": 32204, + "src": "11651:13:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -8455,14 +9622,14 @@ "rightHandSide": { "arguments": [ { - "id": 31856, + "id": 32260, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "11072:4:35", + "src": "11675:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -8470,30 +9637,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31855, + "id": 32259, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "11064:7:35", + "src": "11667:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31854, + "id": 32258, "name": "address", "nodeType": "ElementaryTypeName", - "src": "11064:7:35", + "src": "11667:7:46", "typeDescriptions": {} } }, - "id": 31857, + "id": 32261, "isConstant": false, "isLValue": false, "isPure": false, @@ -8502,22 +9669,22 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "11064:13:35", + "src": "11667:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "11048:29:35", + "src": "11651:29:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 31859, + "id": 32263, "nodeType": "ExpressionStatement", - "src": "11048:29:35" + "src": "11651:29:46" } ] } @@ -8526,24 +9693,24 @@ "expression": { "arguments": [ { - "id": 31863, + "id": 32267, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31794, - "src": "11114:7:35", + "referencedDeclaration": 32198, + "src": "11717:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31864, + "id": 32268, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31796, - "src": "11123:8:35", + "referencedDeclaration": 32200, + "src": "11726:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8561,18 +9728,18 @@ "typeString": "uint256" } ], - "id": 31862, + "id": 32266, "name": "_ensureApproved", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32119, - "src": "11098:15:35", + "referencedDeclaration": 32523, + "src": "11701:15:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,uint256)" } }, - "id": 31865, + "id": 32269, "isConstant": false, "isLValue": false, "isPure": false, @@ -8581,42 +9748,42 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "11098:34:35", + "src": "11701:34:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31866, + "id": 32270, "nodeType": "ExpressionStatement", - "src": "11098:34:35" + "src": "11701:34:46" }, { "expression": { "arguments": [ { "expression": { - "id": 31871, + "id": 32275, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "11346:3:35", + "src": "11949:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31872, + "id": 32276, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "11350:6:35", + "memberLocation": "11953:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "11346:10:35", + "src": "11949:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -8625,14 +9792,14 @@ { "arguments": [ { - "id": 31875, + "id": 32279, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "11366:4:35", + "src": "11969:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -8640,30 +9807,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31874, + "id": 32278, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "11358:7:35", + "src": "11961:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31873, + "id": 32277, "name": "address", "nodeType": "ElementaryTypeName", - "src": "11358:7:35", + "src": "11961:7:46", "typeDescriptions": {} } }, - "id": 31876, + "id": 32280, "isConstant": false, "isLValue": false, "isPure": false, @@ -8672,7 +9839,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "11358:13:35", + "src": "11961:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -8680,12 +9847,12 @@ } }, { - "id": 31877, + "id": 32281, "name": "amountIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31796, - "src": "11373:8:35", + "referencedDeclaration": 32200, + "src": "11976:8:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8710,12 +9877,12 @@ "expression": { "arguments": [ { - "id": 31868, + "id": 32272, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31794, - "src": "11324:7:35", + "referencedDeclaration": 32198, + "src": "11927:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -8729,18 +9896,18 @@ "typeString": "address" } ], - "id": 31867, + "id": 32271, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "11317:6:35", + "src": "11920:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31869, + "id": 32273, "isConstant": false, "isLValue": false, "isPure": false, @@ -8749,29 +9916,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "11317:15:35", + "src": "11920:15:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31870, + "id": 32274, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "11333:12:35", + "memberLocation": "11936:12:46", "memberName": "transferFrom", "nodeType": "MemberAccess", "referencedDeclaration": 30214, - "src": "11317:28:35", + "src": "11920:28:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,address,uint256) external returns (bool)" } }, - "id": 31878, + "id": 32282, "isConstant": false, "isLValue": false, "isPure": false, @@ -8780,113 +9947,113 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "11317:65:35", + "src": "11920:65:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31879, + "id": 32283, "nodeType": "ExpressionStatement", - "src": "11317:65:35" + "src": "11920:65:46" }, { "expression": { "components": [ { - "id": 31880, + "id": 32284, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31798, - "src": "11401:9:35", + "referencedDeclaration": 32202, + "src": "12004:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 31881, + "id": 32285, "name": "swapRecipient", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31800, - "src": "11412:13:35", + "referencedDeclaration": 32204, + "src": "12015:13:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31882, + "id": 32286, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31825, - "src": "11427:13:35", + "referencedDeclaration": 32229, + "src": "12030:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, { - "id": 31883, + "id": 32287, "name": "totalFeeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31818, - "src": "11442:14:35", + "referencedDeclaration": 32222, + "src": "12045:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], - "id": 31884, + "id": 32288, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", - "src": "11400:57:35", + "src": "12003:57:46", "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", + "typeIdentifier": "t_tuple$_t_uint256_$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$_t_uint256_$", "typeString": "tuple(uint256,address,struct SecondaryFee.FeeRecipient memory[] memory,uint256)" } }, - "functionReturnParameters": 31816, - "id": 31885, + "functionReturnParameters": 32220, + "id": 32289, "nodeType": "Return", - "src": "11393:64:35" + "src": "11996:64:46" } ] }, "documentation": { - "id": 31792, + "id": 32196, "nodeType": "StructuredDocumentation", - "src": "9670:713:35", + "src": "10273:713:46", "text": " @notice Private function for the fee logic of `exactOutputSingleWithServiceFee` and `exactOutputWithServiceFee`.\n @param tokenIn The token to swap from.\n @param amountIn The maximum amount of `tokenIn` to swap.\n @param amountOut The fixed amountOut of `tokenOut` to receive.\n @param swapRecipient The address to receive the swap result.\n @param serviceFee The details of the service fee(s).\n @return uint256 The amount of `tokenIn` to swap, after subtracting the fee.\n @return address The address to receive the swap result.\n @return FeeRecipient[] The fee recipients and their respective fee amounts.\n @return uint256 The total fee amount." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_exactOutputInternal", - "nameLocation": "10397:20:35", + "nameLocation": "11000:20:46", "parameters": { - "id": 31805, + "id": 32209, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31794, + "id": 32198, "mutability": "mutable", "name": "tokenIn", - "nameLocation": "10435:7:35", + "nameLocation": "11038:7:46", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10427:15:35", + "scope": 32291, + "src": "11030:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -8894,10 +10061,10 @@ "typeString": "address" }, "typeName": { - "id": 31793, + "id": 32197, "name": "address", "nodeType": "ElementaryTypeName", - "src": "10427:7:35", + "src": "11030:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -8908,13 +10075,13 @@ }, { "constant": false, - "id": 31796, + "id": 32200, "mutability": "mutable", "name": "amountIn", - "nameLocation": "10460:8:35", + "nameLocation": "11063:8:46", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10452:16:35", + "scope": 32291, + "src": "11055:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -8922,10 +10089,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31795, + "id": 32199, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "10452:7:35", + "src": "11055:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8935,13 +10102,13 @@ }, { "constant": false, - "id": 31798, + "id": 32202, "mutability": "mutable", "name": "amountOut", - "nameLocation": "10486:9:35", + "nameLocation": "11089:9:46", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10478:17:35", + "scope": 32291, + "src": "11081:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -8949,10 +10116,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31797, + "id": 32201, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "10478:7:35", + "src": "11081:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -8962,13 +10129,13 @@ }, { "constant": false, - "id": 31800, + "id": 32204, "mutability": "mutable", "name": "swapRecipient", - "nameLocation": "10513:13:35", + "nameLocation": "11116:13:46", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10505:21:35", + "scope": 32291, + "src": "11108:21:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -8976,10 +10143,10 @@ "typeString": "address" }, "typeName": { - "id": 31799, + "id": 32203, "name": "address", "nodeType": "ElementaryTypeName", - "src": "10505:7:35", + "src": "11108:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -8990,64 +10157,66 @@ }, { "constant": false, - "id": 31804, + "id": 32208, "mutability": "mutable", "name": "serviceFee", - "nameLocation": "10562:10:35", + "nameLocation": "11165:10:46", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10536:36:35", + "scope": 32291, + "src": "11139:36:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_memory_ptr_$dyn_memory_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" }, "typeName": { "baseType": { - "id": 31802, + "id": 32206, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31801, + "id": 32205, "name": "ServiceFeeParams", - "nameLocations": ["10536:16:35"], + "nameLocations": [ + "11139:16:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32149, - "src": "10536:16:35" + "referencedDeclaration": 32553, + "src": "11139:16:46" }, - "referencedDeclaration": 32149, - "src": "10536:16:35", + "referencedDeclaration": 32553, + "src": "11139:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_ServiceFeeParams_$32149_storage_ptr", + "typeIdentifier": "t_struct$_ServiceFeeParams_$32553_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams" } }, - "id": 31803, + "id": 32207, "nodeType": "ArrayTypeName", - "src": "10536:18:35", + "src": "11139:18:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32149_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_ServiceFeeParams_$32553_storage_$dyn_storage_ptr", "typeString": "struct ISecondaryFee.ServiceFeeParams[]" } }, "visibility": "internal" } ], - "src": "10417:161:35" + "src": "11020:161:46" }, "returnParameters": { - "id": 31816, + "id": 32220, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31807, + "id": 32211, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10596:7:35", + "scope": 32291, + "src": "11199:7:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9055,10 +10224,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31806, + "id": 32210, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "10596:7:35", + "src": "11199:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9068,13 +10237,13 @@ }, { "constant": false, - "id": 31809, + "id": 32213, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10605:7:35", + "scope": 32291, + "src": "11208:7:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9082,10 +10251,10 @@ "typeString": "address" }, "typeName": { - "id": 31808, + "id": 32212, "name": "address", "nodeType": "ElementaryTypeName", - "src": "10605:7:35", + "src": "11208:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -9096,43 +10265,45 @@ }, { "constant": false, - "id": 31813, + "id": 32217, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10614:21:35", + "scope": 32291, + "src": "11217:21:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31811, + "id": 32215, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31810, + "id": 32214, "name": "FeeRecipient", - "nameLocations": ["10614:12:35"], + "nameLocations": [ + "11217:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "10614:12:35" + "referencedDeclaration": 31620, + "src": "11217:12:46" }, - "referencedDeclaration": 31289, - "src": "10614:12:35", + "referencedDeclaration": 31620, + "src": "11217:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31812, + "id": 32216, "nodeType": "ArrayTypeName", - "src": "10614:14:35", + "src": "11217:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, @@ -9140,13 +10311,13 @@ }, { "constant": false, - "id": 31815, + "id": 32219, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", - "scope": 31887, - "src": "10637:7:35", + "scope": 32291, + "src": "11240:7:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9154,10 +10325,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31814, + "id": 32218, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "10637:7:35", + "src": "11240:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9166,27 +10337,27 @@ "visibility": "internal" } ], - "src": "10595:50:35" + "src": "11198:50:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "private" }, { - "id": 31972, + "id": 32376, "nodeType": "FunctionDefinition", - "src": "11996:1257:35", + "src": "12599:1257:46", "nodes": [], "body": { - "id": 31971, + "id": 32375, "nodeType": "Block", - "src": "12237:1016:35", + "src": "12840:1016:46", "nodes": [], "statements": [ { "condition": { - "id": 31907, + "id": 32311, "isConstant": false, "isLValue": false, "isPure": false, @@ -9194,23 +10365,23 @@ "nodeType": "UnaryOperation", "operator": "!", "prefix": true, - "src": "12297:9:35", + "src": "12900:9:46", "subExpression": { "arguments": [], "expression": { "argumentTypes": [], - "id": 31905, + "id": 32309, "name": "paused", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 29494, - "src": "12298:6:35", + "src": "12901:6:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, - "id": 31906, + "id": 32310, "isConstant": false, "isLValue": false, "isPure": false, @@ -9219,7 +10390,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12298:8:35", + "src": "12901:8:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", @@ -9231,38 +10402,38 @@ "typeString": "bool" } }, - "id": 31914, + "id": 32318, "nodeType": "IfStatement", - "src": "12293:101:35", + "src": "12896:101:46", "trueBody": { - "id": 31913, + "id": 32317, "nodeType": "Block", - "src": "12308:86:35", + "src": "12911:86:46", "statements": [ { "expression": { "arguments": [ { - "id": 31909, + "id": 32313, "name": "tokenOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31894, - "src": "12359:8:35", + "referencedDeclaration": 32298, + "src": "12962:8:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31910, + "id": 32314, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31902, - "src": "12369:13:35", + "referencedDeclaration": 32306, + "src": "12972:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } } @@ -9274,22 +10445,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } ], - "id": 31908, + "id": 32312, "name": "_transferFeesToRecipientsExactOutput", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32078, - "src": "12322:36:35", + "referencedDeclaration": 32482, + "src": "12925:36:46", "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr_$returns$__$", + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr_$returns$__$", "typeString": "function (address,struct SecondaryFee.FeeRecipient memory[] memory)" } }, - "id": 31911, + "id": 32315, "isConstant": false, "isLValue": false, "isPure": false, @@ -9298,32 +10469,34 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12322:61:35", + "src": "12925:61:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31912, + "id": 32316, "nodeType": "ExpressionStatement", - "src": "12322:61:35" + "src": "12925:61:46" } ] } }, { - "assignments": [31916], + "assignments": [ + 32320 + ], "declarations": [ { "constant": false, - "id": 31916, + "id": 32320, "mutability": "mutable", "name": "tokenOutBalance", - "nameLocation": "12412:15:35", + "nameLocation": "13015:15:46", "nodeType": "VariableDeclaration", - "scope": 31971, - "src": "12404:23:35", + "scope": 32375, + "src": "13007:23:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9331,10 +10504,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31915, + "id": 32319, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "12404:7:35", + "src": "13007:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9343,20 +10516,20 @@ "visibility": "internal" } ], - "id": 31926, + "id": 32330, "initialValue": { "arguments": [ { "arguments": [ { - "id": 31923, + "id": 32327, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "12465:4:35", + "src": "13068:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -9364,30 +10537,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31922, + "id": 32326, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "12457:7:35", + "src": "13060:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31921, + "id": 32325, "name": "address", "nodeType": "ElementaryTypeName", - "src": "12457:7:35", + "src": "13060:7:46", "typeDescriptions": {} } }, - "id": 31924, + "id": 32328, "isConstant": false, "isLValue": false, "isPure": false, @@ -9396,7 +10569,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12457:13:35", + "src": "13060:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -9414,12 +10587,12 @@ "expression": { "arguments": [ { - "id": 31918, + "id": 32322, "name": "tokenOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31894, - "src": "12437:8:35", + "referencedDeclaration": 32298, + "src": "13040:8:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -9433,18 +10606,18 @@ "typeString": "address" } ], - "id": 31917, + "id": 32321, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "12430:6:35", + "src": "13033:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31919, + "id": 32323, "isConstant": false, "isLValue": false, "isPure": false, @@ -9453,29 +10626,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12430:16:35", + "src": "13033:16:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31920, + "id": 32324, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "12447:9:35", + "memberLocation": "13050:9:46", "memberName": "balanceOf", "nodeType": "MemberAccess", "referencedDeclaration": 30172, - "src": "12430:26:35", + "src": "13033:26:46", "typeDescriptions": { "typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$", "typeString": "function (address) view external returns (uint256)" } }, - "id": 31925, + "id": 32329, "isConstant": false, "isLValue": false, "isPure": false, @@ -9484,7 +10657,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12430:41:35", + "src": "13033:41:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", @@ -9492,7 +10665,7 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "12404:67:35" + "src": "13007:67:46" }, { "expression": { @@ -9502,18 +10675,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31932, + "id": 32336, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31928, + "id": 32332, "name": "tokenOutBalance", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31916, - "src": "12758:15:35", + "referencedDeclaration": 32320, + "src": "13361:15:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9526,18 +10699,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31931, + "id": 32335, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31929, + "id": 32333, "name": "amountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31896, - "src": "12777:9:35", + "referencedDeclaration": 32300, + "src": "13380:9:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9546,24 +10719,24 @@ "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { - "id": 31930, + "id": 32334, "name": "totalFeeAmount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31898, - "src": "12789:14:35", + "referencedDeclaration": 32302, + "src": "13392:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "12777:26:35", + "src": "13380:26:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "12758:45:35", + "src": "13361:45:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -9571,14 +10744,14 @@ }, { "hexValue": "696e636f72726563742066656520616d6f756e74206469737472696275746564", - "id": 31933, + "id": 32337, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "12805:34:35", + "src": "13408:34:46", "typeDescriptions": { "typeIdentifier": "t_stringliteral_31ab3b9b0200451acd9f1b5736d817cfb577ef0f518cb5cbe3c66fa51e529333", "typeString": "literal_string \"incorrect fee amount distributed\"" @@ -9597,18 +10770,21 @@ "typeString": "literal_string \"incorrect fee amount distributed\"" } ], - "id": 31927, + "id": 32331, "name": "require", "nodeType": "Identifier", - "overloadedDeclarations": [-18, -18], + "overloadedDeclarations": [ + -18, + -18 + ], "referencedDeclaration": -18, - "src": "12750:7:35", + "src": "13353:7:46", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 31934, + "id": 32338, "isConstant": false, "isLValue": false, "isPure": false, @@ -9617,54 +10793,54 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12750:90:35", + "src": "13353:90:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 31935, + "id": 32339, "nodeType": "ExpressionStatement", - "src": "12750:90:35" + "src": "13353:90:46" }, { "expression": { "arguments": [ { "expression": { - "id": 31940, + "id": 32344, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "12939:3:35", + "src": "13542:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31941, + "id": 32345, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "12943:6:35", + "memberLocation": "13546:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "12939:10:35", + "src": "13542:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31942, + "id": 32346, "name": "originalAmountOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31890, - "src": "12951:17:35", + "referencedDeclaration": 32294, + "src": "13554:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9685,12 +10861,12 @@ "expression": { "arguments": [ { - "id": 31937, + "id": 32341, "name": "tokenOut", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31894, - "src": "12920:8:35", + "referencedDeclaration": 32298, + "src": "13523:8:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -9704,18 +10880,18 @@ "typeString": "address" } ], - "id": 31936, + "id": 32340, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "12913:6:35", + "src": "13516:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31938, + "id": 32342, "isConstant": false, "isLValue": false, "isPure": false, @@ -9724,29 +10900,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12913:16:35", + "src": "13516:16:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31939, + "id": 32343, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "12930:8:35", + "memberLocation": "13533:8:46", "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": 30182, - "src": "12913:25:35", + "src": "13516:25:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,uint256) external returns (bool)" } }, - "id": 31943, + "id": 32347, "isConstant": false, "isLValue": false, "isPure": false, @@ -9755,29 +10931,31 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "12913:56:35", + "src": "13516:56:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31944, + "id": 32348, "nodeType": "ExpressionStatement", - "src": "12913:56:35" + "src": "13516:56:46" }, { - "assignments": [31946], + "assignments": [ + 32350 + ], "declarations": [ { "constant": false, - "id": 31946, + "id": 32350, "mutability": "mutable", "name": "remainingTokenInBalance", - "nameLocation": "12988:23:35", + "nameLocation": "13591:23:46", "nodeType": "VariableDeclaration", - "scope": 31971, - "src": "12980:31:35", + "scope": 32375, + "src": "13583:31:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -9785,10 +10963,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31945, + "id": 32349, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "12980:7:35", + "src": "13583:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9797,20 +10975,20 @@ "visibility": "internal" } ], - "id": 31956, + "id": 32360, "initialValue": { "arguments": [ { "arguments": [ { - "id": 31953, + "id": 32357, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "13048:4:35", + "src": "13651:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -9818,30 +10996,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 31952, + "id": 32356, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "13040:7:35", + "src": "13643:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 31951, + "id": 32355, "name": "address", "nodeType": "ElementaryTypeName", - "src": "13040:7:35", + "src": "13643:7:46", "typeDescriptions": {} } }, - "id": 31954, + "id": 32358, "isConstant": false, "isLValue": false, "isPure": false, @@ -9850,7 +11028,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13040:13:35", + "src": "13643:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -9868,12 +11046,12 @@ "expression": { "arguments": [ { - "id": 31948, + "id": 32352, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31892, - "src": "13021:7:35", + "referencedDeclaration": 32296, + "src": "13624:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -9887,18 +11065,18 @@ "typeString": "address" } ], - "id": 31947, + "id": 32351, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "13014:6:35", + "src": "13617:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31949, + "id": 32353, "isConstant": false, "isLValue": false, "isPure": false, @@ -9907,29 +11085,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13014:15:35", + "src": "13617:15:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31950, + "id": 32354, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13030:9:35", + "memberLocation": "13633:9:46", "memberName": "balanceOf", "nodeType": "MemberAccess", "referencedDeclaration": 30172, - "src": "13014:25:35", + "src": "13617:25:46", "typeDescriptions": { "typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$", "typeString": "function (address) view external returns (uint256)" } }, - "id": 31955, + "id": 32359, "isConstant": false, "isLValue": false, "isPure": false, @@ -9938,7 +11116,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13014:40:35", + "src": "13617:40:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", @@ -9946,7 +11124,7 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "12980:74:35" + "src": "13583:74:46" }, { "condition": { @@ -9954,18 +11132,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31959, + "id": 32363, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31957, + "id": 32361, "name": "remainingTokenInBalance", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31946, - "src": "13068:23:35", + "referencedDeclaration": 32350, + "src": "13671:23:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -9975,71 +11153,71 @@ "operator": ">", "rightExpression": { "hexValue": "30", - "id": 31958, + "id": 32362, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "13094:1:35", + "src": "13697:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, - "src": "13068:27:35", + "src": "13671:27:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31970, + "id": 32374, "nodeType": "IfStatement", - "src": "13064:183:35", + "src": "13667:183:46", "trueBody": { - "id": 31969, + "id": 32373, "nodeType": "Block", - "src": "13097:150:35", + "src": "13700:150:46", "statements": [ { "expression": { "arguments": [ { "expression": { - "id": 31964, + "id": 32368, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "13200:3:35", + "src": "13803:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31965, + "id": 32369, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13204:6:35", + "memberLocation": "13807:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "13200:10:35", + "src": "13803:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { - "id": 31966, + "id": 32370, "name": "remainingTokenInBalance", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31946, - "src": "13212:23:35", + "referencedDeclaration": 32350, + "src": "13815:23:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10060,12 +11238,12 @@ "expression": { "arguments": [ { - "id": 31961, + "id": 32365, "name": "tokenIn", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31892, - "src": "13182:7:35", + "referencedDeclaration": 32296, + "src": "13785:7:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10079,18 +11257,18 @@ "typeString": "address" } ], - "id": 31960, + "id": 32364, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "13175:6:35", + "src": "13778:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31962, + "id": 32366, "isConstant": false, "isLValue": false, "isPure": false, @@ -10099,29 +11277,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13175:15:35", + "src": "13778:15:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31963, + "id": 32367, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13191:8:35", + "memberLocation": "13794:8:46", "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": 30182, - "src": "13175:24:35", + "src": "13778:24:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,uint256) external returns (bool)" } }, - "id": 31967, + "id": 32371, "isConstant": false, "isLValue": false, "isPure": false, @@ -10130,16 +11308,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13175:61:35", + "src": "13778:61:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 31968, + "id": 32372, "nodeType": "ExpressionStatement", - "src": "13175:61:35" + "src": "13778:61:46" } ] } @@ -10147,29 +11325,29 @@ ] }, "documentation": { - "id": 31888, + "id": 32292, "nodeType": "StructuredDocumentation", - "src": "11470:521:35", + "src": "12073:521:46", "text": " @notice Transfers the swap result, as well as any remaining amountIn, to the original recipient. Transfers the fees to the fee recipients.\n @param originalAmountOut The original amountOut, before the fee was taken.\n @param tokenIn The token to swap from.\n @param tokenOut The token to swap to.\n @param amountOut The amount of `tokenOut` received.\n @param totalFeeAmount The total fee amount.\n @param feeRecipients The fee recipients and their respective fee amounts." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferFundsToRecipients", - "nameLocation": "12005:26:35", + "nameLocation": "12608:26:46", "parameters": { - "id": 31903, + "id": 32307, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31890, + "id": 32294, "mutability": "mutable", "name": "originalAmountOut", - "nameLocation": "12049:17:35", + "nameLocation": "12652:17:46", "nodeType": "VariableDeclaration", - "scope": 31972, - "src": "12041:25:35", + "scope": 32376, + "src": "12644:25:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10177,10 +11355,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31889, + "id": 32293, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "12041:7:35", + "src": "12644:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10190,13 +11368,13 @@ }, { "constant": false, - "id": 31892, + "id": 32296, "mutability": "mutable", "name": "tokenIn", - "nameLocation": "12084:7:35", + "nameLocation": "12687:7:46", "nodeType": "VariableDeclaration", - "scope": 31972, - "src": "12076:15:35", + "scope": 32376, + "src": "12679:15:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10204,10 +11382,10 @@ "typeString": "address" }, "typeName": { - "id": 31891, + "id": 32295, "name": "address", "nodeType": "ElementaryTypeName", - "src": "12076:7:35", + "src": "12679:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -10218,13 +11396,13 @@ }, { "constant": false, - "id": 31894, + "id": 32298, "mutability": "mutable", "name": "tokenOut", - "nameLocation": "12109:8:35", + "nameLocation": "12712:8:46", "nodeType": "VariableDeclaration", - "scope": 31972, - "src": "12101:16:35", + "scope": 32376, + "src": "12704:16:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10232,10 +11410,10 @@ "typeString": "address" }, "typeName": { - "id": 31893, + "id": 32297, "name": "address", "nodeType": "ElementaryTypeName", - "src": "12101:7:35", + "src": "12704:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -10246,13 +11424,13 @@ }, { "constant": false, - "id": 31896, + "id": 32300, "mutability": "mutable", "name": "amountOut", - "nameLocation": "12135:9:35", + "nameLocation": "12738:9:46", "nodeType": "VariableDeclaration", - "scope": 31972, - "src": "12127:17:35", + "scope": 32376, + "src": "12730:17:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10260,10 +11438,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31895, + "id": 32299, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "12127:7:35", + "src": "12730:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10273,13 +11451,13 @@ }, { "constant": false, - "id": 31898, + "id": 32302, "mutability": "mutable", "name": "totalFeeAmount", - "nameLocation": "12162:14:35", + "nameLocation": "12765:14:46", "nodeType": "VariableDeclaration", - "scope": 31972, - "src": "12154:22:35", + "scope": 32376, + "src": "12757:22:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10287,10 +11465,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31897, + "id": 32301, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "12154:7:35", + "src": "12757:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10300,104 +11478,106 @@ }, { "constant": false, - "id": 31902, + "id": 32306, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "12208:13:35", + "nameLocation": "12811:13:46", "nodeType": "VariableDeclaration", - "scope": 31972, - "src": "12186:35:35", + "scope": 32376, + "src": "12789:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31900, + "id": 32304, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31899, + "id": 32303, "name": "FeeRecipient", - "nameLocations": ["12186:12:35"], + "nameLocations": [ + "12789:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "12186:12:35" + "referencedDeclaration": 31620, + "src": "12789:12:46" }, - "referencedDeclaration": 31289, - "src": "12186:12:35", + "referencedDeclaration": 31620, + "src": "12789:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31901, + "id": 32305, "nodeType": "ArrayTypeName", - "src": "12186:14:35", + "src": "12789:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "src": "12031:196:35" + "src": "12634:196:46" }, "returnParameters": { - "id": 31904, + "id": 32308, "nodeType": "ParameterList", "parameters": [], - "src": "12237:0:35" + "src": "12840:0:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { - "id": 32026, + "id": 32430, "nodeType": "FunctionDefinition", - "src": "13351:388:35", + "src": "13954:388:46", "nodes": [], "body": { - "id": 32025, + "id": 32429, "nodeType": "Block", - "src": "13457:282:35", + "src": "14060:282:46", "nodes": [], "statements": [ { "body": { - "id": 32023, + "id": 32427, "nodeType": "Block", - "src": "13518:215:35", + "src": "14121:215:46", "statements": [ { "expression": { "arguments": [ { "expression": { - "id": 31997, + "id": 32401, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "13559:3:35", + "src": "14162:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 31998, + "id": 32402, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13563:6:35", + "memberLocation": "14166:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "13559:10:35", + "src": "14162:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10406,25 +11586,25 @@ { "expression": { "baseExpression": { - "id": 31999, + "id": 32403, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31979, - "src": "13571:13:35", + "referencedDeclaration": 32383, + "src": "14174:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32001, + "id": 32405, "indexExpression": { - "id": 32000, + "id": 32404, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31983, - "src": "13585:1:35", + "referencedDeclaration": 32387, + "src": "14188:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10435,22 +11615,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "13571:16:35", + "src": "14174:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32002, + "id": 32406, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "13588:9:35", + "memberLocation": "14191:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 31286, - "src": "13571:26:35", + "referencedDeclaration": 31617, + "src": "14174:26:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10459,25 +11639,25 @@ { "expression": { "baseExpression": { - "id": 32003, + "id": 32407, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31979, - "src": "13599:13:35", + "referencedDeclaration": 32383, + "src": "14202:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32005, + "id": 32409, "indexExpression": { - "id": 32004, + "id": 32408, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31983, - "src": "13613:1:35", + "referencedDeclaration": 32387, + "src": "14216:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10488,22 +11668,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "13599:16:35", + "src": "14202:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32006, + "id": 32410, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "13616:6:35", + "memberLocation": "14219:6:46", "memberName": "amount", "nodeType": "MemberAccess", - "referencedDeclaration": 31288, - "src": "13599:23:35", + "referencedDeclaration": 31619, + "src": "14202:23:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10528,12 +11708,12 @@ "expression": { "arguments": [ { - "id": 31994, + "id": 32398, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31975, - "src": "13539:5:35", + "referencedDeclaration": 32379, + "src": "14142:5:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10547,18 +11727,18 @@ "typeString": "address" } ], - "id": 31993, + "id": 32397, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "13532:6:35", + "src": "14135:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 31995, + "id": 32399, "isConstant": false, "isLValue": false, "isPure": false, @@ -10567,29 +11747,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13532:13:35", + "src": "14135:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 31996, + "id": 32400, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13546:12:35", + "memberLocation": "14149:12:46", "memberName": "transferFrom", "nodeType": "MemberAccess", "referencedDeclaration": 30214, - "src": "13532:26:35", + "src": "14135:26:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,address,uint256) external returns (bool)" } }, - "id": 32007, + "id": 32411, "isConstant": false, "isLValue": false, "isPure": false, @@ -10598,27 +11778,27 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13532:91:35", + "src": "14135:91:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 32008, + "id": 32412, "nodeType": "ExpressionStatement", - "src": "13532:91:35" + "src": "14135:91:46" }, { "eventCall": { "arguments": [ { - "id": 32010, + "id": 32414, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31975, - "src": "13651:5:35", + "referencedDeclaration": 32379, + "src": "14254:5:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10626,26 +11806,26 @@ }, { "expression": { - "id": 32011, + "id": 32415, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "13658:3:35", + "src": "14261:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 32012, + "id": 32416, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13662:6:35", + "memberLocation": "14265:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "13658:10:35", + "src": "14261:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10654,25 +11834,25 @@ { "expression": { "baseExpression": { - "id": 32013, + "id": 32417, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31979, - "src": "13670:13:35", + "referencedDeclaration": 32383, + "src": "14273:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32015, + "id": 32419, "indexExpression": { - "id": 32014, + "id": 32418, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31983, - "src": "13684:1:35", + "referencedDeclaration": 32387, + "src": "14287:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10683,22 +11863,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "13670:16:35", + "src": "14273:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32016, + "id": 32420, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "13687:9:35", + "memberLocation": "14290:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 31286, - "src": "13670:26:35", + "referencedDeclaration": 31617, + "src": "14273:26:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -10707,25 +11887,25 @@ { "expression": { "baseExpression": { - "id": 32017, + "id": 32421, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31979, - "src": "13698:13:35", + "referencedDeclaration": 32383, + "src": "14301:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32019, + "id": 32423, "indexExpression": { - "id": 32018, + "id": 32422, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31983, - "src": "13712:1:35", + "referencedDeclaration": 32387, + "src": "14315:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10736,22 +11916,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "13698:16:35", + "src": "14301:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32020, + "id": 32424, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "13715:6:35", + "memberLocation": "14318:6:46", "memberName": "amount", "nodeType": "MemberAccess", - "referencedDeclaration": 31288, - "src": "13698:23:35", + "referencedDeclaration": 31619, + "src": "14301:23:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10777,18 +11957,18 @@ "typeString": "uint256" } ], - "id": 32009, + "id": 32413, "name": "FeeTaken", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31284, - "src": "13642:8:35", + "referencedDeclaration": 31615, + "src": "14245:8:46", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,address,address,uint256)" } }, - "id": 32021, + "id": 32425, "isConstant": false, "isLValue": false, "isPure": false, @@ -10797,16 +11977,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "13642:80:35", + "src": "14245:80:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 32022, + "id": 32426, "nodeType": "EmitStatement", - "src": "13637:85:35" + "src": "14240:85:46" } ] }, @@ -10815,18 +11995,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 31989, + "id": 32393, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 31986, + "id": 32390, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31983, - "src": "13487:1:35", + "referencedDeclaration": 32387, + "src": "14090:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10836,50 +12016,52 @@ "operator": "<", "rightExpression": { "expression": { - "id": 31987, + "id": 32391, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31979, - "src": "13491:13:35", + "referencedDeclaration": 32383, + "src": "14094:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 31988, + "id": 32392, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13505:6:35", + "memberLocation": "14108:6:46", "memberName": "length", "nodeType": "MemberAccess", - "src": "13491:20:35", + "src": "14094:20:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "13487:24:35", + "src": "14090:24:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 32024, + "id": 32428, "initializationExpression": { - "assignments": [31983], + "assignments": [ + 32387 + ], "declarations": [ { "constant": false, - "id": 31983, + "id": 32387, "mutability": "mutable", "name": "i", - "nameLocation": "13480:1:35", + "nameLocation": "14083:1:46", "nodeType": "VariableDeclaration", - "scope": 32024, - "src": "13472:9:35", + "scope": 32428, + "src": "14075:9:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10887,10 +12069,10 @@ "typeString": "uint256" }, "typeName": { - "id": 31982, + "id": 32386, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "13472:7:35", + "src": "14075:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10899,17 +12081,17 @@ "visibility": "internal" } ], - "id": 31985, + "id": 32389, "initialValue": { "hexValue": "30", - "id": 31984, + "id": 32388, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "13484:1:35", + "src": "14087:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" @@ -10917,11 +12099,11 @@ "value": "0" }, "nodeType": "VariableDeclarationStatement", - "src": "13472:13:35" + "src": "14075:13:46" }, "loopExpression": { "expression": { - "id": 31991, + "id": 32395, "isConstant": false, "isLValue": false, "isPure": false, @@ -10929,14 +12111,14 @@ "nodeType": "UnaryOperation", "operator": "++", "prefix": false, - "src": "13513:3:35", + "src": "14116:3:46", "subExpression": { - "id": 31990, + "id": 32394, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31983, - "src": "13513:1:35", + "referencedDeclaration": 32387, + "src": "14116:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -10947,39 +12129,39 @@ "typeString": "uint256" } }, - "id": 31992, + "id": 32396, "nodeType": "ExpressionStatement", - "src": "13513:3:35" + "src": "14116:3:46" }, "nodeType": "ForStatement", - "src": "13467:266:35" + "src": "14070:266:46" } ] }, "documentation": { - "id": 31973, + "id": 32377, "nodeType": "StructuredDocumentation", - "src": "13259:87:35", + "src": "13862:87:46", "text": " @notice Transfers the fees to the fee recipients, from `msg.sender`." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferFeesToRecipientsExactInput", - "nameLocation": "13360:35:35", + "nameLocation": "13963:35:46", "parameters": { - "id": 31980, + "id": 32384, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 31975, + "id": 32379, "mutability": "mutable", "name": "token", - "nameLocation": "13404:5:35", + "nameLocation": "14007:5:46", "nodeType": "VariableDeclaration", - "scope": 32026, - "src": "13396:13:35", + "scope": 32430, + "src": "13999:13:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -10987,10 +12169,10 @@ "typeString": "address" }, "typeName": { - "id": 31974, + "id": 32378, "name": "address", "nodeType": "ElementaryTypeName", - "src": "13396:7:35", + "src": "13999:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -11001,78 +12183,80 @@ }, { "constant": false, - "id": 31979, + "id": 32383, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "13433:13:35", + "nameLocation": "14036:13:46", "nodeType": "VariableDeclaration", - "scope": 32026, - "src": "13411:35:35", + "scope": 32430, + "src": "14014:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 31977, + "id": 32381, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 31976, + "id": 32380, "name": "FeeRecipient", - "nameLocations": ["13411:12:35"], + "nameLocations": [ + "14014:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "13411:12:35" + "referencedDeclaration": 31620, + "src": "14014:12:46" }, - "referencedDeclaration": 31289, - "src": "13411:12:35", + "referencedDeclaration": 31620, + "src": "14014:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 31978, + "id": 32382, "nodeType": "ArrayTypeName", - "src": "13411:14:35", + "src": "14014:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "src": "13395:52:35" + "src": "13998:52:46" }, "returnParameters": { - "id": 31981, + "id": 32385, "nodeType": "ParameterList", "parameters": [], - "src": "13457:0:35" + "src": "14060:0:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { - "id": 32078, + "id": 32482, "nodeType": "FunctionDefinition", - "src": "13840:373:35", + "src": "14443:373:46", "nodes": [], "body": { - "id": 32077, + "id": 32481, "nodeType": "Block", - "src": "13947:266:35", + "src": "14550:266:46", "nodes": [], "statements": [ { "body": { - "id": 32075, + "id": 32479, "nodeType": "Block", - "src": "14008:199:35", + "src": "14611:199:46", "statements": [ { "expression": { @@ -11080,25 +12264,25 @@ { "expression": { "baseExpression": { - "id": 32051, + "id": 32455, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32033, - "src": "14045:13:35", + "referencedDeclaration": 32437, + "src": "14648:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32053, + "id": 32457, "indexExpression": { - "id": 32052, + "id": 32456, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32037, - "src": "14059:1:35", + "referencedDeclaration": 32441, + "src": "14662:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11109,22 +12293,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "14045:16:35", + "src": "14648:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32054, + "id": 32458, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "14062:9:35", + "memberLocation": "14665:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 31286, - "src": "14045:26:35", + "referencedDeclaration": 31617, + "src": "14648:26:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -11133,25 +12317,25 @@ { "expression": { "baseExpression": { - "id": 32055, + "id": 32459, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32033, - "src": "14073:13:35", + "referencedDeclaration": 32437, + "src": "14676:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32057, + "id": 32461, "indexExpression": { - "id": 32056, + "id": 32460, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32037, - "src": "14087:1:35", + "referencedDeclaration": 32441, + "src": "14690:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11162,22 +12346,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "14073:16:35", + "src": "14676:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32058, + "id": 32462, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "14090:6:35", + "memberLocation": "14693:6:46", "memberName": "amount", "nodeType": "MemberAccess", - "referencedDeclaration": 31288, - "src": "14073:23:35", + "referencedDeclaration": 31619, + "src": "14676:23:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11198,12 +12382,12 @@ "expression": { "arguments": [ { - "id": 32048, + "id": 32452, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32029, - "src": "14029:5:35", + "referencedDeclaration": 32433, + "src": "14632:5:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -11217,18 +12401,18 @@ "typeString": "address" } ], - "id": 32047, + "id": 32451, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "14022:6:35", + "src": "14625:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 32049, + "id": 32453, "isConstant": false, "isLValue": false, "isPure": false, @@ -11237,29 +12421,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14022:13:35", + "src": "14625:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 32050, + "id": 32454, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "14036:8:35", + "memberLocation": "14639:8:46", "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": 30182, - "src": "14022:22:35", + "src": "14625:22:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,uint256) external returns (bool)" } }, - "id": 32059, + "id": 32463, "isConstant": false, "isLValue": false, "isPure": false, @@ -11268,27 +12452,27 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14022:75:35", + "src": "14625:75:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 32060, + "id": 32464, "nodeType": "ExpressionStatement", - "src": "14022:75:35" + "src": "14625:75:46" }, { "eventCall": { "arguments": [ { - "id": 32062, + "id": 32466, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32029, - "src": "14125:5:35", + "referencedDeclaration": 32433, + "src": "14728:5:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -11296,26 +12480,26 @@ }, { "expression": { - "id": 32063, + "id": 32467, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "14132:3:35", + "src": "14735:3:46", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 32064, + "id": 32468, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "14136:6:35", + "memberLocation": "14739:6:46", "memberName": "sender", "nodeType": "MemberAccess", - "src": "14132:10:35", + "src": "14735:10:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -11324,25 +12508,25 @@ { "expression": { "baseExpression": { - "id": 32065, + "id": 32469, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32033, - "src": "14144:13:35", + "referencedDeclaration": 32437, + "src": "14747:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32067, + "id": 32471, "indexExpression": { - "id": 32066, + "id": 32470, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32037, - "src": "14158:1:35", + "referencedDeclaration": 32441, + "src": "14761:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11353,22 +12537,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "14144:16:35", + "src": "14747:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32068, + "id": 32472, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "14161:9:35", + "memberLocation": "14764:9:46", "memberName": "recipient", "nodeType": "MemberAccess", - "referencedDeclaration": 31286, - "src": "14144:26:35", + "referencedDeclaration": 31617, + "src": "14747:26:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -11377,25 +12561,25 @@ { "expression": { "baseExpression": { - "id": 32069, + "id": 32473, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32033, - "src": "14172:13:35", + "referencedDeclaration": 32437, + "src": "14775:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32071, + "id": 32475, "indexExpression": { - "id": 32070, + "id": 32474, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32037, - "src": "14186:1:35", + "referencedDeclaration": 32441, + "src": "14789:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11406,22 +12590,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "14172:16:35", + "src": "14775:16:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_memory_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory" } }, - "id": 32072, + "id": 32476, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "14189:6:35", + "memberLocation": "14792:6:46", "memberName": "amount", "nodeType": "MemberAccess", - "referencedDeclaration": 31288, - "src": "14172:23:35", + "referencedDeclaration": 31619, + "src": "14775:23:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11447,18 +12631,18 @@ "typeString": "uint256" } ], - "id": 32061, + "id": 32465, "name": "FeeTaken", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31284, - "src": "14116:8:35", + "referencedDeclaration": 31615, + "src": "14719:8:46", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,address,address,uint256)" } }, - "id": 32073, + "id": 32477, "isConstant": false, "isLValue": false, "isPure": false, @@ -11467,16 +12651,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14116:80:35", + "src": "14719:80:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 32074, + "id": 32478, "nodeType": "EmitStatement", - "src": "14111:85:35" + "src": "14714:85:46" } ] }, @@ -11485,18 +12669,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 32043, + "id": 32447, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 32040, + "id": 32444, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32037, - "src": "13977:1:35", + "referencedDeclaration": 32441, + "src": "14580:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11506,50 +12690,52 @@ "operator": "<", "rightExpression": { "expression": { - "id": 32041, + "id": 32445, "name": "feeRecipients", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32033, - "src": "13981:13:35", + "referencedDeclaration": 32437, + "src": "14584:13:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient memory[] memory" } }, - "id": 32042, + "id": 32446, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "13995:6:35", + "memberLocation": "14598:6:46", "memberName": "length", "nodeType": "MemberAccess", - "src": "13981:20:35", + "src": "14584:20:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "13977:24:35", + "src": "14580:24:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 32076, + "id": 32480, "initializationExpression": { - "assignments": [32037], + "assignments": [ + 32441 + ], "declarations": [ { "constant": false, - "id": 32037, + "id": 32441, "mutability": "mutable", "name": "i", - "nameLocation": "13970:1:35", + "nameLocation": "14573:1:46", "nodeType": "VariableDeclaration", - "scope": 32076, - "src": "13962:9:35", + "scope": 32480, + "src": "14565:9:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -11557,10 +12743,10 @@ "typeString": "uint256" }, "typeName": { - "id": 32036, + "id": 32440, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "13962:7:35", + "src": "14565:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11569,17 +12755,17 @@ "visibility": "internal" } ], - "id": 32039, + "id": 32443, "initialValue": { "hexValue": "30", - "id": 32038, + "id": 32442, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "13974:1:35", + "src": "14577:1:46", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" @@ -11587,11 +12773,11 @@ "value": "0" }, "nodeType": "VariableDeclarationStatement", - "src": "13962:13:35" + "src": "14565:13:46" }, "loopExpression": { "expression": { - "id": 32045, + "id": 32449, "isConstant": false, "isLValue": false, "isPure": false, @@ -11599,14 +12785,14 @@ "nodeType": "UnaryOperation", "operator": "++", "prefix": false, - "src": "14003:3:35", + "src": "14606:3:46", "subExpression": { - "id": 32044, + "id": 32448, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32037, - "src": "14003:1:35", + "referencedDeclaration": 32441, + "src": "14606:1:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -11617,39 +12803,39 @@ "typeString": "uint256" } }, - "id": 32046, + "id": 32450, "nodeType": "ExpressionStatement", - "src": "14003:3:35" + "src": "14606:3:46" }, "nodeType": "ForStatement", - "src": "13957:250:35" + "src": "14560:250:46" } ] }, "documentation": { - "id": 32027, + "id": 32431, "nodeType": "StructuredDocumentation", - "src": "13745:90:35", + "src": "14348:90:46", "text": " @notice Transfers the fees to the fee recipients, from `address(this)`." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferFeesToRecipientsExactOutput", - "nameLocation": "13849:36:35", + "nameLocation": "14452:36:46", "parameters": { - "id": 32034, + "id": 32438, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 32029, + "id": 32433, "mutability": "mutable", "name": "token", - "nameLocation": "13894:5:35", + "nameLocation": "14497:5:46", "nodeType": "VariableDeclaration", - "scope": 32078, - "src": "13886:13:35", + "scope": 32482, + "src": "14489:13:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -11657,10 +12843,10 @@ "typeString": "address" }, "typeName": { - "id": 32028, + "id": 32432, "name": "address", "nodeType": "ElementaryTypeName", - "src": "13886:7:35", + "src": "14489:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -11671,71 +12857,73 @@ }, { "constant": false, - "id": 32033, + "id": 32437, "mutability": "mutable", "name": "feeRecipients", - "nameLocation": "13923:13:35", + "nameLocation": "14526:13:46", "nodeType": "VariableDeclaration", - "scope": 32078, - "src": "13901:35:35", + "scope": 32482, + "src": "14504:35:46", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_memory_ptr_$dyn_memory_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_memory_ptr_$dyn_memory_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" }, "typeName": { "baseType": { - "id": 32031, + "id": 32435, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 32030, + "id": 32434, "name": "FeeRecipient", - "nameLocations": ["13901:12:35"], + "nameLocations": [ + "14504:12:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 31289, - "src": "13901:12:35" + "referencedDeclaration": 31620, + "src": "14504:12:46" }, - "referencedDeclaration": 31289, - "src": "13901:12:35", + "referencedDeclaration": 31620, + "src": "14504:12:46", "typeDescriptions": { - "typeIdentifier": "t_struct$_FeeRecipient_$31289_storage_ptr", + "typeIdentifier": "t_struct$_FeeRecipient_$31620_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient" } }, - "id": 32032, + "id": 32436, "nodeType": "ArrayTypeName", - "src": "13901:14:35", + "src": "14504:14:46", "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31289_storage_$dyn_storage_ptr", + "typeIdentifier": "t_array$_t_struct$_FeeRecipient_$31620_storage_$dyn_storage_ptr", "typeString": "struct SecondaryFee.FeeRecipient[]" } }, "visibility": "internal" } ], - "src": "13885:52:35" + "src": "14488:52:46" }, "returnParameters": { - "id": 32035, + "id": 32439, "nodeType": "ParameterList", "parameters": [], - "src": "13947:0:35" + "src": "14550:0:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { - "id": 32119, + "id": 32523, "nodeType": "FunctionDefinition", - "src": "14314:326:35", + "src": "14917:326:46", "nodes": [], "body": { - "id": 32118, + "id": 32522, "nodeType": "Block", - "src": "14387:253:35", + "src": "14990:253:46", "nodes": [], "statements": [ { @@ -11744,7 +12932,7 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 32100, + "id": 32504, "isConstant": false, "isLValue": false, "isPure": false, @@ -11754,14 +12942,14 @@ { "arguments": [ { - "id": 32092, + "id": 32496, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, - "src": "14496:4:35", + "src": "15099:4:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } } @@ -11769,30 +12957,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_SecondaryFee_$32140", + "typeIdentifier": "t_contract$_SecondaryFee_$32544", "typeString": "contract SecondaryFee" } ], - "id": 32091, + "id": 32495, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "14488:7:35", + "src": "15091:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 32090, + "id": 32494, "name": "address", "nodeType": "ElementaryTypeName", - "src": "14488:7:35", + "src": "15091:7:46", "typeDescriptions": {} } }, - "id": 32093, + "id": 32497, "isConstant": false, "isLValue": false, "isPure": false, @@ -11801,7 +12989,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14488:13:35", + "src": "15091:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -11811,14 +12999,14 @@ { "arguments": [ { - "id": 32096, + "id": 32500, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "14511:13:35", + "referencedDeclaration": 31605, + "src": "15114:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } } @@ -11826,30 +13014,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } ], - "id": 32095, + "id": 32499, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "14503:7:35", + "src": "15106:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 32094, + "id": 32498, "name": "address", "nodeType": "ElementaryTypeName", - "src": "14503:7:35", + "src": "15106:7:46", "typeDescriptions": {} } }, - "id": 32097, + "id": 32501, "isConstant": false, "isLValue": false, "isPure": false, @@ -11858,7 +13046,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14503:22:35", + "src": "15106:22:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -11880,12 +13068,12 @@ "expression": { "arguments": [ { - "id": 32087, + "id": 32491, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32081, - "src": "14471:5:35", + "referencedDeclaration": 32485, + "src": "15074:5:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -11899,18 +13087,18 @@ "typeString": "address" } ], - "id": 32086, + "id": 32490, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "14464:6:35", + "src": "15067:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 32088, + "id": 32492, "isConstant": false, "isLValue": false, "isPure": false, @@ -11919,29 +13107,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14464:13:35", + "src": "15067:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 32089, + "id": 32493, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "14478:9:35", + "memberLocation": "15081:9:46", "memberName": "allowance", "nodeType": "MemberAccess", "referencedDeclaration": 30192, - "src": "14464:23:35", + "src": "15067:23:46", "typeDescriptions": { "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", "typeString": "function (address,address) view external returns (uint256)" } }, - "id": 32098, + "id": 32502, "isConstant": false, "isLValue": false, "isPure": false, @@ -11950,7 +13138,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14464:62:35", + "src": "15067:62:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", @@ -11960,30 +13148,30 @@ "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { - "id": 32099, + "id": 32503, "name": "amountRequired", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32083, - "src": "14529:14:35", + "referencedDeclaration": 32487, + "src": "15132:14:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "14464:79:35", + "src": "15067:79:46", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 32117, + "id": 32521, "nodeType": "IfStatement", - "src": "14460:174:35", + "src": "15063:174:46", "trueBody": { - "id": 32116, + "id": 32520, "nodeType": "Block", - "src": "14545:89:35", + "src": "15148:89:46", "statements": [ { "expression": { @@ -11991,14 +13179,14 @@ { "arguments": [ { - "id": 32107, + "id": 32511, "name": "uniswapRouter", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 31274, - "src": "14589:13:35", + "referencedDeclaration": 31605, + "src": "15192:13:46", "typeDescriptions": { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } } @@ -12006,30 +13194,30 @@ "expression": { "argumentTypes": [ { - "typeIdentifier": "t_contract$_IV3SwapRouter_$30687", + "typeIdentifier": "t_contract$_IV3SwapRouter_$31017", "typeString": "contract IV3SwapRouter" } ], - "id": 32106, + "id": 32510, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "14581:7:35", + "src": "15184:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 32105, + "id": 32509, "name": "address", "nodeType": "ElementaryTypeName", - "src": "14581:7:35", + "src": "15184:7:46", "typeDescriptions": {} } }, - "id": 32108, + "id": 32512, "isConstant": false, "isLValue": false, "isPure": false, @@ -12038,7 +13226,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14581:22:35", + "src": "15184:22:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -12049,22 +13237,22 @@ "expression": { "arguments": [ { - "id": 32111, + "id": 32515, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "14610:7:35", + "src": "15213:7:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { - "id": 32110, + "id": 32514, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "14610:7:35", + "src": "15213:7:46", "typeDescriptions": {} } } @@ -12076,18 +13264,18 @@ "typeString": "type(uint256)" } ], - "id": 32109, + "id": 32513, "name": "type", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -27, - "src": "14605:4:35", + "src": "15208:4:46", "typeDescriptions": { "typeIdentifier": "t_function_metatype_pure$__$returns$__$", "typeString": "function () pure" } }, - "id": 32112, + "id": 32516, "isConstant": false, "isLValue": false, "isPure": true, @@ -12096,22 +13284,22 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14605:13:35", + "src": "15208:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_magic_meta_type_t_uint256", "typeString": "type(uint256)" } }, - "id": 32113, + "id": 32517, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "memberLocation": "14619:3:35", + "memberLocation": "15222:3:46", "memberName": "max", "nodeType": "MemberAccess", - "src": "14605:17:35", + "src": "15208:17:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -12132,12 +13320,12 @@ "expression": { "arguments": [ { - "id": 32102, + "id": 32506, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 32081, - "src": "14566:5:35", + "referencedDeclaration": 32485, + "src": "15169:5:46", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -12151,18 +13339,18 @@ "typeString": "address" } ], - "id": 32101, + "id": 32505, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30215, - "src": "14559:6:35", + "src": "15162:6:46", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$30215_$", "typeString": "type(contract IERC20)" } }, - "id": 32103, + "id": 32507, "isConstant": false, "isLValue": false, "isPure": false, @@ -12171,29 +13359,29 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14559:13:35", + "src": "15162:13:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$30215", "typeString": "contract IERC20" } }, - "id": 32104, + "id": 32508, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "14573:7:35", + "memberLocation": "15176:7:46", "memberName": "approve", "nodeType": "MemberAccess", "referencedDeclaration": 30202, - "src": "14559:21:35", + "src": "15162:21:46", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,uint256) external returns (bool)" } }, - "id": 32114, + "id": 32518, "isConstant": false, "isLValue": false, "isPure": false, @@ -12202,16 +13390,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14559:64:35", + "src": "15162:64:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 32115, + "id": 32519, "nodeType": "ExpressionStatement", - "src": "14559:64:35" + "src": "15162:64:46" } ] } @@ -12219,29 +13407,29 @@ ] }, "documentation": { - "id": 32079, + "id": 32483, "nodeType": "StructuredDocumentation", - "src": "14219:90:35", + "src": "14822:90:46", "text": " @notice Approves the router to spend tokens for this address if needed." }, "implemented": true, "kind": "function", "modifiers": [], "name": "_ensureApproved", - "nameLocation": "14323:15:35", + "nameLocation": "14926:15:46", "parameters": { - "id": 32084, + "id": 32488, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 32081, + "id": 32485, "mutability": "mutable", "name": "token", - "nameLocation": "14347:5:35", + "nameLocation": "14950:5:46", "nodeType": "VariableDeclaration", - "scope": 32119, - "src": "14339:13:35", + "scope": 32523, + "src": "14942:13:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -12249,10 +13437,10 @@ "typeString": "address" }, "typeName": { - "id": 32080, + "id": 32484, "name": "address", "nodeType": "ElementaryTypeName", - "src": "14339:7:35", + "src": "14942:7:46", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -12263,13 +13451,13 @@ }, { "constant": false, - "id": 32083, + "id": 32487, "mutability": "mutable", "name": "amountRequired", - "nameLocation": "14362:14:35", + "nameLocation": "14965:14:46", "nodeType": "VariableDeclaration", - "scope": 32119, - "src": "14354:22:35", + "scope": 32523, + "src": "14957:22:46", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -12277,10 +13465,10 @@ "typeString": "uint256" }, "typeName": { - "id": 32082, + "id": 32486, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "14354:7:35", + "src": "14957:7:46", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -12289,28 +13477,28 @@ "visibility": "internal" } ], - "src": "14338:39:35" + "src": "14941:39:46" }, "returnParameters": { - "id": 32085, + "id": 32489, "nodeType": "ParameterList", "parameters": [], - "src": "14387:0:35" + "src": "14990:0:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { - "id": 32129, + "id": 32533, "nodeType": "FunctionDefinition", - "src": "14727:61:35", + "src": "15330:61:46", "nodes": [], "body": { - "id": 32128, + "id": 32532, "nodeType": "Block", - "src": "14763:25:35", + "src": "15366:25:46", "nodes": [], "statements": [ { @@ -12318,18 +13506,18 @@ "arguments": [], "expression": { "argumentTypes": [], - "id": 32125, + "id": 32529, "name": "_pause", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 29533, - "src": "14773:6:35", + "src": "15376:6:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, - "id": 32126, + "id": 32530, "isConstant": false, "isLValue": false, "isPure": false, @@ -12338,23 +13526,23 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14773:8:35", + "src": "15376:8:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 32127, + "id": 32531, "nodeType": "ExpressionStatement", - "src": "14773:8:35" + "src": "15376:8:46" } ] }, "documentation": { - "id": 32120, + "id": 32524, "nodeType": "StructuredDocumentation", - "src": "14646:76:35", + "src": "15249:76:46", "text": " @notice Pauses the fee capture mechanism of the contract." }, "functionSelector": "8456cb59", @@ -12362,48 +13550,50 @@ "kind": "function", "modifiers": [ { - "id": 32123, + "id": 32527, "kind": "modifierInvocation", "modifierName": { - "id": 32122, + "id": 32526, "name": "onlyOwner", - "nameLocations": ["14753:9:35"], + "nameLocations": [ + "15356:9:46" + ], "nodeType": "IdentifierPath", "referencedDeclaration": 29361, - "src": "14753:9:35" + "src": "15356:9:46" }, "nodeType": "ModifierInvocation", - "src": "14753:9:35" + "src": "15356:9:46" } ], "name": "pause", - "nameLocation": "14736:5:35", + "nameLocation": "15339:5:46", "parameters": { - "id": 32121, + "id": 32525, "nodeType": "ParameterList", "parameters": [], - "src": "14741:2:35" + "src": "15344:2:46" }, "returnParameters": { - "id": 32124, + "id": 32528, "nodeType": "ParameterList", "parameters": [], - "src": "14763:0:35" + "src": "15366:0:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { - "id": 32139, + "id": 32543, "nodeType": "FunctionDefinition", - "src": "14877:65:35", + "src": "15480:65:46", "nodes": [], "body": { - "id": 32138, + "id": 32542, "nodeType": "Block", - "src": "14915:27:35", + "src": "15518:27:46", "nodes": [], "statements": [ { @@ -12411,18 +13601,18 @@ "arguments": [], "expression": { "argumentTypes": [], - "id": 32135, + "id": 32539, "name": "_unpause", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 29549, - "src": "14925:8:35", + "src": "15528:8:46", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, - "id": 32136, + "id": 32540, "isConstant": false, "isLValue": false, "isPure": false, @@ -12431,23 +13621,23 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "14925:10:35", + "src": "15528:10:46", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 32137, + "id": 32541, "nodeType": "ExpressionStatement", - "src": "14925:10:35" + "src": "15528:10:46" } ] }, "documentation": { - "id": 32130, + "id": 32534, "nodeType": "StructuredDocumentation", - "src": "14794:78:35", + "src": "15397:78:46", "text": " @notice Unpauses the fee capture mechanism of the contract." }, "functionSelector": "3f4ba83a", @@ -12455,35 +13645,37 @@ "kind": "function", "modifiers": [ { - "id": 32133, + "id": 32537, "kind": "modifierInvocation", "modifierName": { - "id": 32132, + "id": 32536, "name": "onlyOwner", - "nameLocations": ["14905:9:35"], + "nameLocations": [ + "15508:9:46" + ], "nodeType": "IdentifierPath", "referencedDeclaration": 29361, - "src": "14905:9:35" + "src": "15508:9:46" }, "nodeType": "ModifierInvocation", - "src": "14905:9:35" + "src": "15508:9:46" } ], "name": "unpause", - "nameLocation": "14886:7:35", + "nameLocation": "15489:7:46", "parameters": { - "id": 32131, + "id": 32535, "nodeType": "ParameterList", "parameters": [], - "src": "14893:2:35" + "src": "15496:2:46" }, "returnParameters": { - "id": 32134, + "id": 32538, "nodeType": "ParameterList", "parameters": [], - "src": "14915:0:35" + "src": "15518:0:46" }, - "scope": 32140, + "scope": 32544, "stateMutability": "nonpayable", "virtual": false, "visibility": "external" @@ -12493,56 +13685,68 @@ "baseContracts": [ { "baseName": { - "id": 31257, + "id": 31588, "name": "ISecondaryFee", - "nameLocations": ["505:13:35"], + "nameLocations": [ + "556:13:46" + ], "nodeType": "IdentifierPath", - "referencedDeclaration": 32198, - "src": "505:13:35" + "referencedDeclaration": 32602, + "src": "556:13:46" }, - "id": 31258, + "id": 31589, "nodeType": "InheritanceSpecifier", - "src": "505:13:35" + "src": "556:13:46" }, { "baseName": { - "id": 31259, + "id": 31590, "name": "Ownable", - "nameLocations": ["520:7:35"], + "nameLocations": [ + "571:7:46" + ], "nodeType": "IdentifierPath", "referencedDeclaration": 29442, - "src": "520:7:35" + "src": "571:7:46" }, - "id": 31260, + "id": 31591, "nodeType": "InheritanceSpecifier", - "src": "520:7:35" + "src": "571:7:46" }, { "baseName": { - "id": 31261, + "id": 31592, "name": "Pausable", - "nameLocations": ["529:8:35"], + "nameLocations": [ + "580:8:46" + ], "nodeType": "IdentifierPath", "referencedDeclaration": 29550, - "src": "529:8:35" + "src": "580:8:46" }, - "id": 31262, + "id": 31593, "nodeType": "InheritanceSpecifier", - "src": "529:8:35" + "src": "580:8:46" } ], "canonicalName": "SecondaryFee", "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "linearizedBaseContracts": [32140, 29550, 29442, 30262, 32198], + "linearizedBaseContracts": [ + 32544, + 29550, + 29442, + 30592, + 32602 + ], "name": "SecondaryFee", - "nameLocation": "489:12:35", - "scope": 32141, + "nameLocation": "540:12:46", + "scope": 32545, "usedErrors": [] } ], "license": "Apache-2.0" }, - "id": 35 -} + "id": 46 +} \ No newline at end of file diff --git a/packages/internal/dex/sdk/src/contracts/types/SecondaryFee.ts b/packages/internal/dex/sdk/src/contracts/types/SecondaryFee.ts index 2ca9cf5a56..82037db942 100644 --- a/packages/internal/dex/sdk/src/contracts/types/SecondaryFee.ts +++ b/packages/internal/dex/sdk/src/contracts/types/SecondaryFee.ts @@ -144,6 +144,8 @@ export interface SecondaryFeeInterface extends utils.Interface { "exactInputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))": FunctionFragment; "exactOutputSingleWithServiceFee((address,uint16)[],(address,address,uint24,address,uint256,uint256,uint160))": FunctionFragment; "exactOutputWithServiceFee((address,uint16)[],(bytes,address,uint256,uint256))": FunctionFragment; + "multicall(uint256,bytes[])": FunctionFragment; + "multicall(bytes[])": FunctionFragment; "owner()": FunctionFragment; "pause()": FunctionFragment; "paused()": FunctionFragment; @@ -161,6 +163,8 @@ export interface SecondaryFeeInterface extends utils.Interface { | "exactInputWithServiceFee" | "exactOutputSingleWithServiceFee" | "exactOutputWithServiceFee" + | "multicall(uint256,bytes[])" + | "multicall(bytes[])" | "owner" | "pause" | "paused" @@ -206,6 +210,14 @@ export interface SecondaryFeeInterface extends utils.Interface { IV3SwapRouter.ExactOutputParamsStruct ] ): string; + encodeFunctionData( + functionFragment: "multicall(uint256,bytes[])", + values: [PromiseOrValue, PromiseOrValue[]] + ): string; + encodeFunctionData( + functionFragment: "multicall(bytes[])", + values: [PromiseOrValue[]] + ): string; encodeFunctionData(functionFragment: "owner", values?: undefined): string; encodeFunctionData(functionFragment: "pause", values?: undefined): string; encodeFunctionData(functionFragment: "paused", values?: undefined): string; @@ -247,6 +259,14 @@ export interface SecondaryFeeInterface extends utils.Interface { functionFragment: "exactOutputWithServiceFee", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "multicall(uint256,bytes[])", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "multicall(bytes[])", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; decodeFunctionResult(functionFragment: "pause", data: BytesLike): Result; decodeFunctionResult(functionFragment: "paused", data: BytesLike): Result; @@ -371,6 +391,17 @@ export interface SecondaryFee extends BaseContract { overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; + "multicall(uint256,bytes[])"( + deadline: PromiseOrValue, + data: PromiseOrValue[], + overrides?: PayableOverrides & { from?: PromiseOrValue } + ): Promise; + + "multicall(bytes[])"( + data: PromiseOrValue[], + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + owner(overrides?: CallOverrides): Promise<[string]>; pause( @@ -423,6 +454,17 @@ export interface SecondaryFee extends BaseContract { overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; + "multicall(uint256,bytes[])"( + deadline: PromiseOrValue, + data: PromiseOrValue[], + overrides?: PayableOverrides & { from?: PromiseOrValue } + ): Promise; + + "multicall(bytes[])"( + data: PromiseOrValue[], + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + owner(overrides?: CallOverrides): Promise; pause( @@ -475,6 +517,17 @@ export interface SecondaryFee extends BaseContract { overrides?: CallOverrides ): Promise; + "multicall(uint256,bytes[])"( + deadline: PromiseOrValue, + data: PromiseOrValue[], + overrides?: CallOverrides + ): Promise; + + "multicall(bytes[])"( + data: PromiseOrValue[], + overrides?: CallOverrides + ): Promise; + owner(overrides?: CallOverrides): Promise; pause(overrides?: CallOverrides): Promise; @@ -552,6 +605,17 @@ export interface SecondaryFee extends BaseContract { overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; + "multicall(uint256,bytes[])"( + deadline: PromiseOrValue, + data: PromiseOrValue[], + overrides?: PayableOverrides & { from?: PromiseOrValue } + ): Promise; + + "multicall(bytes[])"( + data: PromiseOrValue[], + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + owner(overrides?: CallOverrides): Promise; pause( @@ -607,6 +671,17 @@ export interface SecondaryFee extends BaseContract { overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; + "multicall(uint256,bytes[])"( + deadline: PromiseOrValue, + data: PromiseOrValue[], + overrides?: PayableOverrides & { from?: PromiseOrValue } + ): Promise; + + "multicall(bytes[])"( + data: PromiseOrValue[], + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + owner(overrides?: CallOverrides): Promise; pause( diff --git a/packages/internal/dex/sdk/src/contracts/types/factories/SecondaryFee__factory.ts b/packages/internal/dex/sdk/src/contracts/types/factories/SecondaryFee__factory.ts index 3761045611..3d83e5ebd9 100644 --- a/packages/internal/dex/sdk/src/contracts/types/factories/SecondaryFee__factory.ts +++ b/packages/internal/dex/sdk/src/contracts/types/factories/SecondaryFee__factory.ts @@ -382,6 +382,49 @@ const _abi = [ stateMutability: "payable", type: "function", }, + { + inputs: [ + { + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]", + }, + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "", + type: "bytes[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]", + }, + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [], name: "owner", @@ -458,7 +501,7 @@ const _abi = [ ] as const; const _bytecode = - "0x608060405234801561001057600080fd5b5060405162001c6d38038062001c6d833981016040819052610031916100bc565b61003a3361006c565b6000805460ff60a01b19169055600180546001600160a01b0319166001600160a01b03929092169190911790556100ec565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100ce57600080fd5b81516001600160a01b03811681146100e557600080fd5b9392505050565b611b7180620000fc6000396000f3fe6080604052600436106100c25760003560e01c8063735de9f71161007f5780638da5cb5b116100595780638da5cb5b146101df578063d9a6f705146101fd578063ed921d3c14610213578063f2fde38b1461022657600080fd5b8063735de9f71461017f578063742ac944146101b75780638456cb59146101ca57600080fd5b80631411734e146100c757806314d90e1b146100ed5780631fd168ff146101165780633f4ba83a146101295780635c975abb14610140578063715018a61461016a575b600080fd5b6100da6100d5366004611744565b610246565b6040519081526020015b60405180910390f35b3480156100f957600080fd5b506101036103e881565b60405161ffff90911681526020016100e4565b6100da610124366004611744565b6103a4565b34801561013557600080fd5b5061013e610514565b005b34801561014c57600080fd5b50600054600160a01b900460ff1660405190151581526020016100e4565b34801561017657600080fd5b5061013e610526565b34801561018b57600080fd5b5060015461019f906001600160a01b031681565b6040516001600160a01b0390911681526020016100e4565b6100da6101c5366004611840565b610538565b3480156101d657600080fd5b5061013e610675565b3480156101eb57600080fd5b506000546001600160a01b031661019f565b34801561020957600080fd5b5061010361271081565b6100da610221366004611840565b610685565b34801561023257600080fd5b5061013e610241366004611896565b6107ad565b60208101516000906001600160a01b03163314801590610273575060208201516001600160a01b03163014155b156102995760405162461bcd60e51b8152600401610290906118ba565b60405180910390fd5b60006102a88360000151610826565b905060008061031383866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610309576102fa60408302860136819003810190611907565b815260200190600101906102dd565b5050505050610838565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103569088906004016119ea565b6020604051808303816000875af1158015610375573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039991906119fd565b979650505050505050565b604081015181516000919082906103ba90610919565b905060006103cb8560000151610826565b905060008060008061043e868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b828210156104345761042560408302860136819003810190611907565b81526020019060010190610408565b505050505061094f565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016104af91906119ea565b6020604051808303816000875af11580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906119fd565b97506105068787878c604001518587610a30565b505050505050509392505050565b61051c610c73565b610524610ccd565b565b61052e610c73565b6105246000610d22565b60608101516000906001600160a01b03163314801590610565575060608201516001600160a01b03163014155b156105825760405162461bcd60e51b8152600401610290906118ba565b6000806105e58460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b82821015610309576105d660408302860136819003810190611907565b815260200190600101906105b9565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf90610628908790600401611a16565b6020604051808303816000875af1158015610647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066b91906119fd565b9695505050505050565b61067d610c73565b610524610d72565b600080826080015190506000806000806106fa87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b82821015610434576106eb60408302860136819003810190611907565b815260200190600101906106ce565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df90610742908a90600401611a16565b6020604051808303816000875af1158015610761573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078591906119fd565b95506107a185886000015189602001518a608001518587610a30565b50505050509392505050565b6107b5610c73565b6001600160a01b03811661081a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610290565b61082381610d22565b50565b60006108328282610db5565b92915050565b600080548190600160a01b900460ff16610877576000806108598786610e1a565b90925090506108688288611a8b565b96506108748882610ff8565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af11580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee9190611a9e565b506108f98686611173565b306001600160a01b0385160361090d573393505b50929491935090915050565b6000806014835161092a9190611a8b565b9050600061093a8483601461126a565b9050610947816000610db5565b949350505050565b600080606081808261096b60005460ff600160a01b9091041690565b61098b576109798988610e1a565b9092509050610988828a611ac0565b98505b6001600160a01b038816301461099f573097505b6109a98b8b611173565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af11580156109fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a209190611a9e565b50979a9699509697505050505050565b600054600160a01b900460ff16610a4b57610a4b8482611377565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab691906119fd565b9050610ac28385611a8b565b811015610b115760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e742064697374726962757465646044820152606401610290565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b829190611a9e565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee91906119fd565b90508015610c695760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610c43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c679190611a9e565b505b5050505050505050565b6000546001600160a01b031633146105245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610290565b610cd56114e6565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610d7a611536565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d053390565b6000610dc2826014611ac0565b83511015610e0a5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610290565b500160200151600160601b900490565b6000606081805b8451811015610e6b57848181518110610e3c57610e3c611ad3565b60200260200101516020015161ffff1682610e579190611ac0565b915080610e6381611ae9565b915050610e21565b506103e8811115610ebe5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f4645450000006044820152606401610290565b600080855167ffffffffffffffff811115610edb57610edb6115c8565b604051908082528060200260200182016040528015610f2057816020015b6040805180820190915260008082526020820152815260200190600190039081610ef95790505b50905060005b8651811015610fe957600061271061ffff16888381518110610f4a57610f4a611ad3565b60200260200101516020015161ffff168a610f659190611b02565b610f6f9190611b19565b90506040518060400160405280898481518110610f8e57610f8e611ad3565b6020026020010151600001516001600160a01b0316815260200182815250838381518110610fbe57610fbe611ad3565b6020908102919091010152610fd38185611ac0565b9350508080610fe190611ae9565b915050610f26565b509093509150505b9250929050565b60005b815181101561116e57826001600160a01b03166323b872dd3384848151811061102657611026611ad3565b60200260200101516000015185858151811061104457611044611ad3565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af11580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca9190611a9e565b508181815181106110dd576110dd611ad3565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061113957611139611ad3565b60200260200101516020015160405161115491815260200190565b60405180910390a48061116681611ae9565b915050610ffb565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa1580156111c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e891906119fd565b10156112665760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611242573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190611a9e565b5050565b60608161127881601f611ac0565b10156112b75760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610290565b6112c18284611ac0565b845110156113055760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610290565b606082158015611324576040519150600082526020820160405261136e565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561135d578051835260209283019201611345565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561116e57826001600160a01b031663a9059cbb8383815181106113a4576113a4611ad3565b6020026020010151600001518484815181106113c2576113c2611ad3565b6020026020010151602001516040518363ffffffff1660e01b81526004016113ff9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af115801561141e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114429190611a9e565b5081818151811061145557611455611ad3565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106114b1576114b1611ad3565b6020026020010151602001516040516114cc91815260200190565b60405180910390a4806114de81611ae9565b91505061137a565b600054600160a01b900460ff166105245760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610290565b600054600160a01b900460ff16156105245760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610290565b60008083601f84011261159557600080fd5b50813567ffffffffffffffff8111156115ad57600080fd5b6020830191508360208260061b8501011115610ff157600080fd5b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715611601576116016115c8565b60405290565b60405160e0810167ffffffffffffffff81118282101715611601576116016115c8565b604051601f8201601f1916810167ffffffffffffffff81118282101715611653576116536115c8565b604052919050565b6001600160a01b038116811461082357600080fd5b803561167b8161165b565b919050565b60006080828403121561169257600080fd5b61169a6115de565b9050813567ffffffffffffffff808211156116b457600080fd5b818401915084601f8301126116c857600080fd5b81356020828211156116dc576116dc6115c8565b6116ee601f8301601f1916820161162a565b9250818352868183860101111561170457600080fd5b81818501828501376000818385010152828552611722818701611670565b8186015250505050604082013560408201526060820135606082015292915050565b60008060006040848603121561175957600080fd5b833567ffffffffffffffff8082111561177157600080fd5b61177d87838801611583565b9095509350602086013591508082111561179657600080fd5b506117a386828701611680565b9150509250925092565b600060e082840312156117bf57600080fd5b6117c7611607565b905081356117d48161165b565b815260208201356117e48161165b565b6020820152604082013562ffffff811681146117ff57600080fd5b604082015261181060608301611670565b60608201526080820135608082015260a082013560a082015261183560c08301611670565b60c082015292915050565b6000806000610100848603121561185657600080fd5b833567ffffffffffffffff81111561186d57600080fd5b61187986828701611583565b909450925061188d905085602086016117ad565b90509250925092565b6000602082840312156118a857600080fd5b81356118b38161165b565b9392505050565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b60006040828403121561191957600080fd5b6040516040810181811067ffffffffffffffff8211171561193c5761193c6115c8565b604052823561194a8161165b565b8152602083013561ffff8116811461196157600080fd5b60208201529392505050565b6000815160808452805180608086015260005b8181101561199d57602081840181015160a0888401015201611980565b50600060a08287010152602084015191506119c360208601836001600160a01b03169052565b60408481015190860152606093840151938501939093525050601f01601f19160160a00190565b6020815260006118b3602083018461196d565b600060208284031215611a0f57600080fd5b5051919050565b60e08101610832828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052601160045260246000fd5b8181038181111561083257610832611a75565b600060208284031215611ab057600080fd5b815180151581146118b357600080fd5b8082018082111561083257610832611a75565b634e487b7160e01b600052603260045260246000fd5b600060018201611afb57611afb611a75565b5060010190565b808202811582820484141761083257610832611a75565b600082611b3657634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220ace639a098395b7bea514c42166a1e5a567128581e5b4dad8d6cc013080bd70964736f6c63430008130033"; + "0x60806040523480156200001157600080fd5b5060405162002123380380620021238339810160408190526200003491620000c2565b6200003f3362000072565b6000805460ff60a01b19169055600180546001600160a01b0319166001600160a01b0392909216919091179055620000f4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000d557600080fd5b81516001600160a01b0381168114620000ed57600080fd5b9392505050565b61201f80620001046000396000f3fe6080604052600436106100e85760003560e01c8063735de9f71161008a578063ac9650d811610059578063ac9650d814610243578063d9a6f70514610263578063ed921d3c14610279578063f2fde38b1461028c57600080fd5b8063735de9f7146101c5578063742ac944146101fd5780638456cb59146102105780638da5cb5b1461022557600080fd5b80633f4ba83a116100c65780633f4ba83a1461014f5780635ae401dc146101665780635c975abb14610186578063715018a6146101b057600080fd5b80631411734e146100ed57806314d90e1b146101135780631fd168ff1461013c575b600080fd5b6101006100fb366004611a14565b6102ac565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101296103e881565b60405161ffff909116815260200161010a565b61010061014a366004611a14565b61040a565b34801561015b57600080fd5b5061016461057a565b005b610179610174366004611ac0565b61058c565b60405161010a9190611b5b565b34801561019257600080fd5b50600054600160a01b900460ff16604051901515815260200161010a565b3480156101bc57600080fd5b506101646105e2565b3480156101d157600080fd5b506001546101e5906001600160a01b031681565b6040516001600160a01b03909116815260200161010a565b61010061020b366004611c50565b6105f4565b34801561021c57600080fd5b50610164610731565b34801561023157600080fd5b506000546001600160a01b03166101e5565b34801561024f57600080fd5b5061017961025e366004611ca5565b610741565b34801561026f57600080fd5b5061012961271081565b610100610287366004611c50565b610836565b34801561029857600080fd5b506101646102a7366004611ce6565b61095e565b60208101516000906001600160a01b031633148015906102d9575060208201516001600160a01b03163014155b156102ff5760405162461bcd60e51b81526004016102f690611d03565b60405180910390fd5b600061030e83600001516109d7565b905060008061037983866040015187602001518a8a808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761036060408302860136819003810190611d50565b81526020019060010190610343565b50505050506109e3565b60408088018390526001600160a01b0380831660208a0152600154915163b858183f60e01b8152939550919350169063b858183f906103bc908890600401611dfc565b6020604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190611e0f565b979650505050505050565b6040810151815160009190829061042090610ac4565b9050600061043185600001516109d7565b90506000806000806104a4868a606001518b604001518c602001518f8f808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761048b60408302860136819003810190611d50565b8152602001906001019061046e565b5050505050610af2565b9350935093509350838960400181815250508289602001906001600160a01b031690816001600160a01b031681525050600160009054906101000a90046001600160a01b03166001600160a01b03166309b813468a6040518263ffffffff1660e01b81526004016105159190611dfc565b6020604051808303816000875af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611e0f565b975061056c8787878c604001518587610bd3565b505050505050509392505050565b610582610e16565b61058a610e70565b565b6060834211156105d05760405162461bcd60e51b815260206004820152600f60248201526e111958591b1a5b99481c185cdcd959608a1b60448201526064016102f6565b6105da8383610741565b949350505050565b6105ea610e16565b61058a6000610ec5565b60608101516000906001600160a01b03163314801590610621575060608201516001600160a01b03163014155b1561063e5760405162461bcd60e51b81526004016102f690611d03565b6000806106a18460000151856080015186606001518989808060200260200160405190810160405280939291908181526020016000905b8282101561036f5761069260408302860136819003810190611d50565b81526020019060010190610675565b608086018290526001600160a01b0380821660608801526001546040516304e45aaf60e01b815293955091935016906304e45aaf906106e4908790600401611e28565b6020604051808303816000875af1158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611e0f565b9695505050505050565b610739610e16565b61058a610f15565b6060816001600160401b0381111561075b5761075b61189c565b60405190808252806020026020018201604052801561078e57816020015b60608152602001906001900390816107795790505b50905060005b8281101561082e576107fe308585848181106107b2576107b2611e87565b90506020028101906107c49190611e9d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f5892505050565b82828151811061081057610810611e87565b6020026020010181905250808061082690611ef9565b915050610794565b505b92915050565b600080826080015190506000806000806108ab87600001518860a0015189608001518a606001518d8d808060200260200160405190810160405280939291908181526020016000905b8282101561049a5761089c60408302860136819003810190611d50565b8152602001906001019061087f565b60808b018490526001600160a01b0380841660608d0152600154604051635023b4df60e01b815295995093975091955093501690635023b4df906108f3908a90600401611e28565b6020604051808303816000875af1158015610912573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109369190611e0f565b955061095285886000015189602001518a608001518587610bd3565b50505050509392505050565b610966610e16565b6001600160a01b0381166109cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f6565b6109d481610ec5565b50565b60006108308282610f84565b600080548190600160a01b900460ff16610a2257600080610a048786610fe9565b9092509050610a138288611f12565b9650610a1f88826111c6565b50505b6040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a999190611f25565b50610aa48686611341565b306001600160a01b03851603610ab8573393505b50929491935090915050565b60008060148351610ad59190611f12565b90506000610ae584836014611438565b90506105da816000610f84565b6000806060818082610b0e60005460ff600160a01b9091041690565b610b2e57610b1c8988610fe9565b9092509050610b2b828a611f47565b98505b6001600160a01b0388163014610b42573097505b610b4c8b8b611341565b6040516323b872dd60e01b8152336004820152306024820152604481018b90526001600160a01b038c16906323b872dd906064016020604051808303816000875af1158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190611f25565b50979a9699509697505050505050565b600054600160a01b900460ff16610bee57610bee8482611545565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190611e0f565b9050610c658385611f12565b811015610cb45760405162461bcd60e51b815260206004820181905260248201527f696e636f72726563742066656520616d6f756e7420646973747269627574656460448201526064016102f6565b60405163a9059cbb60e01b8152336004820152602481018890526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611f25565b506040516370a0823160e01b81523060048201526000906001600160a01b038816906370a0823190602401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190611e0f565b90508015610e0c5760405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0388169063a9059cbb906044016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611f25565b505b5050505050505050565b6000546001600160a01b0316331461058a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f6565b610e786116b4565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f1d611704565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ea83390565b6060610f7d8383604051806060016040528060278152602001611fc360279139611751565b9392505050565b6000610f91826014611f47565b83511015610fd95760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016102f6565b500160200151600160601b900490565b6000606081805b845181101561103a5784818151811061100b5761100b611e87565b60200260200101516020015161ffff16826110269190611f47565b91508061103281611ef9565b915050610ff0565b506103e881111561108d5760405162461bcd60e51b815260206004820152601d60248201527f5365727669636520666565203e204d41585f534552564943455f46454500000060448201526064016102f6565b60008085516001600160401b038111156110a9576110a961189c565b6040519080825280602002602001820160405280156110ee57816020015b60408051808201909152600080825260208201528152602001906001900390816110c75790505b50905060005b86518110156111b757600061271061ffff1688838151811061111857611118611e87565b60200260200101516020015161ffff168a6111339190611f5a565b61113d9190611f71565b9050604051806040016040528089848151811061115c5761115c611e87565b6020026020010151600001516001600160a01b031681526020018281525083838151811061118c5761118c611e87565b60209081029190910101526111a18185611f47565b93505080806111af90611ef9565b9150506110f4565b509093509150505b9250929050565b60005b815181101561133c57826001600160a01b03166323b872dd338484815181106111f4576111f4611e87565b60200260200101516000015185858151811061121257611212611e87565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112989190611f25565b508181815181106112ab576112ab611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061130757611307611e87565b60200260200101516020015160405161132291815260200190565b60405180910390a48061133481611ef9565b9150506111c9565b505050565b600154604051636eb1769f60e11b81523060048201526001600160a01b039182166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611e0f565b10156114345760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529083169063095ea7b3906044016020604051808303816000875af1158015611410573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190611f25565b5050565b60608161144681601f611f47565b10156114855760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016102f6565b61148f8284611f47565b845110156114d35760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102f6565b6060821580156114f2576040519150600082526020820160405261153c565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561152b578051835260209283019201611513565b5050858452601f01601f1916604052505b50949350505050565b60005b815181101561133c57826001600160a01b031663a9059cbb83838151811061157257611572611e87565b60200260200101516000015184848151811061159057611590611e87565b6020026020010151602001516040518363ffffffff1660e01b81526004016115cd9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156115ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116109190611f25565b5081818151811061162357611623611e87565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e85858151811061167f5761167f611e87565b60200260200101516020015160405161169a91815260200190565b60405180910390a4806116ac81611ef9565b915050611548565b600054600160a01b900460ff1661058a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016102f6565b600054600160a01b900460ff161561058a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016102f6565b6060600080856001600160a01b03168560405161176e9190611f93565b600060405180830381855af49150503d80600081146117a9576040519150601f19603f3d011682016040523d82523d6000602084013e6117ae565b606091505b50915091506107278683838760608315611829578251600003611822576001600160a01b0385163b6118225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102f6565b50816105da565b6105da838381511561183e5781518083602001fd5b8060405162461bcd60e51b81526004016102f69190611faf565b60008083601f84011261186a57600080fd5b5081356001600160401b0381111561188157600080fd5b6020830191508360208260061b85010111156111bf57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156118d4576118d461189c565b60405290565b60405160e081016001600160401b03811182821017156118d4576118d461189c565b604051601f8201601f191681016001600160401b03811182821017156119245761192461189c565b604052919050565b6001600160a01b03811681146109d457600080fd5b803561194c8161192c565b919050565b60006080828403121561196357600080fd5b61196b6118b2565b905081356001600160401b038082111561198457600080fd5b818401915084601f83011261199857600080fd5b81356020828211156119ac576119ac61189c565b6119be601f8301601f191682016118fc565b925081835286818386010111156119d457600080fd5b818185018285013760008183850101528285526119f2818701611941565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215611a2957600080fd5b83356001600160401b0380821115611a4057600080fd5b611a4c87838801611858565b90955093506020860135915080821115611a6557600080fd5b50611a7286828701611951565b9150509250925092565b60008083601f840112611a8e57600080fd5b5081356001600160401b03811115611aa557600080fd5b6020830191508360208260051b85010111156111bf57600080fd5b600080600060408486031215611ad557600080fd5b8335925060208401356001600160401b03811115611af257600080fd5b611afe86828701611a7c565b9497909650939450505050565b60005b83811015611b26578181015183820152602001611b0e565b50506000910152565b60008151808452611b47816020860160208601611b0b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611bb057603f19888603018452611b9e858351611b2f565b94509285019290850190600101611b82565b5092979650505050505050565b600060e08284031215611bcf57600080fd5b611bd76118da565b90508135611be48161192c565b81526020820135611bf48161192c565b6020820152604082013562ffffff81168114611c0f57600080fd5b6040820152611c2060608301611941565b60608201526080820135608082015260a082013560a0820152611c4560c08301611941565b60c082015292915050565b60008060006101008486031215611c6657600080fd5b83356001600160401b03811115611c7c57600080fd5b611c8886828701611858565b9094509250611c9c90508560208601611bbd565b90509250925092565b60008060208385031215611cb857600080fd5b82356001600160401b03811115611cce57600080fd5b611cda85828601611a7c565b90969095509350505050565b600060208284031215611cf857600080fd5b8135610f7d8161192c565b6020808252602d908201527f726563697069656e74206d757374206265206d73672e73656e646572206f722060408201526c1d1a1a5cc818dbdb9d1c9858dd609a1b606082015260800190565b600060408284031215611d6257600080fd5b604051604081018181106001600160401b0382111715611d8457611d8461189c565b6040528235611d928161192c565b8152602083013561ffff81168114611da957600080fd5b60208201529392505050565b6000815160808452611dca6080850182611b2f565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b602081526000610f7d6020830184611db5565b600060208284031215611e2157600080fd5b5051919050565b60e08101610830828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611eb457600080fd5b8301803591506001600160401b03821115611ece57600080fd5b6020019150368190038213156111bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611f0b57611f0b611ee3565b5060010190565b8181038181111561083057610830611ee3565b600060208284031215611f3757600080fd5b81518015158114610f7d57600080fd5b8082018082111561083057610830611ee3565b808202811582820484141761083057610830611ee3565b600082611f8e57634e487b7160e01b600052601260045260246000fd5b500490565b60008251611fa5818460208701611b0b565b9190910192915050565b602081526000610f7d6020830184611b2f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203925f97cd63c2e61736a2a442ff1d4bf966f453350e9df354a849229f69092cf64736f6c63430008130033"; type SecondaryFeeConstructorParams = | [signer?: Signer] diff --git a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts index 77cd8412ef..5c16f3c0b0 100644 --- a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts +++ b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountIn.test.ts @@ -7,9 +7,9 @@ import { } from 'errors'; import { ERC20__factory } from 'contracts/types/factories/ERC20__factory'; import { ethers } from 'ethers'; +import { Environment } from '@imtbl/config'; import { Exchange } from './exchange'; import { - decodeMulticallData, mockRouterImplementation, setupSwapTxTest, TEST_PERIPHERY_ROUTER_ADDRESS, @@ -17,8 +17,15 @@ import { TEST_GAS_PRICE, IMX_TEST_TOKEN, TEST_TRANSACTION_GAS_USAGE, + TEST_FEE_RECIPIENT, + TEST_MAX_FEE_BASIS_POINTS, + TEST_SECONDARY_FEE_ADDRESS, + decodeMulticallExactInputOutputSingleWithFees, + decodeMulticallExactInputOutputWithFees, + decodeMulticallExactInputOutputSingleWithoutFees, + decodePath, } from './test/utils'; -import { Router } from './lib'; +import { Router, SecondaryFee } from './lib'; jest.mock('@ethersproject/providers'); jest.mock('@ethersproject/contracts'); @@ -31,6 +38,8 @@ jest.mock('./lib/utils', () => ({ })); const exactInputSingleSignature = '0x04e45aaf'; +const exactInputSingleWithSecondaryFeeSignature = '0x742ac944'; +const exactInputWithSecondaryFeeSignature = '0x1411734e'; const DEFAULT_SLIPPAGE = 0.1; const HIGHER_SLIPPAGE = 0.2; @@ -39,6 +48,7 @@ const APPROVE_GAS_ESTIMATE = BigNumber.from('100000'); describe('getUnsignedSwapTxFromAmountIn', () => { let erc20Contract: jest.Mock; + beforeAll(() => { erc20Contract = (Contract as unknown as jest.Mock).mockImplementation( () => ({ @@ -149,13 +159,18 @@ describe('getUnsignedSwapTxFromAmountIn', () => { }); }); - describe('Swap with single pool and default slippage tolerance', () => { + describe('Swap with single pool and secondary fees', () => { it('generates valid swap calldata', async () => { const params = setupSwapTxTest(DEFAULT_SLIPPAGE); mockRouterImplementation(params, TradeType.EXACT_INPUT); - const exchange = new Exchange(TEST_DEX_CONFIGURATION); + const secondaryFees: SecondaryFee[] = [ + { feeRecipient: TEST_FEE_RECIPIENT, feeBasisPoints: TEST_MAX_FEE_BASIS_POINTS }, + ]; + const exchange = new Exchange( + { baseConfig: { environment: Environment.SANDBOX }, chainId: 13372, secondaryFees }, + ); const { swap } = await exchange.getUnsignedSwapTxFromAmountIn( params.fromAddress, @@ -166,24 +181,107 @@ describe('getUnsignedSwapTxFromAmountIn', () => { const data = swap.transaction?.data?.toString() || ''; - const { functionCallParams, topLevelParams } = decodeMulticallData(data); + const { swapParams, secondaryFeeParams, topLevelParams } = decodeMulticallExactInputOutputSingleWithFees(data); - expect(topLevelParams[1][0].slice(0, 10)).toBe(exactInputSingleSignature); + expect(topLevelParams[1][0].slice(0, 10)).toBe(exactInputSingleWithSecondaryFeeSignature); - expect(functionCallParams.tokenIn).toBe(params.inputToken); // input token - expect(functionCallParams.tokenOut).toBe(params.outputToken); // output token - expect(functionCallParams.fee).toBe(10000); // fee - expect(functionCallParams.recipient).toBe(params.fromAddress); // Recipient - expect(swap.transaction?.to).toBe(TEST_PERIPHERY_ROUTER_ADDRESS); // to address + expect(secondaryFeeParams[0].feeRecipient).toBe(TEST_FEE_RECIPIENT); + expect(secondaryFeeParams[0].feeBasisPoints).toBe(TEST_MAX_FEE_BASIS_POINTS); + + expect(swapParams.tokenIn).toBe(params.inputToken); // input token + expect(swapParams.tokenOut).toBe(params.outputToken); // output token + expect(swapParams.fee).toBe(10000); // fee + expect(swapParams.recipient).toBe(params.fromAddress); // Recipient + expect(swap.transaction?.to).toBe(TEST_SECONDARY_FEE_ADDRESS); // to address expect(swap.transaction?.from).toBe(params.fromAddress); // from address - expect(swap.transaction?.value).toBe('0x00'); // refers to 0ETH - expect(functionCallParams.firstAmount.toString()).toBe( + expect(swap.transaction?.value).toBe('0x00'); // refers to 0 amount of the native token + expect(swapParams.firstAmount.toString()).toBe( params.amountIn.toString(), ); // amountin - expect(functionCallParams.secondAmount.toString()).toBe( + expect(swapParams.secondAmount.toString()).toBe( params.minAmountOut.toString(), ); // minAmountOut - expect(functionCallParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit + expect(swapParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit + }); + }); + + describe('Swap with multiple pools and secondary fees', () => { + it('generates valid swap calldata', async () => { + const params = setupSwapTxTest(DEFAULT_SLIPPAGE, true); + + mockRouterImplementation(params, TradeType.EXACT_INPUT); + + const secondaryFees: SecondaryFee[] = [ + { feeRecipient: TEST_FEE_RECIPIENT, feeBasisPoints: TEST_MAX_FEE_BASIS_POINTS }, + ]; + + const exchange = new Exchange({ ...TEST_DEX_CONFIGURATION, secondaryFees }); + + const { swap } = await exchange.getUnsignedSwapTxFromAmountIn( + params.fromAddress, + params.inputToken, + params.outputToken, + params.amountIn, + ); + + const data = swap.transaction?.data?.toString() || ''; + + const { swapParams, secondaryFeeParams, topLevelParams } = decodeMulticallExactInputOutputWithFees(data); + + expect(topLevelParams[1][0].slice(0, 10)).toBe(exactInputWithSecondaryFeeSignature); + + expect(secondaryFeeParams[0].feeRecipient).toBe(TEST_FEE_RECIPIENT); + expect(secondaryFeeParams[0].feeBasisPoints).toBe(TEST_MAX_FEE_BASIS_POINTS); + + const decodedPath = decodePath(swapParams.path); + + expect(swap.transaction?.to).toBe(TEST_SECONDARY_FEE_ADDRESS); // to address + expect(swap.transaction?.from).toBe(params.fromAddress); // from address + expect(swap.transaction?.value).toBe('0x00'); // refers to 0 amount of the native token + + expect(ethers.utils.getAddress(decodedPath.inputToken)).toBe(params.inputToken); + expect(ethers.utils.getAddress(decodedPath.intermediaryToken)).toBe(params.intermediaryToken); + expect(ethers.utils.getAddress(decodedPath.outputToken)).toBe(params.outputToken); + expect(decodedPath.firstPoolFee.toString()).toBe('10000'); + expect(decodedPath.secondPoolFee.toString()).toBe('10000'); + + expect(swapParams.recipient).toBe(params.fromAddress); // recipient of swap + expect(swapParams.amountIn.toString()).toBe(params.amountIn.toString()); + expect(swapParams.amountOut.toString()).toBe(params.minAmountOut.toString()); + }); + }); + + describe('Swap with single pool without fees and default slippage tolerance', () => { + it('generates valid swap calldata', async () => { + const params = setupSwapTxTest(DEFAULT_SLIPPAGE); + + mockRouterImplementation(params, TradeType.EXACT_INPUT); + + const exchange = new Exchange(TEST_DEX_CONFIGURATION); + + const { swap } = await exchange.getUnsignedSwapTxFromAmountIn( + params.fromAddress, + params.inputToken, + params.outputToken, + params.amountIn, + ); + + const data = swap.transaction?.data?.toString() || ''; + + const { topLevelParams, swapParams } = decodeMulticallExactInputOutputSingleWithoutFees(data); + + expect(topLevelParams[1][0].slice(0, 10)).toBe(exactInputSingleSignature); + + expect(swapParams.tokenIn).toBe(params.inputToken); // input token + expect(swapParams.tokenOut).toBe(params.outputToken); // output token + expect(swapParams.fee).toBe(10000); // fee + expect(swapParams.recipient).toBe(params.fromAddress); // recipient + expect(swap.transaction?.to).toBe(TEST_PERIPHERY_ROUTER_ADDRESS); // to address + expect(swap.transaction?.from).toBe(params.fromAddress); // from address + expect(swap.transaction?.value).toBe('0x00'); // refers to 0ETH + expect(swapParams.firstAmount.toString()).toBe(params.amountIn.toString()); // amount in + expect(swapParams.secondAmount.toString()).toBe(params.minAmountOut.toString()); // min amount out + expect(swapParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit }); it('returns the gas estimate for the swap', async () => { @@ -235,7 +333,7 @@ describe('getUnsignedSwapTxFromAmountIn', () => { }); }); - describe('Swap with single pool and higher slippage tolerance', () => { + describe('Swap with single pool without fees and high slippage tolerance', () => { it('generates valid calldata', async () => { const params = setupSwapTxTest(HIGHER_SLIPPAGE); mockRouterImplementation(params, TradeType.EXACT_INPUT); @@ -252,24 +350,20 @@ describe('getUnsignedSwapTxFromAmountIn', () => { const data = swap.transaction?.data?.toString() || ''; - const { functionCallParams, topLevelParams } = decodeMulticallData(data); + const { topLevelParams, swapParams } = decodeMulticallExactInputOutputSingleWithoutFees(data); expect(topLevelParams[1][0].slice(0, 10)).toBe(exactInputSingleSignature); - expect(functionCallParams.tokenIn).toBe(params.inputToken); // input token - expect(functionCallParams.tokenOut).toBe(params.outputToken); // output token - expect(functionCallParams.fee).toBe(10000); // fee - expect(functionCallParams.recipient).toBe(params.fromAddress); // Recipient + expect(swapParams.tokenIn).toBe(params.inputToken); // input token + expect(swapParams.tokenOut).toBe(params.outputToken); // output token + expect(swapParams.fee).toBe(10000); // fee + expect(swapParams.recipient).toBe(params.fromAddress); // recipient expect(swap.transaction?.to).toBe(TEST_PERIPHERY_ROUTER_ADDRESS); // to address expect(swap.transaction?.from).toBe(params.fromAddress); // from address expect(swap.transaction?.value).toBe('0x00'); // refers to 0ETH - expect(functionCallParams.firstAmount.toString()).toBe( - params.amountIn.toString(), - ); // amountin - expect(functionCallParams.secondAmount.toString()).toBe( - params.minAmountOut.toString(), - ); // minAmountOut - expect(functionCallParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit + expect(swapParams.firstAmount.toString()).toBe(params.amountIn.toString()); // amount in + expect(swapParams.secondAmount.toString()).toBe(params.minAmountOut.toString()); // min amount out + expect(swapParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit }); it('returns valid quote', async () => { diff --git a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts index 5732989cff..c1550f4484 100644 --- a/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts +++ b/packages/internal/dex/sdk/src/exchange.getUnsignedSwapTxFromAmountOut.test.ts @@ -4,12 +4,12 @@ import { BigNumber } from '@ethersproject/bignumber'; import { TradeType } from '@uniswap/sdk-core'; import { Exchange } from './exchange'; import { - decodeMulticallData, mockRouterImplementation, setupSwapTxTest, TEST_PERIPHERY_ROUTER_ADDRESS, TEST_DEX_CONFIGURATION, TEST_GAS_PRICE, + decodeMulticallExactInputOutputSingleWithoutFees, } from './test/utils'; jest.mock('@ethersproject/providers'); @@ -53,7 +53,7 @@ describe('getUnsignedSwapTxFromAmountOut', () => { ) as unknown as JsonRpcProvider; }); - describe('Swap with single pool and default slippage tolerance', () => { + describe('Swap with single pool without fees and default slippage tolerance', () => { it('generates valid swap calldata', async () => { const params = setupSwapTxTest(DEFAULT_SLIPPAGE); @@ -70,24 +70,20 @@ describe('getUnsignedSwapTxFromAmountOut', () => { const data = swap.transaction.data?.toString() || ''; - const { functionCallParams, topLevelParams } = decodeMulticallData(data); + const { topLevelParams, swapParams } = decodeMulticallExactInputOutputSingleWithoutFees(data); expect(topLevelParams[1][0].slice(0, 10)).toBe(exactOutputSingleSignature); - expect(functionCallParams.tokenIn).toBe(params.inputToken); // input token - expect(functionCallParams.tokenOut).toBe(params.outputToken); // output token - expect(functionCallParams.fee).toBe(10000); // fee - expect(functionCallParams.recipient).toBe(params.fromAddress); // Recipient + expect(swapParams.tokenIn).toBe(params.inputToken); // input token + expect(swapParams.tokenOut).toBe(params.outputToken); // output token + expect(swapParams.fee).toBe(10000); // fee + expect(swapParams.recipient).toBe(params.fromAddress); // recipient expect(swap.transaction.to).toBe(TEST_PERIPHERY_ROUTER_ADDRESS); // to address expect(swap.transaction.from).toBe(params.fromAddress); // from address expect(swap.transaction.value).toBe('0x00'); // refers to 0ETH - expect(functionCallParams.firstAmount.toString()).toBe( - params.amountOut.toString(), - ); // amountOut - expect(functionCallParams.secondAmount.toString()).toBe( - params.maxAmountIn.toString(), - ); // maxAmountIn - expect(functionCallParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit + expect(swapParams.firstAmount.toString()).toBe(params.amountOut.toString()); // amount out + expect(swapParams.secondAmount.toString()).toBe(params.maxAmountIn.toString()); // max amount in + expect(swapParams.sqrtPriceLimitX96.toString()).toBe('0'); // sqrtPriceX96Limit }); it('returns valid swap quote', async () => { diff --git a/packages/internal/dex/sdk/src/exchange.ts b/packages/internal/dex/sdk/src/exchange.ts index c69ab2202c..bdc6285dc3 100644 --- a/packages/internal/dex/sdk/src/exchange.ts +++ b/packages/internal/dex/sdk/src/exchange.ts @@ -35,13 +35,12 @@ export class Exchange { this.chainId = config.chain.chainId; this.nativeToken = config.chain.nativeToken; + this.secondaryFees = config.secondaryFees; this.provider = new ethers.providers.JsonRpcProvider( config.chain.rpcUrl, ); - this.secondaryFees = config.secondaryFees; - this.router = new Router( this.provider, config.chain.commonRoutingTokens, @@ -50,6 +49,7 @@ export class Exchange { factoryAddress: config.chain.contracts.coreFactory, quoterAddress: config.chain.contracts.quoterV2, peripheryRouterAddress: config.chain.contracts.peripheryRouter, + secondaryFeeAddress: config.chain.contracts.secondaryFee, }, ); } @@ -139,7 +139,9 @@ export class Exchange { slippagePercent, deadline, this.router.routingContracts.peripheryRouterAddress, + this.router.routingContracts.secondaryFeeAddress, gasPrice, + this.secondaryFees, ); const quote = getQuote(otherToken, tradeType, routeAndQuote.trade, slippagePercent); @@ -218,8 +220,4 @@ export class Exchange { TradeType.EXACT_OUTPUT, ); } - - private thereAreSecondaryFees(): boolean { - return this.secondaryFees.length > 0; - } } diff --git a/packages/internal/dex/sdk/src/lib/router.ts b/packages/internal/dex/sdk/src/lib/router.ts index 892593c2e6..c8a4a25c1d 100644 --- a/packages/internal/dex/sdk/src/lib/router.ts +++ b/packages/internal/dex/sdk/src/lib/router.ts @@ -17,6 +17,7 @@ export type RoutingContracts = { factoryAddress: string; quoterAddress: string; peripheryRouterAddress: string; + secondaryFeeAddress: string; }; export type QuoteTradeInfo = { diff --git a/packages/internal/dex/sdk/src/lib/transactionUtils/swap.ts b/packages/internal/dex/sdk/src/lib/transactionUtils/swap.ts index 1f5653edf6..16945c5e85 100644 --- a/packages/internal/dex/sdk/src/lib/transactionUtils/swap.ts +++ b/packages/internal/dex/sdk/src/lib/transactionUtils/swap.ts @@ -1,25 +1,179 @@ -import { MethodParameters, Trade } from '@uniswap/v3-sdk'; -import { SwapOptions, SwapRouter } from '@uniswap/router-sdk'; +import { + Trade, toHex, encodeRouteToPath, Route, +} from '@uniswap/v3-sdk'; +import { SwapRouter } from '@uniswap/router-sdk'; import { Currency, CurrencyAmount, + Percent, TradeType, } from '@uniswap/sdk-core'; import JSBI from 'jsbi'; import { ethers } from 'ethers'; import { QuoteResponse, QuoteTradeInfo } from 'lib/router'; +import { SecondaryFee__factory } from 'contracts/types'; +import { ISecondaryFee, SecondaryFeeInterface } from 'contracts/types/SecondaryFee'; import { + SecondaryFee, TokenInfo, TransactionDetails, } from '../../types'; import { calculateGasFee } from './gas'; import { slippageToFraction } from './slippage'; -export function createSwapParameters( +type SwapOptions = { + slippageTolerance: Percent; + deadlineOrPreviousBlockhash: number; + recipient: string; +}; + +const zeroNativeCurrencyValue = '0x00'; +const multicallWithDeadlineFunctionSignature = 'multicall(uint256,bytes[])'; + +function buildSwapParametersForSinglePoolSwap( + fromAddress: string, + trade: Trade, + route: Route, + amountIn: string, + amountOut: string, + secondaryFees: SecondaryFee[], + secondaryFeeContract: SecondaryFeeInterface, +) { + const secondaryFeeValues: ISecondaryFee.ServiceFeeParamsStruct[] = secondaryFees.map((fee) => ({ + feePrcntBasisPoints: fee.feeBasisPoints, + recipient: fee.feeRecipient, + })); + + if (trade.tradeType === TradeType.EXACT_INPUT) { + return secondaryFeeContract.encodeFunctionData('exactInputSingleWithServiceFee', [secondaryFeeValues, { + tokenIn: route.tokenPath[0].address, + tokenOut: route.tokenPath[1].address, + fee: route.pools[0].fee, + recipient: fromAddress, + amountIn, + amountOutMinimum: amountOut, + sqrtPriceLimitX96: 0, + }]); + } + + return secondaryFeeContract.encodeFunctionData('exactOutputSingleWithServiceFee', [secondaryFeeValues, { + tokenIn: route.tokenPath[0].address, + tokenOut: route.tokenPath[1].address, + fee: route.pools[0].fee, + recipient: fromAddress, + amountInMaximum: amountIn, + amountOut, + sqrtPriceLimitX96: 0, + }]); +} + +function buildSwapParametersForMultiPoolSwap( + fromAddress: string, + trade: Trade, + route: Route, + amountIn: string, + amountOut: string, + secondaryFees: SecondaryFee[], + secondaryFeeContract: SecondaryFeeInterface, +) { + const path: string = encodeRouteToPath(route, trade.tradeType === TradeType.EXACT_OUTPUT); + + const secondaryFeeValues: ISecondaryFee.ServiceFeeParamsStruct[] = secondaryFees.map((fee) => ({ + feePrcntBasisPoints: fee.feeBasisPoints, + recipient: fee.feeRecipient, + })); + + if (trade.tradeType === TradeType.EXACT_INPUT) { + return secondaryFeeContract.encodeFunctionData('exactInputWithServiceFee', [secondaryFeeValues, { + path, + recipient: fromAddress, + amountIn, + amountOutMinimum: amountOut, + }]); + } + + return secondaryFeeContract.encodeFunctionData('exactOutputWithServiceFee', [secondaryFeeValues, { + path, + recipient: fromAddress, + amountInMaximum: amountIn, + amountOut, + }]); +} + +/** + * Builds swap parameters + * @param fromAddress the msg.sender of the transaction + * @param secondaryFeeAddress the secondary fee contract address + * @param trade details of the swap, including the route, input/output tokens and amounts + * @param options additional swap options + * @returns calldata for the swap + */ +function buildSwapParameters( + fromAddress: string, + trade: Trade, + options: SwapOptions, + secondaryFees: SecondaryFee[], + secondaryFeeContract: SecondaryFeeInterface, +) { + // @dev we don't support multiple swaps in a single transaction + // there will always be only one swap in the trade regardless of the trade type + const { route, inputAmount, outputAmount } = trade.swaps[0]; + const amountIn: string = toHex(trade.maximumAmountIn(options.slippageTolerance, inputAmount).quotient); + const amountOut: string = toHex(trade.minimumAmountOut(options.slippageTolerance, outputAmount).quotient); + + const isSinglePoolSwap = route.pools.length === 1; + + if (isSinglePoolSwap) { + return buildSwapParametersForSinglePoolSwap( + fromAddress, + trade, + route, + amountIn, + amountOut, + secondaryFees, + secondaryFeeContract, + ); + } + + return buildSwapParametersForMultiPoolSwap( + fromAddress, + trade, + route, + amountIn, + amountOut, + secondaryFees, + secondaryFeeContract, + ); +} + +function createSwapCallParametersWithFees( + trade: Trade, + fromAddress: string, + swapOptions: SwapOptions, + secondaryFees: SecondaryFee[], +): string { + const secondaryFeeContract = SecondaryFee__factory.createInterface(); + + const swapWithFeesCalldata = buildSwapParameters( + fromAddress, + trade, + swapOptions, + secondaryFees, + secondaryFeeContract, + ); + + return secondaryFeeContract.encodeFunctionData( + multicallWithDeadlineFunctionSignature, + [swapOptions.deadlineOrPreviousBlockhash, [swapWithFeesCalldata]], + ); +} + +function createSwapParameters( trade: QuoteTradeInfo, fromAddress: string, slippage: number, deadline: number, -): MethodParameters { + secondaryFees: SecondaryFee[], +): string { // Create an unchecked trade to be used in generating swap parameters. const uncheckedTrade: Trade = Trade.createUncheckedTrade({ route: trade.route, @@ -41,8 +195,12 @@ export function createSwapParameters( deadlineOrPreviousBlockhash: deadline, }; - // Generate the parameters. - return SwapRouter.swapCallParameters([uncheckedTrade], options); + if (secondaryFees.length === 0) { + // Generate swap parameters without secondary fee contract details + return SwapRouter.swapCallParameters([uncheckedTrade], options).calldata; + } + + return createSwapCallParametersWithFees(uncheckedTrade, fromAddress, options, secondaryFees); } export function getSwap( @@ -52,15 +210,19 @@ export function getSwap( slippage: number, deadline: number, peripheryRouterAddress: string, + secondaryFeesAddress: string, gasPrice: ethers.BigNumber | null, + secondaryFees: SecondaryFee[], ): TransactionDetails { - const params = createSwapParameters( + const calldata = createSwapParameters( routeAndQuote.trade, fromAddress, slippage, deadline, + secondaryFees, ); + // TODO: Add additional gas fee estimates for secondary fees const gasFeeEstimate = gasPrice ? { token: nativeToken, value: calculateGasFee(gasPrice, routeAndQuote.trade.gasEstimate), @@ -68,9 +230,9 @@ export function getSwap( return { transaction: { - data: params.calldata, - to: peripheryRouterAddress, - value: params.value, + data: calldata, + to: secondaryFees.length > 0 ? secondaryFeesAddress : peripheryRouterAddress, + value: zeroNativeCurrencyValue, // we should never send the native currency to the router for a swap from: fromAddress, }, gasFeeEstimate, diff --git a/packages/internal/dex/sdk/src/lib/utils.test.ts b/packages/internal/dex/sdk/src/lib/utils.test.ts index 229529a21c..23c3bba8c9 100644 --- a/packages/internal/dex/sdk/src/lib/utils.test.ts +++ b/packages/internal/dex/sdk/src/lib/utils.test.ts @@ -1,5 +1,5 @@ import { ethers } from 'ethers'; -import { TEST_FROM_ADDRESS } from 'test/utils'; +import { TEST_FROM_ADDRESS } from '../test/utils'; import { isValidNonZeroAddress } from './utils'; describe('utils', () => { diff --git a/packages/internal/dex/sdk/src/test/utils.ts b/packages/internal/dex/sdk/src/test/utils.ts index 8cf9147d45..6148ff7649 100644 --- a/packages/internal/dex/sdk/src/test/utils.ts +++ b/packages/internal/dex/sdk/src/test/utils.ts @@ -11,9 +11,9 @@ import { Pool, Route, TickMath } from '@uniswap/v3-sdk'; import { Environment, ImmutableConfiguration } from '@imtbl/config'; import { slippageToFraction } from 'lib/transactionUtils/slippage'; import { - ExchangeModuleConfiguration, QuoteTradeInfo, Router, + SecondaryFee, } from '../lib'; export const TEST_GAS_PRICE = ethers.BigNumber.from('1500000000'); // 1.5 gwei or 1500000000 wei @@ -23,6 +23,9 @@ export const TEST_CHAIN_ID = 999; export const TEST_RPC_URL = 'https://0.net'; export const TEST_FROM_ADDRESS = '0x94fC2BcA2E71e26D874d7E937d89ce2c9113af6e'; +export const TEST_FEE_RECIPIENT = '0xe3ece548F1DD4B1536Eb6eE188fE35350bc1dd16'; + +export const TEST_MAX_FEE_BASIS_POINTS = 1000; export const TEST_MULTICALL_ADDRESS = '0x66d0aB680ACEe44308edA2062b910405CC51A190'; export const TEST_V3_CORE_FACTORY_ADDRESS = '0x23490b262829ACDAD3EF40e555F23d77D1B69e4e'; @@ -31,6 +34,7 @@ export const TEST_PERIPHERY_ROUTER_ADDRESS = '0x615FFbea2af24C55d737dD4264895A56 export const TEST_V3_MIGRATOR_ADDRESSES = '0x0Df0d2d5Cf4739C0b579C33Fdb3d8B04Bee85729'; export const TEST_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = '0x446c78D97b1E78bC35864FC49AcE1f7404F163F6'; export const TEST_TICK_LENS_ADDRESSES = '0x3aC4F8094b21A6c5945453007d9c52B7e15340c0'; +export const TEST_SECONDARY_FEE_ADDRESS = '0x8dBE1f0900C5e92ad87A54521902a33ba1598C51'; export const IMX_TEST_TOKEN = new Token( TEST_CHAIN_ID, @@ -74,11 +78,23 @@ const exactInputOutputSingleParamTypes = [ 'uint160', ]; +const exactInputOutputSingleWithFeesParamTypes = [ + '(address,uint16)[]', + '(address,address,uint24,address,uint256,uint256,uint160)', +]; + +const exactInputOutWithFeesParamTypes = [ + '(address,uint16)[]', + '(bytes,address,uint256,uint256)', +]; + +const multicallParamTypes = ['uint256', 'bytes[]']; + export const TEST_IMMUTABLE_CONFIGURATION: ImmutableConfiguration = new ImmutableConfiguration({ environment: Environment.SANDBOX, }); -export const TEST_DEX_CONFIGURATION: ExchangeModuleConfiguration = { +export const TEST_DEX_CONFIGURATION = { baseConfig: TEST_IMMUTABLE_CONFIGURATION, chainId: TEST_CHAIN_ID, overrides: { @@ -88,6 +104,7 @@ export const TEST_DEX_CONFIGURATION: ExchangeModuleConfiguration = { coreFactory: TEST_V3_CORE_FACTORY_ADDRESS, quoterV2: TEST_QUOTER_ADDRESS, peripheryRouter: TEST_PERIPHERY_ROUTER_ADDRESS, + secondaryFee: TEST_SECONDARY_FEE_ADDRESS, }, commonRoutingTokens: [], nativeToken: { @@ -100,6 +117,26 @@ export const TEST_DEX_CONFIGURATION: ExchangeModuleConfiguration = { }, }; +export type SwapTest = { + fromAddress: string; + + chainId: number; + + pools: Pool[], + + arbitraryTick: number; + arbitraryLiquidity: number; + sqrtPriceAtTick: JSBI; + + inputToken: string; + outputToken: string; + intermediaryToken: string | undefined; + amountIn: ethers.BigNumberish; + amountOut: ethers.BigNumberish; + minAmountOut: ethers.BigNumberish; + maxAmountIn: ethers.BigNumberish; +}; + type ExactInputOutputSingleParams = { tokenIn: string; tokenOut: string; @@ -110,6 +147,13 @@ type ExactInputOutputSingleParams = { sqrtPriceLimitX96: ethers.BigNumber; }; +type ExactInputOutputParams = { + path: string; + recipient: string; + amountIn: ethers.BigNumber; + amountOut: ethers.BigNumber; +}; + // uniqBy returns the unique items in an array using the given comparator export function uniqBy( array: K[], @@ -126,35 +170,92 @@ export function uniqBy( return Object.values(uniqArr); } -export function decodeMulticallData(data: ethers.utils.BytesLike): { - topLevelParams: ethers.utils.Result; - functionCallParams: ExactInputOutputSingleParams; -} { +export function decodePath(path: string) { + return { + inputToken: path.substring(0, 42), + firstPoolFee: ethers.BigNumber.from(parseInt(`0x${path.substring(42, 48)}`, 16)), + intermediaryToken: `0x${path.substring(48, 88)}`, + secondPoolFee: ethers.BigNumber.from(parseInt(`0x${path.substring(88, 94)}`, 16)), + outputToken: `0x${path.substring(94, 134)}`, + }; +} + +function decodeParams(calldata: ethers.utils.BytesLike, paramTypes: string[]) { // eslint-disable-next-line no-param-reassign - data = ethers.utils.hexDataSlice(data, 4); + const data = ethers.utils.hexDataSlice(calldata, 4); - const decodedTopLevelParams = ethers.utils.defaultAbiCoder.decode( - ['uint256', 'bytes[]'], + const topLevelParams = ethers.utils.defaultAbiCoder.decode( + multicallParamTypes, data, ); - const calldata = decodedTopLevelParams[1][0]; - const calldataParams = ethers.utils.hexDataSlice(calldata, 4); - const decodedFunctionCallParams = ethers.utils.defaultAbiCoder.decode( - exactInputOutputSingleParamTypes, - calldataParams, - ); - const params: ExactInputOutputSingleParams = { - tokenIn: decodedFunctionCallParams[0], - tokenOut: decodedFunctionCallParams[1], - fee: decodedFunctionCallParams[2], - recipient: decodedFunctionCallParams[3], - firstAmount: decodedFunctionCallParams[4], - secondAmount: decodedFunctionCallParams[5], - sqrtPriceLimitX96: decodedFunctionCallParams[6], + const decodedParams = ethers.utils.defaultAbiCoder + .decode(paramTypes, ethers.utils.hexDataSlice(topLevelParams[1][0], 4)); + + return { topLevelParams, decodedParams }; +} + +export function decodeMulticallExactInputOutputWithFees(data: ethers.utils.BytesLike) { + const { topLevelParams, decodedParams } = decodeParams(data, exactInputOutWithFeesParamTypes); + + const secondaryFeeParams: SecondaryFee[] = []; + + for (let i = 0; i < decodedParams[0].length; i++) { + secondaryFeeParams.push({ + feeRecipient: decodedParams[0][i][0], + feeBasisPoints: decodedParams[0][i][1], + }); + } + + const multiPoolSwapParams: ExactInputOutputParams = { + path: decodedParams[1][0], + recipient: decodedParams[1][1], + amountIn: decodedParams[1][2], + amountOut: decodedParams[1][3], }; - return { topLevelParams: decodedTopLevelParams, functionCallParams: params }; + return { topLevelParams, secondaryFeeParams, swapParams: multiPoolSwapParams }; +} + +export function decodeMulticallExactInputOutputSingleWithFees(data: ethers.utils.BytesLike) { + const { topLevelParams, decodedParams } = decodeParams(data, exactInputOutputSingleWithFeesParamTypes); + + const secondaryFeeParams: SecondaryFee[] = []; + + for (let i = 0; i < decodedParams[0].length; i++) { + secondaryFeeParams.push({ + feeRecipient: decodedParams[0][i][0], + feeBasisPoints: decodedParams[0][i][1], + }); + } + + const singlePoolSwapParams: ExactInputOutputSingleParams = { + tokenIn: decodedParams[1][0], + tokenOut: decodedParams[1][1], + fee: decodedParams[1][2], + recipient: decodedParams[1][3], + firstAmount: decodedParams[1][4], + secondAmount: decodedParams[1][5], + sqrtPriceLimitX96: decodedParams[1][6], + }; + + return { topLevelParams, secondaryFeeParams, swapParams: singlePoolSwapParams }; +} + +export function decodeMulticallExactInputOutputSingleWithoutFees(data: ethers.utils.BytesLike) { + const { topLevelParams, decodedParams } = decodeParams(data, exactInputOutputSingleParamTypes); + + const swapParams: ExactInputOutputSingleParams = { + tokenIn: decodedParams[0], + tokenOut: decodedParams[1], + fee: decodedParams[2], + recipient: decodedParams[3], + firstAmount: decodedParams[4], + secondAmount: decodedParams[5], + sqrtPriceLimitX96: decodedParams[6], + }; + + return { topLevelParams, swapParams }; } export function getMinimumAmountOut( @@ -182,24 +283,7 @@ export function getMaximumAmountIn( return ethers.BigNumber.from(slippageAdjustedAmountIn.toString()); } -export type SwapTest = { - fromAddress: string; - - chainId: number; - - arbitraryTick: number; - arbitraryLiquidity: number; - sqrtPriceAtTick: JSBI; - - inputToken: string; - outputToken: string; - amountIn: ethers.BigNumberish; - amountOut: ethers.BigNumberish; - minAmountOut: ethers.BigNumberish; - maxAmountIn: ethers.BigNumberish; -}; - -export function setupSwapTxTest(slippage: number): SwapTest { +export function setupSwapTxTest(slippage: number, multiPoolSwap: boolean = false): SwapTest { const slippageFraction = slippageToFraction(slippage); const fromAddress = TEST_FROM_ADDRESS; @@ -207,24 +291,64 @@ export function setupSwapTxTest(slippage: number): SwapTest { const arbitraryLiquidity = 10; const sqrtPriceAtTick = TickMath.getSqrtRatioAtTick(arbitraryTick); - const inputToken = IMX_TEST_TOKEN.address; - const outputToken = WETH_TEST_TOKEN.address; + const tokenIn: Token = new Token(TEST_CHAIN_ID, IMX_TEST_TOKEN.address, 18); + const intermediaryToken: Token = new Token(TEST_CHAIN_ID, FUN_TEST_TOKEN.address, 18); + const tokenOut: Token = new Token(TEST_CHAIN_ID, WETH_TEST_TOKEN.address, 18); + const amountIn = ethers.utils.parseEther('0.0000123'); const amountOut = ethers.utils.parseEther('10000'); const minAmountOut = getMinimumAmountOut(slippageFraction, amountOut); const maxAmountIn = getMaximumAmountIn(slippageFraction, amountIn); + const fee = 10000; + + let pools: Pool[] = []; + if (multiPoolSwap) { + pools = [ + new Pool( + tokenIn, + intermediaryToken, + fee, + sqrtPriceAtTick, + arbitraryLiquidity, + arbitraryTick, + ), + new Pool( + intermediaryToken, + tokenOut, + fee, + sqrtPriceAtTick, + arbitraryLiquidity, + arbitraryTick, + ), + ]; + } else { + pools = [ + new Pool( + tokenIn, + tokenOut, + fee, + sqrtPriceAtTick, + arbitraryLiquidity, + arbitraryTick, + ), + ]; + } + return { fromAddress, chainId: TEST_CHAIN_ID, + pools, + arbitraryTick, arbitraryLiquidity, sqrtPriceAtTick, - inputToken, - outputToken, + inputToken: tokenIn.address, + intermediaryToken: multiPoolSwap ? intermediaryToken.address : undefined, + outputToken: tokenOut.address, amountIn, amountOut, minAmountOut, @@ -239,6 +363,7 @@ export function mockRouterImplementation( (Router as unknown as jest.Mock).mockImplementationOnce(() => ({ routingContracts: { peripheryRouterAddress: TEST_PERIPHERY_ROUTER_ADDRESS, + secondaryFeeAddress: TEST_SECONDARY_FEE_ADDRESS, }, findOptimalRoute: () => { const tokenIn: Token = new Token(params.chainId, params.inputToken, 18); @@ -247,19 +372,9 @@ export function mockRouterImplementation( params.outputToken, 18, ); - const fee = 10000; - const pools: Pool[] = [ - new Pool( - tokenIn, - tokenOut, - fee, - params.sqrtPriceAtTick, - params.arbitraryLiquidity, - params.arbitraryTick, - ), - ]; + const route: Route = new Route( - pools, + params.pools, tokenIn, tokenOut, ); @@ -273,8 +388,8 @@ export function mockRouterImplementation( tradeType, gasEstimate: TEST_TRANSACTION_GAS_USAGE, }; + return { - success: true, trade, }; }, diff --git a/packages/internal/dex/sdk/src/types/index.ts b/packages/internal/dex/sdk/src/types/index.ts index 4c7cf8304c..ce5e7043f6 100644 --- a/packages/internal/dex/sdk/src/types/index.ts +++ b/packages/internal/dex/sdk/src/types/index.ts @@ -94,10 +94,10 @@ export interface ExchangeOverrides { exchangeContracts: ExchangeContracts; commonRoutingTokens: TokenInfo[]; nativeToken: TokenInfo; - secondaryFees?: SecondaryFee[]; } export interface ExchangeModuleConfiguration extends ModuleConfiguration { chainId: number; + secondaryFees?: SecondaryFee[]; } From 7438d28a40dbd581b3a1ff5114ec7a30a99e6ca8 Mon Sep 17 00:00:00 2001 From: Ipek Turgul Date: Tue, 1 Aug 2023 13:19:29 +1000 Subject: [PATCH 6/9] GMS-871: regenerate multi rollup client (#621) --- CHANGELOG.md | 2 + packages/internal/generated-clients/Makefile | 2 +- .../generated-clients/src/mr-openapi.json | 84 ++++++++++++++++--- .../src/multi-rollup/.openapi-generator/FILES | 2 + .../generated-clients/src/multi-rollup/api.ts | 2 +- .../src/multi-rollup/base.ts | 4 +- .../src/multi-rollup/common.ts | 2 +- .../src/multi-rollup/configuration.ts | 2 +- .../src/multi-rollup/domain/activities-api.ts | 2 +- .../src/multi-rollup/domain/chains-api.ts | 2 +- .../multi-rollup/domain/collections-api.ts | 2 +- .../src/multi-rollup/domain/nft-owners-api.ts | 2 +- .../src/multi-rollup/domain/nfts-api.ts | 2 +- .../src/multi-rollup/domain/orders-api.ts | 2 +- .../src/multi-rollup/domain/passport-api.ts | 2 +- .../src/multi-rollup/domain/tokens-api.ts | 2 +- .../src/multi-rollup/index.ts | 2 +- .../src/multi-rollup/models/activity-asset.ts | 2 +- .../multi-rollup/models/activity-details.ts | 12 ++- .../models/activity-native-token.ts | 2 +- .../src/multi-rollup/models/activity-nft.ts | 2 +- .../src/multi-rollup/models/activity-token.ts | 2 +- .../src/multi-rollup/models/activity-type.ts | 6 +- .../src/multi-rollup/models/activity.ts | 2 +- .../multi-rollup/models/apierror400-all-of.ts | 2 +- .../src/multi-rollup/models/apierror400.ts | 2 +- .../multi-rollup/models/apierror401-all-of.ts | 2 +- .../src/multi-rollup/models/apierror401.ts | 2 +- .../multi-rollup/models/apierror403-all-of.ts | 2 +- .../src/multi-rollup/models/apierror403.ts | 2 +- .../multi-rollup/models/apierror404-all-of.ts | 2 +- .../src/multi-rollup/models/apierror404.ts | 2 +- .../multi-rollup/models/apierror429-all-of.ts | 2 +- .../src/multi-rollup/models/apierror429.ts | 2 +- .../multi-rollup/models/apierror500-all-of.ts | 2 +- .../src/multi-rollup/models/apierror500.ts | 2 +- .../src/multi-rollup/models/basic-apierror.ts | 2 +- .../models/blockchain-metadata.ts | 2 +- .../src/multi-rollup/models/burn.ts | 2 +- .../models/chain-with-details-all-of.ts | 2 +- .../multi-rollup/models/chain-with-details.ts | 2 +- .../src/multi-rollup/models/chain.ts | 2 +- .../models/collection-contract-type.ts | 2 +- .../src/multi-rollup/models/collection.ts | 2 +- .../create-counterfactual-address-request.ts | 2 +- .../create-counterfactual-address-res.ts | 2 +- .../models/create-listing-request-body.ts | 2 +- .../models/create-order-protocol-data.ts | 2 +- .../src/multi-rollup/models/deposit.ts | 45 ++++++++++ .../src/multi-rollup/models/erc20-item.ts | 2 +- .../src/multi-rollup/models/erc721-item.ts | 2 +- .../src/multi-rollup/models/fee.ts | 2 +- .../models/get-activity-result.ts | 2 +- .../models/get-collection-result.ts | 2 +- .../src/multi-rollup/models/get-nftresult.ts | 2 +- .../multi-rollup/models/get-token-result.ts | 2 +- .../src/multi-rollup/models/index.ts | 2 + .../src/multi-rollup/models/item.ts | 2 +- .../models/list-activities-result.ts | 2 +- .../multi-rollup/models/list-chains-result.ts | 2 +- .../models/list-collections-result.ts | 2 +- .../models/list-listings-result.ts | 2 +- .../models/list-nftowners-result.ts | 2 +- .../multi-rollup/models/list-nfts-result.ts | 2 +- .../multi-rollup/models/list-tokens-result.ts | 2 +- .../src/multi-rollup/models/listing-result.ts | 2 +- .../src/multi-rollup/models/mint.ts | 2 +- .../src/multi-rollup/models/model-error.ts | 2 +- .../src/multi-rollup/models/native-item.ts | 2 +- .../src/multi-rollup/models/nft.ts | 2 +- .../multi-rollup/models/nftcontract-type.ts | 2 +- .../models/nftmetadata-attribute-value.ts | 2 +- .../models/nftmetadata-attribute.ts | 2 +- .../models/nftmetadata-attributes.ts | 2 +- .../src/multi-rollup/models/nftowner.ts | 2 +- .../src/multi-rollup/models/nftsale.ts | 2 +- .../models/nftwith-metadata-attributes.ts | 2 +- .../src/multi-rollup/models/order-status.ts | 2 +- .../src/multi-rollup/models/order.ts | 2 +- .../src/multi-rollup/models/page.ts | 2 +- .../models/protocol-data-all-of.ts | 2 +- .../src/multi-rollup/models/protocol-data.ts | 2 +- .../src/multi-rollup/models/sale-fee.ts | 2 +- .../multi-rollup/models/sale-payment-token.ts | 2 +- .../src/multi-rollup/models/sale-payment.ts | 2 +- .../models/token-contract-type.ts | 2 +- .../src/multi-rollup/models/token.ts | 14 ++-- .../src/multi-rollup/models/transfer.ts | 2 +- .../src/multi-rollup/models/withdrawal.ts | 45 ++++++++++ 89 files changed, 268 insertions(+), 106 deletions(-) create mode 100644 packages/internal/generated-clients/src/multi-rollup/models/deposit.ts create mode 100644 packages/internal/generated-clients/src/multi-rollup/models/withdrawal.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index daffa50ab8..60f63bdbfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- @imtbl/blockchain-data: Added Deposit and Withdrawal activity types + ### Fixed - @imtbl/immutablex_client: Updated to use core-sdk v2.0.2 with grind key fixes. diff --git a/packages/internal/generated-clients/Makefile b/packages/internal/generated-clients/Makefile index 35e83d401a..bb86c7b75a 100644 --- a/packages/internal/generated-clients/Makefile +++ b/packages/internal/generated-clients/Makefile @@ -18,7 +18,7 @@ get-imx-openapi: get-mr-openapi: rm -f src/mr-openapi.json && touch src/mr-openapi.json && \ curl -H "Accept: application/json+v3" \ - https://imx-openapiv3-mr-dev.s3.us-east-2.amazonaws.com/openapi.json \ + https://imx-openapiv3-mr-sandbox.s3.us-east-2.amazonaws.com/openapi.json \ -o src/mr-openapi.json .PHONY: generate-imx-api-client diff --git a/packages/internal/generated-clients/src/mr-openapi.json b/packages/internal/generated-clients/src/mr-openapi.json index ac7dbbaa39..aa77e2bae2 100644 --- a/packages/internal/generated-clients/src/mr-openapi.json +++ b/packages/internal/generated-clients/src/mr-openapi.json @@ -1,7 +1,7 @@ { "openapi": "3.0.2", "info": { - "title": "Immutable X API", + "title": "Immutable zkEVM API", "version": "1.0.0", "description": "Immutable Multi Rollup API", "contact": { @@ -79,12 +79,6 @@ } ], "servers": [ - { - "url": "https://indexer-mr.sandbox.imtbl.com" - }, - { - "url": "https://order-book-mr.dev.imtbl.com" - }, { "url": "https://api.sandbox.immutable.com" } @@ -1328,7 +1322,9 @@ "mint", "burn", "transfer", - "sale" + "sale", + "deposit", + "withdrawal" ] }, "ActivityNFT": { @@ -1404,7 +1400,30 @@ } }, "required": [ - "activity_type", + "to", + "amount", + "asset" + ] + }, + "Deposit": { + "type": "object", + "description": "The deposit activity details", + "properties": { + "to": { + "description": "The account address the asset was deposited to", + "type": "string", + "example": "0xe9b00a87700f660e46b6f5deaa1232836bcc07d3" + }, + "amount": { + "description": "The deposited amount", + "type": "string", + "example": "1" + }, + "asset": { + "$ref": "#/components/schemas/ActivityAsset" + } + }, + "required": [ "to", "amount", "asset" @@ -1429,7 +1448,30 @@ } }, "required": [ - "activity_type", + "from", + "amount", + "asset" + ] + }, + "Withdrawal": { + "description": "The withdrawal activity details", + "type": "object", + "properties": { + "from": { + "description": "The account address the asset was withdrawn from", + "type": "string", + "example": "0xe9b00a87700f660e46b6f5deaa1232836bcc07d3" + }, + "amount": { + "description": "The amount of assets withdrawn", + "type": "string", + "example": "1" + }, + "asset": { + "$ref": "#/components/schemas/ActivityAsset" + } + }, + "required": [ "from", "amount", "asset" @@ -1579,7 +1621,6 @@ } }, "required": [ - "activity_type", "order_id", "to", "from", @@ -1601,6 +1642,12 @@ }, { "$ref": "#/components/schemas/NFTSale" + }, + { + "$ref": "#/components/schemas/Deposit" + }, + { + "$ref": "#/components/schemas/Withdrawal" } ] }, @@ -2185,26 +2232,38 @@ "$ref": "#/components/schemas/Chain" }, "contract_address": { - "type": "string" + "type": "string", + "description": "The address of token contract", + "example": "0xc344c05eef8876e517072f879dae8905aa2b956b" }, "root_contract_address": { "type": "string", + "description": "The address of root token contract", + "example": "0x43e60b30d5bec48c0f5890e3d1e9f1b1296bb4aa", "nullable": true }, "symbol": { "type": "string", + "description": "The symbol of token", + "example": "AAA", "nullable": true }, "decimals": { "type": "integer", + "description": "The decimals of token", + "example": 18, "nullable": true }, "image_url": { "type": "string", + "description": "The image url of token", + "example": "https://some-url", "nullable": true }, "name": { "type": "string", + "description": "The name of token", + "example": "Token A", "nullable": true } }, @@ -3031,7 +3090,6 @@ "required": [ "order_type", "counter", - "order_type", "zone_address", "seaport_address", "seaport_version" diff --git a/packages/internal/generated-clients/src/multi-rollup/.openapi-generator/FILES b/packages/internal/generated-clients/src/multi-rollup/.openapi-generator/FILES index 169f0cfd0a..ff34c443f2 100644 --- a/packages/internal/generated-clients/src/multi-rollup/.openapi-generator/FILES +++ b/packages/internal/generated-clients/src/multi-rollup/.openapi-generator/FILES @@ -46,6 +46,7 @@ models/create-counterfactual-address-request.ts models/create-counterfactual-address-res.ts models/create-listing-request-body.ts models/create-order-protocol-data.ts +models/deposit.ts models/erc20-item.ts models/erc721-item.ts models/fee.ts @@ -85,3 +86,4 @@ models/sale-payment.ts models/token-contract-type.ts models/token.ts models/transfer.ts +models/withdrawal.ts diff --git a/packages/internal/generated-clients/src/multi-rollup/api.ts b/packages/internal/generated-clients/src/multi-rollup/api.ts index 2d7d9cdc6e..429bc9e5de 100644 --- a/packages/internal/generated-clients/src/multi-rollup/api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/base.ts b/packages/internal/generated-clients/src/multi-rollup/base.ts index a26c62059f..73a8ed82c9 100644 --- a/packages/internal/generated-clients/src/multi-rollup/base.ts +++ b/packages/internal/generated-clients/src/multi-rollup/base.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 @@ -18,7 +18,7 @@ import { Configuration } from "./configuration"; // @ts-ignore import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; -export const BASE_PATH = "https://indexer-mr.sandbox.imtbl.com".replace(/\/+$/, ""); +export const BASE_PATH = "https://api.sandbox.immutable.com".replace(/\/+$/, ""); /** * diff --git a/packages/internal/generated-clients/src/multi-rollup/common.ts b/packages/internal/generated-clients/src/multi-rollup/common.ts index f33488f7e8..cde1135539 100644 --- a/packages/internal/generated-clients/src/multi-rollup/common.ts +++ b/packages/internal/generated-clients/src/multi-rollup/common.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/configuration.ts b/packages/internal/generated-clients/src/multi-rollup/configuration.ts index 2f82a847c6..dbd8c27057 100644 --- a/packages/internal/generated-clients/src/multi-rollup/configuration.ts +++ b/packages/internal/generated-clients/src/multi-rollup/configuration.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/activities-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/activities-api.ts index f20f6c8894..e7211f3aa1 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/activities-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/activities-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/chains-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/chains-api.ts index 5a31988015..42fa25e102 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/chains-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/chains-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/collections-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/collections-api.ts index 4c757092cb..cc51804a2e 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/collections-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/collections-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/nft-owners-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/nft-owners-api.ts index 4d2feda162..2ec96c251b 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/nft-owners-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/nft-owners-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/nfts-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/nfts-api.ts index 6881f1081a..1bfd850fbe 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/nfts-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/nfts-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/orders-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/orders-api.ts index 0aa7e9a252..60ac0f75b3 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/orders-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/orders-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/passport-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/passport-api.ts index da2f6c8077..226db5a6d3 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/passport-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/passport-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/domain/tokens-api.ts b/packages/internal/generated-clients/src/multi-rollup/domain/tokens-api.ts index 5a5afa4215..90668a0232 100644 --- a/packages/internal/generated-clients/src/multi-rollup/domain/tokens-api.ts +++ b/packages/internal/generated-clients/src/multi-rollup/domain/tokens-api.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/index.ts b/packages/internal/generated-clients/src/multi-rollup/index.ts index 6c1820ce02..389b9cc462 100644 --- a/packages/internal/generated-clients/src/multi-rollup/index.ts +++ b/packages/internal/generated-clients/src/multi-rollup/index.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity-asset.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity-asset.ts index 7395305aeb..66dc8d2a8d 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity-asset.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity-asset.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity-details.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity-details.ts index 206c4daa75..9ef3d44c79 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity-details.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity-details.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 @@ -15,12 +15,15 @@ // May contain unused imports in some cases // @ts-ignore -import { ActivityNFT } from './activity-nft'; +import { ActivityAsset } from './activity-asset'; // May contain unused imports in some cases // @ts-ignore import { Burn } from './burn'; // May contain unused imports in some cases // @ts-ignore +import { Deposit } from './deposit'; +// May contain unused imports in some cases +// @ts-ignore import { Mint } from './mint'; // May contain unused imports in some cases // @ts-ignore @@ -31,12 +34,15 @@ import { SalePayment } from './sale-payment'; // May contain unused imports in some cases // @ts-ignore import { Transfer } from './transfer'; +// May contain unused imports in some cases +// @ts-ignore +import { Withdrawal } from './withdrawal'; /** * @type ActivityDetails * The activity details * @export */ -export type ActivityDetails = Burn | Mint | NFTSale | Transfer; +export type ActivityDetails = Burn | Deposit | Mint | NFTSale | Transfer | Withdrawal; diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity-native-token.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity-native-token.ts index 4cb64f87df..6af4254792 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity-native-token.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity-native-token.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity-nft.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity-nft.ts index 16eb459ef6..1f997f10dc 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity-nft.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity-nft.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity-token.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity-token.ts index 890079f86b..fd4344b3e7 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity-token.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity-token.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity-type.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity-type.ts index 2565a8dea7..0cc2167bf2 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity-type.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity-type.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 @@ -24,7 +24,9 @@ export const ActivityType = { Mint: 'mint', Burn: 'burn', Transfer: 'transfer', - Sale: 'sale' + Sale: 'sale', + Deposit: 'deposit', + Withdrawal: 'withdrawal' } as const; export type ActivityType = typeof ActivityType[keyof typeof ActivityType]; diff --git a/packages/internal/generated-clients/src/multi-rollup/models/activity.ts b/packages/internal/generated-clients/src/multi-rollup/models/activity.ts index 59d5007a31..64b06f018c 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/activity.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/activity.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror400-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror400-all-of.ts index 4e734dcd39..a7800322f8 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror400-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror400-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror400.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror400.ts index 9b43302d7a..9b2a55ddc3 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror400.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror400.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror401-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror401-all-of.ts index c338860c89..f05071efdb 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror401-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror401-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror401.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror401.ts index 09a1e52a25..f63680ed7e 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror401.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror401.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror403-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror403-all-of.ts index c1532a8415..fb3d6c9116 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror403-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror403-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror403.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror403.ts index da84679afb..fda1a858d2 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror403.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror403.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror404-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror404-all-of.ts index a52024b236..b4d9d6aa72 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror404-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror404-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror404.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror404.ts index 14a46ebde6..b1f67c7ecd 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror404.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror404.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror429-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror429-all-of.ts index 8ffa8719f5..deffdd9a15 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror429-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror429-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror429.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror429.ts index 118f2cb938..1794fcdd9a 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror429.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror429.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror500-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror500-all-of.ts index 7826f0a4d1..ce396c9b51 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror500-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror500-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/apierror500.ts b/packages/internal/generated-clients/src/multi-rollup/models/apierror500.ts index a353662eaf..3827487594 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/apierror500.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/apierror500.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/basic-apierror.ts b/packages/internal/generated-clients/src/multi-rollup/models/basic-apierror.ts index a627ec3745..4e812afa5d 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/basic-apierror.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/basic-apierror.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/blockchain-metadata.ts b/packages/internal/generated-clients/src/multi-rollup/models/blockchain-metadata.ts index 76db67889f..f38b8b8b08 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/blockchain-metadata.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/blockchain-metadata.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/burn.ts b/packages/internal/generated-clients/src/multi-rollup/models/burn.ts index 9ba1323f13..cc24f8dde4 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/burn.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/burn.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details-all-of.ts index 8ac8573dd7..c1128c98f6 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details.ts b/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details.ts index 2ecf537e67..29e89d9d0a 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/chain-with-details.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/chain.ts b/packages/internal/generated-clients/src/multi-rollup/models/chain.ts index 80918030a8..36c6ffa1f6 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/chain.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/chain.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/collection-contract-type.ts b/packages/internal/generated-clients/src/multi-rollup/models/collection-contract-type.ts index d486fcd04c..d9cc049aee 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/collection-contract-type.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/collection-contract-type.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/collection.ts b/packages/internal/generated-clients/src/multi-rollup/models/collection.ts index 1c90dd8212..4ee8cb5d0a 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/collection.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/collection.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-request.ts b/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-request.ts index a2fe9baa51..b420c62b5a 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-request.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-request.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-res.ts b/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-res.ts index acece589c4..4cc1c1f49e 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-res.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/create-counterfactual-address-res.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/create-listing-request-body.ts b/packages/internal/generated-clients/src/multi-rollup/models/create-listing-request-body.ts index 4fc0f1a394..a70a33cbb5 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/create-listing-request-body.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/create-listing-request-body.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/create-order-protocol-data.ts b/packages/internal/generated-clients/src/multi-rollup/models/create-order-protocol-data.ts index 158798fbc5..f8fe8b64e3 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/create-order-protocol-data.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/create-order-protocol-data.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/deposit.ts b/packages/internal/generated-clients/src/multi-rollup/models/deposit.ts new file mode 100644 index 0000000000..18be07429d --- /dev/null +++ b/packages/internal/generated-clients/src/multi-rollup/models/deposit.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { ActivityAsset } from './activity-asset'; + +/** + * The deposit activity details + * @export + * @interface Deposit + */ +export interface Deposit { + /** + * The account address the asset was deposited to + * @type {string} + * @memberof Deposit + */ + 'to': string; + /** + * The deposited amount + * @type {string} + * @memberof Deposit + */ + 'amount': string; + /** + * + * @type {ActivityAsset} + * @memberof Deposit + */ + 'asset': ActivityAsset; +} + diff --git a/packages/internal/generated-clients/src/multi-rollup/models/erc20-item.ts b/packages/internal/generated-clients/src/multi-rollup/models/erc20-item.ts index 37a3d9551f..e4afbb40ef 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/erc20-item.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/erc20-item.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/erc721-item.ts b/packages/internal/generated-clients/src/multi-rollup/models/erc721-item.ts index 584d7fe911..70f6adf4a5 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/erc721-item.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/erc721-item.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/fee.ts b/packages/internal/generated-clients/src/multi-rollup/models/fee.ts index c041e4ab84..5f4a6dbbef 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/fee.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/fee.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/get-activity-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/get-activity-result.ts index 16fa1c83eb..07c96ea948 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/get-activity-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/get-activity-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/get-collection-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/get-collection-result.ts index f139aab63b..2a3af16a94 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/get-collection-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/get-collection-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/get-nftresult.ts b/packages/internal/generated-clients/src/multi-rollup/models/get-nftresult.ts index 1ae057422d..0209315a88 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/get-nftresult.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/get-nftresult.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/get-token-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/get-token-result.ts index fbf7a6b364..fd0cb3e1ab 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/get-token-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/get-token-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/index.ts b/packages/internal/generated-clients/src/multi-rollup/models/index.ts index e5acb36389..1e7ff8a426 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/index.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/index.ts @@ -29,6 +29,7 @@ export * from './create-counterfactual-address-request'; export * from './create-counterfactual-address-res'; export * from './create-listing-request-body'; export * from './create-order-protocol-data'; +export * from './deposit'; export * from './erc20-item'; export * from './erc721-item'; export * from './fee'; @@ -67,3 +68,4 @@ export * from './sale-payment-token'; export * from './token'; export * from './token-contract-type'; export * from './transfer'; +export * from './withdrawal'; diff --git a/packages/internal/generated-clients/src/multi-rollup/models/item.ts b/packages/internal/generated-clients/src/multi-rollup/models/item.ts index 4d7f598804..4d476a277a 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/item.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/item.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-activities-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-activities-result.ts index acc388c9b7..506bcf22fa 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-activities-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-activities-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-chains-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-chains-result.ts index a81d61fc7c..d4433df821 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-chains-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-chains-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-collections-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-collections-result.ts index e2151c9465..b8d0377dc4 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-collections-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-collections-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-listings-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-listings-result.ts index 97efba7779..f0789b5507 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-listings-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-listings-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-nftowners-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-nftowners-result.ts index 75ee04695e..b5bf69185c 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-nftowners-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-nftowners-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-nfts-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-nfts-result.ts index 9d4816cfd0..4eb6013baa 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-nfts-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-nfts-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/list-tokens-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/list-tokens-result.ts index ecdca970f0..f303b3d770 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/list-tokens-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/list-tokens-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/listing-result.ts b/packages/internal/generated-clients/src/multi-rollup/models/listing-result.ts index 099906a36a..fb4c7c061d 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/listing-result.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/listing-result.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/mint.ts b/packages/internal/generated-clients/src/multi-rollup/models/mint.ts index 55a06fd1fe..c4ae6c085f 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/mint.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/mint.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/model-error.ts b/packages/internal/generated-clients/src/multi-rollup/models/model-error.ts index 732a0309ef..d5bff3ee72 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/model-error.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/model-error.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/native-item.ts b/packages/internal/generated-clients/src/multi-rollup/models/native-item.ts index b377a4505b..3199e2e0b2 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/native-item.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/native-item.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nft.ts b/packages/internal/generated-clients/src/multi-rollup/models/nft.ts index 452bebeb21..2cc6f72d82 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nft.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nft.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftcontract-type.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftcontract-type.ts index 3eb742c067..1d89b8431c 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftcontract-type.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftcontract-type.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute-value.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute-value.ts index e16c469de5..902cbf473e 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute-value.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute-value.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute.ts index d3e48a0a45..ffb16ffe8c 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attribute.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attributes.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attributes.ts index 3a8f6d08c2..013d03fe4b 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attributes.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftmetadata-attributes.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftowner.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftowner.ts index 287d1a6aa2..a63855ff80 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftowner.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftowner.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftsale.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftsale.ts index 38f7b6a070..973da2aeaf 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftsale.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftsale.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/nftwith-metadata-attributes.ts b/packages/internal/generated-clients/src/multi-rollup/models/nftwith-metadata-attributes.ts index 32f0f45515..1c8bc4e9bc 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/nftwith-metadata-attributes.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/nftwith-metadata-attributes.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/order-status.ts b/packages/internal/generated-clients/src/multi-rollup/models/order-status.ts index 5a03d1a300..815a37cb36 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/order-status.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/order-status.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/order.ts b/packages/internal/generated-clients/src/multi-rollup/models/order.ts index 740bafa087..3c8303c7f8 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/order.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/order.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/page.ts b/packages/internal/generated-clients/src/multi-rollup/models/page.ts index 918d5825b7..7d6106ada6 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/page.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/page.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/protocol-data-all-of.ts b/packages/internal/generated-clients/src/multi-rollup/models/protocol-data-all-of.ts index dbfea16690..090854635d 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/protocol-data-all-of.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/protocol-data-all-of.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/protocol-data.ts b/packages/internal/generated-clients/src/multi-rollup/models/protocol-data.ts index 207e31eaa4..902f62fb70 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/protocol-data.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/protocol-data.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/sale-fee.ts b/packages/internal/generated-clients/src/multi-rollup/models/sale-fee.ts index 6f51fb66cf..7ed12b657a 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/sale-fee.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/sale-fee.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/sale-payment-token.ts b/packages/internal/generated-clients/src/multi-rollup/models/sale-payment-token.ts index da17df9a5e..cf3b70fdb7 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/sale-payment-token.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/sale-payment-token.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/sale-payment.ts b/packages/internal/generated-clients/src/multi-rollup/models/sale-payment.ts index 3876a5bbb8..9f151856fb 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/sale-payment.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/sale-payment.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/token-contract-type.ts b/packages/internal/generated-clients/src/multi-rollup/models/token-contract-type.ts index 39fd5ab705..e9d4ae4d5c 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/token-contract-type.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/token-contract-type.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/token.ts b/packages/internal/generated-clients/src/multi-rollup/models/token.ts index 12dbeb0b65..09c3d67942 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/token.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/token.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 @@ -30,37 +30,37 @@ export interface Token { */ 'chain': Chain; /** - * + * The address of token contract * @type {string} * @memberof Token */ 'contract_address': string; /** - * + * The address of root token contract * @type {string} * @memberof Token */ 'root_contract_address': string | null; /** - * + * The symbol of token * @type {string} * @memberof Token */ 'symbol': string | null; /** - * + * The decimals of token * @type {number} * @memberof Token */ 'decimals': number | null; /** - * + * The image url of token * @type {string} * @memberof Token */ 'image_url': string | null; /** - * + * The name of token * @type {string} * @memberof Token */ diff --git a/packages/internal/generated-clients/src/multi-rollup/models/transfer.ts b/packages/internal/generated-clients/src/multi-rollup/models/transfer.ts index d5f092122e..21a99c0a75 100644 --- a/packages/internal/generated-clients/src/multi-rollup/models/transfer.ts +++ b/packages/internal/generated-clients/src/multi-rollup/models/transfer.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ /** - * Immutable X API + * Immutable zkEVM API * Immutable Multi Rollup API * * The version of the OpenAPI document: 1.0.0 diff --git a/packages/internal/generated-clients/src/multi-rollup/models/withdrawal.ts b/packages/internal/generated-clients/src/multi-rollup/models/withdrawal.ts new file mode 100644 index 0000000000..832bcb445a --- /dev/null +++ b/packages/internal/generated-clients/src/multi-rollup/models/withdrawal.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { ActivityAsset } from './activity-asset'; + +/** + * The withdrawal activity details + * @export + * @interface Withdrawal + */ +export interface Withdrawal { + /** + * The account address the asset was withdrawn from + * @type {string} + * @memberof Withdrawal + */ + 'from': string; + /** + * The amount of assets withdrawn + * @type {string} + * @memberof Withdrawal + */ + 'amount': string; + /** + * + * @type {ActivityAsset} + * @memberof Withdrawal + */ + 'asset': ActivityAsset; +} + From 7dd627b9a3d6628f835507c62a13a32320d4fae9 Mon Sep 17 00:00:00 2001 From: Zoraiz Mahmood <35128199+rzmahmood@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:35:10 +1000 Subject: [PATCH 7/9] Bridge SDK Native Token Deposits + Withdrawals [NO-CHANGELOG] (#562) --- .../view-context/BridgeViewContextTypes.ts | 4 +- .../src/widgets/bridge/BridgeWidget.cy.tsx | 14 +- .../bridge/components/BridgeForm.cy.tsx | 34 +- .../widgets/bridge/components/BridgeForm.tsx | 10 +- .../widgets/bridge/views/MoveInProgress.tsx | 4 +- .../bridge/bridge-sample-app/src/index.ts | 106 ++- .../bridge/sdk/src/config/config.test.ts | 4 +- .../internal/bridge/sdk/src/config/index.ts | 10 +- .../bridge/sdk/src/constants/bridges.ts | 27 +- .../src/contracts/ABIs/CheckpointManager.ts | 444 +++++++++++ .../sdk/src/contracts/ABIs/ChildERC20.ts | 483 +++++++++++ .../src/contracts/ABIs/ChildERC20Predicate.ts | 404 ++++++++++ .../sdk/src/contracts/ABIs/ExitHelper.ts | 148 ++++ .../sdk/src/contracts/ABIs/L2StateSender.ts | 77 ++ .../src/contracts/ABIs/RootERC20Predicate.ts | 34 +- .../internal/bridge/sdk/src/errors/index.ts | 9 +- .../bridge/sdk/src/lib/decodeExtraData.ts | 35 + .../bridge/sdk/src/tokenBridge.test.ts | 135 ++-- .../internal/bridge/sdk/src/tokenBridge.ts | 749 ++++++++++++++---- .../internal/bridge/sdk/src/types/index.ts | 178 ++++- 20 files changed, 2620 insertions(+), 289 deletions(-) create mode 100644 packages/internal/bridge/sdk/src/contracts/ABIs/CheckpointManager.ts create mode 100644 packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20.ts create mode 100644 packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20Predicate.ts create mode 100644 packages/internal/bridge/sdk/src/contracts/ABIs/ExitHelper.ts create mode 100644 packages/internal/bridge/sdk/src/contracts/ABIs/L2StateSender.ts create mode 100644 packages/internal/bridge/sdk/src/lib/decodeExtraData.ts diff --git a/packages/checkout/widgets-lib/src/context/view-context/BridgeViewContextTypes.ts b/packages/checkout/widgets-lib/src/context/view-context/BridgeViewContextTypes.ts index 50c12feba9..1bc05f41d5 100644 --- a/packages/checkout/widgets-lib/src/context/view-context/BridgeViewContextTypes.ts +++ b/packages/checkout/widgets-lib/src/context/view-context/BridgeViewContextTypes.ts @@ -1,6 +1,6 @@ import { TransactionResponse } from '@ethersproject/providers'; import { - ApproveBridgeResponse, + ApproveDepositBridgeResponse, BridgeDepositResponse, } from '@imtbl/bridge-sdk'; import { TokenInfo } from '@imtbl/checkout-sdk'; @@ -55,7 +55,7 @@ interface BridgeInProgressView extends ViewType { } export interface ApproveERC20BridgeData { - approveTransaction: ApproveBridgeResponse; + approveTransaction: ApproveDepositBridgeResponse; transaction: BridgeDepositResponse; bridgeFormInfo: PrefilledBridgeForm; } diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWidget.cy.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWidget.cy.tsx index 86a7bd6323..296507e881 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWidget.cy.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/BridgeWidget.cy.tsx @@ -251,7 +251,7 @@ describe('Bridge Widget tests', () => { describe('Bridge Submit', () => { beforeEach(() => { - cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') .resolves({ required: true, unsignedTx: {}, @@ -333,7 +333,7 @@ describe('Bridge Widget tests', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce'); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce'); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce'); cySmartGet('simple-text-body__heading').should('have.text', approveSpending.content.heading); @@ -413,7 +413,7 @@ describe('Bridge Widget tests', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce'); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce'); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce'); cySmartGet('footer-button').click(); @@ -464,7 +464,7 @@ describe('Bridge Widget tests', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce'); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce'); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce'); cySmartGet('footer-button').click(); @@ -521,7 +521,7 @@ describe('Bridge Widget tests', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce'); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce'); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce'); cySmartGet('footer-button').click(); @@ -575,7 +575,7 @@ describe('Bridge Widget tests', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce'); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce'); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce'); cySmartGet('footer-button').click(); cySmartGet('@sendTransactionStub').should('have.been.calledOnce'); @@ -629,7 +629,7 @@ describe('Bridge Widget tests', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce'); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce'); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce'); cySmartGet('footer-button').click(); cySmartGet('@sendTransactionStub').should('have.been.calledOnce'); diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.cy.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.cy.tsx index d8db85617b..fd218e1c91 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.cy.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.cy.tsx @@ -176,7 +176,7 @@ describe('Bridge Form', () => { // }); it('should set defaults when provided and ignore casing on token address', () => { - cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') .resolves({ required: true, unsignedTx: {}, @@ -205,7 +205,7 @@ describe('Bridge Form', () => { describe('Bridge Form submit', () => { it('should submit bridge and make required sdk calls', () => { - cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') .resolves({ required: true, unsignedTx: {}, @@ -264,7 +264,7 @@ describe('Bridge Form', () => { }); it('should submit bridge and skip approval if not required', () => { - cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') .resolves({ required: false, }); @@ -305,11 +305,12 @@ describe('Bridge Form', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce').should('have.been.calledWith', { - depositorAddress: '0x123', - token: imxAddress, - depositAmount: utils.parseUnits('0.1', 18), - }); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce') + .should('have.been.calledWith', { + depositorAddress: '0x123', + token: imxAddress, + depositAmount: utils.parseUnits('0.1', 18), + }); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce').should('have.been.calledWith', { depositorAddress: '0x123', @@ -328,7 +329,7 @@ describe('Bridge Form', () => { describe('when approval transaction is not required and user rejected signing the bridge transaction', () => { beforeEach(() => { - cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') .resolves({ required: false, }); @@ -367,11 +368,12 @@ describe('Bridge Form', () => { cySmartGet('bridge-amount-text__input').blur(); cySmartGet('bridge-form-button').click(); - cySmartGet('@getUnsignedApproveBridgeTxStub').should('have.been.calledOnce').should('have.been.calledWith', { - depositorAddress: '0x123', - token: imxAddress, - depositAmount: utils.parseUnits('0.1', 18), - }); + cySmartGet('@getUnsignedApproveDepositBridgeTxStub').should('have.been.calledOnce') + .should('have.been.calledWith', { + depositorAddress: '0x123', + token: imxAddress, + depositAmount: utils.parseUnits('0.1', 18), + }); cySmartGet('@getUnsignedDepositTxStub').should('have.been.calledOnce').should('have.been.calledWith', { depositorAddress: '0x123', @@ -419,7 +421,7 @@ describe('Bridge Form', () => { }], }; - cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') .resolves({ required: false, }); @@ -493,7 +495,7 @@ describe('Bridge Form', () => { // }], // }; - // cy.stub(TokenBridge.prototype, 'getUnsignedApproveBridgeTx').as('getUnsignedApproveBridgeTxStub') + // cy.stub(TokenBridge.prototype, 'getUnsignedApproveDepositBridgeTx').as('getUnsignedApproveDepositBridgeTxStub') // .resolves({ // required: false, // }); diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx index 0d25be4e34..12ad2ef683 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx @@ -7,7 +7,7 @@ import { import { useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react'; -import { ApproveBridgeResponse, BridgeDepositResponse } from '@imtbl/bridge-sdk'; +import { ApproveDepositBridgeResponse, BridgeDepositResponse } from '@imtbl/bridge-sdk'; import { BigNumber, utils } from 'ethers'; import { parseEther } from 'ethers/lib/utils'; import { amountInputValidation } from '../../../lib/validations/amountInputValidations'; @@ -73,7 +73,7 @@ export function BridgeForm(props: BridgeFormProps) { const [estimates, setEstimates] = useState(undefined); const [gasFee, setGasFee] = useState(''); const [gasFeeFiatValue, setGasFeeFiatValue] = useState(''); - const [approvalTransaction, setApprovalTransaction] = useState(undefined); + const [approvalTransaction, setApprovalTransaction] = useState(undefined); const [unsignedBridgeTransaction, setUnsignedBridgeTransaction] = useState(undefined); const [tokensOptions, setTokensOptions] = useState([]); @@ -156,13 +156,13 @@ export function BridgeForm(props: BridgeFormProps) { }; const getUnsignedTransactions = async () - : Promise<{ approveRes: ApproveBridgeResponse, bridgeTxn:BridgeDepositResponse } | undefined> => { + : Promise<{ approveRes: ApproveDepositBridgeResponse, bridgeTxn:BridgeDepositResponse } | undefined> => { if (!checkout || !provider || !tokenBridge || !token || !token.token?.address) return; const depositorAddress = await provider.getSigner().getAddress(); const depositAmount = utils.parseUnits(amount, token.token.decimals); - const approveRes: ApproveBridgeResponse = await tokenBridge.getUnsignedApproveBridgeTx({ + const approveRes: ApproveDepositBridgeResponse = await tokenBridge.getUnsignedApproveDepositBridgeTx({ depositorAddress, token: token.token.address, depositAmount, @@ -344,7 +344,7 @@ export function BridgeForm(props: BridgeFormProps) { try { setLoading(true); - if (approvalTransaction && approvalTransaction.required && approvalTransaction.unsignedTx) { + if (approvalTransaction && approvalTransaction.unsignedTx) { // move to new Approve ERC20 view // pass in approvalTransaction and unsignedBridgeTransaction viewDispatch({ diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx index 14686143fc..76922a50fd 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx @@ -1,7 +1,7 @@ import { TokenInfo } from '@imtbl/checkout-sdk'; import { TransactionResponse } from '@ethersproject/providers'; import { useContext, useEffect } from 'react'; -import { CompletionStatus, WaitForResponse } from '@imtbl/bridge-sdk'; +import { CompletionStatus, WaitForDepositResponse } from '@imtbl/bridge-sdk'; import { SimpleTextBody } from '../../../components/Body/SimpleTextBody'; import { HeaderNavigation } from '../../../components/Header/HeaderNavigation'; import { BridgeHero } from '../../../components/Hero/BridgeHero'; @@ -36,7 +36,7 @@ export function MoveInProgress({ token, transactionResponse, bridgeForm }: MoveI const receipt = await transactionResponse.wait(); if (receipt.status === 1) { - const bridgeResult: WaitForResponse = await tokenBridge.waitForDeposit({ + const bridgeResult: WaitForDepositResponse = await tokenBridge.waitForDeposit({ transactionHash: receipt.transactionHash, }); diff --git a/packages/internal/bridge/bridge-sample-app/src/index.ts b/packages/internal/bridge/bridge-sample-app/src/index.ts index e99961246e..9977e92949 100644 --- a/packages/internal/bridge/bridge-sample-app/src/index.ts +++ b/packages/internal/bridge/bridge-sample-app/src/index.ts @@ -4,16 +4,24 @@ import { ethers } from 'ethers'; import { TokenBridge, BridgeConfiguration, - ETH_SEPOLIA_TO_ZKEVM_DEVNET, BridgeFeeRequest, - ApproveBridgeRequest, - ApproveBridgeResponse, + ApproveDepositBridgeRequest, + ApproveDepositBridgeResponse, BridgeFeeResponse, BridgeDepositRequest, BridgeDepositResponse, - WaitForRequest, - WaitForResponse, + WaitForDepositRequest, + WaitForDepositResponse, CompletionStatus, + BridgeWithdrawRequest, + ETH_SEPOLIA_TO_ZKEVM_TESTNET, + CHILD_CHAIN_NATIVE_TOKEN_ADDRESS, + WaitForWithdrawalRequest, + WaitForWithdrawalResponse, + ExitRequest, + ApproveWithdrawBridgeRequest, + ApproveWithdrawBridgeResponse, + ETH_SEPOLIA_TO_ZKEVM_DEVNET, } from '@imtbl/bridge-sdk'; /** @@ -21,8 +29,9 @@ import { * It uses environment variables for configuration values. * It creates a token bridge instance, gets the bridge fee, calculates the deposit amount, * approves the deposit, and waits for the deposit to complete on L2. + * It then withdraws the deposited amount to the recipient address. */ -async function deposit() { +async function depositAndWithdraw() { // Check and throw errors if required environment variables are not set if (!process.env.ROOT_PROVIDER) { console.log(process.env.ROOT_PROVIDER); @@ -66,6 +75,12 @@ async function deposit() { rootChainProvider, ); + // Create a wallet instance to simulate the user's wallet + const checkoutChildChain = new ethers.Wallet( + process.env.PRIVATE_KEY, + childChainProvider, + ); + // Create a bridge configuration instance const bridgeConfig = new BridgeConfiguration({ baseConfig: new ImmutableConfiguration({ @@ -89,20 +104,17 @@ async function deposit() { const depositAmount = bridgeFeeResponse.feeAmount.add(depositAmountBeforeFee); console.log(`Deposit Amount inclusive of fees is ${depositAmount}`); - const approveReq: ApproveBridgeRequest = { + const approveReq: ApproveDepositBridgeRequest = { depositorAddress: process.env.DEPOSITOR_ADDRESS, token: process.env.TOKEN_ADDRESS, depositAmount, }; // Get the unsigned approval transaction for the deposit - const approveResp: ApproveBridgeResponse = await tokenBridge.getUnsignedApproveBridgeTx(approveReq); + const approveResp: ApproveDepositBridgeResponse = await tokenBridge.getUnsignedApproveDepositBridgeTx(approveReq); // If approval is required, sign and send the approval transaction - if (approveResp.required) { - if (!approveResp.unsignedTx) { - throw new Error('tx is null'); - } + if (approveResp.unsignedTx) { console.log('Sending Approve Tx'); const txResponseApprove = await checkout.sendTransaction( approveResp.unsignedTx, @@ -117,7 +129,6 @@ async function deposit() { // Get the unsigned deposit transaction and send it on L1 const depositArgs: BridgeDepositRequest = { - depositorAddress: process.env.DEPOSITOR_ADDRESS, recipientAddress: process.env.RECIPIENT_ADDRESS, token: process.env.TOKEN_ADDRESS, depositAmount, @@ -126,6 +137,8 @@ async function deposit() { const unsignedDepositResult: BridgeDepositResponse = await tokenBridge.getUnsignedDepositTx(depositArgs); console.log('Sending Deposit Tx'); // Sign and Send the signed transaction + + const txResponse = await checkout.sendTransaction( unsignedDepositResult.unsignedTx, ); @@ -140,10 +153,10 @@ async function deposit() { console.log('MUST BE CONNECTED TO VPN to connect to zkEVM'); console.log('Waiting for Deposit to complete on L2...'); // Wait for the deposit to complete on L2 - const waitReq: WaitForRequest = { + const waitReq: WaitForDepositRequest = { transactionHash: txReceipt.transactionHash, }; - const bridgeResult: WaitForResponse = await tokenBridge.waitForDeposit( + const bridgeResult: WaitForDepositResponse = await tokenBridge.waitForDeposit( waitReq, ); if (bridgeResult.status === CompletionStatus.SUCCESS) { @@ -153,10 +166,71 @@ async function deposit() { console.log( `Deposit Failed on L2 with status ${bridgeResult.status}`, ); + return; } + + console.log(`Starting WITHDRAWAL`); + console.log(`Approving Bridge`); + const withdrawResponse = await tokenBridge.rootTokenToChildToken({ rootToken: process.env.TOKEN_ADDRESS}); + console.log(`Deposit token was ${process.env.TOKEN_ADDRESS}, withdrawal token is ${withdrawResponse.childToken}`); + // Approval + const childApproveReq: ApproveWithdrawBridgeRequest = { + withdrawerAddress: process.env.DEPOSITOR_ADDRESS, + token: withdrawResponse.childToken, + withdrawAmount: depositAmount, + }; + + // Get the unsigned approval transaction for the deposit + const childApproveResp: ApproveWithdrawBridgeResponse = await tokenBridge.getUnsignedApproveWithdrawBridgeTx(childApproveReq); + + // If approval is required, sign and send the approval transaction + if (childApproveResp.unsignedTx) { + console.log('Sending Approve Tx'); + const txResponseApprove = await checkoutChildChain.sendTransaction( + childApproveResp.unsignedTx, + ); + const txApprovalReceipt = await txResponseApprove.wait(); + console.log( + `Approval Tx Completed with hash: ${txApprovalReceipt.transactionHash}`, + ); + } else { + console.log('Approval not required'); + } + + const withdrawlReq: BridgeWithdrawRequest = { + recipientAddress: process.env.DEPOSITOR_ADDRESS, + token: withdrawResponse.childToken, + withdrawAmount: depositAmount + }; + + const unsignedWithdrawReq = await tokenBridge.getUnsignedWithdrawTx(withdrawlReq); + console.log("Sending withdraw tx"); + const txWithdraw = await checkoutChildChain.sendTransaction(unsignedWithdrawReq.unsignedTx); + const txWithdrawReceipt = await txWithdraw.wait(1); + console.log(`Withdrawal tx hash: ${txWithdrawReceipt.transactionHash}`) + + // TODO: Given a tx hash, wait till next epoch + const withdrawalRequest: WaitForWithdrawalRequest = { + transactionHash: txWithdrawReceipt.transactionHash, + } + console.log(`Waiting for withdrawal...this may take a while`); + const waitForWithdrawalResp: WaitForWithdrawalResponse = await tokenBridge.waitForWithdrawal(withdrawalRequest); + console.log(waitForWithdrawalResp) + + // TODO: Exit on Layer 1 + console.log(`Exiting on Layer 1`) + const exitRequest: ExitRequest = { + transactionHash: txWithdrawReceipt.transactionHash, + } + const exitTxResponse = await tokenBridge.getUnsignedExitTx(exitRequest); + + const exitTx = await checkout.sendTransaction(exitTxResponse.unsignedTx); + console.log(exitTx) + const exitTxReceipt = await exitTx.wait(1); + console.log(exitTxReceipt); } // Run the deposit function and exit the process when completed (async () => { - await deposit().then(() => {console.log(`Exiting Successfully`); process.exit(0)}).catch(e => {console.log(`Exiting with error: ${e.toString()}`); process.exit(1)}); + await depositAndWithdraw().then(() => {console.log(`Exiting Successfully`); process.exit(0)}).catch(e => {console.log(`Exiting with error: ${e.toString()}`); process.exit(1)}); })(); diff --git a/packages/internal/bridge/sdk/src/config/config.test.ts b/packages/internal/bridge/sdk/src/config/config.test.ts index 5e21c8f547..092c46d118 100644 --- a/packages/internal/bridge/sdk/src/config/config.test.ts +++ b/packages/internal/bridge/sdk/src/config/config.test.ts @@ -34,7 +34,7 @@ describe('config', () => { expect(() => new BridgeConfiguration(bridgeModuleConfiguration)).toThrow( new Error( - `Bridge instance with rootchain eip155:11155111 and childchain ${ZKEVM_DEVNET_CHAIN_ID} is not supported in environment production`, + `Bridge instance with rootchain 11155111 and childchain ${ZKEVM_DEVNET_CHAIN_ID} is not supported in environment production`, ), ); }); @@ -48,6 +48,8 @@ describe('config', () => { bridgeContracts: { rootChainERC20Predicate: '0x', rootChainStateSender: '0x', + rootChainCheckpointManager: '0x', + rootChainExitHelper: '0x', childChainERC20Predicate: '0x', childChainStateReceiver: '0x', }, diff --git a/packages/internal/bridge/sdk/src/config/index.ts b/packages/internal/bridge/sdk/src/config/index.ts index 266edfadb0..4edbd54745 100644 --- a/packages/internal/bridge/sdk/src/config/index.ts +++ b/packages/internal/bridge/sdk/src/config/index.ts @@ -36,20 +36,26 @@ export const SUPPORTED_BRIDGES_FOR_ENVIRONMENT: { */ const CONTRACTS_FOR_BRIDGE = new Map() .set(ETH_SEPOLIA_TO_ZKEVM_DEVNET, { - rootChainERC20Predicate: '0xf0b3435411A74F1aeCBD0fd6D53a90D5227fEeba', - rootChainStateSender: '0x868097dbAcfD431F441d09D0e4D3B5eD3182E597', + rootChainERC20Predicate: '0xAC0f2096732D40096B3356AD76ba60a2f02366c8', + rootChainStateSender: '0xeA76fcCdD791A9c231CAda787ae7535c8a5E55B5', + rootChainCheckpointManager: '0x321A466aa78F5957C6E2375114915EcD14DAdE44', + rootChainExitHelper: '0x55cA8C418bbB0aC87414F9ea6FFC6a33860Cf967', childChainERC20Predicate: '0x0000000000000000000000000000000000001004', childChainStateReceiver: '0x0000000000000000000000000000000000001001', }) .set(ETH_SEPOLIA_TO_ZKEVM_TESTNET, { rootChainERC20Predicate: '0x0C15a8359865867CdCC44f98b2F3fd5DF098C7E0', rootChainStateSender: '0x4C80001188db53dbc2eaAb32d5ef825feEedECA5', + rootChainCheckpointManager: '0x0F3157bc91f66C350f87172bBB28d9417167074F', + rootChainExitHelper: '0xB057A6C4e951a315E9f2DAe6d28B83cD0480e873', childChainERC20Predicate: '0x0000000000000000000000000000000000001004', childChainStateReceiver: '0x0000000000000000000000000000000000001001', }) .set(ETH_MAINNET_TO_ZKEVM_MAINNET, { rootChainERC20Predicate: '0x', rootChainStateSender: '0x', + rootChainCheckpointManager: '0x', + rootChainExitHelper: '0x', childChainERC20Predicate: '0x', childChainStateReceiver: '0x', }); diff --git a/packages/internal/bridge/sdk/src/constants/bridges.ts b/packages/internal/bridge/sdk/src/constants/bridges.ts index 4fce9ef206..1fe4b7c858 100644 --- a/packages/internal/bridge/sdk/src/constants/bridges.ts +++ b/packages/internal/bridge/sdk/src/constants/bridges.ts @@ -3,24 +3,41 @@ import { BridgeInstance } from 'types'; /** * @constant {string} ETH_SEPOLIA_CHAIN_ID - The chain ID for the Ethereum Sepolia testnet (EIP-155 compatible format). */ -export const ETH_SEPOLIA_CHAIN_ID = 'eip155:11155111'; +export const ETH_SEPOLIA_CHAIN_ID = '11155111'; /** * @constant {string} ETH_MAINNET_CHAIN_ID - The chain ID for the Ethereum mainnet (EIP-155 compatible format). */ -export const ETH_MAINNET_CHAIN_ID = 'eip155:1'; +export const ETH_MAINNET_CHAIN_ID = '1'; /** * @constant {string} ZKEVM_DEVNET_CHAIN_ID - The chain ID for the zkEVM devnet (EIP-155 compatible format). */ -export const ZKEVM_DEVNET_CHAIN_ID = 'eip155:13423'; +export const ZKEVM_DEVNET_CHAIN_ID = '13433'; /** /** * @constant {string} ZKEVM_TESTNET_CHAIN_ID - The chain ID for the zkEVM testnet (EIP-155 compatible format). */ -export const ZKEVM_TESTNET_CHAIN_ID = 'eip155:13372'; +export const ZKEVM_TESTNET_CHAIN_ID = '13372'; /** * @constant {string} ZKEVM_MAINNET_CHAIN_ID - The chain ID for the zkEVM mainnet (EIP-155 compatible format). */ -export const ZKEVM_MAINNET_CHAIN_ID = 'eip155:13371'; +export const ZKEVM_MAINNET_CHAIN_ID = '13371'; + +/** + * @constant {string} CHILD_CHAIN_NATIVE_TOKEN_ADDRESS - Address of the native token on the child chain. + */ +export const CHILD_CHAIN_NATIVE_TOKEN_ADDRESS = '0x0000000000000000000000000000000000001010'; + +/** + * @constant {string} L2_STATE_SENDER_ADDRESS - Address of bridge contract to the rootchain + */ +export const L2_STATE_SENDER_ADDRESS = '0x0000000000000000000000000000000000001002'; + +/** + * The constant value representing the native token in the token bridge context. + * The key is used to indicate the native token of a blockchain network (like Ether in Ethereum) in methods that normally require a token address. + * @constant {string} + */ +export const NATIVE_TOKEN_BRIDGE_KEY = '0x0000000000000000000000000000000000000001'; /** * @constant {BridgeInstance} ETH_SEPOLIA_TO_ZKEVM_DEVNET - A bridge instance configuration for bridging between the Ethereum Sepolia testnet and the zkEVM devnet. diff --git a/packages/internal/bridge/sdk/src/contracts/ABIs/CheckpointManager.ts b/packages/internal/bridge/sdk/src/contracts/ABIs/CheckpointManager.ts new file mode 100644 index 0000000000..2825981766 --- /dev/null +++ b/packages/internal/bridge/sdk/src/contracts/ABIs/CheckpointManager.ts @@ -0,0 +1,444 @@ +export const CHECKPOINT_MANAGER = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint8', + name: 'version', + type: 'uint8', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + inputs: [], + name: 'DOMAIN', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'bls', + outputs: [ + { + internalType: 'contract IBLS', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'bn256G2', + outputs: [ + { + internalType: 'contract IBN256G2', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'chainId', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'checkpointBlockNumbers', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'checkpoints', + outputs: [ + { + internalType: 'uint256', + name: 'epoch', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'eventRoot', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'currentCheckpointBlockNumber', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'currentEpoch', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'currentValidatorSet', + outputs: [ + { + internalType: 'address', + name: '_address', + type: 'address', + }, + { + internalType: 'uint256', + name: 'votingPower', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'currentValidatorSetHash', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'currentValidatorSetLength', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + ], + name: 'getCheckpointBlock', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'leaf', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'leafIndex', + type: 'uint256', + }, + { + internalType: 'bytes32[]', + name: 'proof', + type: 'bytes32[]', + }, + ], + name: 'getEventMembershipByBlockNumber', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'epoch', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'leaf', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'leafIndex', + type: 'uint256', + }, + { + internalType: 'bytes32[]', + name: 'proof', + type: 'bytes32[]', + }, + ], + name: 'getEventMembershipByEpoch', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + ], + name: 'getEventRootByBlock', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IBLS', + name: 'newBls', + type: 'address', + }, + { + internalType: 'contract IBN256G2', + name: 'newBn256G2', + type: 'address', + }, + { + internalType: 'uint256', + name: 'chainId_', + type: 'uint256', + }, + { + components: [ + { + internalType: 'address', + name: '_address', + type: 'address', + }, + { + internalType: 'uint256[4]', + name: 'blsKey', + type: 'uint256[4]', + }, + { + internalType: 'uint256', + name: 'votingPower', + type: 'uint256', + }, + ], + internalType: 'struct ICheckpointManager.Validator[]', + name: 'newValidatorSet', + type: 'tuple[]', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'bytes32', + name: 'blockHash', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'blockRound', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'currentValidatorSetHash', + type: 'bytes32', + }, + ], + internalType: 'struct ICheckpointManager.CheckpointMetadata', + name: 'checkpointMetadata', + type: 'tuple', + }, + { + components: [ + { + internalType: 'uint256', + name: 'epoch', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'eventRoot', + type: 'bytes32', + }, + ], + internalType: 'struct ICheckpointManager.Checkpoint', + name: 'checkpoint', + type: 'tuple', + }, + { + internalType: 'uint256[2]', + name: 'signature', + type: 'uint256[2]', + }, + { + components: [ + { + internalType: 'address', + name: '_address', + type: 'address', + }, + { + internalType: 'uint256[4]', + name: 'blsKey', + type: 'uint256[4]', + }, + { + internalType: 'uint256', + name: 'votingPower', + type: 'uint256', + }, + ], + internalType: 'struct ICheckpointManager.Validator[]', + name: 'newValidatorSet', + type: 'tuple[]', + }, + { + internalType: 'bytes', + name: 'bitmap', + type: 'bytes', + }, + ], + name: 'submit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'totalVotingPower', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, +]; diff --git a/packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20.ts b/packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20.ts new file mode 100644 index 0000000000..27627efe17 --- /dev/null +++ b/packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20.ts @@ -0,0 +1,483 @@ +export const CHILD_ERC20 = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint8', + name: 'version', + type: 'uint8', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'userAddress', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'relayerAddress', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes', + name: 'functionSignature', + type: 'bytes', + }, + ], + name: 'MetaTransactionExecuted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'burn', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'subtractedValue', + type: 'uint256', + }, + ], + name: 'decreaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'userAddress', + type: 'address', + }, + { + internalType: 'bytes', + name: 'functionSignature', + type: 'bytes', + }, + { + internalType: 'bytes32', + name: 'sigR', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'sigS', + type: 'bytes32', + }, + { + internalType: 'uint8', + name: 'sigV', + type: 'uint8', + }, + ], + name: 'executeMetaTransaction', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'user', + type: 'address', + }, + ], + name: 'getNonce', + outputs: [ + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'addedValue', + type: 'uint256', + }, + ], + name: 'increaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'rootToken_', + type: 'address', + }, + { + internalType: 'string', + name: 'name_', + type: 'string', + }, + { + internalType: 'string', + name: 'symbol_', + type: 'string', + }, + { + internalType: 'uint8', + name: 'decimals_', + type: 'uint8', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'offset', + type: 'uint256', + }, + ], + name: 'invalidateNext', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'mint', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'predicate', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'rootToken', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +]; diff --git a/packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20Predicate.ts b/packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20Predicate.ts new file mode 100644 index 0000000000..002c825502 --- /dev/null +++ b/packages/internal/bridge/sdk/src/contracts/ABIs/ChildERC20Predicate.ts @@ -0,0 +1,404 @@ +export const CHILD_ERC20_PREDICATE = [ + { + inputs: [ + { + internalType: 'string', + name: 'only', + type: 'string', + }, + ], + name: 'Unauthorized', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint8', + name: 'version', + type: 'uint8', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'rootToken', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'childToken', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'L2ERC20Deposit', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'rootToken', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'childToken', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'L2ERC20Withdraw', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'rootToken', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'childToken', + type: 'address', + }, + ], + name: 'L2TokenMapped', + type: 'event', + }, + { + inputs: [], + name: 'DEPOSIT_SIG', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MAP_TOKEN_SIG', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NATIVE_TOKEN_CONTRACT', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NATIVE_TRANSFER_PRECOMPILE', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NATIVE_TRANSFER_PRECOMPILE_GAS', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'SYSTEM', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'VALIDATOR_PKCHECK_PRECOMPILE', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'VALIDATOR_PKCHECK_PRECOMPILE_GAS', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'WITHDRAW_SIG', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'childTokenTemplate', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newL2StateSender', + type: 'address', + }, + { + internalType: 'address', + name: 'newStateReceiver', + type: 'address', + }, + { + internalType: 'address', + name: 'newRootERC20Predicate', + type: 'address', + }, + { + internalType: 'address', + name: 'newChildTokenTemplate', + type: 'address', + }, + { + internalType: 'address', + name: 'newNativeTokenRootAddress', + type: 'address', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'l2StateSender', + outputs: [ + { + internalType: 'contract IStateSender', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'onStateReceive', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'rootERC20Predicate', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'rootTokenToChildToken', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'stateReceiver', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IChildERC20', + name: 'childToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'withdraw', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IChildERC20', + name: 'childToken', + type: 'address', + }, + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'withdrawTo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +]; diff --git a/packages/internal/bridge/sdk/src/contracts/ABIs/ExitHelper.ts b/packages/internal/bridge/sdk/src/contracts/ABIs/ExitHelper.ts new file mode 100644 index 0000000000..b25360fd45 --- /dev/null +++ b/packages/internal/bridge/sdk/src/contracts/ABIs/ExitHelper.ts @@ -0,0 +1,148 @@ +export const EXIT_HELPER = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'id', + type: 'uint256', + }, + { + indexed: true, + internalType: 'bool', + name: 'success', + type: 'bool', + }, + { + indexed: false, + internalType: 'bytes', + name: 'returnData', + type: 'bytes', + }, + ], + name: 'ExitProcessed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint8', + name: 'version', + type: 'uint8', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + inputs: [ + { + components: [ + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'leafIndex', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'unhashedLeaf', + type: 'bytes', + }, + { + internalType: 'bytes32[]', + name: 'proof', + type: 'bytes32[]', + }, + ], + internalType: 'struct IExitHelper.BatchExitInput[]', + name: 'inputs', + type: 'tuple[]', + }, + ], + name: 'batchExit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'checkpointManager', + outputs: [ + { + internalType: 'contract ICheckpointManager', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'leafIndex', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'unhashedLeaf', + type: 'bytes', + }, + { + internalType: 'bytes32[]', + name: 'proof', + type: 'bytes32[]', + }, + ], + name: 'exit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract ICheckpointManager', + name: 'newCheckpointManager', + type: 'address', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'processedExits', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, +]; diff --git a/packages/internal/bridge/sdk/src/contracts/ABIs/L2StateSender.ts b/packages/internal/bridge/sdk/src/contracts/ABIs/L2StateSender.ts new file mode 100644 index 0000000000..881ed8f6c0 --- /dev/null +++ b/packages/internal/bridge/sdk/src/contracts/ABIs/L2StateSender.ts @@ -0,0 +1,77 @@ +export const L2_STATE_SENDER = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'id', + type: 'uint256', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'L2StateSynced', + type: 'event', + }, + { + inputs: [], + name: 'MAX_LENGTH', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'counter', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'syncState', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +]; diff --git a/packages/internal/bridge/sdk/src/contracts/ABIs/RootERC20Predicate.ts b/packages/internal/bridge/sdk/src/contracts/ABIs/RootERC20Predicate.ts index ae11fd33ba..b79c0d6559 100644 --- a/packages/internal/bridge/sdk/src/contracts/ABIs/RootERC20Predicate.ts +++ b/packages/internal/bridge/sdk/src/contracts/ABIs/RootERC20Predicate.ts @@ -131,6 +131,19 @@ export const ROOT_ERC20_PREDICATE = [ stateMutability: 'view', type: 'function', }, + { + inputs: [], + name: 'NATIVE_TOKEN', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, { inputs: [], name: 'WITHDRAW_SIG', @@ -188,6 +201,19 @@ export const ROOT_ERC20_PREDICATE = [ stateMutability: 'nonpayable', type: 'function', }, + { + inputs: [ + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + ], + name: 'depositNativeTo', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, { inputs: [ { @@ -266,7 +292,13 @@ export const ROOT_ERC20_PREDICATE = [ }, ], name: 'mapToken', - outputs: [], + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], stateMutability: 'nonpayable', type: 'function', }, diff --git a/packages/internal/bridge/sdk/src/errors/index.ts b/packages/internal/bridge/sdk/src/errors/index.ts index 0aba0266c3..c33dfd5496 100644 --- a/packages/internal/bridge/sdk/src/errors/index.ts +++ b/packages/internal/bridge/sdk/src/errors/index.ts @@ -8,6 +8,8 @@ export enum BridgeErrorType { INTERNAL_ERROR = 'INTERNAL_ERROR', PROVIDER_ERROR = 'PROVIDER_ERROR', TRANSACTION_REVERTED = 'TRANSACTION_REVERTED', + INVALID_TOKEN = 'INVALID_TOKEN', + INVALID_TRANSACTION = 'INVALID_TRANSACTION', } /** @@ -38,16 +40,21 @@ export class BridgeError extends Error { * @template T - The type of the value that the Promise resolves to. * @param {() => Promise} fn - The function to wrap with error handling. * @param {BridgeErrorType} customErrorType - The custom error type to use for the error. + * @param {string} [details] - Additional details to add to the error message. * @returns {Promise} The result of the wrapped function or a rejected promise with a BridgeError. */ export const withBridgeError = async ( fn: () => Promise, customErrorType: BridgeErrorType, + details?: string, ): Promise => { try { return await fn(); } catch (error) { - const errorMessage = `${customErrorType}: ${(error as Error).message}` || 'UnknownError'; + let errorMessage = `${customErrorType}: ${(error as Error).message}` || 'UnknownError'; + if (details) { + errorMessage = `${details}: ${errorMessage}`; + } throw new BridgeError(errorMessage, customErrorType); } }; diff --git a/packages/internal/bridge/sdk/src/lib/decodeExtraData.ts b/packages/internal/bridge/sdk/src/lib/decodeExtraData.ts new file mode 100644 index 0000000000..3faa49af3d --- /dev/null +++ b/packages/internal/bridge/sdk/src/lib/decodeExtraData.ts @@ -0,0 +1,35 @@ +import { ethers } from 'ethers'; + +interface CheckpointData { + blockRound: number; + epochNumber: number; + currentValidatorHash: string; + nextValidatorHash: string; + eventRoot: string; +} + +interface BlockExtraData { + validators: string[]; + parent: string[]; + committed: string[]; + checkpoint: CheckpointData +} + +export function decodeExtraData(extraData: string): BlockExtraData { + const decoded = ethers.utils.RLP.decode(`0x${extraData.substring(66)}`); + + const blockExtraData: BlockExtraData = { + validators: decoded[0], + parent: decoded[1], + committed: decoded[2], + checkpoint: { + blockRound: decoded[3][0], + epochNumber: parseInt(decoded[3][1], 16), + currentValidatorHash: decoded[3][2], + nextValidatorHash: decoded[3][3], + eventRoot: decoded[3][4], + }, + }; + + return blockExtraData; +} diff --git a/packages/internal/bridge/sdk/src/tokenBridge.test.ts b/packages/internal/bridge/sdk/src/tokenBridge.test.ts index 6d65652f0c..4ea3ea9a89 100644 --- a/packages/internal/bridge/sdk/src/tokenBridge.test.ts +++ b/packages/internal/bridge/sdk/src/tokenBridge.test.ts @@ -25,7 +25,7 @@ describe('Token Bridge', () => { expect(bridge).toBeDefined(); }); - describe('getUnsignedApproveBridgeTx', () => { + describe('getUnsignedApproveRootBridgeTx', () => { let tokenBridge: TokenBridge; const mockERC20Contract = { allowance: jest.fn(), @@ -53,6 +53,7 @@ describe('Token Bridge', () => { jest.clearAllMocks(); }); it('returns the unsigned approval transaction when the allowance is less than the deposit amount', async () => { + expect.assertions(5); const allowance = ethers.utils.parseUnits('50', 18); const depositAmount = ethers.utils.parseUnits('100', 18); @@ -65,8 +66,7 @@ describe('Token Bridge', () => { depositAmount, }; - const result = await tokenBridge.getUnsignedApproveBridgeTx(req); - expect(result.required).toBe(true); + const result = await tokenBridge.getUnsignedApproveDepositBridgeTx(req); expect(result.unsignedTx).toBeDefined(); expect(result.unsignedTx?.data).toBe('0xdata'); expect(result.unsignedTx?.to).toBe(req.token); @@ -74,7 +74,8 @@ describe('Token Bridge', () => { expect(result.unsignedTx?.value).toBe(0); }); - it('return not requird when the allowance is greater than the deposit amount', async () => { + it('return null tx when the allowance is greater than the deposit amount', async () => { + expect.assertions(1); const allowance = ethers.utils.parseUnits('200', 18); const depositAmount = ethers.utils.parseUnits('100', 18); @@ -87,24 +88,28 @@ describe('Token Bridge', () => { depositAmount, }; - const result = await tokenBridge.getUnsignedApproveBridgeTx(req); - expect(result.required).toBe(false); + const result = await tokenBridge.getUnsignedApproveDepositBridgeTx(req); expect(result.unsignedTx).toBeNull(); }); - it('throws an error when the token is NATIVE', async () => { + it('return null tx when the token is NATIVE', async () => { + expect.assertions(1); + const result = await tokenBridge.getUnsignedApproveDepositBridgeTx({ token: 'NATIVE', depositorAddress: '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816', depositAmount: ethers.utils.parseUnits('0.01', 18) }); + expect(result.unsignedTx).toBeNull(); + }); + it('throws an error when depositorAddress is not a valid address and the token is ERC20', async () => { expect.assertions(2); try { - await tokenBridge.getUnsignedApproveBridgeTx({ token: 'NATIVE', depositorAddress: '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816', depositAmount: ethers.utils.parseUnits('0.01', 18) }); + await tokenBridge.getUnsignedApproveDepositBridgeTx({ token: '0x1234567890123456789012345678901234567890', depositorAddress: 'invalidAddress', depositAmount: ethers.utils.parseUnits('0.01', 18) }); } catch (error: any) { expect(error).toBeInstanceOf(BridgeError); - expect(error.type).toBe(BridgeErrorType.UNSUPPORTED_ERROR); + expect(error.type).toBe(BridgeErrorType.INVALID_ADDRESS); } }); - it('throws an error when depositorAddress is not a valid address', async () => { + it('throws an error when depositorAddress is not a valid address and the token is NATIVE', async () => { expect.assertions(2); try { - await tokenBridge.getUnsignedApproveBridgeTx({ token: 'ERC20', depositorAddress: 'invalidAddress', depositAmount: ethers.utils.parseUnits('0.01', 18) }); + await tokenBridge.getUnsignedApproveDepositBridgeTx({ token: 'NATIVE', depositorAddress: 'invalidAddress', depositAmount: ethers.utils.parseUnits('0.01', 18) }); } catch (error: any) { expect(error).toBeInstanceOf(BridgeError); expect(error.type).toBe(BridgeErrorType.INVALID_ADDRESS); @@ -113,16 +118,25 @@ describe('Token Bridge', () => { it('throws an error when token is not a valid address', async () => { expect.assertions(2); try { - await tokenBridge.getUnsignedApproveBridgeTx({ token: 'invalidToken', depositorAddress: '0x1234567890123456789012345678901234567890', depositAmount: ethers.utils.parseUnits('0.01', 18) }); + await tokenBridge.getUnsignedApproveDepositBridgeTx({ token: 'invalidToken', depositorAddress: '0x1234567890123456789012345678901234567890', depositAmount: ethers.utils.parseUnits('0.01', 18) }); } catch (error: any) { expect(error).toBeInstanceOf(BridgeError); expect(error.type).toBe(BridgeErrorType.INVALID_ADDRESS); } }); - it('throws an error when depositAmount is less than or equal to 0', async () => { + it('throws an error when depositAmount is less than or equal to 0 and token is ERC20', async () => { + expect.assertions(2); + try { + await tokenBridge.getUnsignedApproveDepositBridgeTx({ token: '0x1234567890123456789012345678901234567890', depositorAddress: '0x1234567890123456789012345678901234567890', depositAmount: ethers.BigNumber.from(0) }); + } catch (error: any) { + expect(error).toBeInstanceOf(BridgeError); + expect(error.type).toBe(BridgeErrorType.INVALID_AMOUNT); + } + }); + it('throws an error when depositAmount is less than or equal to 0 and token is NATIVE', async () => { expect.assertions(2); try { - await tokenBridge.getUnsignedApproveBridgeTx({ token: '0x1234567890123456789012345678901234567890', depositorAddress: '0x1234567890123456789012345678901234567890', depositAmount: ethers.BigNumber.from(0) }); + await tokenBridge.getUnsignedApproveDepositBridgeTx({ token: 'NATIVE', depositorAddress: '0x1234567890123456789012345678901234567890', depositAmount: ethers.BigNumber.from(0) }); } catch (error: any) { expect(error).toBeInstanceOf(BridgeError); expect(error.type).toBe(BridgeErrorType.INVALID_AMOUNT); @@ -149,18 +163,16 @@ describe('Token Bridge', () => { }); it('ERC20 token with valid arguments is successful', async () => { - const depositorAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + expect.assertions(3); const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = '0x2f14582947E292a2eCd20C430B46f2d27CFE213c'; const depositAmount = ethers.utils.parseUnits('0.01', 18); const request: BridgeDepositRequest = { - depositorAddress, depositAmount, recipientAddress, token, }; const response: BridgeDepositResponse = await tokenBridge.getUnsignedDepositTx(request); - expect(response.unsignedTx.from).toBe(depositorAddress); expect(response.unsignedTx.to).toBe( bridgeConfig.bridgeContracts.rootChainERC20Predicate, ); @@ -168,41 +180,34 @@ describe('Token Bridge', () => { expect(response.unsignedTx.data).not.toBeNull(); }); - it('Native token fails with unsupported error', async () => { - const depositorAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + it('Native token with valid arguments is successful', async () => { + expect.assertions(3); const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = 'NATIVE'; const depositAmount = ethers.utils.parseUnits('0.01', 18); const request: BridgeDepositRequest = { - depositorAddress, depositAmount, recipientAddress, token, }; - await expect(async () => { - await tokenBridge.getUnsignedDepositTx(request); - }).rejects.toThrow( - new BridgeError( - 'native token deposit is not yet supported', - BridgeErrorType.INVALID_ADDRESS, - ), - ); + const response: BridgeDepositResponse = await tokenBridge.getUnsignedDepositTx(request); + expect(response.unsignedTx.to).toBe(bridgeConfig.bridgeContracts.rootChainERC20Predicate); + expect(response.unsignedTx.value).toBe(depositAmount); + expect(response.unsignedTx.data).not.toBeNull(); }); it('ERC20 token with no-prefix addresses is successful', async () => { - const depositorAddress = '3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + expect.assertions(3); const recipientAddress = '3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = '2f14582947E292a2eCd20C430B46f2d27CFE213c'; const depositAmount = ethers.utils.parseUnits('0.01', 18); const request: BridgeDepositRequest = { - depositorAddress, depositAmount, recipientAddress, token, }; const response: BridgeDepositResponse = await tokenBridge.getUnsignedDepositTx(request); - expect(response.unsignedTx.from).toBe(`0x${depositorAddress}`); expect(response.unsignedTx.to).toBe( bridgeConfig.bridgeContracts.rootChainERC20Predicate, ); @@ -210,13 +215,12 @@ describe('Token Bridge', () => { expect(response.unsignedTx.data).not.toBeNull(); }); - it('ERC20 token with invalid depositor address fails', async () => { - const depositorAddress = 'xxxx3095171469a0db24D9Fb9C789D62dF22BBAfa816'; - const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + it('ERC20 token with invalid receipient address fails', async () => { + expect.assertions(1); + const recipientAddress = 'zzzz3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = '0x2f14582947E292a2eCd20C430B46f2d27CFE213c'; const depositAmount = ethers.utils.parseUnits('0.01', 18); const request: BridgeDepositRequest = { - depositorAddress, depositAmount, recipientAddress, token, @@ -226,18 +230,17 @@ describe('Token Bridge', () => { await tokenBridge.getUnsignedDepositTx(request); }).rejects.toThrow( new BridgeError( - 'depositor address xxxx3095171469a0db24D9Fb9C789D62dF22BBAfa816 is not a valid address', + 'address zzzz3095171469a0db24D9Fb9C789D62dF22BBAfa816 is not a valid address', BridgeErrorType.INVALID_ADDRESS, ), ); }); - it('ERC20 token with invalid receipient address fails', async () => { - const depositorAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + it('NATIVE token with invalid receipient address fails', async () => { + expect.assertions(1); const recipientAddress = 'zzzz3095171469a0db24D9Fb9C789D62dF22BBAfa816'; - const token = '0x2f14582947E292a2eCd20C430B46f2d27CFE213c'; + const token = 'NATIVE'; const depositAmount = ethers.utils.parseUnits('0.01', 18); const request: BridgeDepositRequest = { - depositorAddress, depositAmount, recipientAddress, token, @@ -247,18 +250,17 @@ describe('Token Bridge', () => { await tokenBridge.getUnsignedDepositTx(request); }).rejects.toThrow( new BridgeError( - 'recipient address zzzz3095171469a0db24D9Fb9C789D62dF22BBAfa816 is not a valid address', + 'address zzzz3095171469a0db24D9Fb9C789D62dF22BBAfa816 is not a valid address', BridgeErrorType.INVALID_ADDRESS, ), ); }); it('ERC20 token with invalid token address fails', async () => { - const depositorAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + expect.assertions(1); const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = 'zzzzf14582947E292a2eCd20C430B46f2d27CFE213c'; const depositAmount = ethers.utils.parseUnits('0.01', 18); const request: BridgeDepositRequest = { - depositorAddress, depositAmount, recipientAddress, token, @@ -275,12 +277,32 @@ describe('Token Bridge', () => { }); it('ERC20 token with 0 amount fails', async () => { - const depositorAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + expect.assertions(1); const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = '0x2f14582947E292a2eCd20C430B46f2d27CFE213c'; const depositAmount = ethers.utils.parseUnits('0', 18); const request: BridgeDepositRequest = { - depositorAddress, + depositAmount, + recipientAddress, + token, + }; + + await expect(async () => { + await tokenBridge.getUnsignedDepositTx(request); + }).rejects.toThrow( + new BridgeError( + 'deposit amount 0 is invalid', + BridgeErrorType.INVALID_AMOUNT, + ), + ); + }); + + it('NATIVE token with 0 amount fails', async () => { + expect.assertions(1); + const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + const token = 'NATIVE'; + const depositAmount = ethers.utils.parseUnits('0', 18); + const request: BridgeDepositRequest = { depositAmount, recipientAddress, token, @@ -296,12 +318,31 @@ describe('Token Bridge', () => { ); }); it('ERC20 token with negative amount fails', async () => { - const depositorAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + expect.assertions(1); const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; const token = '0x2f14582947E292a2eCd20C430B46f2d27CFE213c'; const depositAmount = ethers.utils.parseUnits('-1', 18); const request: BridgeDepositRequest = { - depositorAddress, + depositAmount, + recipientAddress, + token, + }; + + await expect(async () => { + await tokenBridge.getUnsignedDepositTx(request); + }).rejects.toThrow( + new BridgeError( + 'deposit amount -1000000000000000000 is invalid', + BridgeErrorType.INVALID_AMOUNT, + ), + ); + }); + it('NATIVE token with negative amount fails', async () => { + expect.assertions(1); + const recipientAddress = '0x3095171469a0db24D9Fb9C789D62dF22BBAfa816'; + const token = 'NATIVE'; + const depositAmount = ethers.utils.parseUnits('-1', 18); + const request: BridgeDepositRequest = { depositAmount, recipientAddress, token, diff --git a/packages/internal/bridge/sdk/src/tokenBridge.ts b/packages/internal/bridge/sdk/src/tokenBridge.ts index a35295497b..908a9fdb51 100644 --- a/packages/internal/bridge/sdk/src/tokenBridge.ts +++ b/packages/internal/bridge/sdk/src/tokenBridge.ts @@ -1,16 +1,27 @@ import { BridgeConfiguration } from 'config'; import { ethers } from 'ethers'; import { - ApproveBridgeRequest, - ApproveBridgeResponse, + ApproveDepositBridgeRequest, + ApproveDepositBridgeResponse, + ApproveWithdrawBridgeRequest, + ApproveWithdrawBridgeResponse, BridgeDepositRequest, BridgeDepositResponse, BridgeFeeRequest, BridgeFeeResponse, + BridgeWithdrawRequest, + BridgeWithdrawResponse, + ChildTokenToRootTokenRequest, + ChildTokenToRootTokenResponse, CompletionStatus, - FungibleToken, - WaitForRequest, - WaitForResponse, + ExitRequest, + ExitResponse, + RootTokenToChildTokenRequest, + RootTokenToChildTokenResponse, + WaitForDepositRequest, + WaitForDepositResponse, + WaitForWithdrawalRequest, + WaitForWithdrawalResponse, } from 'types'; import { ROOT_ERC20_PREDICATE } from 'contracts/ABIs/RootERC20Predicate'; import { ERC20 } from 'contracts/ABIs/ERC20'; @@ -18,6 +29,13 @@ import { BridgeError, BridgeErrorType, withBridgeError } from 'errors'; import { ROOT_STATE_SENDER } from 'contracts/ABIs/RootStateSender'; import { CHILD_STATE_RECEIVER } from 'contracts/ABIs/ChildStateReceiver'; import { getBlockNumberClosestToTimestamp } from 'lib/getBlockCloseToTimestamp'; +import { CHILD_ERC20_PREDICATE } from 'contracts/ABIs/ChildERC20Predicate'; +import { CHECKPOINT_MANAGER } from 'contracts/ABIs/CheckpointManager'; +import { decodeExtraData } from 'lib/decodeExtraData'; +import { L2_STATE_SENDER_ADDRESS, NATIVE_TOKEN_BRIDGE_KEY } from 'constants/bridges'; +import { L2_STATE_SENDER } from 'contracts/ABIs/L2StateSender'; +import { EXIT_HELPER } from 'contracts/ABIs/ExitHelper'; +import { CHILD_ERC20 } from 'contracts/ABIs/ChildERC20'; /** * Represents a token bridge, which manages asset transfers between two chains. @@ -38,7 +56,8 @@ export class TokenBridge { } /** - * Retrieves the bridge fee for a specific token. + * Retrieves the bridge fee for depositing a specific token, used to reimburse the bridge-relayer. + * It is clipped from the deposit amount. * * @param {BridgeFeeRequest} req - The fee request object containing the token address for which the fee is required. * @returns {Promise} - A promise that resolves to an object containing the bridge fee for the specified token and a flag indicating if the token is bridgeable. @@ -49,7 +68,12 @@ export class TokenBridge { * * @example * const feeRequest = { - * token: '0x123456...', // ERC20 token address + * token: '0x123456...', // token + * }; + * + * @example + * const feeRequest = { + * token: 'NATIVE', // token * }; * * bridgeSdk.getFee(feeRequest) @@ -62,7 +86,8 @@ export class TokenBridge { * }); */ public async getFee(req: BridgeFeeRequest): Promise { - if (!ethers.utils.isAddress(req.token)) { + this.validateChainConfiguration(); + if (req.token !== 'NATIVE' && !ethers.utils.isAddress(req.token)) { throw new BridgeError( `token address ${req.token} is not a valid address`, BridgeErrorType.INVALID_ADDRESS, @@ -70,12 +95,99 @@ export class TokenBridge { } return { bridgeable: true, - feeAmount: await this.getFeeForToken(req.token), + feeAmount: ethers.BigNumber.from(0), + }; + } + + /** + * Retrieves the unsigned approval transaction for a deposit to the bridge. + * Approval is required before depositing tokens to the bridge using + * + * @param {ApproveBridgeRequest} req - The approve bridge request object containing the depositor address, token address, and deposit amount. + * @returns {Promise} - A promise that resolves to an object containing the unsigned approval transaction and a flag indicating if the approval is required. + * @throws {BridgeError} - If an error occurs during the transaction creation, a BridgeError will be thrown with a specific error type. + * + * Possible BridgeError types include: + * - UNSUPPORTED_ERROR: The operation is not supported. Currently thrown when attempting to deposit native tokens. + * - INVALID_ADDRESS: An Ethereum address provided in the request is invalid. + * - INVALID_AMOUNT: The deposit amount provided in the request is invalid (less than or equal to 0). + * - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation. + * - PROVIDER_ERROR: An error occurred while interacting with the Ethereum provider. This includes issues calling the ERC20 smart contract + * + * @example + * const approveRequest = { + * depositorAddress: '0x123456...', // Depositor's Ethereum address + * token: '0xabcdef...', // ERC20 token address + * depositAmount: ethers.utils.parseUnits('100', 18), // Deposit amount in token's smallest unit (e.g., wei for Ether) + * }; + * + * bridgeSdk.getUnsignedApproveDepositBridgeTx(approveRequest) + * .then((approveResponse) => { + * if (approveResponse.unsignedTx) { + * // Send the unsigned approval transaction to the depositor to sign and send + * } else { + * // No approval is required + * } + * }) + * .catch((error) => { + * console.error('Error:', error.message); + * }); + */ + public async getUnsignedApproveDepositBridgeTx( + req: ApproveDepositBridgeRequest, + ): Promise { + this.validateChainConfiguration(); + + TokenBridge.validateDepositArgs(req.depositorAddress, req.depositAmount, req.token); + + // If the token is NATIVE, no approval is required + if (req.token === 'NATIVE') { + return { + unsignedTx: null, + }; + } + + const erc20Contract: ethers.Contract = await withBridgeError(async () => new ethers.Contract(req.token, ERC20, this.config.rootProvider), BridgeErrorType.PROVIDER_ERROR); + + // Get the current approved allowance of the RootERC20Predicate + const rootERC20PredicateAllowance: ethers.BigNumber = await withBridgeError(() => erc20Contract.allowance( + req.depositorAddress, + this.config.bridgeContracts.rootChainERC20Predicate, + ), BridgeErrorType.PROVIDER_ERROR); + + // If the allowance is greater than or equal to the deposit amount, no approval is required + if (rootERC20PredicateAllowance.gte(req.depositAmount)) { + return { + unsignedTx: null, + }; + } + // Calculate the amount of tokens that need to be approved for deposit + const approvalAmountRequired = req.depositAmount.sub( + rootERC20PredicateAllowance, + ); + + // Encode the approve function call data for the ERC20 contract + const data: string = await withBridgeError(async () => erc20Contract.interface.encodeFunctionData('approve', [ + this.config.bridgeContracts.rootChainERC20Predicate, + approvalAmountRequired, + ]), BridgeErrorType.INTERNAL_ERROR); + + // Create the unsigned transaction for the approval + const unsignedTx: ethers.providers.TransactionRequest = { + data, + to: req.token, + value: 0, + from: req.depositorAddress, + }; + + return { + unsignedTx, }; } /** * Generates an unsigned deposit transaction for a user to sign and submit to the bridge. + * Must be called after bridgeSdk.getUnsignedApproveDepositBridgeTx to ensure user has approved sufficient tokens for deposit. * * @param {BridgeDepositRequest} req - The deposit request object containing the required data for depositing tokens. * @returns {Promise} - A promise that resolves to an object containing the unsigned transaction data. @@ -88,13 +200,21 @@ export class TokenBridge { * - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation. * * @example - * const depositRequest = { + * const depositERC20Request = { * token: '0x123456...', // ERC20 token address * depositorAddress: '0xabcdef...', // User's wallet address * recipientAddress: '0x987654...', // Destination wallet address on the target chain * depositAmount: ethers.utils.parseUnits('100', 18), // Deposit amount in wei * }; * + * @example + * const depositEtherTokenRequest = { + * token: 'NATIVE', + * depositorAddress: '0xabcdef...', // User's wallet address + * recipientAddress: '0x987654...', // Destination wallet address on the target chain + * depositAmount: ethers.utils.parseUnits('100', 18), // Deposit amount in wei + * }; + * * bridgeSdk.getUnsignedDepositTx(depositRequest) * .then((depositResponse) => { * console.log(depositResponse.unsignedTx); @@ -106,46 +226,9 @@ export class TokenBridge { public async getUnsignedDepositTx( req: BridgeDepositRequest, ): Promise { - if (req.token === 'NATIVE') { - throw new BridgeError( - 'native token deposit is not yet supported', - BridgeErrorType.UNSUPPORTED_ERROR, - ); - } - - if (!ethers.utils.isAddress(req.depositorAddress)) { - throw new BridgeError( - `depositor address ${req.depositorAddress} is not a valid address`, - BridgeErrorType.INVALID_ADDRESS, - ); - } + this.validateChainConfiguration(); - if (!ethers.utils.isAddress(req.recipientAddress)) { - throw new BridgeError( - `recipient address ${req.recipientAddress} is not a valid address`, - BridgeErrorType.INVALID_ADDRESS, - ); - } - - // If the token is ERC20, the address must be valid - if (req.token !== 'NATIVE' && !ethers.utils.isAddress(req.token)) { - throw new BridgeError( - `token address ${req.token} is not a valid address`, - BridgeErrorType.INVALID_ADDRESS, - ); - } - // The deposit amount cannot be <= 0 - if (req.depositAmount.isNegative() || req.depositAmount.isZero()) { - throw new BridgeError( - `deposit amount ${req.depositAmount.toString()} is invalid`, - BridgeErrorType.INVALID_AMOUNT, - ); - } - - // Convert the addresses to correct format addresses (e.g. prepend 0x if not already) - const depositor = ethers.utils.getAddress(req.depositorAddress); - const receipient = ethers.utils.getAddress(req.recipientAddress); - const token = ethers.utils.getAddress(req.token); + TokenBridge.validateDepositArgs(req.recipientAddress, req.depositAmount, req.token); const rootERC20PredicateContract = await withBridgeError( async () => { @@ -158,6 +241,29 @@ export class TokenBridge { BridgeErrorType.INTERNAL_ERROR, ); + // Convert the addresses to correct format addresses (e.g. prepend 0x if not already) + const receipient = ethers.utils.getAddress(req.recipientAddress); + + // Handle return if it is a native token + if (req.token === 'NATIVE') { + // Encode the function data into a payload + const data = await withBridgeError(async () => rootERC20PredicateContract.interface.encodeFunctionData( + 'depositNativeTo', + [receipient], + ), BridgeErrorType.INTERNAL_ERROR); + + return { + unsignedTx: { + data, + to: this.config.bridgeContracts.rootChainERC20Predicate, + value: req.depositAmount, + }, + }; + } + + // Handle return for ERC20 + const token = ethers.utils.getAddress(req.token); + // Encode the function data into a payload const data = await withBridgeError(async () => rootERC20PredicateContract.interface.encodeFunctionData( 'depositTo', @@ -169,168 +275,461 @@ export class TokenBridge { data, to: this.config.bridgeContracts.rootChainERC20Predicate, value: 0, - from: depositor, }, }; } /** - * Retrieves the unsigned approval transaction for a deposit to the bridge. + * Waits for the deposit transaction to be confirmed and synced from the root chain to the child chain. * - * @param {ApproveBridgeRequest} req - The approve bridge request object containing the depositor address, token address, and deposit amount. - * @returns {Promise} - A promise that resolves to an object containing the unsigned approval transaction and a flag indicating if the approval is required. - * @throws {BridgeError} - If an error occurs during the transaction creation, a BridgeError will be thrown with a specific error type. + * @param {WaitForDepositRequest} req - The wait for request object containing the transaction hash. + * @returns {Promise} - A promise that resolves to an object containing the status of the deposit transaction. + * @throws {BridgeError} - If an error occurs during the transaction confirmation or state sync, a BridgeError will be thrown with a specific error type. * * Possible BridgeError types include: - * - UNSUPPORTED_ERROR: The operation is not supported. Currently thrown when attempting to deposit native tokens. - * - INVALID_ADDRESS: An Ethereum address provided in the request is invalid. - * - INVALID_AMOUNT: The deposit amount provided in the request is invalid (less than or equal to 0). - * - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation. - * - PROVIDER_ERROR: An error occurred while interacting with the Ethereum provider. This includes issues calling the ERC20 smart contract + * - PROVIDER_ERROR: An error occurred with the Ethereum provider during transaction confirmation or state synchronization. + * - TRANSACTION_REVERTED: The transaction on the root chain was reverted. * * @example - * const approveRequest = { - * depositorAddress: '0x123456...', // Depositor's Ethereum address - * token: '0xabcdef...', // ERC20 token address - * depositAmount: ethers.utils.parseUnits('100', 18), // Deposit amount in token's smallest unit (e.g., wei for Ether) + * const waitForRequest = { + * transactionHash: '0x123456...', // Deposit transaction hash on the root chain * }; * - * bridgeSdk.getUnsignedApproveBridgeTx(approveRequest) - * .then((approveResponse) => { - * console.log('Approval Required:', approveResponse.required); - * console.log('Unsigned Approval Transaction:', approveResponse.unsignedTx); + * bridgeSdk.waitForDeposit(waitForRequest) + * .then((waitForResponse) => { + * console.log('Deposit Transaction Status:', waitForResponse.status); * }) * .catch((error) => { * console.error('Error:', error.message); * }); */ - public async getUnsignedApproveBridgeTx( - req: ApproveBridgeRequest, - ): Promise { - // If the token is NATIVE, no approval is required - if (req.token === 'NATIVE') { - // When native tokens are supported, change this to return required: false - throw new BridgeError( - 'native token deposit is not yet supported', - BridgeErrorType.UNSUPPORTED_ERROR, - ); - } + public async waitForDeposit( + req: WaitForDepositRequest, + ): Promise { + this.validateChainConfiguration(); + const rootTxReceipt: ethers.providers.TransactionReceipt = await withBridgeError(async () => this.config.rootProvider.waitForTransaction(req.transactionHash, this.config.rootChainFinalityBlocks), BridgeErrorType.PROVIDER_ERROR); - if (!ethers.utils.isAddress(req.depositorAddress)) { - throw new BridgeError( - `depositor address ${req.depositorAddress} is not a valid address`, - BridgeErrorType.INVALID_ADDRESS, - ); + // Throw an error if the transaction was reverted + if (rootTxReceipt.status !== 1) { + throw new BridgeError(`${rootTxReceipt.transactionHash} on rootchain was reverted`, BridgeErrorType.TRANSACTION_REVERTED); } - // If the token is ERC20, the address must be valid - if (req.token !== 'NATIVE' && !ethers.utils.isAddress(req.token)) { + // Get the state sync ID from the transaction receipt + const stateSyncID = await withBridgeError(async () => this.getRootStateSyncID(rootTxReceipt), BridgeErrorType.PROVIDER_ERROR); + + // Get the block for the timestamp + const rootBlock: ethers.providers.Block = await withBridgeError(async () => await this.config.rootProvider.getBlock(rootTxReceipt.blockNumber), BridgeErrorType.PROVIDER_ERROR, `failed to query block ${rootTxReceipt.blockNumber} on rootchain`); + + // Get the minimum block on childchain which corresponds with the timestamp on rootchain + const minBlockRange: number = await withBridgeError(async () => getBlockNumberClosestToTimestamp(this.config.childProvider, rootBlock.timestamp, this.config.blockTime, this.config.clockInaccuracy), BridgeErrorType.PROVIDER_ERROR); + + // Get the upper bound for which we expect the StateSync event to occur + const maxBlockRange: number = minBlockRange + this.config.maxDepositBlockDelay; + + // Poll till event observed + const result: CompletionStatus = await withBridgeError(async () => this.waitForChildStateSync(stateSyncID, this.config.pollInterval, minBlockRange, maxBlockRange), BridgeErrorType.PROVIDER_ERROR); + + return { + status: result, + }; + } + + /** + * Retrieves the corresponding child token address for a given root token address. + * This function is used to map a root token to its child token in the context of a bridging system between chains. + * If the token is native, a special key is used to represent it. + * + * @param {RootTokenToChildTokenRequest} req - The request object containing the root token address or the string 'NATIVE'. + * @returns {Promise} - A promise that resolves to an object containing the child token address. + * @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type. + * + * Possible BridgeError types include: + * - INVALID_ADDRESS: If the Ethereum address provided in the request is invalid. + * - PROVIDER_ERROR: If there's an error in querying the rootTokenToChildToken mapping. + * - INTERNAL_ERROR: An unexpected error occurred during the execution. + * + * @example + * const request = { + * rootToken: '0x123456...', // Root token address or 'NATIVE' + * }; + * + * bridgeSdk.rootTokenToChildToken(request) + * .then((response) => { + * console.log(response.childToken); // Child token address + * }) + * .catch((error) => { + * console.error('Error:', error.message); + * }); + */ + public async rootTokenToChildToken(req: RootTokenToChildTokenRequest): Promise { + // Validate the chain configuration to ensure proper setup + this.validateChainConfiguration(); + + // If the root token is native, use the native token key; otherwise, use the provided root token address + const reqTokenAddress = (req.rootToken === 'NATIVE') ? NATIVE_TOKEN_BRIDGE_KEY : req.rootToken; + + // Validate the request token address + if (!ethers.utils.isAddress(reqTokenAddress)) { throw new BridgeError( - `token address ${req.token} is not a valid address`, + `recipient address ${reqTokenAddress} is not a valid address`, BridgeErrorType.INVALID_ADDRESS, ); } - // The deposit amount cannot be <= 0 - if (req.depositAmount.isNegative() || req.depositAmount.isZero()) { - throw new BridgeError( - `deposit amount ${req.depositAmount.toString()} is invalid`, - BridgeErrorType.INVALID_AMOUNT, - ); - } + // Create an instance of the root ERC20 predicate contract + const childTokenAddress: string = await withBridgeError( + async () => { + const rootERC20Predicate: ethers.Contract = new ethers.Contract(this.config.bridgeContracts.rootChainERC20Predicate, ROOT_ERC20_PREDICATE, this.config.rootProvider); + return await rootERC20Predicate.rootTokenToChildToken(reqTokenAddress); + }, + BridgeErrorType.PROVIDER_ERROR, + 'failed to query rootTokenToChildToken mapping', + ); - const erc20Contract: ethers.Contract = await withBridgeError(async () => new ethers.Contract(req.token, ERC20, this.config.rootProvider), BridgeErrorType.INTERNAL_ERROR); + // Return the child token address + return { + childToken: childTokenAddress, + }; + } - // Get the current approved allowance of the RootERC20Predicate - const rootERC20PredicateAllowance: ethers.BigNumber = await withBridgeError(() => erc20Contract.allowance( - req.depositorAddress, - this.config.bridgeContracts.rootChainERC20Predicate, + /** + * Retrieves the corresponding root token address for a given child token address. + * This function is used to map a child token back to its root token in the context of a bridging system between chains. + * + * If the root token address matches the address designated for the native token, the method will return 'NATIVE'. + * + * @param {ChildTokenToRootTokenRequest} req - The request object containing the child token address. + * @returns {Promise} - A promise that resolves to an object containing the root token address. + * @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type. + * + * Possible BridgeError types include: + * - PROVIDER_ERROR: If there's an error in querying the root token from the child token contract. + * - INVALID_TOKEN: If the token being withdrawed is not a valid bridgeable token + * + * @example + * const request = { + * childToken: '0x123456...', // Child token address + * }; + * + * bridgeSdk.childTokenToRootToken(request) + * .then((response) => { + * console.log(response.rootToken); // Outputs: 'NATIVE' or Root token address + * }) + * .catch((error) => { + * console.error('Error:', error.message); + * }); + */ + public async childTokenToRootToken(req: ChildTokenToRootTokenRequest): Promise { + // Validate the chain configuration to ensure proper setup + this.validateChainConfiguration(); + + // Query the corresponding root token address using the child token contract + const rootToken = await withBridgeError( + async () => { + // Create an instance of the child token contract using the given child token address + const childToken: ethers.Contract = new ethers.Contract(req.childToken, CHILD_ERC20, this.config.childProvider); + return await childToken.rootToken(); + }, + BridgeErrorType.PROVIDER_ERROR, + 'failed to query the root token from the child token contract', + ); + + // Check if the rootToken address is the designated native token address. If it is, return 'NATIVE'. Else, return the root token address. + return { + rootToken: (rootToken === NATIVE_TOKEN_BRIDGE_KEY) ? 'NATIVE' : rootToken, + }; + } + + /** + * Generates an unsigned approval transaction to allow the bridge to withdraw a specific amount of tokens from a user's address. + * This must be called before a user can sign and submit a withdrawal request to the bridge. + * + * @param {ApproveWithdrawBridgeRequest} req - The approval request object containing the necessary data for approving token withdrawal. + * @returns {Promise} - A promise that resolves to an object containing the unsigned transaction data. + * + * @throws {BridgeError} - If an error occurs during the generation of the unsigned transaction, a BridgeError will be thrown with a specific error type. + * Possible BridgeError types include: + * - INVALID_ADDRESS: The Ethereum address provided in the request is invalid. This could be the user's address or the token's address. + * - INVALID_AMOUNT: The withdrawal amount provided in the request is invalid (less than or equal to 0). + * - PROVIDER_ERROR: An error occurred when interacting with the Ethereum provider, likely due to a network or connectivity issue. + * - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation. + * + * @example + * const approveWithdrawalRequest = { + * token: '0x123456...', // ERC20 token address + * withdrawerAddress: '0xabcdef...', // User's wallet address + * withdrawAmount: ethers.utils.parseUnits('100', 18), // Withdraw amount in wei + * }; + * + * bridgeSdk.getUnsignedApproveWithdrawBridgeTx(approveWithdrawalRequest) + * .then((approvalResponse) => { + * console.log(approvalResponse.unsignedTx); + * }) + * .catch((error) => { + * console.error('Error:', error.message); + * }); + */ + public async getUnsignedApproveWithdrawBridgeTx( + req: ApproveWithdrawBridgeRequest, + ): Promise { + // Ensure the configuration of chains is valid. + this.validateChainConfiguration(); + + TokenBridge.validateWithdrawArgs(req.withdrawerAddress, req.withdrawAmount, req.token); + + // Create a contract instance for interacting with the token contract + const childERC20: ethers.Contract = await withBridgeError(async () => new ethers.Contract(req.token, CHILD_ERC20, this.config.childProvider), BridgeErrorType.PROVIDER_ERROR); + + // Get the current approved allowance of the ChildERC20Predicate + const childERC20PredicateAllowance: ethers.BigNumber = await withBridgeError(() => childERC20.allowance( + req.withdrawerAddress, + this.config.bridgeContracts.childChainERC20Predicate, ), BridgeErrorType.PROVIDER_ERROR); - // If the allowance is greater than or equal to the deposit amount, no approval is required - if (rootERC20PredicateAllowance.gte(req.depositAmount)) { + // If the allowance is greater than or equal to the withdraw amount, no approval is required + if (childERC20PredicateAllowance.gte(req.withdrawAmount)) { return { unsignedTx: null, - required: false, }; } - // Calculate the amount of tokens that need to be approved for deposit - const approvalAmountRequired = req.depositAmount.sub( - rootERC20PredicateAllowance, + + // Calculate the amount of tokens that need to be approved for withdrawal + const approvalAmountRequired = req.withdrawAmount.sub( + childERC20PredicateAllowance, ); // Encode the approve function call data for the ERC20 contract - const data: string = await withBridgeError(async () => erc20Contract.interface.encodeFunctionData('approve', [ - this.config.bridgeContracts.rootChainERC20Predicate, + const data: string = await withBridgeError(async () => childERC20.interface.encodeFunctionData('approve', [ + this.config.bridgeContracts.childChainERC20Predicate, approvalAmountRequired, ]), BridgeErrorType.INTERNAL_ERROR); - // Create the unsigned transaction for the approval + // Construct the unsigned transaction for the approval const unsignedTx: ethers.providers.TransactionRequest = { data, to: req.token, value: 0, - from: req.depositorAddress, + from: req.withdrawerAddress, }; return { unsignedTx, - required: true, }; } /** - * Waits for the deposit transaction to be confirmed and synced from the root chain to the child chain. + * Generates an unsigned transaction that a user can use to initiate a token withdrawal from the bridge. + * The user must sign and submit this transaction to execute the withdrawal. * - * @param {WaitForRequest} req - The wait for request object containing the transaction hash. - * @returns {Promise} - A promise that resolves to an object containing the status of the deposit transaction. - * @throws {BridgeError} - If an error occurs during the transaction confirmation or state sync, a BridgeError will be thrown with a specific error type. + * @param {BridgeWithdrawRequest} req - The withdrawal request object containing the necessary data for withdrawing tokens. + * @returns {Promise} - A promise that resolves to an object containing the unsigned transaction data. * + * @throws {BridgeError} - If an error occurs during the generation of the unsigned transaction, a BridgeError will be thrown with a specific error type. * Possible BridgeError types include: - * - PROVIDER_ERROR: An error occurred with the Ethereum provider during transaction confirmation or state synchronization. - * - TRANSACTION_REVERTED: The transaction on the root chain was reverted. + * - INVALID_ADDRESS: The Ethereum address provided in the request is invalid. This could be the user's address or the token's address. + * - INVALID_AMOUNT: The withdrawal amount provided in the request is invalid (less than or equal to 0). + * - PROVIDER_ERROR: An error occurred when interacting with the Ethereum provider, likely due to a network or connectivity issue. + * - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation. * * @example - * const waitForRequest = { - * transactionHash: '0x123456...', // Deposit transaction hash on the root chain + * const withdrawRequest = { + * token: '0x123456...', // ERC20 token address + * recipientAddress: '0xabcdef...', // Address to receive the withdrawn tokens + * withdrawAmount: ethers.utils.parseUnits('100', 18), // Withdraw amount in wei * }; * - * bridgeSdk.waitForDeposit(waitForRequest) - * .then((waitForResponse) => { - * console.log('Deposit Transaction Status:', waitForResponse.status); + * bridgeSdk.getUnsignedWithdrawTx(withdrawRequest) + * .then((withdrawalResponse) => { + * console.log(withdrawalResponse.unsignedTx); * }) * .catch((error) => { * console.error('Error:', error.message); * }); */ - public async waitForDeposit( - req: WaitForRequest, - ): Promise { - const rootTxReceipt: ethers.providers.TransactionReceipt = await withBridgeError(async () => this.config.rootProvider.waitForTransaction(req.transactionHash, this.config.rootChainFinalityBlocks), BridgeErrorType.PROVIDER_ERROR); + public async getUnsignedWithdrawTx( + req: BridgeWithdrawRequest, + ): Promise { + // Ensure the configuration of chains is valid. + this.validateChainConfiguration(); - // Throw an error if the transaction was reverted - if (rootTxReceipt.status !== 1) { - throw new BridgeError(`${rootTxReceipt.transactionHash} on rootchain was reverted`, BridgeErrorType.TRANSACTION_REVERTED); + // Validate the recipient address, withdrawal amount, and token. + TokenBridge.validateWithdrawArgs(req.recipientAddress, req.withdrawAmount, req.token); + + // Create a contract instance for interacting with the ChildERC20Predicate + const childERC20PredicateContract = await withBridgeError( + async () => { + const contract = new ethers.Contract( + this.config.bridgeContracts.childChainERC20Predicate, + CHILD_ERC20_PREDICATE, + ); + return contract; + }, + BridgeErrorType.INTERNAL_ERROR, + ); + + // Encode the withdrawTo function call data for the ERC20 contract + const data: string = await withBridgeError(async () => childERC20PredicateContract.interface.encodeFunctionData('withdrawTo', [ + req.token, + req.recipientAddress, + req.withdrawAmount, + ]), BridgeErrorType.INTERNAL_ERROR); + + // Construct the unsigned transaction for the withdrawal + return { + unsignedTx: { + data, + to: this.config.bridgeContracts.childChainERC20Predicate, + value: 0, + }, + }; + } + + /** + * Waits for the withdrawal transaction to be confirmed in the root chain by continuously polling until the transaction is included in a checkpoint. + * This function is intended to be used after executing a withdrawal transaction. + * + * @param {WaitForWithdrawalRequest} req - The request object containing the transaction hash of the withdrawal transaction. + * @returns {Promise} - A promise that resolves to an empty object once the withdrawal transaction has been confirmed in the root chain. + * + * @throws {BridgeError} - If an error occurs during the waiting process, a BridgeError will be thrown with a specific error type. + * Possible BridgeError types include: + * - PROVIDER_ERROR: An error occurred when interacting with the Ethereum provider, likely due to a network or connectivity issue. + * + * @example + * const waitForWithdrawalRequest = { + * transactionHash: '0x123456...', // Transaction hash of the withdrawal transaction + * }; + * + * bridgeSdk.waitForWithdrawal(waitForWithdrawalRequest) + * .then(() => { + * console.log('Withdrawal transaction has been confirmed in the root chain.'); + * }) + * .catch((error) => { + * console.error('Error:', error.message); + * }); + */ + public async waitForWithdrawal( + req:WaitForWithdrawalRequest, + ): Promise { + // Ensure the configuration of chains is valid. + this.validateChainConfiguration(); + + // Helper function to pause execution for a specified interval + const pause = (): Promise => new Promise((resolve) => { + setTimeout(resolve, this.config.pollInterval); + }); + + await withBridgeError(async () => { + // Fetch the receipt of the withdrawal transaction + const transactionReceipt = await this.config.childProvider.getTransactionReceipt(req.transactionHash); + + // Fetch the block in which the withdrawal transaction was included + const block = await this.config.childProvider.getBlock(transactionReceipt.blockNumber); + + // Decode the extra data field from the block header + const decodedExtraData = decodeExtraData(block.extraData); + + // Instantiate the checkpoint manager contract + const checkpointManager = new ethers.Contract(this.config.bridgeContracts.rootChainCheckpointManager, CHECKPOINT_MANAGER, this.config.rootProvider); + + // Recursive function to keep checking for the child deposit event + const waitForRootEpoch = async (): Promise => { + // Fetch the current checkpoint epoch from the root chain + const currentEpoch = await checkpointManager.currentEpoch(); + + // If the current epoch is greater than or equal to the epoch number of the checkpoint in which the withdrawal transaction was included, the withdrawal has been confirmed in the root chain + if (currentEpoch >= decodedExtraData.checkpoint.epochNumber) { + return null; + } + + // Pause execution for a specified interval before checking again + await pause(); + + // Recursive call + return waitForRootEpoch(); + }; + + // Start waiting for the withdrawal transaction to be confirmed in the root chain + await waitForRootEpoch(); + }, BridgeErrorType.PROVIDER_ERROR); + + // Return an empty object once the withdrawal transaction has been confirmed in the root chain + return {}; + } + + /** + * Creates an unsigned exit transaction which, when executed, will exit the assets from the child chain to the root chain. + * This function should be used after a withdraw transaction has been executed on the child chain. + * It should only be executed after `waitForWithdrawal` has completed successfully. + * + * @param {ExitRequest} req - The request object containing the transaction hash of the withdraw transaction. + * @returns {Promise} - A promise that resolves to an object containing the unsigned exit transaction. + * + * @throws {BridgeError} - If an error occurs during the exit transaction creation process, a BridgeError will be thrown with a specific error type. + * Possible BridgeError types include: + * - PROVIDER_ERROR: An error occurred when interacting with the Ethereum provider, likely due to a network or connectivity issue. + * - INVALID_TRANSACTION: The deposit transaction is invalid or the L2StateSynced event log does not match the expected format. + * - INTERNAL_ERROR: An internal error occurred during the function call encoding process. + * + * @example + * const exitRequest = { + * transactionHash: '0x123456...', // Transaction hash of the deposit transaction + * }; + * + * bridgeSdk.getUnsignedExitTx(exitRequest) + * .then((response) => { + * console.log('Unsigned exit transaction:', response.unsignedTx); + * }) + * .catch((error) => { + * console.error('Error:', error.message); + * }); + */ + public async getUnsignedExitTx(req: ExitRequest): Promise { + // Ensure the configuration of chains is valid + this.validateChainConfiguration(); + + // Fetch the receipt of the deposit transaction + const txReceipt = await withBridgeError(async () => await this.config.childProvider.getTransactionReceipt(req.transactionHash), BridgeErrorType.PROVIDER_ERROR); + + // Filter out the StateSynced event log from the transaction receipt + const stateSenderLogs = txReceipt.logs.filter((log) => log.address.toLowerCase() === L2_STATE_SENDER_ADDRESS); + if (stateSenderLogs.length !== 1) { + throw new BridgeError(`expected 1 log in tx ${txReceipt.transactionHash} from address ${L2_STATE_SENDER_ADDRESS}`, BridgeErrorType.INVALID_TRANSACTION); } - // Get the state sync ID from the transaction receipt - const stateSyncID = await withBridgeError(async () => this.getRootStateSyncID(rootTxReceipt), BridgeErrorType.PROVIDER_ERROR); + // Parse the StateSynced event log + const l2StateSyncEvent: ethers.utils.LogDescription = await withBridgeError(async () => { + const l2StateSenderInterface = new ethers.utils.Interface(L2_STATE_SENDER); + const event = l2StateSenderInterface.parseLog(stateSenderLogs[0]); - // Get the block for the timestamp - const rootBlock: ethers.providers.Block = await this.config.rootProvider.getBlock(rootTxReceipt.blockNumber); + // Throw an error if the event log doesn't match the expected format + if (event.signature !== 'L2StateSynced(uint256,address,address,bytes)') { + throw new Error(`expected L2StateSynced event in tx ${txReceipt.transactionHash}`); + } + return event; + }, BridgeErrorType.INVALID_TRANSACTION); - // Get the minimum block on childchain which corresponds with the timestamp on rootchain - const minBlockRange: number = await withBridgeError(async () => getBlockNumberClosestToTimestamp(this.config.childProvider, rootBlock.timestamp, this.config.blockTime, this.config.clockInaccuracy), BridgeErrorType.PROVIDER_ERROR); + // Instantiate the exit helper contract + const exitHelper = await withBridgeError(async () => new ethers.Contract(this.config.bridgeContracts.rootChainExitHelper, EXIT_HELPER, this.config.rootProvider), BridgeErrorType.PROVIDER_ERROR); - // Get the upper bound for which we expect the StateSync event to occur - const maxBlockRange: number = minBlockRange + this.config.maxDepositBlockDelay; + // Generate the exit proof + const exitProof = await withBridgeError(async () => (this.config.childProvider as ethers.providers.JsonRpcProvider).send('bridge_generateExitProof', [l2StateSyncEvent.args.id.toHexString()]), BridgeErrorType.PROVIDER_ERROR); - // Poll till event observed - const result: CompletionStatus = await withBridgeError(async () => this.waitForChildStateSync(stateSyncID, this.config.pollInterval, minBlockRange, maxBlockRange), BridgeErrorType.PROVIDER_ERROR); + // Encode the exit function call data + const encodedExitTx = await withBridgeError(async () => { + const exitEventEncoded = ethers.utils.defaultAbiCoder.encode(['uint256', 'address', 'address', 'bytes'], l2StateSyncEvent.args); + return exitHelper.interface.encodeFunctionData('exit', [exitProof.Metadata.CheckpointBlock, exitProof.Metadata.LeafIndex, exitEventEncoded, exitProof.Data]); + }, BridgeErrorType.INTERNAL_ERROR); - return { - status: result, + // Create the unsigned exit transaction + const unsignedTx: ethers.providers.TransactionRequest = { + data: encodedExitTx, + to: this.config.bridgeContracts.rootChainExitHelper, + value: 0, }; + + // Return the unsigned exit transaction + return { unsignedTx }; } private async waitForChildStateSync( @@ -397,12 +796,70 @@ export class TokenBridge { return stateSyncID; } - // TODO: please fix this - // eslint-disable-next-line class-methods-use-this - private async getFeeForToken( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - token: FungibleToken, - ): Promise { - return ethers.BigNumber.from(0); + private static validateDepositArgs(depositorOrRecipientAddress: string, depositAmount: ethers.BigNumber, token: string) { + if (!ethers.utils.isAddress(depositorOrRecipientAddress)) { + throw new BridgeError( + `address ${depositorOrRecipientAddress} is not a valid address`, + BridgeErrorType.INVALID_ADDRESS, + ); + } + + // The deposit amount cannot be <= 0 + if (depositAmount.isNegative() || depositAmount.isZero()) { + throw new BridgeError( + `deposit amount ${depositAmount.toString()} is invalid`, + BridgeErrorType.INVALID_AMOUNT, + ); + } + + // If the token is not native, it must be a valid address + if (token !== 'NATIVE' && !ethers.utils.isAddress(token)) { + throw new BridgeError( + `token address ${token} is not a valid address`, + BridgeErrorType.INVALID_ADDRESS, + ); + } + } + + private static validateWithdrawArgs(withdrawerOrRecipientAddress: string, withdrawAmount: ethers.BigNumber, token: string) { + // Validate the withdrawer address + if (!ethers.utils.isAddress(withdrawerOrRecipientAddress)) { + throw new BridgeError( + `withdrawer address ${withdrawerOrRecipientAddress} is not a valid address`, + BridgeErrorType.INVALID_ADDRESS, + ); + } + + // Validate the withdrawal amount. It cannot be zero or negative. + if (withdrawAmount.isNegative() || withdrawAmount.isZero()) { + throw new BridgeError( + `withdraw amount ${withdrawAmount.toString()} is invalid`, + BridgeErrorType.INVALID_AMOUNT, + ); + } + + // Check if the ERC20 Token is a valid address + if (!ethers.utils.isAddress(token)) { + throw new BridgeError( + `token address ${token} is not a valid address`, + BridgeErrorType.INVALID_ADDRESS, + ); + } + } + + // Query the rootchain and childchain providers to ensure the chainID is as expected by the SDK. + // This is to prevent the SDK from being used on the wrong chain, especially after a chain reset. + private async validateChainConfiguration(): Promise { + const errMessage = 'Please upgrade to the latest version of the Bridge SDK or provide valid configuration'; + + const rootNetwork = await withBridgeError(async () => this.config.rootProvider.getNetwork(), BridgeErrorType.PROVIDER_ERROR); + if (rootNetwork.chainId.toString() !== this.config.bridgeInstance.rootChainID) { + throw new BridgeError(`Rootchain provider chainID ${rootNetwork.chainId} does not match expected chainID ${this.config.bridgeInstance.rootChainID}. ${errMessage}`, BridgeErrorType.UNSUPPORTED_ERROR); + } + + const childNetwork = await this.config.childProvider.getNetwork(); + if (childNetwork.chainId.toString() !== this.config.bridgeInstance.childChainID) { + throw new BridgeError(`Childchain provider chainID ${childNetwork.chainId} does not match expected chainID ${this.config.bridgeInstance.childChainID}. ${errMessage}`, BridgeErrorType.UNSUPPORTED_ERROR); + } } } diff --git a/packages/internal/bridge/sdk/src/types/index.ts b/packages/internal/bridge/sdk/src/types/index.ts index 7a0a96c331..c61e0b25cc 100644 --- a/packages/internal/bridge/sdk/src/types/index.ts +++ b/packages/internal/bridge/sdk/src/types/index.ts @@ -29,6 +29,8 @@ export interface BridgeOverrides { export type BridgeContracts = { rootChainERC20Predicate: Address; rootChainStateSender: Address; + rootChainCheckpointManager: Address; + rootChainExitHelper: Address; childChainERC20Predicate: Address; childChainStateReceiver: Address; }; @@ -57,6 +59,56 @@ export type Address = string; */ export type FungibleToken = Address | 'NATIVE'; +/** + * @typedef {Object} CompletionStatus + * @property {string} SUCCESS - The transaction has been successfully synced. + * @property {string} PENDING - The transaction is still pending. + * @property {string} FAILED - The transaction has failed. + */ +export enum CompletionStatus { + SUCCESS = 'SUCCESS', + PENDING = 'PENDING', + FAILED = 'FAILED', +} + +/** + * @typedef {Object} BridgeFeeRequest + * @property {FungibleToken} token - The token for which the bridge fee is being requested. + */ +export interface BridgeFeeRequest { + token: FungibleToken; +} + +/** + * @typedef {Object} BridgeFeeResponse + * @property {boolean} bridgeable - Indicates whether the token can be bridged or not. + * @property {ethers.BigNumber} feeAmount - The fee amount for bridging the token. + */ +export interface BridgeFeeResponse { + bridgeable: boolean; + feeAmount: ethers.BigNumber; +} + +/** + * @typedef {Object} ApproveDepositBridgeRequest + * @property {string} depositorAddress - The address of the depositor. + * @property {FungibleToken} token - The token to be approved. + * @property {ethers.BigNumber} depositAmount - The amount to be approved for deposit. + */ +export interface ApproveDepositBridgeRequest { + depositorAddress: Address; + token: FungibleToken; + depositAmount: ethers.BigNumber; +} + +/** + * @typedef {Object} ApproveDepositBridgeResponse + * @property {ethers.providers.TransactionRequest | null} unsignedTx - The unsigned transaction for the token approval, or null if no approval is required. + */ +export interface ApproveDepositBridgeResponse { + unsignedTx: ethers.providers.TransactionRequest | null; +} + /** * @typedef {Object} BridgeDepositRequest * @property {Address} depositorAddress - The address of the depositor. @@ -65,7 +117,6 @@ export type FungibleToken = Address | 'NATIVE'; * @property {ethers.BigNumber} depositAmount - The amount to be deposited. */ export interface BridgeDepositRequest { - depositorAddress: Address; recipientAddress: Address; token: FungibleToken; depositAmount: ethers.BigNumber; @@ -80,69 +131,120 @@ export interface BridgeDepositResponse { } /** - * @typedef {Object} ApproveBridgeRequest - * @property {string} depositorAddress - The address of the depositor. - * @property {FungibleToken} token - The token to be approved. - * @property {ethers.BigNumber} depositAmount - The amount to be approved for deposit. + * @typedef {Object} WaitForDepositRequest + * @property {string} transactionHash - The hash of the deposit transaction on the root chain. */ -export interface ApproveBridgeRequest { - depositorAddress: string; - token: FungibleToken; - depositAmount: ethers.BigNumber; +export interface WaitForDepositRequest { + transactionHash: string; } /** - * @typedef {Object} ApproveBridgeResponse - * @property {ethers.providers.TransactionRequest | null} unsignedTx - The unsigned transaction for the token approval, or null if no approval is required. - * @property {boolean} required - Indicates whether an approval transaction is required or not. + * @typedef {Object} WaitForDepositResponse + * @property {CompletionStatus} status - The status of the deposit transaction after waiting. + */ +export interface WaitForDepositResponse { + status: CompletionStatus; +} + +/** + * @typedef {Object} RootTokenToChildTokenRequest + * @property {FungibleToken} rootToken - The token on the root chain for which the corresponding token on the child chain is required. + */ +export interface RootTokenToChildTokenRequest { + rootToken: FungibleToken; +} + +/** + * @typedef {Object} RootTokenToChildTokenResponse + * @property {Address} childToken - The address of the corresponding token on the child chain. + */ +export interface RootTokenToChildTokenResponse { + childToken: Address; +} + +/** + * @typedef {Object} ChildTokenToRootTokenRequest + * @property {Address} childToken - The token on the child chain for which the corresponding token on the root chain is required. + */ +export interface ChildTokenToRootTokenRequest { + childToken: Address; +} + +/** + * @typedef {Object} ChildTokenToRootTokenResponse + * @property {FungibleToken} rootToken - The corresponding token on the root chain. + */ +export interface ChildTokenToRootTokenResponse { + rootToken: FungibleToken; +} + +/** + * @typedef {Object} ApproveWithdrawBridgeRequest + * @property {Address} withdrawerAddress - The address of the account intending to withdraw the tokens. + * @property {Address} token - The address of the token contract. + * @property {ethers.BigNumber} withdrawAmount - The amount of tokens to be withdrawn. + */ +export interface ApproveWithdrawBridgeRequest { + withdrawerAddress: Address; + token: Address; + withdrawAmount: ethers.BigNumber; +} + +/** + * @typedef {Object} ApproveWithdrawBridgeResponse + * @property {ethers.providers.TransactionRequest|null} unsignedTx - The unsigned withdrawal transaction, or null if the approval is not required. */ -export interface ApproveBridgeResponse { +export interface ApproveWithdrawBridgeResponse { unsignedTx: ethers.providers.TransactionRequest | null; - required: boolean; } /** - * @typedef {Object} BridgeFeeRequest - * @property {FungibleToken} token - The token for which the bridge fee is being requested. + * @typedef {Object} BridgeWithdrawRequest + * @property {Address} recipientAddress - The address of the recipient of the withdrawn tokens on the root chain. + * @property {FungibleToken} token - The token to be withdrawn. + * @property {ethers.BigNumber} withdrawAmount - The amount of tokens to be withdrawn. */ -export interface BridgeFeeRequest { +export interface BridgeWithdrawRequest { + recipientAddress: Address; token: FungibleToken; + withdrawAmount: ethers.BigNumber; } /** - * @typedef {Object} BridgeFeeResponse - * @property {boolean} bridgeable - Indicates whether the token can be bridged or not. - * @property {ethers.BigNumber} feeAmount - The fee amount for bridging the token. + * @typedef {Object} BridgeWithdrawResponse + * @property {ethers.providers.TransactionRequest} unsignedTx - The unsigned withdrawal transaction. */ -export interface BridgeFeeResponse { - bridgeable: boolean; - feeAmount: ethers.BigNumber; +export interface BridgeWithdrawResponse { + unsignedTx: ethers.providers.TransactionRequest; } /** - * @typedef {Object} WaitForRequest - * @property {string} transactionHash - The hash of the deposit transaction on the root chain. + * @typedef {Object} WaitForWithdrawalRequest + * @property {string} transactionHash - The hash of the withdrawal transaction on the child chain. */ -export interface WaitForRequest { +export interface WaitForWithdrawalRequest { transactionHash: string; } /** - * @typedef {Object} CompletionStatus - * @property {string} SUCCESS - The transaction has been successfully synced. - * @property {string} PENDING - The transaction is still pending. - * @property {string} FAILED - The transaction has failed. + * @typedef {Object} WaitForWithdrawalResponse + * Empty object signifies the successful completion of the withdrawal process. + * If the withdrawal fails, an error will be thrown instead of a response. */ -export enum CompletionStatus { - SUCCESS = 'SUCCESS', - PENDING = 'PENDING', - FAILED = 'FAILED', +export interface WaitForWithdrawalResponse {} + +/** + * @typedef {Object} ExitRequest + * @property {string} transactionHash - The hash of the withdraw transaction on the child chain + */ +export interface ExitRequest { + transactionHash: string; } /** - * @typedef {Object} WaitForResponse - * @property {CompletionStatus} status - The status of the deposit transaction after waiting. + * @typedef {Object} ExitResponse + * @property {ethers.providers.TransactionRequest} unsignedTx - The unsigned transaction that, when signed and broadcasted, will perform the exit operation on the root chain. */ -export interface WaitForResponse { - status: CompletionStatus; +export interface ExitResponse { + unsignedTx: ethers.providers.TransactionRequest; } From c2f3e19878a81b835cfc8ed882d88c4c3a4b8146 Mon Sep 17 00:00:00 2001 From: Jon <24399271+Jon-Alonso@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:10:16 +1000 Subject: [PATCH 8/9] [NO-CHANGELOG] Update zkevm testnet url (#619) --- .../passport/sdk-sample-app/src/context/ImmutableProvider.tsx | 2 +- packages/passport/sdk/src/config/config.ts | 2 +- packages/passport/sdk/src/mocks/zkEvm/msw.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/passport/sdk-sample-app/src/context/ImmutableProvider.tsx b/packages/passport/sdk-sample-app/src/context/ImmutableProvider.tsx index 6d111d044c..4cbc1fd54d 100644 --- a/packages/passport/sdk-sample-app/src/context/ImmutableProvider.tsx +++ b/packages/passport/sdk-sample-app/src/context/ImmutableProvider.tsx @@ -87,7 +87,7 @@ const getPassportConfig = (environment: EnvironmentNames): PassportModuleConfigu immutableXConfig: getCoreSdkConfig(EnvironmentNames.DEV), }, }), - zkEvmRpcUrl: 'https://zkevm-rpc.dev.x.immutable.com', + zkEvmRpcUrl: 'https://rpc.testnet.immutable.com', zkEvmChainId: 'eip155:13423', relayerUrl: 'https://api.dev.immutable.com/relayer-mr', indexerMrBasePath: 'https://indexer-mr.dev.imtbl.com', diff --git a/packages/passport/sdk/src/config/config.ts b/packages/passport/sdk/src/config/config.ts index b2c679559a..eb7763c7d5 100644 --- a/packages/passport/sdk/src/config/config.ts +++ b/packages/passport/sdk/src/config/config.ts @@ -126,7 +126,7 @@ export class PassportConfiguration { this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0='; this.passportDomain = 'https://passport.sandbox.immutable.com'; this.imxPublicApiDomain = 'https://api.sandbox.immutable.com'; - this.zkEvmRpcUrl = 'https://zkevm-rpc.sandbox.x.immutable.com'; + this.zkEvmRpcUrl = 'https://rpc.testnet.immutable.com'; this.zkEvmChainId = 'eip155:13392'; this.relayerUrl = 'https://api.sandbox.immutable.com/relayer-mr'; this.multiRollupConfig = multiRollupConfig.getSandbox(); diff --git a/packages/passport/sdk/src/mocks/zkEvm/msw.ts b/packages/passport/sdk/src/mocks/zkEvm/msw.ts index e351c81eb3..7b6b972418 100644 --- a/packages/passport/sdk/src/mocks/zkEvm/msw.ts +++ b/packages/passport/sdk/src/mocks/zkEvm/msw.ts @@ -9,7 +9,7 @@ export const chainId = '13372'; export const transactionHash = '0x867'; const mandatoryHandlers = [ - rest.post('https://zkevm-rpc.sandbox.x.immutable.com', (req, res, ctx) => { + rest.post('https://rpc.testnet.immutable.com', (req, res, ctx) => { const body = req.body as JsonRpcRequestPayload; switch (body.method) { case 'eth_chainId': { @@ -34,7 +34,7 @@ export const mswHandlers = { internalServerError: rest.post('https://api.sandbox.immutable.com/passport-mr/v1/counterfactual-address', (req, res, ctx) => res(ctx.status(500))), }, jsonRpcProvider: { - success: rest.post('https://zkevm-rpc.sandbox.x.immutable.com', (req, res, ctx) => { + success: rest.post('https://rpc.testnet.immutable.com', (req, res, ctx) => { const body = req.body as JsonRpcRequestPayload; switch (body.method) { case 'eth_getCode': { From dde5150cb967f59f2237eab4be3aa7f544d70b9b Mon Sep 17 00:00:00 2001 From: Zoraiz Mahmood <35128199+rzmahmood@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:53:21 +1000 Subject: [PATCH 9/9] Remove Approvals from Bridge SDK Withdraw (#625) --- .../bridge/bridge-sample-app/src/index.ts | 27 ------- .../internal/bridge/sdk/src/tokenBridge.ts | 79 ------------------- .../internal/bridge/sdk/src/types/index.ts | 20 ----- 3 files changed, 126 deletions(-) diff --git a/packages/internal/bridge/bridge-sample-app/src/index.ts b/packages/internal/bridge/bridge-sample-app/src/index.ts index 9977e92949..27d6380992 100644 --- a/packages/internal/bridge/bridge-sample-app/src/index.ts +++ b/packages/internal/bridge/bridge-sample-app/src/index.ts @@ -14,13 +14,9 @@ import { WaitForDepositResponse, CompletionStatus, BridgeWithdrawRequest, - ETH_SEPOLIA_TO_ZKEVM_TESTNET, - CHILD_CHAIN_NATIVE_TOKEN_ADDRESS, WaitForWithdrawalRequest, WaitForWithdrawalResponse, ExitRequest, - ApproveWithdrawBridgeRequest, - ApproveWithdrawBridgeResponse, ETH_SEPOLIA_TO_ZKEVM_DEVNET, } from '@imtbl/bridge-sdk'; @@ -173,29 +169,6 @@ async function depositAndWithdraw() { console.log(`Approving Bridge`); const withdrawResponse = await tokenBridge.rootTokenToChildToken({ rootToken: process.env.TOKEN_ADDRESS}); console.log(`Deposit token was ${process.env.TOKEN_ADDRESS}, withdrawal token is ${withdrawResponse.childToken}`); - // Approval - const childApproveReq: ApproveWithdrawBridgeRequest = { - withdrawerAddress: process.env.DEPOSITOR_ADDRESS, - token: withdrawResponse.childToken, - withdrawAmount: depositAmount, - }; - - // Get the unsigned approval transaction for the deposit - const childApproveResp: ApproveWithdrawBridgeResponse = await tokenBridge.getUnsignedApproveWithdrawBridgeTx(childApproveReq); - - // If approval is required, sign and send the approval transaction - if (childApproveResp.unsignedTx) { - console.log('Sending Approve Tx'); - const txResponseApprove = await checkoutChildChain.sendTransaction( - childApproveResp.unsignedTx, - ); - const txApprovalReceipt = await txResponseApprove.wait(); - console.log( - `Approval Tx Completed with hash: ${txApprovalReceipt.transactionHash}`, - ); - } else { - console.log('Approval not required'); - } const withdrawlReq: BridgeWithdrawRequest = { recipientAddress: process.env.DEPOSITOR_ADDRESS, diff --git a/packages/internal/bridge/sdk/src/tokenBridge.ts b/packages/internal/bridge/sdk/src/tokenBridge.ts index 908a9fdb51..af8073bc39 100644 --- a/packages/internal/bridge/sdk/src/tokenBridge.ts +++ b/packages/internal/bridge/sdk/src/tokenBridge.ts @@ -3,8 +3,6 @@ import { ethers } from 'ethers'; import { ApproveDepositBridgeRequest, ApproveDepositBridgeResponse, - ApproveWithdrawBridgeRequest, - ApproveWithdrawBridgeResponse, BridgeDepositRequest, BridgeDepositResponse, BridgeFeeRequest, @@ -440,83 +438,6 @@ export class TokenBridge { }; } - /** - * Generates an unsigned approval transaction to allow the bridge to withdraw a specific amount of tokens from a user's address. - * This must be called before a user can sign and submit a withdrawal request to the bridge. - * - * @param {ApproveWithdrawBridgeRequest} req - The approval request object containing the necessary data for approving token withdrawal. - * @returns {Promise} - A promise that resolves to an object containing the unsigned transaction data. - * - * @throws {BridgeError} - If an error occurs during the generation of the unsigned transaction, a BridgeError will be thrown with a specific error type. - * Possible BridgeError types include: - * - INVALID_ADDRESS: The Ethereum address provided in the request is invalid. This could be the user's address or the token's address. - * - INVALID_AMOUNT: The withdrawal amount provided in the request is invalid (less than or equal to 0). - * - PROVIDER_ERROR: An error occurred when interacting with the Ethereum provider, likely due to a network or connectivity issue. - * - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation. - * - * @example - * const approveWithdrawalRequest = { - * token: '0x123456...', // ERC20 token address - * withdrawerAddress: '0xabcdef...', // User's wallet address - * withdrawAmount: ethers.utils.parseUnits('100', 18), // Withdraw amount in wei - * }; - * - * bridgeSdk.getUnsignedApproveWithdrawBridgeTx(approveWithdrawalRequest) - * .then((approvalResponse) => { - * console.log(approvalResponse.unsignedTx); - * }) - * .catch((error) => { - * console.error('Error:', error.message); - * }); - */ - public async getUnsignedApproveWithdrawBridgeTx( - req: ApproveWithdrawBridgeRequest, - ): Promise { - // Ensure the configuration of chains is valid. - this.validateChainConfiguration(); - - TokenBridge.validateWithdrawArgs(req.withdrawerAddress, req.withdrawAmount, req.token); - - // Create a contract instance for interacting with the token contract - const childERC20: ethers.Contract = await withBridgeError(async () => new ethers.Contract(req.token, CHILD_ERC20, this.config.childProvider), BridgeErrorType.PROVIDER_ERROR); - - // Get the current approved allowance of the ChildERC20Predicate - const childERC20PredicateAllowance: ethers.BigNumber = await withBridgeError(() => childERC20.allowance( - req.withdrawerAddress, - this.config.bridgeContracts.childChainERC20Predicate, - ), BridgeErrorType.PROVIDER_ERROR); - - // If the allowance is greater than or equal to the withdraw amount, no approval is required - if (childERC20PredicateAllowance.gte(req.withdrawAmount)) { - return { - unsignedTx: null, - }; - } - - // Calculate the amount of tokens that need to be approved for withdrawal - const approvalAmountRequired = req.withdrawAmount.sub( - childERC20PredicateAllowance, - ); - - // Encode the approve function call data for the ERC20 contract - const data: string = await withBridgeError(async () => childERC20.interface.encodeFunctionData('approve', [ - this.config.bridgeContracts.childChainERC20Predicate, - approvalAmountRequired, - ]), BridgeErrorType.INTERNAL_ERROR); - - // Construct the unsigned transaction for the approval - const unsignedTx: ethers.providers.TransactionRequest = { - data, - to: req.token, - value: 0, - from: req.withdrawerAddress, - }; - - return { - unsignedTx, - }; - } - /** * Generates an unsigned transaction that a user can use to initiate a token withdrawal from the bridge. * The user must sign and submit this transaction to execute the withdrawal. diff --git a/packages/internal/bridge/sdk/src/types/index.ts b/packages/internal/bridge/sdk/src/types/index.ts index c61e0b25cc..7eaaaeaad3 100644 --- a/packages/internal/bridge/sdk/src/types/index.ts +++ b/packages/internal/bridge/sdk/src/types/index.ts @@ -178,26 +178,6 @@ export interface ChildTokenToRootTokenResponse { rootToken: FungibleToken; } -/** - * @typedef {Object} ApproveWithdrawBridgeRequest - * @property {Address} withdrawerAddress - The address of the account intending to withdraw the tokens. - * @property {Address} token - The address of the token contract. - * @property {ethers.BigNumber} withdrawAmount - The amount of tokens to be withdrawn. - */ -export interface ApproveWithdrawBridgeRequest { - withdrawerAddress: Address; - token: Address; - withdrawAmount: ethers.BigNumber; -} - -/** - * @typedef {Object} ApproveWithdrawBridgeResponse - * @property {ethers.providers.TransactionRequest|null} unsignedTx - The unsigned withdrawal transaction, or null if the approval is not required. - */ -export interface ApproveWithdrawBridgeResponse { - unsignedTx: ethers.providers.TransactionRequest | null; -} - /** * @typedef {Object} BridgeWithdrawRequest * @property {Address} recipientAddress - The address of the recipient of the withdrawn tokens on the root chain.